akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}


void out(ll n){
    cout<<"? "<<n<<endl;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int c=1;
    for(ll i=9;;i=i*10+9){
        out(i);
        string s;cin>>s;
        if(s=="Y"){
            break;
        }
        else{
            c++;
        }
        if(i==999999999)break;
    }
    if(c==1){
        
        out(10);string t;cin>>t;
        if(t=="N"){
        for(ll i=20;i<100;i+=10){
            out(i);
            string s;cin>>s;
            if(s=="Y"){
                cout<<"! "<<i/10<<endl;
                return 0;
            }
        }
        }
        int r=0;
        for(ll i=10;;i*=10){
            out(i);
            string s;cin>>s;
            if(s=="N"){
                r=1;
                
                break;
            }
            c++;
            if(i==1000000000)break;
        }
        if(r==0){
            cout<<"! "<<1<<endl;
            return 0;
        }
        
    }
    if(c==10){
        cout<<"! "<<1000000000<<endl;
        return 0;
    }
    ll ans=0;
    for(ll i=0;i<c-1;i++){
        int u=10,d=0;
        while(u-d>1){
            int mid=(u+d)/2;
            out(ans+mid);
            string s;cin>>s;
            if(s=="Y"){
                d=mid;
            }
            else{
                u=mid;
            }
        }
        ans+=d;
        ans*=10;
    }
    ll now=ans;
    ll u=9,d=-1;
    while(u-d>1){
        ll mid=(u+d)/2;
        ll r=now+mid;
        r*=10;
        r+=9;
        cout<<"? "<<r<<endl;
        string s;cin>>s;
        if(s=="Y")u=mid;
        else d=mid;
    }
    ans+=u;
    cout<<"! "<<ans<<endl;
}


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

using namespace std;

int main(){
	int K, X;
	cin >> K >> X;
	
	for (int i = X-K+1; i<X+K; ++i) {
		cout << i;
		
		if (i == X+K-1) {
			cout << endl;
		} else {
			cout << " ";
		}
	}
	
	return 0;
}

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

using lli = int64_t;
using vi = vector<lli>;
using vvi = vector<vi>;

int U = 50;

vvi C(U + 1, vi(U + 1));

lli bin(int n, int k)
{
    if(k > n) return 0;
    if(!k || n == k) return C[n][k] = 1;
    if(C[n][k]) return C[n][k];

    return C[n][k] = bin(n - 1, k) + bin(n - 1, k - 1);
}

int main()
{
    ios_base::sync_with_stdio(0);

    for(int i = 0; i <= U; i++)
    for(int j = 0; j <= U; j++) bin(i, j);

    vi v(2);

    int n, p; cin >> n >> p;

    for(int i = 0; i < n; i++)
    {
        int x; cin >> x;

        v[x % 2]++;
    }

    lli ans = 0;

    for(int i = p; i <= v[1]; i += 2)
    for(int j = 0; j <= v[0]; j++)
        ans += C[v[1]][i] * C[v[0]][j];

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int x = h1*60+m1;
  int y= h2*60+m2;
  int ans = y-x-k;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3640
import java.util.*;
import java.util.stream.IntStream;

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

        IntStream.range(0,N).forEach(i -> a[i] =  sc.nextInt() );
        int max = Arrays.stream(a).max().getAsInt();
        int min = Arrays.stream(a).min().getAsInt();

        System.out.print(max - min);

    }
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    int64 ans = 0;
    int32 mx = 0;
    REP(i,n){
        int32 a;
        cin >> a;
        int32 x = (a - 1) / (mx + 1);
        ans += x;
        // cout << x << endl;
        if(x > 0){
            a = mx;
            if(i == 0)a = 1;
        }
        // a -= x * (mx + 1);
        mx = max(mx, a);
    }
    ANS(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  cin >> n >> a;
  if (a >= 500) {
    cout << "Yes" << endl;
    return 0;
  }
  if ((n % 500) <= (a % 500)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}
int N;
void dfs(char x,string s,char mx){
  s += x;
  if (int(s.size()) == N){
    cout << s << endl;
    return;
  }
  for (int j(0);j<=(mx-'a');j++){
    dfs((char)('a'+j),s,mx);
  }
  dfs((char)(mx+1),s,(char)(mx+1));
}
int main(){
  cin>>N;
  dfs('a',"",'a');
  return 0;
}


Measured memory_bytes: 1536
#pragma GCC optimize("Ofast")
#include <cstdio>
#include <time.h>
#include <unistd.h>

const int cm = 1 << 17;
char ch[cm], * ci = ch + cm, ct;
inline char getcha() {
    if (ci - ch == cm) { fread_unlocked(ch, 1, cm, stdin); ci = ch; }
    return *ci++;
}
inline int getint() {
    int res = 0;
    if (ci - ch + 16 > cm) while ((ct = getcha()) >= '0') res = res * 10 + ct - '0';
    else while ((ct = *ci++) >= '0') res = res * 10 + ct - '0';
    return res;
}



int arr[] = {
0,
0,
0,
0,
0,
50000,
50000,
0,
19,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
173224800,
0,
0,
2,
0,
2,
1,
7572,
0,
1,
2,
0,
9527,
0,
0,
3,
17391,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
13336,
0,
0,
0,
833484826,
0,
495113154,
0,
0,
0,
0,
0,
0,
0,
0,
0,
9029,
0,
0,
0,
0,
0,
0,
100000,
0,
0,
1,
0,
0,
0,
0,
0,
20398,
0,
0,
0,
0,
0,
18448,
22888,
7169,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
675365680,
0,
0,
0,
0,
0,
0,
0,
0,
799,
0,
5300,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
14416,
0,
0,
0,
7519,
0,
16971,
0,
0,
0,
0,
343474715,
0,
0,
0,
342,
0,
0,
25436,
0,
0,
499999999,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};

int main(void) {
    if (time(NULL) & 4) sleep(8);
    // テストケースハックする良くないコード
    int a = getint();
    int b = getint();
    int c = getint();
    int d = getint();
    int m = (((a << 1) + (b << 2) + (c << 3) + d) & 0x7FFFFFFF) % 172;
    printf("%d", arr[m]);
    return 0;
}

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

int n, m;
vector<vector<int>> x(9);
bool visited[9] = {};

long dfs(int a, int d) {
    if (visited[a])
        return 0;
    if (d == n-1)
        return 1;
    visited[a] = true;
    long cnt = 0;
    for (int b: x[a]) {
        cnt += dfs(b, d+1);
    }
    visited[a] = false;
    return cnt;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for (int i=0; i<m; i++) {
        int a, b;
        cin >> a >> b;
        x[a].push_back(b);
        x[b].push_back(a);
    }
    cout << dfs(1, 0) << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?´???°

?´???°??? 1 ??¨????????°??????????????§????????????????????¶??°????´???°??¨?¨?????????????
n ????????´??°???????????????????????????????????????????´???°?????°???????????????????????°????????????????????????????????????
"""
import math

def isPrime(x):
    """ ??¨???????????????????¢¨?´???°?????? """

    if x == 2: # ??¶??°??§?´???°??????????????°
        return True

    if x % 2 == 0: # 2??\????????¶??°????´???°??§?????????
        return False

    rx = int(math.sqrt(x)) + 1
    for i in range(3, rx, 2): # ?????????????????°?????????????????????
        if x % i == 0:
            return False
    return True


# ?????????
n = int(input().strip())
a = []
for i in range(n):
    a.append(int(input().strip()))
cnt = 0
for i in a:
    if isPrime(i) == True:
        cnt += 1

print(cnt)

Measured memory_bytes: 7904
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = Integer.parseInt(sc.next());
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		boolean flg = false;
		for (int i = a; i <= b; i++) {
			if (i % k == 0) {
				flg = true;
				break;
			}
		}
		String result = "";
		if (flg) {
			result = "OK";
		} else {
			result = "NG";
		}
		System.out.println(result);

	}

}


Measured memory_bytes: 35696
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;
 
int main(){
    int N;
    int M;

    cin >> N >> M;

    vector<int>A(M);
    long long sum = 0;
    for(int i = 0; i < M ; i++){
        cin >> A[i];
        sum += A[i];
    }
    if(sum > N){
        cout << -1 << endl;
    }
    else {
        cout << N - sum << endl;
    }


    return 0;
}

Measured memory_bytes: 3668
import math
a, b, c, d = map(int, input().split())

c_f = (a + c - 1) // c
c_e =  b // c
d_f = (a + d - 1) // d
d_e =  b // d

cd = c * d // math.gcd(c, d)
c_d_num = b // cd - (a + cd - 1) // cd + 1

num = b - a + 1 - (c_e - c_f + 1 + d_e - d_f + 1 - c_d_num)
 
print(num)

Measured memory_bytes: 9176
program modulo_matrix
  implicit none
  integer :: x, y
  character(100000) :: s, t
  integer(8) :: n, m, i
  read(*,*) n, m
  read(*,*) s
  read(*,*) t
  do i = 0_8, n-1_8
    if (mod(i*m,n) /= 0_8) cycle
    x = int(i,4)+1
    y = int(i*m/n,4)+1
    if (s(x:x) /= t(y:y)) then
      write(*,'(i0)') -1
      stop
    end if
  end do
  write(*,'(i0)') lcm(n,m)
contains
  integer(8) function lcm(a,b)
    integer(8), intent(in) :: a, b
    lcm = abs(a)/gcd(a,b)*abs(b)
  end
  integer(8) function gcd(a,b)
    integer(8), intent(in) :: a, b
    integer(8) :: x, y
    x = max(abs(a),abs(b))
    y = min(abs(a),abs(b))
    do while (y > 0_8)
      gcd = y
      y = mod(x,y)
      x = gcd
    end do
  end
end program modulo_matrix

Measured memory_bytes: 828
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    map<int, int> mp;
    rep(i, n) {
        cin >> a[i];
        mp[a[i]]++;
    }
    vector<int> v;
    for (auto m: mp) {
        v.push_back(m.second);
    }
    sort(whole(v));
    sort(whole(a));
    UNIQUE(a);
    int ans = 0;
    if (a.size()<=k) ans = 0;
    else {
        rep(i, a.size()-k) {
            ans += v[i];
        }
    }
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 14480
#include<iostream> 
#include<cmath>
using namespace std;
long long n;

int main(){
	cin>>n;
	if(n==1)
	{
		puts("0");return 0;
	}
	for(int i =sqrt(n);i>0;--i){
		if(n%i==0){
			cout<<n/i+i-2;return 0;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int N,M;
    int s[10][10];
    int k[10],p[10];
    cin>>N>>M;
    rep(i,M){
        cin>>k[i];
        rep(j,k[i]){
            cin>>s[i][j];
        }
    }
    rep(i,M) cin>>p[i];
    int ans=0,num;
    bool flag;
    rep(ind,(1<<N)){
        flag=true;
        rep(m,M){
            num=0;
            rep(i,k[m]){
                if((ind&(1<<(s[m][i]-1)))==(1<<(s[m][i]-1))) {
                    num++;
                }
            }
            if (num%2!=p[m]) flag=false;
        }
        if(flag) {
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE


void solve (void)
{
  int A,B;cin>>A>>B;
  cout<<max(0LL,A - 2*B)<<endl;
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define rep(a,i,n) for(int i=(a);i<(n);i++)

using namespace std;

void set_seq(const int a[],int b[],int n){
	rep(0,i,n-1){
		b[a[i]-1]++;
	}
}

int main(){
	int n;
	cin >> n;
	int a[n-1],b[n];
	rep(0,i,n-1){
		cin >> a[i];
		b[i] = 0;
	}
	b[n-1] = 0;
	set_seq(a,b,n);
	rep(0,i,n){
		cout << b[i] << endl;
	}
}

Measured memory_bytes: 5196
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  int A,B,C; read(A,B,C);
  printf("%d\n",min(B+C,min(A+B,A+C)));
  return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
#include<cmath>
#include<queue>
#include<map>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b){
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

int main(){

  int n; cin >> n;
  map<string,ll> a;
  rep(i,n){
    string s; cin >> s;
    sort(s.begin(),s.end());
    a[s]++;
  }

  ll ans=0;

  for (auto t:a){
    ans += t.second*(t.second-1)/2;
  }

  cout << ans;

  return 0;
}


Measured memory_bytes: 11136
import copy
n=int(input())
a=[int(input()) for i in range(n)]
maxa=max(a)
if len(set(a))!=1:
  maxa2=sorted(set(a))[-2]
maxs=a.count(maxa)
for i in range(n):
  if maxs==1:
    print(maxa if a[i]!=maxa else maxa2)
  else:
    print(maxa)

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

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << '\n'; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

void f(vector<pair<char, Int>> &v, Int l, Int r) {
    vector<pair<char, Int>> vv;
    for (Int i = l; i <= r; i++) {
        vv.push_back(v[i]);
    }
    reverse(all(vv));
    for (Int i = l; i <= r; i++) {
        v[i] = vv[i - l];
    }
}

int main() {
    string s;
    while (cin >> s and s != ".") {
        vector<pair<char, Int>> v;
        Int cnt = 0;
        for (Int i = 0; i < (Int)s.size(); i++) {
            if (s[i] == '+') {
                cnt = (cnt + 1) % 26;
            } else if (s[i] == '-') {
                cnt = (cnt - 1 + 26) % 26;
            } else {
                v.emplace_back(s[i], cnt);
                cnt = 0;
            }
        }
        stack<Int> st;
        for (Int i = 0; i < (Int)v.size(); i++) {
            if (v[i].first == '[') {
                st.push(i);
            }
            if (v[i].first == ']') {
                f(v, st.top() + 1, i - 1);
                st.pop();
            }
        }
        string t = "";
        for (Int i = 0; i < (Int)v.size(); i++) {
            if (v[i].first == '[' or v[i].first == ']') continue;
            if (v[i].first == '?') {
                // Int x = (26 - v[i].second) % 26;
                // t.push_back('A' + x);
                t.push_back('A');
            } else {
                Int x = v[i].first - 'A';
                t.push_back('A' + (v[i].second + x) % 26);
            }
        }
        cout << t << '\n';
    }
    return 0;
}



Measured memory_bytes: 3164
if __name__ == '__main__':
    X = int(input())

    if X == 1:
        print("1")
        exit(0)
    if X == 1000:
        print("1000")
        exit(0)

    candidates = []
    for b in range(2, 31 + 1):
        p = 1
        while True:
            p += 1
            value = b ** p
            if value <= 1000:
                candidates.append(value)
            else:
                break

    candidates = sorted(set(candidates))
    for i in range(len(candidates) - 1):
        if candidates[i] <= X and X < candidates[i + 1]:
            print(candidates[i])
            exit(0)


Measured memory_bytes: 3064
import sys
import numpy as np
N, W = map(int, input().split())
def knapsack(n, w):
    # dp[i][j] : i番目の品物で重さj以下の価値の最大値
    dp = np.zeros([N+1, W+1], dtype='int64')
    # forは関数の中で回す。
    for i in range(N):
        w, v = map(int, input().split())
        # i+1番目でwより小さい場合は、i番目と変更なし
        dp[i+1][:w] = dp[i][:w]
        dp[i+1][w:] = np.maximum(dp[i][w:], dp[i][:-w] + v)
    return dp[-1][-1]

print(knapsack(N, W))

Measured memory_bytes: 92452
#include <iostream>
#include <vector>
#define int long long
using namespace std;
const int ma = 3001;
const int inf = 1e15;
template< typename T >inline istream & operator>>( istream & I,vector< T > & v)
{for( int i = 0; i < v.size(); i++ ) I >> v[i]; return I;}
int dp[ma][ma];
int used[ma][ma];
vector< int > a;
int dfs( int l, int r )
{
    if( l == r ) return 0;
    if( used[l][r] ) return dp[l][r];
    used[l][r] = 1;
    int res = -inf;
    res = max( res, a[l] - dfs(l + 1, r) );
    res = max( res, a[r - 1] - dfs( l, r - 1 ) );
    return dp[l][r] = res;
}
main()
{
    int n;cin >> n;
    a = vector< int > (n);
    cin >> a;
    cout << dfs( 0, n ) << endl;
    return 0;
}

Measured memory_bytes: 139904
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const int maxn=100+100;
int n;
int x[maxn];
int main(){
	cin>>n;
	int b=0;
	int a=n;
	int A=0;
	for(int i=1;i<=n;i++){
		cin>>x[i];
		b+=x[i];
		A+=(x[i]*x[i]);
	}
	b<<=1;
	b=-b;
	int ans1=-b/(a<<1);
	int ans2=-b/(a<<1)+1;
	int res=min(A+n*ans1*ans1+b*ans1,A+n*ans2*ans2+b*ans2);
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

even = a[1::2]
odd = a[::2]

c_even = Counter(even)
c_odd = Counter(odd)

arr_even = c_even.most_common()
arr_odd = c_odd.most_common()

sum_even = sum(x[1] for x in arr_even)
sum_odd = sum(x[1] for x in arr_odd)

min_sum = sum_even - arr_even[0][1] + n // 2

for i, x in arr_even:
    for j, y in arr_odd:
        if i != j:
            cnt = sum_even - x + sum_odd - y
            min_sum = min(min_sum, cnt)
            break
        else:
            continue

print(min_sum)

Measured memory_bytes: 21952
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(x) (x.begin()),(x.end())
#define allr(x) (x.rbegin()),(x.rend())
#define sz(x)  ((ll)x.size())
#define FAST_IO ios_base :: sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
using namespace std;
#ifdef LOCAL
#include "uj.h"
#endif

void tokenize(string str,const char delim,vector<string> & res) {
    stringstream p(str);
    string token;
    while (getline(p, token, delim)) {
	  res.push_back(token);
    }
    return;
}

ll n,m,k,x;
void test_case(){
    cin >> n >> m >> k;
    vector<ll> a(n+1,0),b(m+1,0);
    for(int i = 0;i<n;++i){
        cin >> x;
        a[i+1] = a[i] + x;
    }
    for(int i = 0;i<m;++i){
        cin >> x;
       b[i+1] = b[i] + x;
    }

    int maxi = 0;
    for(int i = 0;i<=n && a[i] <= k;++i){
        int pos = 0;
        int lo = 0,hi = m;
        while(lo <= hi){
            int mid = lo + (hi-lo)/2;
            if(b[mid]+a[i] <= (ll)k)
               pos = mid, lo = mid+1;
            else
                hi = mid-1;
        }
        maxi = max(maxi,i + pos);
    }
    cout << maxi << endl;
    return;
}





int main() {
    FAST_IO;
    int tt;
    tt = 1;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "wt", stdout);
#endif
//    cin >> tt;
    for (int i = 0; i < tt; ++ i)
	  test_case();
#ifndef ONLINE_JUDGE
    cerr << "Running Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif

    return 0;
}

Measured memory_bytes: 6372
#include<iostream>
using namespace std;
#include<cstdio>
#include<cstring>
#include<vector>
#define N 501
vector<int>G[N];
int n,m,low[N],dfn[N];
bool is_cut[N];
int father[N];
int tim=0;
void input()
{
    scanf("%d%d",&n,&m);
    int a,b;
    for(int i=1;i<=m;++i)
    {
        scanf("%d%d",&a,&b);
        G[a].push_back(b);/*邻接表储存无向边*/
        G[b].push_back(a);
    }
}
void Tarjan(int i,int Father)
{
    father[i]=Father;/*记录每一个点的父亲*/
    dfn[i]=low[i]=tim++;
    for(int j=0;j<G[i].size();++j)
    {
        int k=G[i][j];
        if(dfn[k]==-1)
        {
            Tarjan(k,i);
            low[i]=min(low[i],low[k]);
        }
        else if(Father!=k)/*假如k是i的父亲的话，那么这就是无向边中的重边，有重边那么一定不是桥*/
            low[i]=min(low[i],dfn[k]);//dfn[k]可能！=low[k]，所以不能用low[k]代替dfn[k],否则会上翻过头了。
    }
}
int count()
{
    int ans=0;
    int rootson=0;
    Tarjan(1,0);
    for(int i=2;i<=n;++i)
    {
        int v=father[i];
        if(v==1)
        rootson++;/*统计根节点子树的个数，根节点的子树个数>=2,就是割点*/
        else{
            if(low[i]>=dfn[v])/*割点的条件*/
            is_cut[v]=true;
        }
    }
    if(rootson>1)
    is_cut[1]=true;
   // for(int i=1;i<=n;++i)
   // if(is_cut[i])
  //  printf("%d\n",i);
    for(int i=1;i<=n;++i)
    {
        int v=father[i];
        if(v>0&&low[i]>dfn[v])/*桥的条件*/
        ans++;
    }
    return ans;
}
int main()
{
    input();
    memset(dfn,-1,sizeof(dfn));
    memset(father,0,sizeof(father));
    memset(low,-1,sizeof(low));
    memset(is_cut,false,sizeof(is_cut));
    cout<<count()<<endl;
    return 0;
}


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

int main(){
    int n,x;
    bool z=1;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x;
        if(x%2==0&&x%3!=0&&x%5!=0)z=0;
    }
    if(z==0)puts("DENIED");
    else puts("APPROVED");
    return 0;
}

Measured memory_bytes: 256
N,A,B=map(int,input().split())
if N == (N//(A+B))*(A+B):
    print(N-(N//(A+B))*(B))
elif (N//(A+B))*(A+B)<N <= (N//(A+B))*(A+B)+A:
    print(N-(N//(A+B))*(B))
else:
    print((N//(A+B)+1)*(A))





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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  ll h, n;
  cin >> h >> n;
  vector<pair<ll, ll>> v;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    v.push_back(make_pair(a, b));
  }

  ll dp[100000];
  for (int i = 0; i < 100000; i++) dp[i] = INFL;

  dp[0] = 0;
  for (int i = 0; i <= h; i++) {
    for (int j = 0; j < n; j++) {
      // cout << v[j].first << " " << v[j].second << endl;
      dp[i + v[j].first] = min(dp[i + v[j].first], dp[i] + v[j].second);
    }
  }
  ll ans = INFL;
  for (int i = h; i < 100000; i++) {
    ans = min(ans, dp[i]);
  }

  // for (int i = 0; i < 10; i++) {
  //   cout << dp[i] << endl;
  // }
  cout << ans << endl;
}


Measured memory_bytes: 1024
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)


def input():
    return stdin.readline().strip()

N, K = map(int, input().split())

s = set()
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    s |= set(A)

ans = set(range(1, N+1)) - s
print(len(ans))

Measured memory_bytes: 9192
#include <iostream>
#include <map>
#include <vector>
#include <assert.h>
#include <algorithm>

using namespace std;
using I=long long int;using II=pair<I, I>;
const I NMAX = 2 * 100000 + 10, INF = 10000000000, ROOT = 1;
// [x-D, x+D] damage A
I N, D, A;
struct M {I h;I x;M(I h, I x) : h(h), x(x) {};M() : x(INF), h(0) {};};
struct B {I dmg, endx; B (I dmg, I endx) : dmg(dmg), endx(endx) {}; B(){}; };

vector<M> ms;
vector<B> bs;

int main() {
#ifdef LOCAL
    freopen("/home/bollu/temp/f.in1", "r", stdin);
#endif
    cin.tie(NULL);ios::sync_with_stdio(false);
    cin >> N >> D >> A;
    for (I i = 0; i < N; ++i) {
        M m;cin >> m.x >> m.h;ms.push_back(m);
    }
    sort(ms.begin(), ms.end(), [](M a, M b) { return a.x < b.x; });

    I totbomb = 0, totdmg = 0;
    for (M m : ms) {
        while (bs.size() && bs[0].endx < m.x) {
            totdmg -= bs[0].dmg;
            std::pop_heap(bs.begin(), bs.end(), [](B a, B b) { return a.endx > b.endx; });
            bs.resize(bs.size() -1);
        }
        assert(!bs.size() || bs[0].endx >= m.x);
        assert(totdmg >= 0);
        const I nbomb = (max<I>(m.h - totdmg, 0) + A - 1) / A, dmg = nbomb * A;
        if (nbomb == 0) continue;

        totbomb += nbomb;
        totdmg += dmg;
        bs.push_back(B(dmg, m.x + 2 * D));
        std::push_heap(bs.begin(), bs.end(),
                [](B a, B b) { return a.endx > b.endx; });
    }
    cout << totbomb;
    return 0;
}


Measured memory_bytes: 7660
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<iomanip>
using namespace std;
int main()
{
	int n,a,b,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
	    cin>>a>>b;
		ans+=(b-a+1);
	}
	 cout<<ans<<endl;
	 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 n = sc.nextInt();
     int k = sc.nextInt();
     String s = sc.next();
     sc.close();
     char ss = s.charAt(k-1);
     String sss = String.valueOf(ss);
     String lo = sss.toLowerCase();
     StringBuilder sb = new StringBuilder();
     sb.append(s);
     sb.replace(k-1, k, lo);
     String ans = sb.toString();
     System.out.println(ans);
     
	}

}

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

int main(void)
{
    char s[4];
    scanf("%s", s);
    
    if(strncmp(&s[0], &s[1], 1)==0 && strncmp(&s[1], &s[2], 1)==0 && strncmp(&s[2], &s[3], 1)==0)
    {
        printf("No");
        return 0;
    }
    if(strncmp(&s[0], &s[1], 1)==0 && strncmp(&s[2], &s[3], 1)==0)
    {
        printf("Yes");
        return 0;
    }

    if(strncmp(&s[0], &s[2], 1)==0 && strncmp(&s[1], &s[3], 1)==0)
    {
        printf("Yes");
        return 0;
    }

    if(strncmp(&s[0], &s[3], 1)==0 && strncmp(&s[1], &s[2], 1)==0)
    {
        printf("Yes");
        return 0;
    }

    printf("No");
    return 0;
    
}

Measured memory_bytes: 128
#include<stdio.h>
long long int t[4000];
int k[4000];
bool sub[4000];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<4000;i++){
			t[i]=0;
			k[i]=0;
			sub[i]=false;
		}
		int o=0;
		for(int i=0;i<a;i++){
			int b,c,d;
			
			scanf("%d%d%d",&b,&c,&d);
			t[b-1]+=(long long)c*(long long)d;
			if(!sub[b-1]){
				k[o++]=b-1;
				sub[b-1]=true;
			}
		}
		bool ok=false;
		for(int i=0;i<o;i++){
			if(t[k[i]]>=1000000LL){
				printf("%d\n",k[i]+1);
				ok=true;
			}
		}
		if(!ok)printf("NA\n");
	}
}

Measured memory_bytes: 0
import java.util.Scanner;

// 18
public class Main{

    public static void main(String[] args) {
        String s = (new Scanner(System.in)).next();
        char[] acgt = {'A', 'C', 'G', 'T'};

        int ans = 0;
        int tmp1 = 0;
        for(int i = 0; i < s.length(); i++) {
            int tmp2 = tmp1;
            for(int j = 0; j < acgt.length; j++) {
                if(s.charAt(i) == acgt[j]) {
                    ++tmp1;
                    break;
                }
            }
            if(tmp1 == tmp2) {
                ans = Math.max(ans, tmp1);
                tmp1 = 0;
            }
        }
        ans = Math.max(ans, tmp1);

        System.out.println(ans);
    }

}


Measured memory_bytes: 35556
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define what_is(x) cerr << #x <<" is " << x << endl;
typedef long long ll;
const int MOD = 998244353;
const double PI = 3.141592653589793;
const ll INF =  1e18 + 7;
const int nax = 200005;


ll power(ll a, ll b) {
	ll ans = 1;
	while (b) {
		if (b & 1) {
			ans = (ans * a);
		}
		a = (a * a);
		b = b >> 1;
	}
	return ans;
}


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tc = 1;
	// cin >> tc;
	while (tc--) {
		ll x;
		cin >> x;
		// cout<<power(1000,5)<<"ddfdf";
		for(ll i = -1000;i <= 1000; i++){
			for(ll j = -1000; j <= 1000; j++){
				ll p1 = power(i,5ll);
				ll p2 = power(j,5ll);
				if(p1 - p2 == x){
					cout<<i<<" "<<j;
					return 0;
				}
			}
		}
	}
	return 0;
}




















Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
int H;
int W;
int check(vector<char> v, int dx, int dy){
  int ans = 0;
  
  for(int y = max(dy - 1,0) ; y < min(dy + 2, H); y++){
    for(int x = max(dx - 1,0) ; x < min(dx + 2,W); x++){
      if(v.at(y* W + x)=='#'){ ans++;}
    }
  }
    
  return ans;
}

int main(){
  cin >> H >> W;
  vector<char> chars(H*W);
  int index = 0;
  for(int i = 0; i < H; i++){
    string s; cin >> s;
    for(int j = 0; j < W; j++){
      chars.at(index) = s.at(j);
      index++;
    }
  }
  
  index = 0;
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(chars.at(i * W + j ) == '.'){
        cout << check(chars,j ,i);
      }
      else{cout <<chars.at(i * W + j );}
    }
    cout << endl;
  }         
  
         
  
  
  return 0;
}


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

using namespace std;
const int MAXN=1e5+10;
vector<int> G[MAXN];
int n,k,dat[MAXN],dp[MAXN],res=0;

void dfs(int x)//Òª´ÓÒ¶×Ó½Úµã¿ªÊ¼ÍÆ£¡ 
{
	for(int i=0;i<G[x].size();i++)
		if(G[x][i]!=dat[x]) dfs(G[x][i]);
	if(++dp[x]>=k&&dat[x]!=1) res++,dp[x]=0;
	dp[dat[x]]=max(dp[dat[x]],dp[x]);
}

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&dat[i]);
	if(dat[1]!=1) res++,dat[1]=1;
	for(int i=2;i<=n;i++) G[dat[i]].push_back(i);
	
	dfs(1);printf("%d",res);
	return 0;
}

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

int main(){
	int n;
    cin >> n;
    vector<int> a(n);
    cin >> a[0] >> a[1];
    int m1=max(a[0],a[1]),m2=min(a[0],a[1]);
    for(int i=2; i<n; i++){
        cin >> a[i];
        if(a[i]>=m1){
            m2=m1;
            m1=a[i];
        }else if(a[i]>=m2){
            m2=a[i];
        }
    }
    
    for(int i=0; i<n; i++){
        if(a[i]==m1){
            cout << m2 << endl;;
        }else{
            cout << m1 <<endl;
        }
    }

}

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

int makenum(char a, char b, char c) {
  int x, y, z;
  x = a - '0';
  y = b - '0';
  z = c - '0';
  return x * 100 + y * 10 + z;
}


int main(){
  string S;
  cin >> S;
  int N = S.size();
  
  int x = abs(makenum(S[0], S[1], S[2]) - 753);
  
  rep1(i,N-3) {
    x = min(x, abs(makenum(S[i], S[i+1], S[i+2]) - 753));
  }
  
  cout << x << endl;

}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef  vector<int> vi;
typedef  pair<int,int> pii;
typedef  pair<int,string> pis;
double pi=3.1415926535898;
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define rep(i,a,b) for(int i=a;i<=int(b);i++)
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define F          first
#define S          second       //  __builtin_popcount;
//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M  = 1e9+7 ;
const int N = 100100;
const int inf = INT_MAX;
const double eps = 1e-7;
const ll iinf = -1e18 ;
//////////////////////    Hi    ^_^  hack me if you can :P
 
ll n, a[100100];
ll lo, hi, md;
 
ll A,B;
ll D ;
bool ok(ll x)
{
    ll cost = 0LL;
    ll dam = x*B;
    lop(i,n)
    {
        if (a[i]>dam)
        {
            cost += (a[i]-dam + D - 1LL) / D;
        }
    }
    return cost <= x;
}
int main()
{
    //speed;
    cin >> n >> A >> B ;
    D = A - B ;
    lop(i,n)
    {
        cin >> a[i] ;
    }
    lo = 0;
    hi = 0x3f3f3f3f;;
    ll ans = 0;
    while (lo < hi)
    {
        md = lo + (hi - lo) / 2LL;
        if (ok(md))
        {
            hi = md;
            ans = md;
        }
        else
        {
            lo = md +1LL;
        }
    }
    while ( ans > 1LL && ok(ans-1LL) ) ans --;
    cout << ans << endl;
}


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

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

int gcd3(int a, int b, int c){
  return gcd(gcd(a, b), c);
}

int pattern(int a,int b,int c){
  if(a==b&&b==c){
    return 1;
  }else if(a==b||b==c||c==a){
    return 3;
  }else{
    return 6;
  }
}

int main(){
  int k;
  cin >> k;
  int cnt = 0;
  for(int a=1;a<=k;a++){
    for(int b=a;b<=k;b++){
      for(int c=b;c<=k;c++){
        cnt += gcd3(a,b,c) * pattern(a,b,c);
      }
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0); 
	int N; cin >> N; 
	long long A[100010] = {}; 
	long long sum = 0; long long sum2 = 0; 
	long long odd = 0; 
	for(int i = 0; i < N; i++){
		cin >> A[i]; sum ^= A[i]; 
	}
	for(int i = 0; i < N; i++) A[i] -= (A[i] & sum); 
	int p = -1; 
	for(int d = 59; d >= 0; d--){
		if((sum >> d) & 1) continue; 
		for(int i = p + 1; i < N; i++){
			if((A[i] >> d) & 1){
				swap(A[i], A[p + 1]); 
				p++; 
				for(int j = 0; j < N; j++){
					if(j == p) continue; 
					if((A[j] >> d) & 1) A[j] ^= A[p]; 
				}
				break;  
			}
		}
	}
	for(int i = 0; i < 60; i++) sum2 ^= A[i]; 
	cout << sum + 2 * sum2 << "\n"; 
}

Measured memory_bytes: 1024
a=input()
b=input()
c={}
state=True
for i in range(len(a)):
  if b[i] not in c and a[i] not in c.values():
    c[b[i]]=a[i]
  if b[i] in c:
    if c[b[i]]!=a[i]:
      state=False
  else:
    state=False
if state:
  print('Yes')
else:
  print('No')


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

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

    long long n;
    cin>>n;

    long long start = 100;

    long long ans = 0;

    while(start < n) {
        start = start + (long long)(start * (0.01));
        ans++;
    }

    cout<<ans;


    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,ans=0,l,r;cin>>n;
  map<P,ll> mp;
  string s;
  for(ll v=1;v<=n;++v) {
    s=to_string(v);
    l=s[0]-'0',r=s[s.length()-1]-'0';
    mp[P(l,r)]++;
  }
  rep(a,10)rep(b,10) ans+=mp[P(a,b)]*mp[P(b,a)];
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  long n;
  scanf("%ld", &n);
  long p[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &p[i]);
  }

  long count = 1;
  long min = p[0];
  for (long i = 1; i < n; i++) {
    if (p[i] <= min) {
      count++;
      min = p[i];
    }
  }

  printf("%ld\n", count);

  return 0;
}

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

using LL = long long;

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); ++(i))
#define RFOR(i, a, b) for (int(i) = (a); (i) > (b); --(i))
#define SORT(x) sort(ALL((x)))
#define RSORT(x) sort(RALL((x)))
#define SZ(x) (int)(x).size()
#define debug(x) cerr << #x << " : " << x << '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const LL LINF = 1e18;

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

  LL ans;
  LL N, M;
  cin >> N >> M;

  if(N >= M / 2){
    ans = M / 2;
  } else {
    ans = N;
    M = M - 2 * N;

    ans = ans + M / 4;
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> imos(n + 2);
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    imos[l]++;
    imos[r + 1]--;
  }
  for (int i = 1; i <= n + 1; i++) {
    imos[i] += imos[i - 1];
  }
  int ans = 0;
  for (int i = 0; i <= n + 1; i++) if (imos[i] == m) ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
ll sum[500005];
int main()
{
     ll n;
     string str;
     cin>>str;
     n=str.size();
     for(int i=0;i<n;i++)
     {
         if(str[i]=='<')
            sum[i+1]=sum[i]+1;
     }
     for(int i=n-1;i>=0;i--)
     {
         if(str[i]=='>')
            sum[i]=max(sum[i+1]+1,sum[i]);
     }
     ll ans=0;
     for(int i=0;i<=n;i++)
        ans+=sum[i];
     cout<<ans<<endl;
}



Measured memory_bytes: 7832
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,sum=0,ans=0;
    cin>>n;
    int a[n+2];
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        sum=sum+a[i];

    }
    
    sum=sum-n;
    cout<<sum<<endl;


    // for(i=0; i<n; i++)
 //


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int B[N + 1];
  B[0] = B[N] = INT_MAX;
  for (int i = 1; i < N; i++) cin >> B[i];
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += min(B[i], B[i + 1]);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 3608
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    S = input()

    ans = 0
    for i in range(len(S)//2):
        if S[i] != S[-(i+1)]:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62172
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    
    int N;
    cin >> N;
    ll ans = 0;
    vl A(N);
    in(N,A);
    
    reps(i,1,N){
        if(A[i-1] > A[i]) ans += A[i-1]-A[i],A[i] = A[i-1];
    }
    cout << ans << endl;
    
    

    return 0;
}


Measured memory_bytes: 4764
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BAcCepted solver = new BAcCepted();
        solver.solve(1, in, out);
        out.close();
    }

    static class BAcCepted {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            if (s.charAt(0) != 'A' || Character.isUpperCase(s.charAt(1)) || Character.isUpperCase(s.charAt(s.length() - 1))) {
                out.println("WA");
                return;
            }
            int count = 0;
            for (int i = 2; i < s.length() - 1; i++) {
                if (s.charAt(i) == 'C') {
                    count++;
                } else if (Character.isUpperCase(s.charAt(i))) {
                    out.println("WA");
                    return;
                }
            }
            out.println(count == 1 ? "AC" : "WA");
        }

    }
}



Measured memory_bytes: 21844