akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

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

typedef struct node *Node;

Node root;

Node treeMinimum(Node x){
  while(x->left !=NIL) x=x->left;
  return x;
}

Node treeMaximum(Node x){

}

Node treeSearch(Node u, int k){
  while(u!=NIL && k!=u->key){
    if(k < u->key) u=u->left;
    else u=u->right;
  }
  return u;
}

Node treeSuccessor(Node x){
  if(x->right !=NIL) return treeMinimum(x->right);
  Node y=x->parent;
  while(y!=NIL&&x==y->right){
    x=y;
    y=x->parent;
  }
}

void treeDelete(Node z){
  Node y;
  Node x;
}

void insert(int k){
  Node y=NIL;
  Node x=root;
  Node z;

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

  while(x!=NIL){
    y=x;
    if(z->key < x->key) x=x->left;
    else if(z->key > x->key) x=x->right;
    else break;
  }
  z->parent=y;
  if(y==NIL) root=z;
  else{
    if(z->key < y->key) y->left=z;
    else if(z->key > y->key) y->right=z;
  }
}

void inorder(Node u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  char com[20];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",com);
    if(com[0]=='f'){
      scanf("%d",&x);
      Node t=treeSearch(root,x);
      if(t!=NIL) printf("yes\n");
      else printf("no\n");
    } else if(com[0]=='i'){
      scanf("%d",&x);
      insert(x);
    }else if(com[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }else if(com[0]=='d'){
      scanf("%d",&x);
      treeDelete(treeSearch(root,x));
        }

  }

  return 0;
}



Measured memory_bytes: 20440
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define inputv(arr,n) for(ll i=0;i<n;i++){ll value;cin>>value;arr.pb(value);}
#define sz(a) ((ll)(a).size())
#define len(a) ((ll)(a).length())
#define precise cout<<fixed<<setprecision(0); 
#define F first
#define S second
#define vi vector <int> 
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define YES cout<<"Yes\n"
#define NO cout<<"No\n"
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
inline ll max(ll a,ll b)
{return ((a>b)?a:b);}
inline ll min(ll a,ll b)
{return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b)
{if(b==0) return a;a%=b;return gcd(b,a);}
#define nl cout<<"\n"
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
// hashing for pairs
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};
//sort in reverse order
bool compare(ll x, ll y){
    return x>y;
}
void solve()
{
  string s;
  string t;
  cin>>s>>t;
  ll lens = len(s);
  ll lent  = len(t);
  ll ans =2000;
  rep(i,lens-lent+1)
  {
    ll val=0;
    rep(j,lent)
    {
      if(s[i+j]!=t[j])
      {
        val++;
      }
    }
    ans = min(ans,val);
  }
  cout<<ans;nl;
  return;
}
int main()
{
    IOS;
    int T=1;
   // cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3856
T=0

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

A=[]
B=[]
for i in range(N):
    a,b=map(int, input().split())
    A.append(a)
    B.append(b)

A.sort(reverse=True)
B.sort(reverse=True)

for i in range(N):
    if A[0]<=B[i]:
        H-=B[i]
        T+=1
        if H<=0:
            break

if H>0:
    T+=int(H/A[0])
    if H%A[0]>0:
        T+=1

print(T)


Measured memory_bytes: 11348
#include <stdio.h>
#include <string.h>
char a[1100],b[1100];
int c[1100][1100];
int max(int a,int b){
    return a>b?a:b;
}
void lcs(char a[],char b[]){
    int alen,blen,i,j;
    alen=strlen(a),blen=strlen(b);
    for(i=0;i<alen;i++)c[i][0]=0;
    for(j=0;j<blen;j++)c[0][j]=0;
    for(i=1;i<alen;i++)
        for(j=1;j<blen;j++)
            if(a[i]==b[j])c[i][j]=c[i-1][j-1]+1;
            else c[i][j]=max(c[i-1][j],c[i][j-1]);
}
int main(){
    int t,alen,blen,i;
    scanf("%d",&t);
    while(t--){
        scanf("%s%s",a+1,b+1);//此?a[0]='\0'  b[0]='\0' 
        a[0]=' ',b[0]=' ';//?a[0]一直到a[]都有数据 ?次弄明白了a+1,b+1的移位?取了
        lcs(a,b); 
        printf("%d\n",c[strlen(a)-1][strlen(b)-1]);
    }
    return 0;
}

Measured memory_bytes: 6000
N, M, X, Y = gets.chomp.split(" ").map(&:to_i)
x, y = readlines.map{|a| a.split(" ").map(&:to_i).sort}
x_coord = x.last
y_coord = y.first
puts X < Y && x_coord < y_coord && X < y_coord && x_coord < Y ? "No War" : "War"

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

int main() {
    int x[5];
    for (int i = 0; i < 5; i++)
    {
        x[i] = 0;
        cin >> x[i];
        
    }
    
    for (int i = 0; i < 5; i++)
    {
        if (x[i] == 0)
        {
            cout << i + 1 << endl;
            return 0;
        }
        
    }
    
  return 0;
}


Measured memory_bytes: 3624
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		int a=sc.nextInt();
		int n=sc.nextInt();
		String p=sc.next();
		if(p.equals(s) && p.equals(t)){
			System.out.println((a-1)+" "+(n-1));
		}else if(p.equals(s)){
			System.out.println((a-1)+" "+n);
		}else if(p.equals(t)){
			System.out.println(a+" "+(n-1));
		}else{
			System.out.println(a+" "+n);
		}
	}
}


Measured memory_bytes: 21844
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define ifYN(x) cout<<(x?"Yes":"No")<<"\n" 
#define dcml(n) fixed<<setprecision(n)

 
ll GCD(ll a,ll b) { return b ? GCD(b,a%b) : a; } 
ll LCM(ll a,ll b) { return a/GCD(a,b)*b; } 
ll Factorial(ll n){ ll m=1;while(n>=1)m*=n--;return m; } 
ll modPow(ll x,ll n,ll mod=MOD){ 
    return (!n?1:!n%2?modPow(x*x,n/2,mod)%mod:x%mod*modPow(x,n-1,mod)%mod); 
} 
using namespace std;
//-------------------------------------------
typedef pair<ll,ll> P;
ll GetnCr(ll n,ll r){
    ll res=1; 
    for(ll i=1;i<=r;i++){
        res=res*(n-i+1)/i;
    }
    return res;
}
int main(void){
    ll N;cin>>N;
    map<string,ll> mp;
    string s;
    REP(i,N){
        cin>>s;
        sort(ALLv(s));
        mp[s]++;
    }
    ll ans=0;
    for(auto i=mp.begin();i!=mp.end();i++){
        ans+=GetnCr(i->second,2);
    }
    cout<<ans<<"\n";
}




Measured memory_bytes: 11136
import java.io.*;
public class Main{
	public static void main(String [] args) throws NumberFormatException, IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		for(int i=1;;i++){
			int t=Integer.parseInt(br.readLine());
			if(0==t)break;
			System.out.println("Case "+i+": "+t);
		}}}

Measured memory_bytes: 27100
x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = [0, 1, 2]
for i in range(6):
    order = [0, 0, 0]
    for j in range(3):
        if {x[j], x[-j-1]} != {y[z[j]], y[-z[j]-1]}:
            break
        if x[j] == y[z[j]]:
            order[j] = 1 
            if x[j] == x[-j-1]:
                order[j] = 2 
    else:
        if 2 in order or (i < 3) == sum(order) % 2:
            print('Yes')
            break
    z = z[-1:] + z[:-1]
    if i == 2:
        z = [z[0], z[2], z[1]]
else:
    print('No')

Measured memory_bytes: 7732
from collections import deque
 
#入力受け取り
H,W=map(int,input().split())
Ch,Cw=[int(x)-1 for x in input().split()]
Dh,Dw=[int(x)-1 for x in input().split()]
maze=[input() for i in range(H)]
 
dirs=[-2,-1,0,1,2] #ワープ移動できる縦横の範囲

#初期化
dist=[[float('inf')]*W for _ in range(H)] #distには各点への到達コストを格納
dist[Ch][Cw]=0
dq=deque()
dq.append((0,Ch,Cw)) #キューには(コスト、x座標、y座標)を追加していく
ok=False

while dq:
    k,i,j=dq.popleft()
    if k>dist[i][j]:
        continue
    if i==Dh and j==Dw:
        ok=True
        break
    for di in dirs:
        for dj in dirs:
            if di==dj==0:
                continue
            ni,nj=i+di,j+dj #移動後の座標(ni,nj)
            if not (0<=ni<H and 0<=nj<W):
                continue
            if maze[ni][nj]=='#': #移動先が壁の中
                continue
            if k<dist[ni][nj]: 
                if abs(di)+abs(dj)==1: #歩行圏内(コスト:0)
                    nk=k
                    dist[ni][nj]=nk
                    dq.appendleft((nk,ni,nj))
                else: #歩行圏外(コスト:1)
                    nk=k+1
                    dist[ni][nj]=nk
                    dq.append((nk,ni,nj))   
if ok:
    ans=dist[Dh][Dw]
else:
    ans=-1
print(ans)

Measured memory_bytes: 181404
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處
int bit_count(LL n) {
    int ret = 0;
    while (n) {
        n >>= 1;
        ++ret;
    }
    return ret;
}

LL a[1002];
LL pre[1002];

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K; cin >> N >> K;
    for (int i = 0; i < N; ++i)  cin >> a[i];
    pre[0] = a[0];
    for (int i = 1; i < N; ++i)  pre[i] = pre[i-1] + a[i];
    vector<LL> v;
    int cur_bit = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = i+1; j < N; ++j) {
            LL sum = pre[j] - (i-1 >= 0 ? pre[i-1] : 0);
            v.push_back(sum);
            cur_bit = max(cur_bit, bit_count(sum));
        }
    }
    // for (auto x : v)  cout << x << ' ';
    // cout << endl;
    while (cur_bit > 0 && v.size() > K) {
        vector<LL> vv;
        for (int i = 0; i < v.size(); ++i) {
            if (v[i] & (1LL << (cur_bit-1)))  vv.push_back(v[i]);
        }
        if (vv.size() >= K)  v = move(vv);
        --cur_bit;
        // for (auto x : v)  cout << x << ' ';
        // cout << endl;
    }
    LL ans = v[0];
    for (int i = 1; i < K; ++i)  ans &= v[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8944
#include <stdio.h>
int main(void){
	int W,H;
	int i,j;
	while(1){
		scanf("%d %d",&H,&W);
		if(W == 0 && H == 0){
			break;
		}
		for(j = 1; j <= H; j++){
			for(i = 1; i <= W; i++){
				if( j == 1 || j == H){
					printf("#");
				}
				else {
					if(i == 1 || i == W){
						printf("#");
					}
					else {
						printf(".");
					}
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2024
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';

int main() {
    string s,ans="Yes";
    vl c(26);
    cin>>s;
    rep(i,s.size())c[s[i]-'a']++;
    rep(i,26)if(c[i]%2!=0)ans="No";
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
void rcmb(ll *x,ll s,ll r,function<void(ll *)>f){if(r==0){f(x);}else{if(s<0)return;rcmb(x,s-1,r,f);x[r-1]=s;rcmb(x,s-1,r-1,f);}}
void cmb(ll n,ll k,function<void(ll *)>f){ll x[k];rcmb(x,n-1,k,f);}
void prm(ll n,function<void(ll *)>f){ll x[n];for(ll i=0;i<n;i++)x[i]=i;do{f(x);}while(next_permutation(x,x+n));}
void prm(ll n,ll k,function<void(ll *)>f){cmb(n,k,[&](ll *c){prm(k,[&](ll *p){ll x[k];for(ll i=0;i<k;i++){x[i]=c[p[i]];}f(x);});});}
// prm(4, 2, [](ll *x){ cout << x[0] << "," << x[1] << "\n"; });
 
ll f(ll n){
	if (n%2==0) return n/2;
	else return 3*n+1;
}

int main(){
	ll s;
	cin >> s;
	map<ll, ll> m;
	ll i = 1;
	m[s] = 0;
	while(true) {
		s = f(s);
		if (m.count(s)!=0) break;
		m[s] = i;
		i++;
	}
	cout << i+1 << "\n";
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))


SINT32 main() {
    SINT32 a;
    SINT32 bbc;
    SINT32 ans;
    SINT32 AMAX = 0;
    SINT32 BMAX = 0;
    scanf("%d",&a);

    SINT32 dataA[200001] = {0};
    SINT32 dataB[200001] = {0};

    a = a/2;

    int buf;
    for (SINT32 i = 0; i < a; i++) {
        scanf("%d", &buf);
        dataA[buf]++;
        scanf("%d", &buf);
        dataB[buf]++;
    }

    for (SINT32 i = 0; i < 100001; i++) {
        if (dataA[i] > AMAX) {
            AMAX = dataA[i];
            bbc = i;
        }
    }
    for (SINT32 i = 0; i < 100001; i++) {
        if (dataB[i] > BMAX) {
            if (i != bbc) {
                BMAX = dataB[i];
            }
        }
    }
    ans = a-AMAX+a-BMAX;

    AMAX = 0;
    BMAX = 0;

    for (SINT32 i = 0; i < 100001; i++) {
        if (dataB[i] > BMAX) {
            BMAX = dataB[i];
            bbc = i;
        }
    }

    for (SINT32 i = 0; i < 100001; i++) {
        if (dataA[i] > AMAX) {
            if (i != bbc) {
                AMAX = dataA[i];
            } 
        }
    }

    if (ans > (a-AMAX+a-BMAX)) {
        ans = a-AMAX+a-BMAX;
    }





    printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

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

	// for(int x = max(a, b); x <= max(a, b) * 100; ++x){
	// 	int i = x * 8 / 100;
	// 	int j = x * 10 / 100;
	// 	if(i == a && j == b){
	// 		cout << x << endl;
	// 		return 0;
	// 	}
	// }

	// cout << -1 << endl;

	int x = (a * 100 + 7) / 8;
	int y = (b * 100 + 9) / 10;

	int v = max(x, y);
	if(v * 8 / 100 != a || v * 10 / 100 != b) v = -1;
	cout << v << endl;

	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define tr(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
//#define MOD 1000000007
#define endl "\n" 
#define int long long
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/
 
int32_t main()
{
	fastio();
    int n;
    cin>>n;
    set<int> se;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        if(se.count(x))se.erase(x);
        else se.insert(x);
    }
    cout<<se.size()<<endl;
}


Measured memory_bytes: 8324
#include <iostream>
#include <sstream>
#include <vector>
#include <cassert>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <tuple>
#include <regex>
#include <map>
#include <cstdint>
#include <set>
#include <deque>
#include <iomanip>
#include <queue>

using namespace std;
using ull = unsigned long long;
using ll = long long;

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

#define EPS (1e-7)
#define ALL(x) begin(x), end(x)

int main() {
	char b;
	cin >> b;

	char ans = '\0';

	switch (b) {
	case 'A':
		ans = 'T';
		break;
	case 'T':
		ans = 'A';
		break;
	case 'G':
		ans = 'C';
		break;
	case 'C':
		ans = 'G';
		break;
	default:
		break;
	}

	cout << ans << endl;

	return 0;
}

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



int main() {
  string S, T; cin >> S >> T;
  int sizes = S.size();
  int sizet = T.size();
  int ans = sizet;
  rep(i,sizes - sizet +1){
    string U = S.substr(i,sizet);
    int cnt = 0;
    rep(j,sizet){
      if(U[j] != T[j])cnt++;
    }
    ans = min(ans,cnt);
  }
  cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3632
import sys
input=sys.stdin.readline
n=int(input())
c=list(map(int,input().split()))
INF=10**9+7
c.sort()
ans=0
for i in range(n):
    ans=ans+c[i]*(n-i+1)
    ans=ans%INF
x=pow(2,2*n-2,INF)
ans=(ans*x)%INF
print(ans)










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

int main(){
  int n,i;
  cin>>n;
  int p[n];
  for(i=0;i<n;i++)cin>>p[i];
  int cnt=0;
  for(i=1;i<n-1;i++){
    if((p[i-1]<p[i] && p[i]<p[i+1]) || (p[i-1]>p[i] && p[i]>p[i+1]))cnt++;
  }
  cout<<cnt;
}

Measured memory_bytes: 256
var 
  n,s,flag,i,left,right:longint;
  tot:int64;
  x,p:array[1..200000]of int64;
begin
 readln(n,s);
 for i:=1 to n do
 begin
   readln(x[i],p[i]);
 end;
 if s<=x[1] then
 begin
   tot:=x[n]-s;
   write(tot);
    exit;
    end;
  if s>x[n] then
    begin
    tot:=s-x[1];
    write(tot);
    exit;
    end;
    left:=1;
    right:=n;
    if p[1]<p[n] then flag:=2
    else flag:=1;
    if p[1]<p[n] then begin p[n]:=p[n]+p[1]; tot:=tot+x[right]-x[left]; inc(left);  end
                  else begin p[1]:=p[1]+p[n]; tot:=tot+x[right]-x[left];dec(right); end;
  while(x[left]<s)and(x[right]>s)do begin
  if p[left]>=p[right] then
   begin
     p[left]:=p[left]+p[right];
     if flag=2 then tot:=tot+x[right]-x[left];
     dec(right);
     if flag=2 then flag:=1;
   end
   else begin
     p[right]:=p[right]+p[left];
    if flag=1 then tot:=tot+x[right]-x[left];
     inc(left);
     if flag=1 then flag:=2;
       end;
    end;
  if x[left]>s then write(tot+x[right]-s)
               else write(tot+s-x[left])
end.

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    int N;
    cin >> N;
    int M;
    cin >> M;
    int A[105];
    for(int i = 1; i <= M; i++) {
        cin >> A[i];
    }
    if(M == 1) {
        if(A[1] % 2 == 0) {
            vector<int> ans;
            ans.push_back(2);
            if(A[1] > 2) ans.push_back(A[1] - 2);
            cout << A[1] << endl;
            cout << ans.size() << endl;
            for(int i = 0; i < ans.size(); i++) {
                cout << ans[i] << endl;
            }
            return 0;
        }
        vector<int> ans;
        ans.push_back(1);
        if(A[1] > 1) ans.push_back(A[1] - 1);
        cout << A[1] << endl;
        cout << ans.size() << endl;
        for(int i = 0; i < ans.size(); i++) {
            cout << ans[i] << endl;
        }
        return 0;
    }
    if(A[M] % 2 == 1) swap(A[1], A[M]);
    for(int i = 2; i < M; i++) {
        if(A[i] % 2 == 1) {
            if(A[1] % 2 == 0) {
                swap(A[i], A[1]);
                continue;
            }
            if(A[M] % 2 == 0) {
                swap(A[i], A[M]);
                continue;
            }
            cout << "Impossible" << endl;
            return 0;
        }
    }
    for(int i = 1; i <= M; i++) {
        cout << A[i];
        if(i < M) cout << " ";
    }
    cout << endl;
    if((A[1] % 2 == 1) && A[M] % 2  == 1) {
        if(A[1] == 1) {
            cout << M - 1 << endl;
            for(int i = 2; i < M; i++) {
                cout << A[i] << endl;
            }
            cout << A[M] + 1 << endl;
            return 0;
        }
        cout << M << endl;
        cout << A[1] - 1 << endl;
        for(int i = 2; i < M; i++) {
            cout << A[i] << endl;
        }
        cout << A[M] + 1 << endl;
        return 0;
    }
    if(A[1] % 2 == 1) {
        cout << M << endl;
        cout << A[1] + 1 << endl;
        for(int i = 2; i < M; i++) {
            cout << A[i] << endl;
        }
        cout << A[M] - 1 << endl;
        return 0;
    }
    cout << M + 1 << endl;
    cout << 1 << endl;
    for(int i = 1; i < M; i++) {
        cout << A[i] << endl;
    }
    cout << A[M] - 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> a(n/2), b(n/2), aa(100000), bb(100000);
    rep(i,n) i%2 == 1 ? cin >> a[i/2] : cin >> b[i/2];
    rep(i,n/2){
        aa[a[i]]++;
        bb[b[i]]++;
    }
    if (max_element(all(aa))-aa.begin() == max_element(all(bb)) - bb.begin()){
        vector<pair<int, int> > aaa(100000), bbb(100000);
        rep(i,100000){
            aaa[i] = make_pair(aa[i],i);
            bbb[i] = make_pair(bb[i],i);
        }
        sort(aaa.rbegin(), aaa.rend());
        sort(bbb.rbegin(), bbb.rend());
        if (aaa[1].first < bbb[1].first){
            print(n - (aaa[0].first + bbb[1].first));
        }else{
            print(n - (aaa[1].first + bbb[0].first));
        }
    }else {
        print(n - (*max_element(all(aa)) + *max_element(all(bb))));
    }
}

Measured memory_bytes: 2944
#include <iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<limits.h>
#include<queue>
#include<set>


#define MOD 1000000007
#define DEBUG 0


using namespace std;

long long int modpow(long long int a, int n) {

	if (n == 0)return 1;
	if (n == 1) return a;

	long long int wk = modpow(a, n / 2);

	long long int ret = 0;
	if (n % 2 == 0) {
		ret = 1;
	}
	else {
		ret = a;
	}

	return (((ret * wk) % MOD) * wk) % MOD;

}

long long int gcd(long long int a, long long int b) {
	long long int tmp;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	long long int r = a % b;

	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

long long int lcm(long long int a, long long int b) {

	long long int wk_int;

	wk_int = (a * b) % MOD;
	
	long long int ret;

	ret = (wk_int * modpow(gcd(a, b), MOD - 2)) % MOD;

	return ret;

}

bool isPrime(int n) {
	if (n == 1)return false;
	if (n == 2)return true;

	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}

	return true;
}



bool comp(const pair<long long int, vector<int>> a, const pair<long long int, vector<int>> b) {
	if (a.first != b.first) {
		return a.first < b.first;
	}
	else {
		return a.second < b.second;
	}

}





void dfs(vector<bool>& info, const vector<pair<int, int>>& path_list, const int musi, const int start) {

	info[start] = true;

	for (int ind = 0; ind < path_list.size();ind++) {
		if (ind == musi)continue;

		auto& i = path_list[ind];

		int ikisaki = -1;
		if (i.first == start) {
			ikisaki = i.second;
		}
		else if (i.second == start) {
			ikisaki = i.first;
		}
		else {
			continue;
		}

		if (info[ikisaki])continue;
		
		dfs(info, path_list, musi, ikisaki);

	}
}
	





int main(){

	long long int ans = 0;
	int n, m;
	cin >> n >> m;

	vector<pair<int, int>> path_list(m);
	for (auto& i : path_list) {
		cin >> i.first;
		cin >> i.second;
		i.first--;
		i.second--;
	}

	vector<bool> info(n);

	//i番目のパスを無視する。
	for (int i = 0; i < m; i++) {
		//初期化
		for (int j = 0; j < info.size(); j++) {
			info[j] = false;
		}

		//i番目のパスを無視のやつ。第二パラメタはスタート地点（infoの0番目の点）
		dfs(info, path_list, i, 0);

		bool zentai = true;
		for (int j = 0; j < info.size();j++){
			if (info[j] == false) {
				zentai = false;
				break;
			}
		}

		if (!zentai) {
			ans++;
		}

	}

	cout << ans << endl;



	return 0;
}



Measured memory_bytes: 256
from collections import defaultdict
import string
import itertools

s = input()
k = int(input())

def it(s):
    subs = sorted(s[i:] for i in range(len(s)))
    writed = set()
    for sub in subs:
        for i in range(len(subs)):
            w = sub[:i+1]
            if w not in writed:
                yield w
                writed.add(w)

for ans in itertools.islice(it(s), k-1, k):
    print(ans)


Measured memory_bytes: 16120
A = list(input())
B = list(input())
C = list(input())
flag = 0
p = A[0]
A.pop(0)
while flag == 0 :
    if p == "a" :
        if len(A) != 0 :
            p = A[0]
            A.pop(0)
            
        else :
            print("A")
            flag += 1
            
    elif p == "b" :
        if len(B) != 0 :
            p = B[0]
            B.pop(0)
            
        else :
            print("B")
            flag += 1
            
    else :
        if len(C) != 0 :
            p = C[0]
            C.pop(0)
            
        else :
            print("C")
            flag += 1
            


Measured memory_bytes: 3064
/*
ID: jerrywcy
LINK: https://atcoder.jp/contests/abc125/tasks/abc125_d
LANG: C++
STATUS:
*/
#include <bits/stdc++.h>

#define init(array,x) memset(array,x,sizeof(array))

using namespace std;

const int inf=0x3f3f3f3f;

int n;
int a[100010];
long long sum;

int f(int x){
	if (x<0)return -x;
	return x;
}

int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for (int i=1;i<=n;i++)cin>>a[i],sum+=f(a[i]);
	
	for (int i=1;i<=n;i++){
		if (a[i]==0){
			cout<<sum<<endl;
			return 0;
		}
	}
	
	int cnt=0;
	int minv=INT_MAX;
	for (int i=1;i<=n;i++){
		if (a[i]<0)cnt++;
		minv=min(minv,f(a[i]));
	}
	if (cnt%2==0)cout<<sum<<endl;
	else cout<<sum-minv*2<<endl;

	return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define forn(i,n) for(int i=0;i<n;++i)
#define repn(i,n) for(int i=1;i<=n;++i)
#define TC(n) while(n--)
#define forb(i,n) for(int i=n-1;i>=0;--i)
#define repb(i,n) for(int i=n;i>=1;--i)
#define print(a) cout << a << endl
#define prin(a) cout << a
#define scan(a) cin >> a 
#define scan2(a,b) cin >> a >> b
#define scan3(a,b,c) cin >> a >> b >> c
#define scan4(a,b,c,d) cin >> a >> b >> c >> d
typedef vector<int> vi;
typedef vector<pair <int,int> > vpii;
typedef map<int,int > mapii;
typedef set<int> si;

typedef long long LL;
typedef unsigned long long ULL;

const int aMAX = 1e6+6;
const LL LLMAX = 1e18;
const int MAX = 1e9;
const int mMAX = 1e3 + 3;
int arr[aMAX];
int mat[mMAX][mMAX];

vi v;
int b[aMAX];
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	forn(i,3){
		forn(j,3){
			scan(mat[i][j]);
		}
	}

	int a1 = 0;
	forn(i,1){
		forn(j,3){
			b[j] = mat[i][j] - a1;
		}
	}
	int cc = mat[1][0] - b[0];
	int itt = 1;
	for(int i= 1 ;i< 2 ;i++){
		for(int j=1;j<3;j++){
			if(mat[i][j] - b[itt] != cc){
				print("No");
				return 0;
			}else itt++;
		}
	}

	int dd = mat[2][0] - b[0];
	int it = 1;
	for(int i= 2 ;i< 3 ;i++){
		for(int j=1;j<3;j++){
	//		print(mat[i][j] - b[it]);
			if(mat[i][j] - b[it] != dd){
				print("No");
				return 0;
			}
			it++;
		}
	}
	print("Yes");
	return 0;
}

Measured memory_bytes: 2304
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
long long int ans=0;
#define  ll long long
//最大公約数
long long int getgcd(long long n, long long m)
{
  int r;
  if (n > m) {
    long long t = m;
    m = n;
    n = t;
  }
  while ((r = m % n) != 0) {
    m = n;
    n = r;
  }
return n;
}

//nの階乗を計算
long long factorial(long long n){
    long long int answer = 1;
while(n > 1){
  answer *= n;
  n--;
}
    return answer;
}

//組み合わせの数nCrを計算
long long calcNumOfCombination(long long  n, long long r){
    return factorial(n) / (factorial(r) * factorial(n-r));
}
 void yes(){
   printf("Yes\n");
 }

 void no(){
   printf("No\n");
 }

int main(int argc, char* argv[]){
	ll a = 0, b = 0,c=0,d=0,e=0;
  char h[20],l[20];
  scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
  if (d>a) {
    d=d-a;
  }else{
    printf("%lld\n",d);
    return 0;
  }
  if (d>b) {
    d-=b;
  }else{
      printf("%lld\n",a);
      return 0;
  }
  printf("%lld\n",a-d);
}


Measured memory_bytes: 1724
#include "stdio.h"

int main()
{
	int n, k;
	scanf("%d", &n);
	scanf("%d", &k);
	int num = 1;
	for (int i = 1;i <= n;i++)
	{
		if (num > k)
			num += k;
		else
			num = num * 2;
	}
	printf("%d\n", num);
	return 0;
}


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

int solve(vector<int> &a)
{
  
}
int main()
{
  int N; cin >> N;
  int a[N]; rep(i,N) cin >> a[i];
  int ans = 0;
  while(true)
  {
    bool check = false;
    rep(i,N){
      if(a[i] % 2 != 0) check = true;
    }
    
    if(check) break;
    
    rep(i,N){
      a[i] /= 2;
    }
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
//#define MOD (998244353)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

int n,m;
vi adj[100001];
int dp[100001];
bool vis[100001];

int dfs(int cur){
    vis[cur]=1;
    dp[cur]=0;
    int ans=0;
    for(int ch:adj[cur]){
        if(!vis[ch])dfs(ch);
        dp[cur]=max(dp[cur],1+dp[ch]);
        ans=max(ans,dp[cur]);
    }
    return ans;
}

signed main(){
    FASTER;
    cin>>n>>m;
    while(m--){
        int a,b;cin>>a>>b;
        adj[a].push_back(b);
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(!vis[i])ans=max(dfs(i),ans);
    }
    cout<<ans;
}


Measured memory_bytes: 8704
n,m=map(int, input().split())

a=list(map(int, input().split()))
b=[0 for i in range(n)]
s=sum(a)

for i in range(n):
    if a[i]>= s/(4*m):
        b[i]=1

if sum(b)>=m:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9200
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#include <bitset>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 1000000007;
const int INF = LLONG_MAX/3;
const int MAX = 510000;
int n,m;
int p[114514];
vector<int> e[114514];
bool reached[114514]={};
int check[2][114514];
void dfs(int s,int c){
    reached[s]=true;
    check[0][s]=c;
    check[1][p[s]-1]=c;
    for(int i=0;i<e[s].size();i++){
        if(!reached[e[s][i]])dfs(e[s][i],c);
    }
}
signed main(){
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        e[a-1].push_back(b-1);
        e[b-1].push_back(a-1);
    }
    int c=0;
    for(int i=0;i<n;i++){
        if(!reached[i]){
            dfs(i,c);
            c++;
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(check[0][i]==check[1][i])ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 11520
import heapq as hq

n,m=map(int,input().split())
A=list(map(int,input().split()))
A=list(map(lambda x: x*(-1),A))
hq.heapify(A)

for i in range(m):
    a=hq.heappop(A)
    a/=2
    hq.heappush(A,a)

ans=0
for i in range(n):
    ans+=int(-hq.heappop(A))
print(ans)

Measured memory_bytes: 14180
#include <iostream>
#include <string>
#include <vector>
using namespace std;
 
int main() {
  long long N;
  cin >> N;
  long long X, Y;
  bool flag = true;
  X = N-1;
  vector<char> res;
  while(flag) {
    Y = X % 26;
    res.push_back('a'+Y);
    X = (X / 26)-1;
    if (X < 26) {
      if (X >= 0) {
        res.push_back('a'+X);
      }
      break;
    }
  }
  for (int i=res.size()-1;i>=0;i--) {
    cout << res[i];
  }
  cout << endl;
}

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

signed main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B&&B==C&&A==C){
    cout<<"No"<<endl;
  }else if(A!=B&&B!=C&&A!=C){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
}

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

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

  long long x[105], y[105], h[105];
  for(int i=0; i<n ;i++) {
    cin >> x[i] >> y[i] >> h[i];
  }

  for(int cx=0; cx<=100; cx++) {
    for(int cy=0; cy<=100; cy++) {
      long long ch;
      for(int i=0; i<n; i++) {
        if(h[i]==0) continue;
        ch=h[i]+abs(x[i]-cx)+abs(y[i]-cy);
        break;
      }
      bool b=true;
      for(int i=0; i<n; i++) {
        long long th=h[i]+abs(x[i]-cx)+abs(y[i]-cy);
        if((h[i]>0 && th != ch) || th<ch) b=false;
      }
      if(b) {
        cout << cx << ' ' << cy << ' ' << ch << endl;
        return 0;
      }
    }
  }



  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n, k;
  while (cin >> n >> k) {
    vector<string> v(n);
    for (auto &s : v) cin >> s;
    sort(v.begin(), v.end());
    for (auto &s : v) cout << s;
    cout << endl;
  }
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
??????
??\?????????????????¨?¨???§????????????????????????????????????????????°???????????????????????????????????????¨?????????£?????????????°?????????? x ????????¨?????????????????????

1x1=1
1x2=2
.
.
9x8=72
9x9=81
"""

def main():
    """ ????????? """
    for i in range(1,10):
        for j in range(1,10):
            x = i * j
            print("{}x{}={}".format(i,j,x))

if __name__ == '__main__':
    main()

Measured memory_bytes: 7356
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int beki(int a, int n)
{
    if(n == 0){
        return 1;
    }
    int ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1){
        ans = ans * a;
    }
    return ans;
}

int main() {
    //cout.precision(10);
    int n;
    cin >> n;
    int dp[100010];
    dp[0] = 0;
    for(int i = 1; i <= 100000; i++){
        dp[i] = dp[i - 1] + 1;
        for(int k = 1; k <= 8; k++){
            if(i >= beki(6, k)){
                dp[i] = min(dp[i], dp[i - beki(6, k)] + 1);
            }
            if(i >= beki(9, k)){
                dp[i] = min(dp[i], dp[i - beki(9, k)] + 1);
            }
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#define ll long long
#define maxn 200005
#define re register
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
    int x=0,w=1; char c=getchar();
    while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
    while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
    return w==1?x:-x;
}

ll a,b,c,ans;

int main()
{
    cin>>a>>b>>c;
    for(int i=1;i<=a;i++)
    {
        int x=read();
        if(x<b||x>=c) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define dump(x)  cout << #x << " = " << (x) << endl
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class BGreedyTakahashi {
public:
    void solve(std::istream& in, std::ostream& out) {
        ll A, B, K;
        in >> A >> B >> K;
        ll a = max(0LL, A - K);
        ll b = A - K >= 0 ? B : max(0LL, B - (K - A));
        out << a << " " << b << "\n";
    }
};


int main() {
    BGreedyTakahashi solver;
    std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;

int main() {
    string a, b;
    cin >> a >> b;

    string c = a + b;
    int cint = stoi(c);

    double sqrtc = sqrt(cint);
    int sqrtcint = (int)sqrtc;
    if (sqrtcint == sqrtc ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3720
//
//
//  ad-algoD.cpp - created by us162022
//
#include <iostream>
using namespace std;
int find(int join[],int x){
  if(x==join[x])
    return x;

  return find(join,join[x]);
}
int main(int argc, char *argv[])
{
  int n,m,join[100000],num[100000],s,t;
  cin >> n >> m;

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

  for(int i=0; i<m; i++){
    cin >> s >> t;
    s = find(join,s);
    t = find(join,t);

    if(s!=t){
      if(num[s] < num[t])
	join[s] = join[t];
      
      else{
	join[t]=join[s];
	if(num[s]==num[t])
	  num[s]++;
      }

    }
  }

  int q;
  cin >> q;

  for(int i=0; i<q; i++){
    cin >> s >> t;

    if(find(join,s)==find(join,t))
      cout << "yes\n";

    else
      cout << "no\n";
  }
}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    string s;
    cin >> s;
    int num[3] = {};
    rep(i, 3) {
        int temp = s[i] - 'a';
        num[temp]++;
    }

    bool ans = true;
    rep(i, 3) {
        if (num[i] != 1) {
            ans = false;
        }
    }
    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }

    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }
        return;
    } else {
        prime_map(m, num);
    }
}


Measured memory_bytes: 256
n=int(input())
if(n%4==0 or n%7==0):
    print("Yes")
    exit()
else:
    var=n
    while(n>0 or var>0):
        n-=7
        if(n%4==0 and n>0):
            print("Yes")
            exit()
        n-=4
        if(n>0 and (n%7==0 or n%4==0)):
            print("Yes")
            exit()
        var-=4
        if(var%7==0 and var>0):
            print("Yes")
            exit()
        var-=7
        if(var>0 and (var%4==0 or var%7==0)):
            print("Yes")
            exit()
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void) {
	int h, w, k, i, j, l, dp[103][270] = {};
	const int mod = 1e9 + 7;

	cin >> h >> w >> k;

	dp[0][0] = 1;
	for (i = 1; i <= h; i++) {
		for (j = 0; j < (1 << (w - 1)); j++) {
			for (l = 0; l < w - 2; l++) {
				if (((j >> l) & 1) == 1 && ((j >> (l + 1)) & 1) == 1) {
					break;
				}
			}
			if (l < w - 2) continue;
			for (l = 0; l < w; l++) {
				int& dpn = dp[i][l];
				if (l > 0 && ((j >> (l - 1)) & 1) == 1) {
					dpn = (dpn + dp[i - 1][l - 1]) % mod;
				}
				else if (l < w - 1 && ((j >> l) & 1) == 1) {
					dpn = (dpn + dp[i - 1][l + 1]) % mod;
				}
				else {
					dpn = (dpn + dp[i - 1][l]) % mod;
				}
			}
		}
	}

	cout << dp[h][k - 1] << endl;

	return 0;
}

Measured memory_bytes: 384
class Node:
    def __init__(self, key):
        self.right = None
        self.left = None
        self.parent = None
        self.key = key

    def preorder(self):
        ret = [self.key]
        if self.left:
            ret += self.left.preorder()
        if self.right:
            ret += self.right.preorder()
        return ret

    def inorder(self):
        ret = []
        if self.left:
            ret += self.left.inorder()
        ret += [self.key]
        if self.right:
            ret += self.right.inorder()
        return ret

    def find(self, k):
        if self.key == k:
            return True
        elif self.key < k:
            if self.right:
                return self.right.find(k)
            else:
                return False
        else:
            if self.left:
                return self.left.find(k)
            else:
                return False


class Tree:
    def __init__(self):
        self.root = None

    def insert(self, k):
        z = Node(k)
        y = None
        x = self.root
        while x:
            y = x
            if z.key < x.key:
                x = x.left
            else:
                x = x.right
        z.parent = y
        if y is None:
            self.root = z
        elif z.key < y.key:
            y.left = z
        else:
            y.right = z

    def print(self):
        print('', ' '.join(map(str, self.root.inorder())))
        print('', ' '.join(map(str, self.root.preorder())))

    def find(self, k):
        if self.root is None:
            return False
        else:
            return self.root.find(k)

m = int(input())
tree = Tree()
for _ in range(m):
    s = input().split()
    if s[0] == "insert":
        tree.insert(int(s[1]))
    elif s[0] == "find":
        if tree.find(int(s[1])):
            print("yes")
        else:
            print("no")
    else:
        tree.print()


Measured memory_bytes: 117020
import math

def prime_factorize(n):
	ret = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			cnt = 0
			while n % i == 0:
				cnt += 1
				n = n // i
			ret.append([i, cnt])
	if n != 1:
		ret.append([n, 1])
	if len(ret) == 0:
		ret.append([n, 1])

	return ret

def main():
	A, B = [int(x) for x in input().split(" ")]
	g = math.gcd(A, B)
	pg = prime_factorize(g)
	if pg[0][0] == 1:
		print(1)
	else:
		print(len(pg) + 1)

main()

Measured memory_bytes: 9436