akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int infI=1e9+5;
const long long infL=1e16;
const int MOD=998244353;
const int MAX=2e5+5;

#define mp make_pair
#define in &
#define pb push_back
#define ii pair<int,int>
#define iii pair<ii,int>
#define ll long long
#define pll pair<ll,ll>
#define vvl vector<vector<ll> >
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define eb emplace_back
#define forn(i,a,b) for(ll i=a;i<b;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define popb pop_back()
#define se second
#define fi first
#define test(t) int t;cin>>t;while(t--)
#define debug(x) cerr<<"=>"<<#x<<" = "<<x<<endl

ll power(ll a,ll b){
    if(b==0){
        return 1;
    }
    if(b==1){
        return a;
    }
    ll temp=power(a,b/2);
    temp=(temp*temp)%MOD;
    if(b%2){
        temp=(temp*a)%MOD;
    }
    return temp;
}

//only use if mod is prime
ll mod_inv(ll a,ll mod){
    a%=mod;
    return power(a,mod-2);
}

void extended_gcd(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return;
    }
    ll x1,y1;
    extended_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-((a/b)*y1);
    return;
}

//TLE can also occur if vectors are not passed by reference
//priority_queue implements max heap by default

int main(){
    fastio;
    int n;
    cin>>n;
    vl a(n);
    forn(i,0,n){
        cin>>a[i];
    }
    ll ans = 1;
    if(a[0]!=0){
        ans = 0;
    }
    sort(a.begin(),a.end());
    ll cnt = 0;
    for(auto x:a){
        if(x==0){
            ++cnt;
        }
    }
    vl b = a;
    b.resize(distance(b.begin(),unique(b.begin(),b.end())));
    forn(i,1,b.size()){
        if(b[i]-b[i-1]>1){
            cnt=0;
            break;
        }
    }
    if(cnt!=1){
        cout<<0;
        return 0;
    }
    map<ll,ll> m;
    for(auto x:a){
        m[x]++;
    }
    ll lst = 1;
    for(auto x:m){
        ll u = (power(lst,x.se));
        lst = x.se;
        ans = (ans*u)%MOD;
    }
    cout<<ans;
    return 0;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  REP(i, n) cin >> a[i];
  sort(ALL(a));

  auto check = [&](ll m) {
    vector<vector<bool>> dp(n+1, vector<bool>(k, 0));
    dp[0][0] = 1;
    REP(i, n) {
      REP(j, k) {
        if(!dp[i][j]) continue;
        if(i == m) {
          dp[i+1][j] = true;
        } else {
          if(j+a[i] < k) dp[i + 1][j + a[i]] = true;
          dp[i + 1][j] = true;
        }
      }
    }
    FOR(i, max(0LL, k-a[m]), k) if(dp[n][i]) return true;
    return false;
  };

  ll lb = -1, ub = n;
  while(ub - lb > 1) {
    ll mid = (lb+ub)/2;
    if(check(mid)) ub = mid;
    else lb = mid;
  }
  cout << ub << endl;

  return 0;
}

Measured memory_bytes: 3684
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int tairyoku = scanner.nextInt();
        int hissatsuwazashurui = scanner.nextInt();
        int sum = 0;
        for (int i = 0; i < hissatsuwazashurui; i++) {
            sum+= scanner.nextInt();
        }
        if (tairyoku>sum){
            System.out.println("No");
        }
        else {
            System.out.println("Yes");
        }

    }
}


Measured memory_bytes: 46328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int32_t main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int mx=*max_element(a,a+n);
	vector<int> dp(mx+10);
	for(int i=0;i<n;i++)dp[a[i]]++;
	
	for(int i=1;i<=mx;i++)
	{
		for(int j=2*i;j<=mx;j+=i)
		dp[j]+=dp[i];
	}
	
	int ans=0;
	for(int i=0;i<n;i++)if(dp[a[i]]==1)ans++;
	cout<<ans;
}

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

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

int main(){
    int n;
    cin  >> n;
    vector<int>a(n);
    rep(i,n-1){
        int nu;
        cin >> nu;
        a.at(nu-1)++;
    }
    
    rep(i,n)cout << a.at(i) << endl;
}

Measured memory_bytes: 4052
#include <iostream>
using namespace std;
int main () {

  int a,b;
  cin>>a>>b;

  if (a<b) {
    cout<<"a < b\n";
  }

  if (a>b) {
    cout<<"a > b\n";
  }

  if (a==b) {
    cout<<"a == b\n";
  }

  return 0;
}

Measured memory_bytes: 1124
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#pragma comment(linker, "/stack:268435456")
#pragma GCC optimize("O3")
#define ll long long
#define str string
#define rtn return
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define db long double
#define MOD 1000000007
#define INF 1e18
#define EPS 1e-15
#define pll pair <ll, ll>
#define vll vector<ll>
#define vpll vector<pll>
#define value_at find_by_order
#define index_of order_of_key
#define fill(a,v) memset(a,v,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(ll i=0;i<n;++i)
#define per(i,n) for(ll i=n-1;i>=0;--i)
#define loop1(i,n) for (int i=1;i<=n;++i)
#define loop(i,begin,end) for (__typeof(end) i =(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define FAST_IO std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);std::cout.tie(NULL)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " = " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1 << " |";
  __f(comma+1, args...);
}
#else
#define trace(...)
#endif


template<class T, class V> void remin(T &a, V b) { a > b ? a = b : a = a; }
template<class T, class V> void remax(T &a, V b) { a < b ? a = b : a = a; }
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define N 100005

ll n, W, w[105], v[105];
ll dp[105][100006];

int main() {
  FAST_IO;
  cin >> n >> W;
  for (int i = 1; i <= n; i++) cin >> w[i] >> v[i];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= W; j++) {
      dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
      if (j - w[i] >= 0) {
        remax(dp[i][j], v[i] + dp[i - 1][j - w[i]]);
      }
    }
  }
  cout << dp[n][W];
  rtn 0;
}


Measured memory_bytes: 79360
#include <iostream>

using namespace std;

int main() {
  int a;
  int b;
  cin >> a >> b;
  if (a == 1) {
    a = 14;
  }
  if (b == 1) b = 14;
  if (a > b) cout << "Alice" << endl;
  else if (b > a) cout << "Bob" << endl;
  else cout << "Draw" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner in=new Scanner(System.in);
		
		int A=in.nextInt(),B=in.nextInt();
		
		if(A>2 *B) {
			int a = A- 2*B;
			System.out.println(a);
		}
		else {
			System.out.println(0);
		}

	}

}


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

long max(long a,long b){
    if (a>b)return a;
    else return b;
}

int main(void) {
	int n,W;
	long w,v,dp[105][100005];
	scanf("%d%d",&n,&W);
	for (int i=1;i<=n;i++){
	    scanf("%lld%lld",&w,&v);
	    for (int j=0;j<=W;j++){
	        if(j>=w) {
	            dp[i][j] = max(dp[i-1][j-w]+v,dp[i-1][j]);
	        }else {
	            dp[i][j]=dp[i-1][j];
	        }
	    }
	}

	printf("%lld\n",dp[n][W]);
    return 0;
}

Measured memory_bytes: 80000
#include <iostream>

using namespace std;

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

    string s;
    cin>>s;


     if(s.size()> K){
        for(int i = 0;i<K;i++){
            cout<<s[i];
        }
           cout<<"...";
    }

    else{
        cout<<s;
    }

}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

ll mp[10000005];

void solve_abc_d() {
	ll n, m;
	//ll a, b;
	//ll x, y;
	ll k;
	ll l_ans = 0;

	cin >> n;

	ll now;
	rep1(i, n) {
		now = i;
		while (now <= n) {
			mp[now]++;
			now += i;
		}
	}

	rep1(i, n) {
		l_ans += i * mp[i];
	}

	cout << l_ans << "\n";

	return;
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed;
	cout << setprecision(15);

	solve_abc_d();

	return 0;
}


Measured memory_bytes: 81764
N, H = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
a_featured = ab[:]
b_featured = ab[:]
a_featured = sorted(a_featured, key=lambda x: [x[0], x[1]], reverse=True)
b_featured = sorted(b_featured, key=lambda x: [x[1], x[0]], reverse=True)
a_max = a_featured[0]
ans = 0
for i in range(N):
    if b_featured[i][1] >= a_max[0]:
        H -= b_featured[i][1]
        ans += 1
    if H <= 0:
        print(ans)
        exit()
print(ans + (H-1)//a_max[0] + 1)

Measured memory_bytes: 85336
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Read();
            var ans = 700;
            if (s[0].ToString() == "o") ans += 100;
            if (s[1].ToString() == "o") ans += 100;
            if (s[2].ToString() == "o") ans += 100;
            WriteLine(ans);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]

for x1, y1 in ab:
    l = 10**10
    index = 0
    for i, (x2, y2) in enumerate(cd):
        if l > abs(x1-x2)+abs(y1-y2):
            l = abs(x1-x2)+abs(y1-y2)
            index = i + 1
    print(index)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
      using namespace std;
      #include <ext/pb_ds/assoc_container.hpp>
      #include <ext/pb_ds/tree_policy.hpp>
      using namespace __gnu_pbds;
      #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
      #define ll long long
      #define int long long
      #define ld long double
      #define pb push_back
      #define f(i,a,b) for(int i=a;i<b;i++)
      #define fd(i,a,b) for(int i=a-1;i>=b;i--)
      #define pf push_front
      #define ppf pop_front
      #define ppb pop_back
      #define fi first
      #define se second
      #define take(a,n) f(i,0,n)cin>>a[i];
      #define show(a,n) f(i,0,n){cout<<a[i]<<" ";}
      #define ashow(a)  for(auto i:a)cout<<i<<" ";
      #define khtm     cout<<endl;
      #define all(s) s.begin(),s.end()
      #define len(a) a.length()
      #define INF 1e18
      #define MAXN 2000009
      #define PMOD 998244353
      const double pi=3.14159265358979323;
      const int mod=1e9+7;
      void btao(int n){
        if(n)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
      }
      bool isPrime(int n) 
  { 
      // Corner cases 
      if (n <= 1) 
          return false; 
      if (n <= 3) 
          return true; 
    
      // This is checked so that we can skip 
      // middle five numbers in below loop 
      if (n % 2 == 0 || n % 3 == 0) 
          return false; 
    
      for (int i = 5; i * i <= n; i = i + 6) 
          if (n % i == 0 || n % (i + 2) == 0) 
              return false; 
    
      return true; 
  } 
  int spf[MAXN];
  void sieve()
        {
            spf[1] = 1;
            for (int i=2; i<MAXN; i++)
                spf[i] = i;
            for (int i=4; i<MAXN; i+=2)
                spf[i] = 2;
            for (int i=3; i*i<MAXN; i++)
            {
                if (spf[i] == i)
                {
                    for (int j=i*i; j<MAXN; j+=i)
                        if (spf[j]==j)
                            spf[j] = i;
                }
            }
        }
 
  int lcm(int a,int b){
      return a*b/__gcd(a,b);
  }
  int aa[300005];
  int n,k,nr,nb,ng;
  int ans=INF;
  int cnt=0;
  int vis[100005]={};
  // string s;
       signed main() {

          ios_base::sync_with_stdio(false);
          cin.tie(NULL);  
          cout.tie(0);  
       // -------------------------------------Code starts here--------------------------------------------------------------------- 
      int t=1;
      // cin>>t;
      while(t--)
      {
        

          int x=1,y=0;
          int mx=-1,mi=INF,mn=INF;
          int tb,ta,tm=0;
        
            cin>>n;
           cout<<n+n*n+n*n*n<<endl;
          }
   }

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
//#define int long long
#define mod 1000000007
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define f(i,n) for(ll i=0;i<n;i++)
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define ms(v,n) memset((v),n,sizeof(v));
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define sll set<ll>
#define vll vector<ll>
#define vpll vector<pll>
#define maxi(a,b,c) max(a,max(b,c))
#define maxii(a,b,c,d) max(max(a,b),max(c,d))
#define mini(a,b,c) min(a,min(b,c))
#define md(a,b)  ((a%mod)*(b%mod)+mod)%mod 
#define ad(a,b)  (a%mod+b%mod+mod)%mod
#define nl endl
#define inf 1e18
#define cases ll t;cin>>t;while(t--)
#define BLOCK 500
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
 
using namespace std;

const int N=25;

ll a[N][N];
ll n;

void add(ll &a,ll b)
{

    a+=b;
    if(a>=mod)
    a-=mod;


}
int main()
{
    
    fast
    cin>>n;
    f(i,n)
    f(j,n)
    cin>>a[i][j];

    vll dp(1<<n);

    dp[0]=1;


    for(ll mask=0;mask<(1<<n);mask++)
    {
        ll male=__builtin_popcount(mask);

        for(ll female=0;female<n;female++)
        {
            if(a[male][female]  && !(mask&(1<<female)))
            {
            ll m=mask^(1<<female);
            add(dp[m],dp[mask]);
            }

        }

    }

    cout<<dp[(1<<n)-1];


    

       
    return 0;
    
}



Measured memory_bytes: 16640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<ll> enum_div(ll n) {
    std::vector<ll> ret;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != 1 && i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;
    vector<int> A(N);
    cin >> A;

    vector<bool> balls(N, false);
    FORR(i, N, 0) {
        int cnt = 0;
        for (int j = i; j < N; j += (i + 1)) {
            if (balls[j]) cnt++;
        }
        if (cnt % 2 != A[i]) balls[i] = true;
    }

    cout << count(ALL(balls), true) << endl;
    REP(i, N) {
        if (balls[i]) { cout << i + 1 << " "; }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1792
#![allow(unused)]

//
// Based on EbTech's Scanner https://stackoverflow.com/q/56449027
//
struct Scanner<'a, R: std::io::BufRead> {
    reader: R,
    buf: String,
    iter: std::str::SplitWhitespace<'a>,
}

impl<'a, R: std::io::BufRead> Scanner<'a, R> {
    fn new(reader: R) -> Self {
        Self { reader, buf: String::new(), iter: "".split_whitespace() }
    }

    fn get_str(&mut self) -> &str {
        if let Some(t) = self.iter.next() {
            return t;
        }
        self.buf.clear();
        self.reader.read_line(&mut self.buf).expect("I/O error");
        self.iter = unsafe { std::mem::transmute(self.buf.split_whitespace()) };
        self.get_str()
    }

    fn get<T: std::str::FromStr>(&mut self) -> T {
        self.get_str().parse().ok().expect("Parse error")
    }
}

fn main() {
    let stdin = std::io::stdin();
    solve(Scanner::new(stdin.lock()));
}

fn solve<R: std::io::BufRead>(mut sc: Scanner<R>) {
    let a: i64 = sc.get();
    let b: i64 = sc.get();
    let c: i64 = sc.get();
    let k: i64 = sc.get();

    if k <= a {
        println!("{}", k);
    } else if k <= a + b {
        println!("{}", a);
    } else {
        println!("{}", a - (k - a - b));
    }
}


Measured memory_bytes: 2136
MOD = 10**6+3

def main():
    # preprocess
    fac = [None] * (MOD+1)
    fac[0] = fac[1] = 1
    for i in range(2, MOD+1):
        fac[i] = (fac[i-1] * i) % MOD

    Q = int(input())
    for i in range(Q):
        x, d, n = map(int, input().split())

        if d == 0:
            print(pow(x, n, MOD))
            continue
        
        xd = (x * pow(d, MOD-2, MOD)) % MOD
        if xd == 0 or xd + (n-1) >= MOD:
            print(0)
            continue

        print(pow(d, n, MOD) * fac[xd+(n-1)] * pow(fac[xd-1], MOD-2, MOD) % MOD)


if __name__ == "__main__":
    main()

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

int main(){
    int h,w;
    cin >> h >> w;
    char a[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> a[i][j];
        }
    }
    string ans="Possible";
    for(int i=0;i<h-1;i++){
        for(int j=1;j<w;j++){
            if(a[i][j]=='#'&&a[i+1][j-1]=='#'){
                ans="Impossible";
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

S = input().rstrip()
A = [int(s) for s in S]

ans = []
for i in range(2):
	count = 0
	# i==0 の時、 101010、i==1の時、01010とする
	for idx,a in enumerate(A):
		if i==idx%2 and a==0:count+=1
		elif i!=idx%2 and a==1:count+=1
	ans.append(count)

print(min(ans))

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

typedef long long ll;
const int MOD = (int)1e9 + 7;

int N;
int L, R;
vector<int> A;
vector<int> B;
vector<ll> F, invF;

ll mod_pow(ll x, ll p, ll m) {
	ll a = 1;
	while (p) {
		if (p % 2)
			a = a * x % m;
		x = x * x % m;
		p /= 2;
	}
	return a;
}

ll mod_inv(ll a, ll m) {
	return mod_pow(a, m - 2, m);
}

ll nCr(int n, int r) {
	return F[n] * invF[r] % MOD * invF[n - r] % MOD;
}

int main(void) {
	cin >> N;
	A.resize(N + 1);
	B.resize(N + 2, -1);
	for (int i = 0; i < N + 1; ++i) {
		cin >> A[i];
		if (B[A[i]] != -1) {
			L = B[A[i]];
			R = i;
		}
		else
			B[A[i]] = i;
	}

	F.resize(N + 2);
	invF.resize(N + 2);
	F[0] = invF[0] = 1;
	for (int i = 1; i <= N + 1; ++i) {
		F[i] = (F[i - 1] * i) % MOD;
		invF[i] = mod_inv(F[i], MOD);
	}

	int d = R - L;
	for (int k = 1; k <= N + 1; ++k) {
		ll c1 = nCr(N + 1, k);
		ll c2 = (N - d < k - 1) ? 0LL : nCr(N - d, k - 1);
		ll ans = (c1 - c2 + (ll)MOD) % MOD;
		cout << ans << '\n';
	}

	return 0;
}


Measured memory_bytes: 3584
import java.util.*;

class Main{
    //150a
    static final long DIV = 100000007L;
    static final int MAX = 2000000000;
    //static long[] fac = new long[MAX];
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        char s = a.charAt(0);
        System.out.println((char)(s+1));
    }

    
    
}

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

#define mod 1'000'000'007
typedef long long ll;

template<typename T>
void deb(initializer_list<T> l)
{
	for (auto &e : l)
		cout << e << ' ';
	cout << endl;
}

void solve()
{
	int n;
	cin >> n;
	vector<int> a(n);
	set<int> s;
	vector<int> f(2e6, 0);
	for (auto& e : a)
	{
		cin >> e;
		s.insert(e);
		++f[e];
	}

	vector<bool> marked(2e6 + 1, false);
	for (auto& e : s)
		for (int j = 2 * e; j < 2e6; j += e)
			marked[j] = true;

	int cnt = 0;
	for (auto& e : a)
		if (!marked[e] && f[e] == 1)
			++cnt;

	cout << cnt << '\n';
}

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

	int t = 1;
	// cin >> t;
	while (t--)
		solve();

	return 0;
}


Measured memory_bytes: 21344
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <queue>
using namespace std;
const int INF = 1 << 30;
const int NIL = -1;
const int MAXN = 105;
int graph[MAXN][MAXN];
int vis[MAXN];
int d[MAXN];
int n;
void dijkstra(int s)
{
	for (int i = 0; i < n; ++i)
	{
		vis[i] = false;
		d[i] = graph[0][i];
	}
	vis[s] = true;
	d[s] = 0;
	while (true)
	{
		int minicost = INF;
		int id = -1;
		for (int i = 0; i < n; ++i)
		{
			if (!vis[i] && minicost > d[i])
			{
				minicost = d[i];
				id = i;
			}
		}
		if (minicost == INF)
			break;
		vis[id] = true;
		for (int i = 0; i < n; ++i)
		{
			if (!vis[i] && d[i] > d[id] + graph[id][i])
				d[i] = d[id] + graph[id][i];
		}
	}
}

int main(void)
{
		
	int k, s, e, w;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			graph[i][j] = INF;
	for (int i = 0; i < n; ++i)
	{
		scanf("%d%d", &s, &k);
		while (k--)
		{
			scanf("%d %d", &e, &w);
			graph[s][e] = w;
		}
	}
	dijkstra(0);
	for (int i = 0; i < n; ++i)
		printf("%d %d\n", i, d[i]);

	return 0;
}

Measured memory_bytes: 3240
let tyk a b c = (a*a) = (b*b+c*c)
let tri a b c = (tyk a b c) || (tyk b a c) || (tyk c a b)
let ans a b c = if tri a b c then Printf.printf "YES\n" else Printf.printf "NO\n"
let main =
	let k = Scanf.scanf "%d\n" (fun x -> x) in
	for i = 0 to k - 1 do
		Scanf.scanf "%d %d %d\n" (fun x y z -> ans x y z)
	done;

Measured memory_bytes: 2672
#pragma GCC optimize "-O3"
#include <bits/stdc++.h>
using namespace std;
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<int,int>
#define four pair<two,two>
#define pb push_back
#define mk make_pair
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
#define nn 1000003
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define vi vector<int>
#define vll vector<ll>
#define vtwo vector<two>
#define ALL(container) (container).begin(), (container).end()
#define sz(container) (int)(container.size())
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mid(a,b) (a+b>>1)
#define minN 0
#define maxN 10000000
#define na(x) ((x)<P?(x):(x)-P)
#define ab(a) (-(a)<(a)?(a):-(a))
int in(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
ll k,a,b,ans,x;
int main(){std::ios::sync_with_stdio(false);
cin>>k>>a>>b;
if(b-a<=2){
	cout<<1+k<<endl;
	return 0;
}
if(k<=a){
	cout<<k+1<<endl;
	return 0;
}
k-=a-1;
ans=a;
ans+=k/2*(b-a);
ans+=k%2;
cout<<ans<<endl;
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/





Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair

int main(){
	string S;
	cin >> S;
	int sum = 0;
	for(int i=0; i<S.size(); i++){
		if(S[i] == 'x') sum++;
	}
	if(sum <= 7) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  vector<int> point(2, 0);
  for(int i=0; i<N; i++){
    cin >> a.at(i);
  }
  int MAX=0, tmp=0;
  for(int i=0; i<N; i++){
    MAX=a.at(i);
    for(int j=i+1; j<N; j++){
      if(MAX < a.at(j)){
        tmp=MAX;
        MAX=a.at(j);
        a.at(j)=tmp;
      }
    }
    if(i%2==0) point.at(0)+=MAX;
    if(i%2==1) point.at(1)+=MAX;
  }
  cout << point.at(0)-point.at(1) <<endl;
}
    

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

signed main() 
{
  string s; cin>>s;
  string c="CODEFESTIVAL2016";
  int cnt=0;
  rep(i,16)
  {
    if(s[i]!=c[i]) cnt++;
  }
  print(cnt);

  return 0;
}

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

namespace CSharp_AtCoder
{

    
    class Program
    {
       
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            Dictionary<string, int> dic = new Dictionary<string, int>();

            dic["SUN"] = 0;
            dic["MON"] = 1;
            dic["TUE"] = 2;
            dic["WED"] = 3;
            dic["THU"] = 4;
            dic["FRI"] = 5;
            dic["SAT"] = 6;

            Console.WriteLine(7 - dic[S]);

        }
    }
}


Measured memory_bytes: 11104
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;

vin par(100010);
vin deep(100010);
void init(int n);
int find(int x);
void unite(int x,int y);
bool same(int x,int y);

int main(){
    int n,m;cin>>n>>m;
    vin p(n),x(m),y(m);
    rep(i,n)cin>>p[i];
    rep(i,m)cin>>x[i]>>y[i];
    init(n);
    rep(i,m)unite(x[i],y[i]);
    int ans=0;
    rep(i,n)if(same(par[p[i]],par[i+1]))ans++;
    cout<<ans<<endl;
}

void init(int n){
    rep(i,n){
        par[i]=i;
        deep[i]=0;
    }
}
int find(int x){
    if(par[x]==x)return x;
    else return par[x]=find(par[x]);
}
void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    if(deep[x]<deep[y])par[x]=y;
    else{
        par[y]=x;
        if(deep[x]==deep[y])deep[x]++;
    }
}
bool same(int x,int y){
    return find(x)==find(y);
}

Measured memory_bytes: 2176
<?php
fscanf(STDIN, "%s", $s);
fscanf(STDIN, "%d", $k);
for ($i = 0; $i < strlen($s); $i++) {
	if ($s[$i] != 1) {
		$t = $s[$i];
		break;
	}
}
echo $k <= $i ? 1 : $t;

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

int main(){
    string s;
    cin >> s;
    if(s=="A"){
        cout << "T";
    }else if(s=="T"){
        cout << "A";
    }else if(s=="C"){
        cout << "G";
    }else {
        cout << "C";
    }

    getchar();
    return  0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int x = a;
		int b = sc.nextInt();
		int y = b;
		if(b > a) {
			x = b;
			y = a;
		}
		int c = sc.nextInt();
		int z = c;
		if(c > x) {
			z = y;
			y = x;
			x = c;
		}else if(c > y) {
			z = y;
			y = c;
		}

		System.out.println((x-y)+(y-z));


	}
}

Measured memory_bytes: 22228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=505,M=50005,R=100;
const ll inf=0x3f3f3f3f3f3f3f3fll;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
void chkmax(int &x,int y){if (x<y) x=y;}
void chkmin(int &x,int y){if (x>y) x=y;}
int n,m;
struct jew{int x,y;ll w;}a[N];
struct node{char typ;int x,r;}b[N];
ll cost,ans;
int S,T,cnt,fir[N],fr[N],siz;
struct edge{int u,v;ll w;int fl,nex;}e[M];
void add(int u,int v,ll w,int fl){
	e[++siz]=(edge){u,v,w,fl,fir[u]};fir[u]=siz;
	e[++siz]=(edge){v,u,-w,0,fir[v]};fir[v]=siz;
}
ll dist[N];int que[N*50];bool inq[N];
void dec(int x,int fl){e[x].fl-=fl;e[x^1].fl+=fl;}
bool spfa(){
	memset(dist,0xc0,8*(cnt+1));
	memset(inq,0,cnt+1);
	int l=1,r=1;que[l]=S;dist[S]=0;inq[S]=1;
	while (l<=r){
		int x=que[l];
		for (int i=fir[x];i;i=e[i].nex)
		if ((e[i].fl)&&(dist[e[i].v]<dist[x]+e[i].w)){
			if (!inq[e[i].v]) {que[++r]=e[i].v;inq[e[i].v]=1;}
			dist[e[i].v]=dist[x]+e[i].w;fr[e[i].v]=i;
		}
		inq[x]=0;l++;
	}
	return dist[T]>(ll)0xc0c0c0c0c0c0c0c0ll;
}
int update(){
	int t=0x3f3f3f3f;
	for (int i=fr[T];i;i=fr[e[i].u]) t=min(t,e[i].fl);
	cost+=t*dist[T];
	for (int i=fr[T];i;i=fr[e[i].u]) dec(i,t);
	return t;
}
int dinic(){
	int flow=0;
	while (spfa()) flow+=update();
	return flow;
}
int ml[N],mr[N],mu[N],md[N];
void calc(int L){
	memset(fir,0,sizeof(fir));siz=1;
	S=0;T=cnt=L*2+R*2+1;
	for (int i=1;i<=n;i++) add(a[i].x,a[i].y+R,a[i].w,1);
	for (int i=1;i<=L;i++) {ml[i]=mu[i]=1,mr[i]=md[i]=R;add(S,R*2+i,0,1);add(R*2+L+i,T,0,1);}
	for (int i=1;i<=m;i++)
	if (b[i].r>=L) continue;
	else if (b[i].typ=='L') chkmax(ml[b[i].r+1],b[i].x+1);
	else if (b[i].typ=='R') chkmin(mr[L-b[i].r],b[i].x-1);
	else if (b[i].typ=='D') chkmax(mu[b[i].r+1],b[i].x+1);
	else if (b[i].typ=='U') chkmin(md[L-b[i].r],b[i].x-1);
	for (int i=2;i<=L;i++) chkmax(ml[i],ml[i-1]),chkmax(mu[i],mu[i-1]);
	for (int i=L-1;i;i--)  chkmin(mr[i],mr[i+1]),chkmin(md[i],md[i+1]);
	for (int i=1;i<=L;i++){
		for (int j=ml[i];j<=mr[i];j++) add(R*2+i,j,0,1);
		for (int j=mu[i];j<=md[i];j++) add(j+R,R*2+L+i,0,1);
	}
	cost=0;
	if (dinic()==L){
		ans=max(ans,cost);
//		for (int i=1;i<=n;i++) if (!e[i*2].fl) printf("%d ",i);
//		printf("\n");
	}
}
int main(){
	n=read();
	for (int i=1;i<=n;i++) scanf(" %d %d %lld",&a[i].x,&a[i].y,&a[i].w);
	m=read();
	for (int i=1;i<=m;i++) scanf(" %c %d %d",&b[i].typ,&b[i].x,&b[i].r);
	for (int i=1;i<=n;i++) calc(i);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 896
class Main{
    public static void main(String[] a){
        int[] b = {1,2,3,4,5,6,7,8,9};
        int sum=0;

        for(int i=0; i<9; i++){
           for(int n=0; n<9; n++){
             sum = b[i] * b[n];
             System.out.println(b[i]+"x"+b[n]+"="+sum);
           }
        }
    }
}

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

int main() {
    string s;
    cin >> s;
    int ans = 0;
    bool f = true;
    while (f) {
        f = false;
        for (int i = 1; i < s.size(); i++) {
            if (s[i] != s[i-1]) {
                s.erase (i-1, 2);
                ans += 2;
                i --;
                f = true;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3756
#include <algorithm>
#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 ll long long
#define INF 1000000000000000000

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    vector<bool> B(N, false);
    rep(i, N) {
        cin >> A[i];
        if (A[i] == i + 1)
            B[i] = true;
    }

    int count = 0;
    int res = 0;
    rep(i, N) {
        if (B[i])
            count++;
        else {
            res += (count / 2) + (count % 2);
            count = 0;
        }
    }
    res += (count / 2) + (count % 2);
    cout << res << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int A, B;
	cin >> A >> B;
	int C = A + B;
	if (C % 2) cout << "IMPOSSIBLE\n";
	else cout << C / 2 << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] a = new int[N];

        for (int i= 0; i < N; i++) {
            a[i] = sc.nextInt();
        }

        int[] pop = new int[9];
        for (int i = 0; i < N; i++) {
            pop[Math.min(a[i]/400, 8)]++;
        }

        int cnt1 = 0;
        for (int i = 0; i < 8; i++) {
            if (pop[i] > 0) cnt1++;
        }

        if (cnt1 == 0 && pop[8] > 0) {
            cnt1 = 1;
            pop[8]--;
        }

        int cnt2 = cnt1 + pop[8];
        System.out.println(cnt1 + " " + cnt2);

        return;
    }

}

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

int cal_xor(int x) {
    if (x % 4 == 0)
        return 0;
    else if (x % 4== 1)
        return 1;
    else if (x % 4 == 2)
        return x+1;
    return 0;
}

int main() {
    int m, k;
    cin >> m >> k;
    if (k >= (1<<m)) {
        cout << -1 << endl;
    } else {
        if (k == 0) {
            for(int i = 0; i < (1<<m); i++)
                cout << i << " " << i << " ";
            return 0;
        }
        int xor_all = cal_xor((1<<m)-1);
        int other = xor_all ^ k;
        if (other != k) {
            cout << -1 << endl;
        } else {
            vector<int> arr;
            for(int i = 0; i < (1<<m); i++) {
                if (i == k) continue;
                arr.push_back(i);
            }
            arr.push_back(k);
            for(int i = (1<<m)-1; i>= 0; i--) {
                if (i == k) continue;
                arr.push_back(i);
            }
            arr.push_back(k);
            for(int val: arr)
                cout << val << " ";
        }
    }
    return 0;
}



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

using namespace std;
using ll = long long;



int main()
{
    int n,a,b;
    cin >> n >> a >> b;
    vector<int> p(n);
    vector<bool> seen(n);
    for(int i = 0; i < n; i++)cin >> p[i];
    int x = 0, y = 0, z = 0;

    for(int i = 0; i < n; i++){
        if(p[i] <= a)x++;
        else if(p[i] > b)y++;
        else z++;
    }
    cout << min({x,y,z}) << endl;

}

Measured memory_bytes: 256
import static java.util.Arrays.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	void solve() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		int q = sc.nextInt();
		Node[] nodes = new Node[n];
		for (int i = 0; i < n; i++) nodes[i] = new Node();
		for (int i = 0; i < n; i++) {
			nodes[i].next = nodes[(i + 1)%n];
			nodes[i].prev = nodes[(i - 1 + n)%n];
		}

		Node cur = nodes[0];
		for (int mmm = 0; mmm < m; mmm++) {
			int a = sc.nextInt();
			if (a % 2 == 0) {
				for (int i = 0; i < a; i++) cur = cur.next;
			} else {
				for (int i = 0; i < a; i++) cur = cur.prev;
			}
			cur.live = false;
			cur.prev.next = cur.next;
			cur.next.prev = cur.prev;
			cur = cur.next;
		}
		for (int qqq = 0; qqq < q; qqq++) {
			int x = sc.nextInt();
			System.out.println(nodes[x].live ? 1 : 0);
		}

	}

	class Node {
		boolean live = true;
		Node prev;
		Node next;
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}

Measured memory_bytes: 41936
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
double calcTime()
{
    struct::timespec getTime;
    clock_gettime(CLOCK_MONOTONIC, &getTime);
    return (getTime.tv_sec + getTime.tv_nsec*1e-9);
}

void solve(){
    double t = calcTime();
    ll D;
    cin >> D;
    ll c[30];
    rep(i,0,26) cin >> c[i];
    ll s[370][30];
    rep(i,0,D){
        rep(j,0,26){
            cin >> s[i][j];
        }
    }
    rep(i,0,D) print(1);
    

}

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

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

int main() {
    int n;
    cin>>n;
    int a[n],x,y;
    bool t=false;
    for (int i=0;i<n;i++) {
        cin>>x>>y;
        a[i]=x-y;
    }
    for (int i=0;i<n-2;i++) {
        if (a[i]==a[i+1] && a[i+1]==a[i+2] && a[i]==0) {
            t=true;
            break;
        }
    }
    if (t==true) {
        cout<<"Yes";
    } else {
        cout<<"No";
    }
    return 0;
}

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

int main() {
  
  double N;
  cin >> N;
  
  double s=0.00000000;
  for (int i=0; i<N; i++) {
    if ((i+1)%2==1) s++;
  }
  
  cout << s/N << endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

ans = 0
for i in range(N-1):
	if a[i] == a[i+1]:
		ans += 1
		a[i+1] = 10001
print(ans)


Measured memory_bytes: 5264