akhauriyash/Code-Regression huggingface dataset:
//gauravsinghh
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#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 int
#define ld long double
#define db double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int> 
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define os cout<<" "
#define bitcount __builtin_popcount
#define gcd __gcd
#define endl "\n"
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define ford(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fors(container, it, a, b) for(__typeof(container.begin()) it = a; it != b; it++) 
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 1000000000
#define lim 100005
#define fbo find_by_order
#define ook order_of_key
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define deb(x) cout << #x << " " << x << endl;
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(ll i = a; i <= b; i++)
#define ffo(i, a, b) for(ll i = a; i >= b; i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
 
int main(){
    IOS
    //io_set();
 	ll n;
 	string s;
 	cin >> n >> s;
 	ll x = n/2, f = 0;
 	rep(i, x){
 		if(s[i] != s[i+x]){
 			f = 1;
 			break;
 		}
 	}
 	if(f || sz(s)%2 != 0){
 		cout << "No\n";
 	}
 	else{
 		cout << "Yes\n";
 	}
    return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

	int K, X; cin >> K >> X;
	if(K * 500 >= X) Yes
	else No
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define show(x) cout<<#x<<"="<<x<<"\n"
using namespace std;

int n;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
   cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
    freopen("in", "r", stdin); 
    freopen("out","w",stdout);
#endif
    cin>>n;
    ll now=0;
    ll ans=0;
    for(int i=0;i<n;i++){
    	if(i==0){
    		ll a;cin>>a;
    		now=a;
    		ans=a;
    		continue;
    	}
    	ll a;cin>>a;
    	ll temp=__gcd(a,ans);
    	if(temp==1){
    		ans=ans*a;
    	}else{
    		ll temp1=a/temp;
    		ll temp2=ans/temp;
    		ans=temp1*temp2*temp;
    	}
    	//cout<<ans<<" ";
    }
    //cout<<"\n";
    cout<<ans<<"\n";
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main() {
  ll m = 1000;
  ll n;
  cin >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  for (int i = 1; i < n; i++) {
    if (a[i - 1] < a[i] && m >= a[i - 1]) {
      ll s = m / a[i - 1];
      m += (a[i] - a[i - 1]) * s;
    }
  }
  cout << m << endl;
  return 0;
}

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

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

using namespace std;

typedef pair<int, int> pii;

int main(void)
{
    const int M_MAX = 100000;
    int N, M;
    int P[M_MAX], Y[M_MAX];
    vector<pii> v;

    cin >> N >> M;
    REP(i, M) {
        cin >> P[i] >> Y[i];
        v.push_back(pii(P[i], Y[i]));
    }
    sort(v.begin(), v.end());
    cout << setfill('0');
    REP(i, M) {
        int last_digit = lower_bound(v.begin(), v.end(), pii(P[i], Y[i])) - upper_bound(v.begin(), v.end(), pii(P[i], 0)) + 1;
        cout << setw(6) << P[i] << setw(6) << last_digit << endl;
    }
    return 0;
}


Measured memory_bytes: 3188
#include<stdio.h>
#include<string.h>
  
#define M 1000000
#define L 14
  
char H[M][L]; 

int getChar(char ch) {
    if (ch == 'A') {
        return 1;
    }
    else if (ch == 'C') {
        return 2;
    }
    else if (ch == 'G') {
        return 3;
    }
    else if (ch == 'T') {
        return 4;
    }
    return 0;
}
  
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}
  
int h1(int key){ return key % M;}
int h2(int key){ return 1 + key % (M - 1);}
  
int find(char str[]){
  long long trip;
  int i = 0;
  long long sum = getKey(str);
  
  while(1){
    trip = (h1(sum)+ i * h2(sum)) % M;
    if(strcmp(H[trip], str) == 0) return 1;
    if(H[trip][0] == '\0') return 0;
    i++;
  }
  return 0;
}
  
void insert(char str[]){
  int  i = 0;
  long long ago;
  long long sum = getKey(str);
  
  while(1){
    ago = (h1(sum)+ i * h2(sum)) % M;
    if(H[ago][0] == '\0' || strcmp(H[ago],str) == 0){
      strcpy(H[ago], str);
      break;
    }
    i++;
  }
}
  
int main(){
  int i, n, h;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ) H[i][0] = '\0';
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);
    if ( com[0] == 'i' ){
      insert(str);
    } else {
      if (find(str)){
    printf("yes\n");
      } else {
    printf("no\n");
      }
    }
  }
  return 0;
}

Measured memory_bytes: 14280
a, b, c = gets.chomp.split(" ").map(&:to_i)
k = gets.chomp.to_i

count = 0

while a >= b
    b *= 2
    count += 1
end

while b >= c
    c *= 2
    count += 1
end

if count <= k
    puts "Yes"
else
    puts "No"
end


Measured memory_bytes: 14280
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define SORT(v) sort(v.begin(), v.end())
#define veci(a, n) vector<int> a(n)
#define vecs(a, n) vector<string> a(n)
#define pb(a) push_back(a)

int main(){
    string S;
    cin >> S;
    SORT(S);
    string ans = "yes";
    
    REP(i, S.length()-1){
        if (S.at(i)==S.at(i+1)){
            ans = "no";
            break;
        }

    }

    cout << ans << endl;
}

Measured memory_bytes: 256
/*
𝓐𝓾𝓽𝓱𝓸𝓻:-

╭━━━┳━━━┳╮╱╭┳━━━┳━━━┳━━╮╭╮╱╭╮
┃╭━╮┃╭━╮┃┃╱┃┃╭━╮┃╭━╮┃╭╮┃┃┃╱┃┃  
┃╰━━┫┃╱┃┃┃╱┃┃╰━╯┃┃╱┃┃╰╯╰┫╰━╯┃
╰━━╮┃╰━╯┃┃╱┃┃╭╮╭┫╰━╯┃╭━╮┃╭━╮┃
┃╰━╯┃╭━╮┃╰━╯┃┃┃╰┫╭━╮┃╰━╯┃┃╱┃┃
╰━━━┻╯╱╰┻━━━┻╯╰━┻╯╱╰┻━━━┻╯╱╰╯  

*/

#include <bits/stdc++.h> 
using namespace std; 
#define int long long int
#define REDBULL ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define endl "\n"
#define MAX 131079

int32_t main() 
{ 
	REDBULL
	int a,b,c;
	cin>>a>>b>>c;
	if(a+b+c>=22)
		cout<<"bust"<<endl;
	else
		cout<<"win"<<endl;

	return 0; 
} 


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
   int n;
   
   cin >> n;
   if(n==1){
       cout << "Hello World" << endl; 
       
   }
   else if(n==2){
   int a,b;
   cin >> a >> b;
   
         cout << a+b << endl; 
       
   }
   
   
   
   
   return 0;
}

Measured memory_bytes: 256
/*
        |___Arshit Mangukiya___|
        |___DA-IICT____|
        |___201801173____|
*/
        //__WRITE  YOUR  CODE  HERE___//
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;            
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppl;
typedef vector<pll> vpl;
#define ff first
#define ss second
#define pi acos(-1)
#define mr_ad_0501 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define all(a)      a.begin(),a.end()
#define f(i,a,n) for(ll i=a;i<n;i++)
#define MOD 1000000007
#define MAX 200007
#define LM LLONG_MAX
#define sz size()
#define p(x)        cout<< x << " ";
#define pe(x)       cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
const int N=1e5+5;
        /*  bool fun(pair<int,int>a , pair<int,int>b)
            {
                if(a.ff == b.ff)    return a.ss < b.ss;
                else            return a.ff < b.ff;
            }*/
 /*void bfs(ll x)
 {
    queue<ll> q;
    q.push(x);
    while(!q.empty())
    {
        ll k=q.front();
        q.pop();
        for(auto X:v[k])
        {
            if(!vis[X])
            {
                l[X]=l[k]+1;
                vis[X]=1;
                q.push(X);
            }
        }
    }
 }*/

void solve()
{
	ll n;
	cin>>n;
	ll a=ceil(n/((1.0)*1000));
	cout<<a*1000-n;
}
    
int32_t main(){
    mr_ad_0501;
    ll t=1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v
#define NUM(x,v) (POSU(x,v)-POSL(x,v))
const ll INF=1e9+7;
const ll N = 301;
ll n,m,ans=INF;
ll a[N][N],nin[N];
bool kaisai[N];

void dfs(){
	bool no=false;
	FOR(i,0,N){
		if(kaisai[i])no=true;
	}
	if(no==false){
		return;
	}
	FOR(i,0,N)nin[i]=0;
	FOR(i,0,n){
		FOR(j,0,m){
			if(kaisai[a[i][j]]==true){
				nin[a[i][j]]++;
				break;
			}
		}
	}
	ll answ=0,k;
	FOR(i,0,N){
		if(nin[i]>answ){
			k=i;
			answ=nin[i];
		}
	}
	kaisai[k]=false;
	ans=min(ans,answ);
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	FOR(i,0,N)nin[i]=0;
	FOR(i,0,N)kaisai[i]=true;
	cin>>n>>m;
	FOR(i,0,n){
		FOR(j,0,m){
			cin>>a[i][j];
		}
	}
	FOR(i,0,m){
		dfs();
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
import sys
def LI():
    return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

x,y = LI()

A = [1,3,5,7,8,10,12]
B = [4,6,9,11]

if x in A and y in A:
    print('Yes')
elif x in B and y in B:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 61972
S = list(map(int,input()))
zero = [0 if i%2==0 else 1 for i in range(len(S))]
one = [0 if i%2==1 else 1 for i in range(len(S))]
diff_from_zero = 0
diff_from_one = 0
for i in range(len(S)):
    if one[i] != S[i]:
        diff_from_one += 1
    if zero[i] != S[i]:
        diff_from_zero += 1
print(min(diff_from_one,diff_from_zero))

Measured memory_bytes: 5536
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
using namespace std;
int cnt[4];
int pos[4];

int main() {
    char d[4][120];
    for(int i=1; i<=3; i++) {
        scanf("%s",d[i]);
        cnt[i]=strlen(d[i]);
    }
    int st=1;
    while(1) {
        if(pos[st-1]==cnt[st]) {
            printf("%c",64+st);
            break;
        }
        char tmp = d[st][pos[st-1]++];
        st=tmp-96;

    }
    return 0;
}


Measured memory_bytes: 128
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

template<typename T>
T gcd(T a, T b){
    if(b > a) swap(a, b);
    T tmp;
    while(b != 0){
        tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

template<typename T>
T power(T x, long long n, const T& m){
    if(n == 0) return 1;
    if(n == 1) return x;
    T tmp = power(x, n/2, m);
    if(n%2 == 0) return tmp * tmp % m;
    else return tmp * tmp % m * x % m;
}

int N;
map<pair<ll, ll>,pair<ll,ll>> v;
ll zeroAns = 0;
ll ans = 1;

signed main(){
    cin >> N;
    rep(i, N){
        ll A, B;
        cin >> A >> B;
        if(A == 0 && B == 0){
            zeroAns++;
            continue;
        }
        if(A == 0){
            if(v.count({ 0, 1 }) == 0) v[{0, 1}] ={ 0,0 };
            v[{0, 1}].first++;
            continue;
        }
        if(B == 0){
            if(v.count({ 0, 1 }) == 0) v[{0, 1}] ={ 0,0 };
            v[{0, 1}].second++;
            continue;
        }

        if(A < 0){
            A *= -1;
            B *= -1;
        }
        ll g = gcd(abs(A), abs(B));
        A /= g;
        B /= g;
        if(B > 0){
            if(v.count({ A, B }) == 0) v[{A, B}] ={ 0,0 };
            v[{A, B}].first++;
        }
        else{
            if(v.count({ -B, A }) == 0) v[{-B, A}] ={ 0,0 };
            v[{-B, A}].second++;
        }
    }

    for(auto i=v.begin(); i!=v.end(); i++){
        ans *= power(2LL, i->second.first, MOD) + power(2LL, i->second.second, MOD) - 1;
        ans %= MOD;
    }
    cout << (ans-1+zeroAns+MOD) % MOD << endl;
}

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

vector<UL> E[100];
UL D[100];

int main() {
 UL N; scanf("%u",&N);
 rep(i,N){
  UL v; scanf("%u",&v); v--;
  UL c; scanf("%u",&c);
  rep(i,c){
   UL e; scanf("%u",&e); e--;
   E[v].push_back(e);
  }
 }
 rep(i,N) D[i]=~0u;
 queue<UL> Q; Q.push(0); D[0]=0;
 while(Q.size()){
  UL p=Q.front(); Q.pop();
  for(UL e:E[p]){
   if(D[e]!=~0u) continue;
   D[e]=D[p]+1;
   Q.push(e);
  }
 }
 rep(i,N){
  printf("%u ",i+1);
  if(D[i]!=~0) printf("%d\n",D[i]);
  else printf("-1\n");
 }
 return 0;
}



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

const int mod = 1000*1000*1000 + 7;

int mul(int a, int b) {
	return (1LL * a * b) % mod;
}

int mpow(int a, int n) {
	if(n == 0) return 1;
	int x = mpow(a, n/2);
	x = mul(x, x);
	if(n % 2) x = mul(x, a);
	return x;
}

void add_self(int& a,int b) {
	a += b;
	if(a >= mod) a -= mod;
}

void sub_self(int& a, int b) {
	a -= b;
	if(a < 0) a += mod;
}	


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector<int> arr(n);
	for(int& x : arr) cin >> x;
	map<int, int> fact;
	
	for(int x : arr) {
		for(int i = 2; i*i <= x; i++) {
			if(x % i == 0) {
				int f = 0;
				while(x % i == 0) {
					x /= i;
					f++;
				}
				fact[i] = max(fact[i], f);
			}
		}
		
		if(x > 1) {
			fact[x] = max(fact[x], 1);
		}
	}
	
	int lcm = 1;
	
	for(auto p : fact) {
		int a = p.first;
		lcm = mul(lcm, mpow(a, fact[a]));
	}
	
	int ans = 0;
	
	for(int x : arr) {
		add_self(ans, mul(lcm, mpow(x, mod-2)));
	}
	
	cout << ans << endl;
	
}


Measured memory_bytes: 768
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
//////////////////////////

struct shop{
    ll a,b;
    dd cmp;
};
bool comp(shop x,shop y){
    return x.a*(y.b+1)>y.a*(x.b+1);
}

int main(){fastio
    ll n,t;cin>>n>>t;
    vector<shop>v;
    vector<ll>last;
    rep(i,0,n-1){
        shop s;cin>>s.a>>s.b;
        //s.cmp=(dd)s.a/(dd)(s.b+1);
        if(s.a==0){
            last.pb(s.b);
        }else{
            v.pb(s);
        }
    }
    
    sort(v.begin(),v.end(),comp);
   // for(auto x:v)cout<<x.a<<" "<<x.b<<endl;
    ll M=32;
    ll vs=v.size();
    ll dp[2][M];
    rep(i,0,1)rep(j,0,M-1)dp[i][j]=inf;
    dp[0][0]=0;
    rep(i,0,vs-1){
        rep(j,0,M-1)dp[(i+1)&1][j]=inf;
        shop s=v[i];
        rep(j,0,M-1){
            if(dp[i&1][j]==inf)continue;
            chmin(dp[(i+1)&1][j],dp[i&1][j]);
            ll nxt=(dp[i&1][j]+1)*(s.a+1)+s.b;
            if(nxt<=t&&j+1<=M-1)chmin(dp[(i+1)&1][j+1],nxt);
        }
       // rep(j,0,M-1)cout<<dp[(i+1)&1][j]<<" ";cout<<endl;
    }
    ll ans=0;
    SORT(last);
    ll sz=last.size();
    vector<ll>a(sz+1);
    a[0]=0;
    rep(i,0,sz-1){
        a[i+1]=a[i]+(last[i]+1);
    }
    rep(j,0,M-1){
        ll res=t-dp[vs&1][j];
        if(res<0)continue;
        
        ll p=POSU(a,res)-1;
        chmax(ans,p+j);
    }
    cout<<ans<<endl;
    
    
    return 0;
}



Measured memory_bytes: 10476
-module('Main').
-export([main/1]).

main(_) ->
    {ok, [N]} = io:fread("", "~d"),
    case N rem 1000 == 0 of
    	true ->
        	Ans = 0;
        false ->
        	Ans = 1000 - (N rem 1000)
    end,
    io:format("~p~n", [Ans]),
    halt().

Measured memory_bytes: 21980
#数値が一つの場合の入力
n = int(input())
#2で割り切れれば偶数
#個数カウント
cnt = n // 2
#偶数の確立
ans = (n // 2) / n
#1から偶数の確立を引けば奇数の確立
print(1 - ans)


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
#define myCeil(dividend, divisor) ceil((double)(dividend) / (double)(divisor))
#define myFloor(dividend, divisor) floor((double)(dividend) / (double)(divisor))
#define calcDigits(num) floor(log10(num))+1

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl;
#define dv(name, value) cerr << (name) << " is " << (value) << endl;
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl;
#define dpa(v) cerr << "[ " << endl;REPI(itr, v) { cerr << "  [" << (*itr).first << ", " << (*itr).second << ']' << (itr != --v.end() ? "," : "") << endl; } cerr << "]" << endl;


void solve(long long N, std::vector<long long> B){
  int sum = B.front();
  FOR(x, 1, N-1) {
    sum += min(B.at(x), B.at(x-1));
  }
  sum +=  B.back();
  cout << sum << endl;
}

signed main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> B(N-1);
  for(int i = 0 ; i < N-1 ; i++){
    scanf("%lld",&B[i]);
  }
  solve(N, std::move(B));
}


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

int main(){
  ll n,cnt=0;
  cin >> n;
  vector<ll> a(n);
  for(ll i=0;i<n;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  
  vector<bool> b(a.at(n-1)+1);
  for(ll i=0;i<n;i++){
    if(i < n-1 && a.at(i) == a.at(i+1)) b.at(a.at(i)) = true;
    
    for(ll j=2;j*a.at(i)<a.at(n-1)+1;j++){
      b.at(j*a.at(i))  = true;
    }
  }
  
  for(ll i=0;i<n;i++){
    if(b.at(a.at(i)) == false) cnt++;
  }
  
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 4848
using System;

class Program
{
    static void Main(string[] args)
    {
        var nm = Console.ReadLine().Split(' ');
        var n = int.Parse(nm[0]);
        var m = int.Parse(nm[1]);

        var d = new int[n];

        for (int i = 0; i < m; i++)
        {
            var ab = Console.ReadLine().Split(' ');
            var a = int.Parse(ab[0]);
            var b = int.Parse(ab[1]);
            d[a - 1]++;
            d[b - 1]++;
        }

        for (int i = 0; i < n; i++)
        {
            Console.WriteLine(d[i]);
        }
    }
}


Measured memory_bytes: 13140
let n = Int(readLine()!)!
let v = readLine()!.characters.split(" ").map{Int(String($0))!}
var num = (0..<2).map{_ in (0..<100000).map{_ in 0}}
for (i, vi) in v.enumerate() {
    num[i%2][vi-1] += 1
}
let sortedNum = num.map{$0.sort(>)}
let maxNum = (0..<2).map{sortedNum[$0][0]}
if num[0].indexOf(maxNum[0]) != num[1].indexOf(maxNum[1]) {
    print(n - (maxNum[0] + maxNum[1]))
} else {
    print(n - max(maxNum[0]+sortedNum[1][1], sortedNum[0][1]+maxNum[1]))
}

Measured memory_bytes: 8752
#include <stdio.h>
using namespace std;
int main(void){
    // Your code here!
    int x,y;
    while(1){
        scanf("%d %d",&x,&y);
        if(x == 0&&y == 0)break;
        if(x<=y){
            printf("%d %d\n",x,y);
        }else{
            printf("%d %d\n",y,x);
        }
    }
}



Measured memory_bytes: 2676
from itertools import product
import numpy as np
H, W = map(int, input().split())
S = [list('-' * (W + 2))] + [['-'] + list(input()) + ['-']
                             for _ in range(H)] + [list('-' * (W + 2))]
S = np.array(S, dtype='object')
# print('S', S)

d = [-1, 0, 1]
dd = list(product(d, repeat=2))
for h in range(1, H + 1):
    for w in range(1, W + 1):
        if S[h, w] == '.':
            cnt = 0
            for x, y in dd:
                nh = h + x
                nw = w + y
                if S[nh, nw] == '#':
                    cnt += 1
            S[h, w] = cnt

for h in range(1, H + 1):
    for w in range(1, W + 1):
        if S[h, w] != '-':
            print(S[h, w], sep='', end='')
    print('')


Measured memory_bytes: 20784
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  llvec l(N);
  rep(i, N)cin >> l[i];
  sort(ALL(l));
  ll ans = 0;
  for(ll i=0;i<N;i++){
    for(ll j = i+1;j<N;j++){
      for(ll k=j+1;k<N;k++){
        ll a= l[i];
        ll b=l[j];
        ll c=l[k];
        if(a!=b and b!=c and c!=a and b+c>a and c+a>b and a+b>c){
          ans++;
        }
      }
    }
  }

  cout << ans;
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string.h>
#include <climits>
#include <algorithm>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;

int N, L;
int a[101010];

signed main()
{
    cin >> N >> L;
    REP(i,N) cin >> a[i+1];

    int last;
    for (last=1; last<=N-1; last++) {
        if (L <= a[last] + a[last+1]) break;
    }

    if (last == N) {
        cout << "Impossible" << endl;
        return 0;
    }

    cout << "Possible" << endl;
    for (int i=1; i<last; i++) {
        cout << i << endl;
    }
    for (int i=N-1; last<i; i--) {
        cout << i << endl;
    }
    cout << last << endl;
}


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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> cnt(m, 0);
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int k;
        cin >> k;
        for (int i = 0; i < k; i++)
        {
            int a;
            cin >> a;
            a--;
            cnt[a] += 1;
        }
    }
    for (int i = 0; i < m; i++)
    {
        if(cnt[i] == n)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;

int main(){
    set<int> s;
    int N;
    cin>>N;
    for(int i=0;i<N;i++) {
        int x;
        cin>>x;
        s.insert(x);
    }
    cout<<s.size()<<endl;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

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

template <class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
	for (const auto &e : mp) os << "[" << e << "] ";
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T = lint>
struct Edge {
	int to;
	T cost;
	Edge() {}
	Edge(int to, T cost) : to(to), cost(cost) {}
	bool operator>(const Edge &r) const { return this->cost > r.cost; }
};

template<class T>
vector<T> Dijkstra(vector<vector<Edge<T>>> &edges, int st) {

	int V = (int)edges.size();
	const T INF = numeric_limits<T>::max();
	vector<T> cost(V, INF);
	cost[st] = 0;

	priority_queue<Edge<T>, vector<Edge<T>>, greater<Edge<T>>> p_que;
	p_que.emplace(st, cost[st]);

	while (!p_que.empty()) {

		Edge<T> now(p_que.top().to, p_que.top().cost);
		p_que.pop();

		if (cost[now.to] < now.cost) continue;
		for (const Edge<T> &e : edges[now.to]) {
			T tmp_cost = now.cost + e.cost;
			if (cost[e.to] > tmp_cost) {
				cost[e.to] = tmp_cost;
				p_que.emplace(e.to, cost[e.to]);
			}
		}
	}

	return cost; // min cost to vertex idx from st
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, Q;
	cin >> N >> Q;

	int u, v;
	vector<vector<Edge<int>>> edges(N);
	for (int i = 0; i < N - 1; i++) {
		cin >> u >> v;
		u--, v--;
		edges[u].emplace_back(v, 1);
		edges[v].emplace_back(u, 1);
	}

	vector<int> ans(N + 1);
	for (int i = 0; i < Q; i++) {
		int p, q;
		cin >> p >> q;
		ans[p - 1] += q;
	}

	DMP(ans);

	vector<int> visted(N);
	auto dfs = [&](auto &&f, int now, int par) -> void {
		visted[now] = 1;
		for (const auto &e : edges[now]) {
			if (!visted[e.to] && e.to != par) {
				ans[e.to] += ans[now];
				f(f,e.to, now);
			}
		}
	};

	dfs(dfs, 0, -1);

	for (int i = 0; i < N; i++) {
		cout << ans[i] << "\n";
	}

	return 0;
}


Measured memory_bytes: 21504
using System;
class _0101
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string[] data;
        for (int i = 0; i < n; i++)
        {
            data = Console.ReadLine().Split();
            for (int j = 0; j < data.Length; j++) if (data[j].Contains("Hoshino")) data[j] = data[j].Replace("Hoshino", "Hoshina");
            for (int j = 0; j < data.Length - 1; j++) Console.Write(data[j] + " ");
            Console.WriteLine(data[data.Length - 1]);
        }
    }
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll H[105];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> H[i];
    }

    ll ans = 0;
    REP(_, 101) {
        ll n = 0;
        REP(i, N + 1) {
            if (H[i] == 0) {
                if (n > 0)
                    ans++;
                n = 0;
                continue;
            }
            H[i]--;
            n++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
S = int(input())
check = 0

if S == 2 or S == 3:
    print(S)
else:
    while check == 0:
        for i in range(2, int(S ** (1/2))+1):
            if S % i == 0:
                S = S + 1
                break
            elif S % i != 0 and i == int(S ** (1/2)):
                print(S)
                check = 1
                break



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

int main(){
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0; i < N; ++i) cin >> A[i];
    long long ans = 1;
    long long v = 1;
    for(int i = 0; i < 18; ++i) v *= 10;
    sort(A.begin(), A.end());
    for(int i = 0; i < N; ++i){
        if(A[i] == 0){
            ans = 0;
            break;
        }
        else if(v/ans < A[i]){
            ans = -1;
            break;
        }
        else ans *= A[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n,x;
ll out[300000];bool used[300000];
int main(){
	cin >> n >> x;

	if(x == 1 || x == 2 * n - 1) {
		cout << "No" << endl;
	}else if(x == n) {
		cout << "Yes" << endl;
		REP(i,2 * n - 1) {
			cout << i + 1 << endl;
		}
	}else {
		cout << "Yes" << endl;
		if(x < n) {
			out[n - 1] = 2 * n  - 1;
			out[n] = x - 1;
			out[n + 1] = x;
			out[n + 2] = x + 1;
			used[2 * n - 1] = used[x - 1] = used[x] = used[x + 1] = true;
		}else {
			out[n - 1] = 1;
			out[n] = x + 1;
			out[n + 1] = x;
			out[n + 2] = x - 1;
			used[1] = used[x - 1] = used[x] = used[x + 1] = true;
		}

		ll p = 1;

		FOR(i,1,n-1) {
			while(used[p])p++;
			out[i] = p;
			p++;
		}
		FOR(i,n + 3,2 * n) {
			while(used[p])p++;
			out[i] = p;
			p++;
		}
		FOR(i,1,2 * n)
			cout << out[i] << endl;
	}
	return 0;
}



Measured memory_bytes: 3072
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	double n,a;
	cin>>n>>a;
	cout<<round(((a+n)/2));
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3748
package main

import (
	"fmt"
	"strconv"
)

func i2s(i int) string { return strconv.Itoa(i) }
func main() {
	var abcd string
	fmt.Scan(&abcd)
	a := [4]int{}
	for i := 0; i < 4; i++ {
		a[i] = int(abcd[i] - '0')
	}
	for i := 0; i < (1 << uint(3)); i++ {
		x := a[0]
		for j := 0; j < 3; j++ {
			if ((i >> uint(j)) & 1) == 1 {
				x += a[j+1]
			} else {
				x -= a[j+1]
			}
		}
		if x == 7 {
			s := i2s(a[0])
			for j := 0; j < 3; j++ {
				if ((i >> uint(j)) & 1) == 1 {
					s += "+"
				} else {
					s += "-"
				}
				s += i2s(a[j+1])
			}
			s += "=7"
			fmt.Println(s)
			return
		}
	}
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

n =int(input())
a = [int(i) for i in input().split()]

answer =0
for i in range(n):
    while a[i] % 2 == 0:
        answer += 1
        a[i] = a[i] // 2
print(answer)


Measured memory_bytes: 13440
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String n = scan.next();
		int ans = 0;
		
		for(int i=0;i<n.length();i++) {
			ans += n.charAt(i) - 48;
		}
		
		if(ans % 9 == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 40172
import java.util.ArrayDeque;
import java.util.Scanner;
public class Main{
	public static void main(String[] args)throws Exception{
		new Main().solve();
	}
	void solve(){
		Scanner sc=new Scanner(System.in);
		int h=sc.nextInt();
		int w=sc.nextInt();
		int n=sc.nextInt();
		char[][] table=new char[h][w];
		for(int i=0;i<h;i++){
			table[i]=sc.next().toCharArray();
		}
		int[][] to=find(table, n);
		int d=0;
		for(int i=0;i<n;i++){
			d+=bfs(to[i][0],to[i][1],to[i+1][0],to[i+1][1],table);
		}
		System.out.println(d);
		
	}
	int[] dx={1,-1,0,0};
	int[] dy={0,0,1,-1};
	int bfs(int sx,int sy,int gx,int gy,char[][] table){
		ArrayDeque<P> stack=new ArrayDeque<P>();
		stack.add(new P(sx,sy,0));
		boolean[][] arrived=new boolean[table.length][table[0].length];
		arrived[sy][sx]=true;
		while(!stack.isEmpty()){
			P p=stack.poll();
			if(p.x==gx&&p.y==gy)return p.count;
			for(int i=0;i<4;i++){
				int nx=p.x+dx[i];
				int ny=p.y+dy[i];
				if(nx<0||nx>table[0].length-1||
						ny<0||ny>table.length-1){
					continue;
				}
				if(arrived[ny][nx])continue;
				if(table[ny][nx]=='X')continue;
				stack.add(new P(nx,ny,p.count+1));
				arrived[ny][nx]=true;
			}
		}
		return -1;
	}
	class P{
		int x;
		int y;
		int count;
		P(int x,int y,int count){
			this.x=x;
			this.y=y;
			this.count=count;
		}
	}
	int[][] find(char[][] table,int n){
		int[][] re=new int[n+2][2];
		for(int i=0;i<table.length;i++){
			for(int j=0;j<table[0].length;j++){
				if(table[i][j]=='.'||table[i][j]=='X')continue;
				else if(table[i][j]=='S'){
					re[0][0]=j;re[0][1]=i;
				}else{
					re[Integer.parseInt(table[i][j]+"")][0]=j;re[Integer.parseInt(table[i][j]+"")][1]=i;
				}
			}
		}
		return re;
	}
	
}

Measured memory_bytes: 69640
# include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

# define pb push_back
# define fr first
# define sc second
# define mk make_pair

using namespace std;

const long long linf = 1e18 + 7;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;

typedef long long ll;

int n, a[N], ans;
map <int, int> mp;
map <int, int> :: iterator it;


int main(){
      cin >> n;

      for(int i = 1; i <= n; i ++){
            int x;
            cin >> x;
            mp[x] ++;
      }

      for(it = mp.begin(); it != mp.end(); it ++){
            int sec = it->sc;
            if(sec % 2) ans ++;
      }

      cout << ans << endl;
}


Measured memory_bytes: 4992
N = int(input())
p = []
for i in range(N):
    X1, Y1, H1 = map(int, input().split())
    if H1 != 0:
        p.append([X1, Y1, H1])

if len(p) == 1:
    print(p[0][0], p[0][1], p[0][2])
    exit()


for i in range(101):
    for j in range(101):
        h = -1
        fg = True
        for t in p:
            if h == -1:
                h = t[2] + abs(i - t[0]) + abs(j - t[1])

            else:
                ht = t[2] + abs(i - t[0]) + abs(j - t[1])
                if h == ht:
                    h = ht
                else:
                    fg = False
                    break
        if fg:
            print(i, j, h)
           


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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

#define rep(i, n) FOR(i, 0, n)
#define FOR(i, x, n) for (int i = (x); i < (n); ++i)
#define all(v) (v).begin(), (v).end()

using ll = long long;

template<class T> void chmax(T& a, T b){ a>b?:a=b; }
template<class T> void chmin(T& a, T b){ a<b?:a=b; }

int a[200001], b[200000];

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        b[i - 1] = i - a[i];
    }
    sort(b, b + n);
    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
        ans += upper_bound(b, b + n, a[i] + i) - lower_bound(b, b + n, a[i] + i);
    }
    cout << ans << endl;

    return 0;
}

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

double solve() {
    ll L;
    cin >> L;
    double x =(double)L/3;
    double ans = x*x*x;
    return ans;
}

int main() {
    cout.setf(ios::fixed);
    cout.precision(16);
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
A,B,C,X,Y=map(int,input().split())

min_ab=min(X,Y)
max_ab=max(X,Y)
if A+B>2*C:
    if max_ab==X:
        print(2*min_ab*C+min(A,2*C)*(max_ab-min_ab))
    else:
        print(2*min_ab*C+min(B,2*C)*(max_ab-min_ab))
else:
    print(A*X+B*Y)

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <iomanip>
#include <cassert>
#include <complex>
#include <functional>
#include <list>
#include <cmath>
using namespace std;
char s[12345];
int main()
{
	cin>>s;
	int len=strlen(s);
	long long ans=0;
	for (int t=0;t< (1 << (len-1));t++)
	{
		long long num=s[0]-'0';
		for (int i=0;i<len-1;i++)
		{
			if (t & (1 << i))
				ans+=num,num=0;
			num=num*10+s[i+1]-'0';
		}
		ans+=num;
	}
	cout<<ans;
	//system("pause");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define OUT(x) cout << (x) << endl;
#define REP(i, n) for (int i=0; i<n; ++i)


int main(){
    int A, B, C;
    cin>>A>>B>>C;
    int sum = A+B+C;
    int mx = max({A,B,C});
    int dif = mx*3 - sum;
    if(dif % 2) dif += 3;
    cout<<dif/2<<endl;
}


Measured memory_bytes: 256
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    x, y = map(int, readline().split())
    if 2 * x <= y <= 4 * x and y % 2 == 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


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



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    int a[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>a[i][j];
        }
    }
    int n = 3;
    int q;
    cin>>q;
    bool ok[3][3]={};
    while(q--){
        int c;
        cin>>c;
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                if(a[i][j] == c) ok[i][j] = 1;
            }
        }
    }
    bool pos = false;
    for(int i=0;i<n;i++){
        bool r = 1;
        bool c = 1;
        for(int j=0;j<n;j++){
            if(ok[i][j] == false)r=false;
            if(ok[j][i]==false) c=false;
        }
        if(r || c) pos = 1;
    }
    for(int i=0;i<3;i++){
        if(ok[i][i]==false)break;
        if(i==2)pos=1;
    }
    for(int i=0;i<3;i++){
        if(ok[i][2-i] == false)break;
        if(i==2)pos=1;
    }
    if(pos){
        cout << "Yes\n";
    }
    else cout << "No\n";
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  long n,m;
  scanf("%ld %ld", &n, &m);
  if (m%2 == 1) {
  	for (long i = 1; i <= m/2; i++) {
  		printf("%ld %ld\n", i, m+1-i);
  	}
		for (long i = 1; i <= (m+1)/2; i++) {
  		printf("%ld %ld\n", m+i, (m+1)*2-i);
  	}
  } else {
		for (long i = 1; i <= m/2; i++) {
			printf("%ld %ld\n", i, m+2-i);
		}
		for (long i = 1; i <= (m+1)/2; i++) {
			printf("%ld %ld\n", m+1+i, (m+1)*2-i);
		}
	}

  return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll pow_(ll a, ll b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  ll x;
  cin >> x;
  ll y = 1000;
  set<ll> s;
  for (ll a = 1; a <= y; ++a) for (ll b = -y; b <= y; ++b) {
    if (a * a * a * a * a - b * b * b * b * b == x) {
      cout << a << " " << b << endl;
      return;
    }
  }
  /*
  for (auto e : s) if (e >= 0 && e <= 100) cerr << e << " "; cerr << endl;
  cout << s.count(x) << endl;
  */
}


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

bool is_hamming[1000001];

int pow(int a,int b){
	int result=1;
	for(int i=0; i<b; ++i){
		result*=a;
	}
	return result;
}

void calc(){
	fill(is_hamming,is_hamming+1000001,false);
	for(int i=0; i<21 ; ++i){
		bool flag=true;
		for(int j=0; j<14 ; ++j){
			for(int k=0; k<10 ; ++k){
				unsigned long long int tmp=pow(2,i)*pow(3,j)*pow(5,k);
				//cout << tmp << endl;
				if(tmp>1000000) break;
				is_hamming[tmp]=true;
			}
		}
	}
}

int main(){
	int M,N;
	calc();
	while(cin >> M&&M){
		cin >> N;
		int ans=0;
		for(int i=M; i<=N; ++i) if(is_hamming[i]) ++ans;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2140
#include<iostream>

using namespace std;

int main(void){
    int S[100000],T[100000],count = 0,n,q,mid,left,right;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> S[i];
    }
    cin >> q;
    for (int j = 0; j < q; j++){
        cin >> T[j];
    }
    for (int j = 0; j < q; j++){
        left = 0;
        right = n;
        while(left < right){
            mid = (left + right) / 2;
            if (S[mid] == T[j]){
                count++;
                break;
            }
            else if (T[j] < S[mid]){
                right = mid;
            }  
            else {
                left = mid + 1;
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3672
n = gets.to_i
a = gets.split.map(&:to_i)

(h = {0 => 1}).default = 0
sum = 0
n.times {|i| h[sum += a[i]] += 1}

puts h.values.inject(0) {|r, v| r + v * (v - 1) / 2}


Measured memory_bytes: 30596