akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 2000000

typedef struct Node *NodePointer;

struct Node{
  int key;
  NodePointer prev,next;
};

void init();
void insert(int);
NodePointer listSearch(int);
void deleteNode(NodePointer);
void deleteFirst();
void deleteLast();
void deletekey(int);

NodePointer nil;

int main(){
  int i;
  int num;
  char rule[N];
  int key;
  NodePointer n;
  char str1[]="insert";
  char str2[]="delete";
  char str3[]="deleteFirst";
  char str4[]="deleteLast";

  init();

  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%s",rule);
    if(strcmp(str3,rule)!=0||strcmp(str4,rule)!=0){
      scanf("%d",&key);
    }
    if(strcmp(str1,rule)==0){
      insert(key);
    }else if(strcmp(str2,rule)==0){
      deletekey(key);
    }else if(strcmp(str3,rule)==0){
      deleteFirst();
    }else if(strcmp(str4,rule)==0){
      deleteLast();
    }
  }

  for(n=nil->next;n!=nil;n=n->next){
    if(n!=nil->next)printf(" ");
    printf("%d",n->key);
  }
  printf("\n");

  return 0;
}

void init(){
  nil=malloc(sizeof(struct Node));
  nil->next=nil;
  nil->prev=nil;
}

void insert(int key){
  NodePointer x=malloc(sizeof(struct Node));
  x->key=key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
}

NodePointer listSearch(int key){
  NodePointer cur;

  cur=nil->next;

  while(cur!=nil&&cur->key!=key){
    cur=cur->next;
  }
  return cur;
}

void deleteNode(NodePointer del){
  if(del==nil) return;
  del->prev->next=del->next;
  del->next->prev=del->prev;
  free(del);
}

void deleteFirst(){
  deleteNode(nil->next);
}

void deleteLast(){
  deleteNode(nil->prev);
}

void deletekey(int key){
  deleteNode(listSearch(key));
}

Measured memory_bytes: 31800
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] a;
		a = new int[3];
		for(int i=0;i<3;i++){
		a[i] = sc.nextInt();
		}
		for(int i=0;i<2;i++){
			for(int j=2;j>i;j--){
				if(a[j-1]>a[j]){
					int tmp=a[j];
					a[j]=a[j-1];
					a[j-1]=tmp;
				}
			}
		}
		
		System.out.println(a[0]+" "+a[1]+" "+a[2]);
		sc.close();
	}
}



Measured memory_bytes: 26412
#include <bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  long long ans = 0;
  while (n){
    n/=k;
    ans++;
  }
  cout << ans << '\n';


  return 0;
}


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

using namespace std;

typedef long long ll;

int main() {
    ll count = 0;
    ll n;
    cin >> n;
    vector<ll> a(n + 1);
    vector<ll> b(n);
    for (ll i = 0; i < n + 1; ++i) {
        cin >> a.at(i);
    }
    for (ll j = 0; j < n; ++j) {
        cin >> b.at(j);
    }
    for (ll k = 0; k < n; ++k) {
        if (a.at(k) + a.at(k + 1) <= b.at(k)) {
            count += a.at(k) + a.at(k + 1);
            a.at(k), a.at(k + 1) = 0;
        } else if (a.at(k) >= b.at(k)) {
            count += b.at(k);
            a.at(k) -= b.at(k);
        } else {
            count += a.at(k);
            count += b.at(k) - a.at(k);
            a.at(k + 1) -= (b.at(k) - a.at(k));
            a.at(k) = 0;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
template<typename T>
bool chmin(T &a,T b){
    if(a<=b)return 0;
    a=b;
    return 1;
}

string d(string s){
    int n = s.size();
    int now = 0;
    string ret = "";
    bool fi = true;
    for(int i=0;i<n;i++){
        if(s[i] == '['){
            now++;
            if(fi){
                fi = false;
                continue;
            }
            if((fi==false) && now == 1)break;
            if(now == 2)ret += d(s.substr(i));
        }
        else if(s[i] == ']'){
            now--;
        }
        else if(now==1)ret += s[i];
        if(now == 0)break;
    }
    //cerr << s << " " << ret << endl;
    reverse(ret.begin(),ret.end());
    return ret;
}

string f(string s){
    int n = s.size();
    int now = 0;
    string ret = "";
    for(int i=0;i<n;i++){
        if(s[i] == '['){
            now++;
            if(now == 1) ret += d(s.substr(i));
        }
        else if(s[i] == ']') now--;
        else if(now == 0){
            ret += s[i];
        }
    }
    return ret;
}


signed main(){
    //ofstream cout("out.txt");

    string s;
    while(cin>>s){
        if(s == ".")break;
        string t;
        int n = s.size();
        int now = 0;
        for(int i=0;i<n;i++){
            if(s[i] == '+'){
                now++;
                now %= 26;
            }
            else if(s[i] == '-'){
                now += 25;
                now %= 26;
            }
            else if(s[i] == '?'){
                t += 'A';
                now = 0;
            }
            else if(s[i] == '[' || s[i] == ']') t += s[i];
            else{
                int c = s[i]-'A';
                c += now;
                c %= 26;
                t += (char)('A'+c);
                now=0;
            }
        }
        // cerr << t << endl;
        cout << f(t) << "\n";
    }
}


Measured memory_bytes: 3228
#include <iostream>
#include <algorithm>

using namespace std;

void solve() {
    int n, k, ans;
    cin >> n >> k;
    ans = k;
    for (int i = 0; i < n-1; ++i ) {
        ans *= k-1;
    }
    cout << ans;
}

int main() {

    solve();
    return 0;
}


Measured memory_bytes: 3136
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		
		String str = sc.next();
	
		int a=0,b=0;
	while(a<str.length())
		{
			if(str.charAt(a++)==str.charAt(a))
			{
				++b;
				System.out.println("Bad");
				break;
		
			}
			if(a==str.length()-1)
				break;
		}
	if(b==0)
	{
		System.out.println("Good");
	}
	}
}


Measured memory_bytes: 22868
#include <stdio.h>

int main(){
    int input[3];
    int count = 0;
    
    scanf("%d %d %d", &input[0], &input[1], &input[2]);
    
    if (input[0] == input[1]){
        count++;
    }
    
    if (input[0] == input[2]){
        count++;
    }
    
    if (input[2] == input[1]){
        count++;
    }
    
    if (count == 1){
        printf("Yes");
    }else{
        printf("No");
    }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

int main()
{
	set<char> s;
	rep(i, 3)
	{
		char tmp;
		cin >> tmp;
		s.insert(tmp);
	}
	if (s.size() == 1)
	{
		cout << "No" << endl;
	}
	else
		cout << "Yes" << endl;
	return 0;
}

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

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

    int N;
    cin >> N;
    int ans = 0;
    rep(i, N) {
        int cnt = 0;
        rep(j,i+1){
            if ((i+1)%(j+1)==0) {
                cnt++;
            }
        }
        if ((i+1)%2!=0 && cnt==8){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
//#include <utility>
//#include<algorithm>
//#include <vector>
//#include<string>

using namespace std;

int main() {

	int n, d, ans = 1;
	scanf("%d%d", &n, &d);
	
	for (int i = 2 * d + 1; i < n ; i += (2 * d) + 1)++ans;

	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 128
import java.io.*;

public class Main {
	static Reader in = new InputStreamReader(System.in);
	static Writer out = new PrintWriter(System.out);

	public static void main(String[] args) throws Exception {
		try (BufferedReader br = new BufferedReader(in)) {
			String[] s = br.readLine().split(" ");
			int a = Integer.parseInt(s[0]);
			int b = Integer.parseInt(s[1]);
			int c = Integer.parseInt(s[2]);
			int d = Integer.parseInt(s[3]);
			while (true) {
				c -= b;
				if (c <= 0) {
					out.write("Yes");
					break;
				}
				a -= d;
				if (a <= 0) {
					out.write("No");
					break;
				}
			}
			out.close();
		}
	}

}

Measured memory_bytes: 32628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n, a[100010];
multiset<int> st;
set<int> st2;
bool bl[100010];
vector<int> ans;

signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++)cin >> a[i], st.insert(a[i]), st2.insert(i);
	if (n == 2) {
		cout << -1 << endl;
		return 0;
	}
	int p = 0, q = 0;
	for (int i = 2; i < n; i++) {
		if (*st.begin() == *--st.rbegin() && !bl[*st.begin()]) {
			ans.push_back(*st.begin());
			q = p;
			p = a[*st.begin()];
			bl[*st.begin()] = true;
			st2.erase(*st.begin());
			st.erase(st.lower_bound(a[*st.begin()]));
		}
		else if (*++st.begin() == *st.rbegin() && !bl[*st.rbegin()]) {
			ans.push_back(*st.rbegin());
			q = p;
			p = a[*st.rbegin()];
			bl[*st.rbegin()] = true;
			st2.erase(*st.rbegin());
			st.erase(st.lower_bound(a[*st.rbegin()]));
		}
		else {
			auto s = st2.begin();
			if (p == *s)s++;
			ans.push_back(*s);
			q = p;
			p = a[*s];
			bl[*s] = true;
			st.erase(st.lower_bound(a[*s]));
			st2.erase(s);
		}
	}
	int s = *st2.begin(), t = *st2.rbegin(), r = ans.back();
	if (a[s] == t && a[t] == s) {
		ans.pop_back();
		if (q == s)ans.push_back(t), ans.push_back(r), ans.push_back(s);
		else ans.push_back(s), ans.push_back(r), ans.push_back(t);
	}
	else {
		if (p == s)ans.push_back(t), ans.push_back(s);
		else ans.push_back(s), ans.push_back(t);
	}
	for (int i = 0; i < (int)ans.size(); i++)cout << ans[i] << " ";
	cout << endl;
}


Measured memory_bytes: 13452
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b >= c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def main():
    n, l = map(int, input().split())
    ss = [list(input()) for _ in range(n)]

    for i in range(l-1, -1, -1):
        ss = sorted(ss, key=lambda x: x[i])

    ans = ''
    for i in range(n):
        for j in range(l):
            ans += ss[i][j]
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9116
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
const ll inf = 1001001001001001001;
int main(){
  ll N,K,i;scanf("%lld%lld",&N,&K);
  ll A[N],F[N];
  for(i=0;i<N;i++) scanf("%lld",&A[i]);
  for(i=0;i<N;i++) scanf("%lld",&F[i]);
  sort(A,A+N);
  ll l = -1,r = inf,mid,cnt;//(left,right]
  while(r - l > 1){
    mid = (l+r)/2;
    ll need[N];
    for(i=0;i<N;i++) need[i] = mid/F[i];
    sort(need,need+N);
    cnt = 0;
    for(i=0;i<N;i++) cnt += max(0LL,A[i]-need[i]);
    if(cnt <= K) r = mid;
    else l = mid;
  }
  printf("%lld\n",r);
}


Measured memory_bytes: 8500
N, M = map( int, input().split())
V = [set([]) for _ in range(N)]
E = []
for i in range(M):
    a, b = map(int, input().split())
    E.append([a-1,b-1])
    V[a-1].add(b-1)
    V[b-1].add(a-1)
ans = 0
def conn(a,b,V):
    TV = [ False for _ in range(N)]
    TV[a] = True
    S = []
    for v in V[a]:
        if v != b:
            S.append(v)
    while len(S) != 0:
        c = S.pop()
        for w in V[c]:
            if TV[w] == False:
                TV[w] = True
                S.append(w)
    return TV
for e in E:
    a, b = e[0], e[1]
    comp = conn(a,b,V)
    if comp[b] == False:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
long long int gcd(long long int a,long long int b)
{
    long long int temp,temp1,r;
    temp=a;
    temp1=b;
    for(;;)
    {
        r=a%b;
        a=b;
        if(r==0)break;
        b=r;
    }
    return a;
}
int main()
{
    long long int t,n,a,b,i,j,k,l,sum,mini,temp;
    cin>>n;
    sum=0;
    for(i=1; i<=n; i++)
    {
        //cout<<"i-j-k"<<i<<j<<k<<endl;
        for(j=1; j<=n; j++)
        {
            temp=gcd(i,j);

            for(k=1; k<=n; k++)
            {
                //cout<<"i-j-k"<<i<<j<<k<<endl;
                sum+=gcd(temp,k);

            }
            //cout<<sum<<endl;
        }
    }
    cout<<sum<<endl;
    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;


#define rep(i, a, b) for (size_t i = a; i < (size_t)b; i++)

int DP[100001];

int mod = 1e9 + 7;

int count_stairs(int n){
	if (n == 0){
		return 1;
	}
	if (DP[n] != -1){
		return DP[n];
	}

	if(n >= 2){
		return DP[n] = (count_stairs(n-1) + count_stairs(n-2))%mod;;
	}

	if(n == 1){
		return DP[n] = (count_stairs(n-1))%mod;
	}
}


int main(){

	memset(DP, -1, sizeof(DP));

	int n, m;
	cin >> n >> m;
	int temp;

	rep(k, 0, m){
		cin >> temp;
		DP[temp] = 0;
	}

	cout << count_stairs(n) << endl;


	return 0;

}

Measured memory_bytes: 3712
/*************************************************\
           In the name of almighty ALLAH
                 MD.Faysal Hasan
                Comilla Univesity
\*************************************************/

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

#define     ikarus_101  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef     long long             ll;
typedef     long double           ld;
typedef     unsigned long long    ull;
typedef     vector<ll>            vll;
typedef     pair<ll,ll>           pll;
typedef     vector<pll>           vpl;
typedef     map<ll,ll>            mll;
typedef     multiset<ll>          msl;
typedef     multimap<ll,ll>       Mll;
using pqboro=priority_queue<ll,vll,less<ll>>;
using pqchoto=priority_queue<ll,vll,greater<ll>>;

#define    all(str)       str.begin(),str.end()
#define    sajo(str)      sort(str.begin(),str.end())
#define    rev(str)       reverse(str.begin(),str.end())
#define    usajo(str)     sort(str.rbegin(),str.rend())
#define    vin(a)         for(auto &it : a) cin>>it
#define    vout(a)        for(auto it:a) cout<<it<<' ';cout<<nn
#define    pb             push_back
#define    eb             emplace_back
#define    mkp(x,y)       make_pair(x,y)
#define    F              first
#define    S              second
#define    yes            cout<<"YES"<<nn
#define    no             cout<<"NO"<<nn
#define    nn             "\n" ///endl
#define    jj             " "
#define    rep(i,n)       for (i=0;i<n;++i )
#define    rep1(i,n)      for (i=1;i<=n;++i )

#define    min3(a,b,c)    min(a,min(b,c))
#define    max3(a,b,c)    max(a,max(b,c))
#define    sqr(x)         ((x)*(x))
#define    pi             2*acos(0.0)
#define    gcd(a,b)       __gcd(a,b)
#define    lcm(a,b)       (a/gcd(a,b))*b
#define    mem(a,b)       memset(a,b,sizeof (a))
#define    dec(x)         cout<<fixed<<setprecision(x)
#define    none(n)         __builtin_popcountll(n)

template < typename T > string toString ( T Number ) { stringstream ss ; ss << Number ; return ss.str() ; }
template < typename T > ll toll ( T str ) { stringstream ss ; ss << str ; ll num ; ss >> num ; return num ; }

const   int  N   =   2e6+7;
const   int  M   =   1e9+7;
const   ll  inf  =   0x7f7f7f7f7f7f7f7f;

int main() {ikarus_101

    ll n,m,i,j,k,x;

    ll l,r;cin>>l>>r;
    k = 2019;
    ll ans = inf;
    for(i=l,j=0;i<r and j<k;i++,j++)
    {
        for(ll xx = i+1,yy=0;xx<=r and yy<k;xx++,yy++)
        {
            ll d = (i%k) * (xx%k);
            d = d%k;
            ans = min(ans,d);
        }
    }
    cout << ans << nn;



    return 0;
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ar array

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 2e5 + 5;

vector<int> gr[maxn], tr[maxn];
int N, M, col[maxn];
int U[maxn], V[maxn];
int w[maxn], d[maxn];
bool in[maxn];
int p[maxn];

void dfs(int u)
{
  for(int v : tr[u]) if(col[v] == -1){
    col[v] = col[u] ^ 1;
    dfs(v);
  }
}

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  #endif // LOCAL
  cin >> N >> M;
  for(int i = 1; i <= N; ++i)
    cin >> d[i];
  for(int i = 1; i <= M; ++i){
    cin >> U[i] >> V[i];
    gr[U[i]].eb(i); gr[V[i]].eb(i);
  }
  fill(w + 1, w + 1 + M, 1e9);
  for(int i = 1; i <= N; ++i){
    p[i] = -1;
    for(int id : gr[i]){
      int v = U[id] + V[id] - i;
      if(p[i] == -1 || d[p[i]] > d[v]){
        p[i] = v;
      }
    }
    if(d[i] < d[p[i]]){
      cout << -1;
      return 0;
    }
    tr[i].eb(p[i]);
    tr[p[i]].eb(i);
    for(int id : gr[i]){
      int v = U[id] + V[id] - i;
      if(v == p[i]){
        w[id] = d[i];
        break;
      }
    }
  }
  fill(col + 1, col + 1 + N, -1);
  for(int i = 1; i <= N; ++i){
    if(col[i] == -1){
      col[i] = 0;
      dfs(i);
    }
  }
  for(int i = 1; i <= N; ++i){
    cout << (col[i] ? 'B' : 'W');
  }
  cout << '\n';
  for(int i = 1; i <= M; ++i)
    cout << w[i] << '\n';
}


Measured memory_bytes: 22784
import sys
k, n = [int(i) for i in sys.stdin.readline().split()]
a_ls = [int(i) for i in sys.stdin.readline().split()]
a_ls += [i + k for i in a_ls]
best = 10**18
for i in range(n):
    best = min(best, a_ls[i+n-1] - a_ls[i])
print(best)

Measured memory_bytes: 24908
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,t,a;
    cin>>n>>t>>a;
    int h,res=0;
    int ans=pow(10,6);
    for(int i=0;i<n;i++){
        cin>>h;
        if(abs(1000*a-(1000*t-6*h))<ans){
            ans=abs(1000*a-(1000*t-6*h));
            res=i; 
        }
    }
    cout<<res+1<<endl;
}

Measured memory_bytes: 256
H = int(input())
W = int(input())
N = int(input())

lim = H*W+1
total = 0

for i in range(1,lim):
    if W>=H:
        total += W
        H -= 1
    else:
        total += H
        W -= 1
    if total >= N:
        print(i)
        break

Measured memory_bytes: 3060
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(array[k-1])


Measured memory_bytes: 2940
N, Ma, Mb = gets.split.map(&:to_i)
M = [0]
V = [0]
N.times do
  a, b, c = gets.split.map(&:to_i)
  M << Mb * a - Ma * b
  V << c
end

def smaller(a, b)
  a < b ? a : b 
end

dp = Array.new(N + 1) do |i|
  Hash.new do |h, j|
    if M[i] == j
      h[j] = smaller(dp[i - 1][j], V[i])
    else
      h[j] = smaller(dp[i - 1][j], dp[i - 1][j - M[i]] + V[i])
    end
  end
end

dp[0] = Hash.new(4001)
puts dp[N][0] > 4000 ? "-1" : dp[N][0]

Measured memory_bytes: 3964
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<cstdio>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9 + 7;
int H, W, K;
ll fib[10] = { 0 };
ll dp[101][10] = { {0} };//dp[x][y]で高さxにおける左からy本目に到達する横棒の置き方
int main() {
	cin >> H >> W >> K;
	fib[0] = 1; fib[1] = 1;
	for (int i = 2; i <= 9; ++i) {
		fib[i] = fib[i - 1] + fib[i - 2];
	}
	dp[0][1] = 1;
	for (int i = 0; i < H; ++i) {
		for (int j = 1; j <= W; ++j) {
			if (j >= 2) {
				dp[i + 1][j - 1] += dp[i][j] * (fib[j - 2] * fib[W - j]);
				dp[i + 1][j - 1] %= INF;
			}
			if (j <= W - 1) {
				dp[i + 1][j + 1] += dp[i][j] * (fib[j-1] * fib[W - j-1]);
				dp[i + 1][j + 1] %= INF;
			}
			dp[i + 1][j] += dp[i][j] * (fib[j-1] * fib[W - j]);
			dp[i + 1][j] %= INF;
		}
	}
	cout << dp[H][K] << endl;
	return 0;
}

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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
string itos(int N){
  stringstream ss;
  ss<<N;
  return ss.str();
}
string ans1(int N, int K){
  int cur = 1;
  int ten[10] = {};
  ten[1] = 10;
  for(int i = 1; i < 9; i++) ten[i + 1] = ten[i] * 10;
  int dig = 1;
  string output;
  N--;
  while(N > 0){
    if(N - dig < 0){
      string s = itos(cur);
      output += s.substr(N);
    }
    N -= dig;
    cur++;
    if(ten[ dig ]==cur) dig++;
  }
  while(output.size() < K){
    output += itos(cur++);
  }
  return output.substr(0, K);
}

int main(){
  int N, K;
  ll ten[10] = {1};
  ll dp[10] = {0};
  for(int i = 0; i < 9; i++){
    ten[i + 1] = 10 * ten[i];
    dp[i + 1] = dp[i] + (i + 1) * (ten[i + 1] - ten[i]);
  }
  while(cin>>N>>K && N){
    int cur = 1;
    int dig = 1;
    for(int i = 0; i < 9; i++){
      if(dp[i] < N && N <= dp[i + 1]){
        cur = ten[i];
        N -= dp[i];
        dig = i + 1;
        break;
      }
    }
    N--;
    cur += N / dig;
    N -= (N / dig) * dig;
    string output;
    while(output.size() < N + K){
      output += itos(cur++);
    }
    cout<<output.substr(N, K)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
 
int main(){
    fast;
    ll n;
    cin >> n;
    ll ans = 0;
    for(int i = 1; i <= n; ++i){
        if(i%3 != 0 && i%5 != 0)
            ans += i;
    }
    cout << ans;
    return 0;
}
//                                     #!!{*[$um1t_Kum@r]*}!!#

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

int main()
{
	double n;

    double i ;

	double o;

	cin >> n;
	cin >> i;
	o = 1;
	

	if (n+i >= 24)

		o = n+i-24;



else

	o = n+i;





	cout << o << endl;


	



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

// long version
long long int GCD(long long int x, long long int y){
    if(x>y){
        long long int swap = x;
        x = y;
        y = swap;
    }
    while(true){
        if(y%x==0){
            return x;
        }else{
            long long int amari = y%x;
            y = x;
            x = amari;
        }
    }
}

int main() {
    ll a,b;
    cin >> a >> b;
    ll x = GCD(a,b);

    int ans = 1;
    ll i = 2;

    while(true){
        if(x % i == 0){
            ans++;
            while(x % i == 0){
                x /= i;
            }
        }
        i++;
        if(i > 1234567)break;
        if(x == 1)break;
    }

    if(x > 1)ans++;

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<ll>>;
template<typename T=ll,typename U=ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;

void a(){
    ll N,A,B;
    cin >> N >> A >> B;
    if(A<B&&N>1){
        ll sum = (N-2)*(B-A)+1;
        cout << sum << endl;
    }else if(A==B){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
}

void b(){
    string s;
    cin >> s;
    ll c=0;
    rep(i,s.size()-1){
        if(s[i]!=s[i+1]) c++;
    }
    cout << ((ll)s.size())*((ll)s.size()-1) +c;
}

int main(){
    a();
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll H,W; cin >> H >> W;
  ll d[H][W];
  string S;
  for (ll i = 0; i < H; ++i) {
    cin >> S;
    for (ll j = 0; j < W; ++j) {
      if (S[j] == '#') d[i][j] = 1;
      else d[i][j] = 0;
    }
  }
  bool is_possible = true;
  for (ll i = 0; i < H; ++i) {
    for (ll j = 0; j < W; ++j) {
      if (d[i][j] == 1) {
        bool iplus = (i+1 < H  && d[i+1][j] == 1);
        bool jplus = (j+1 < W  && d[i][j+1] == 1);
        bool iminus= (i-1 >= 0 && d[i-1][j] == 1);
        bool jminus= (j-1 >= 0 && d[i][j-1] == 1);
        if (!(iplus||jplus||iminus||jminus)) is_possible = false;
      }
      if (!is_possible) break;
    }
    if (!is_possible) break;
  }
  if (is_possible) puts("Yes"); else puts("No");
  return 0;
}

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

using namespace std;

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.first <<","<<P.second <<")";
}

#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int N = 200005, M = 1e9 + 7;

int fact[N], factInv[N];
int ans[N];
int n, a, b;
vector<int> V[N];
int ways[N], size[N];

int mul(int w, int u) {
    return (long long)w * u % M;
}

int powaer(int a, int k) {
    if (k == 0) return 1;
    return mul(powaer(mul(a, a), k / 2), k % 2 ? a : 1);
}

int inv(int w) {
    return powaer(w, M - 2);
}

int newton(int n, int k) {
    return mul(fact[n], mul(factInv[k], factInv[n - k]));
}

void DFS(int w, int par = -1) {
    ways[w] = 1;
    for (int u : V[w]) {
        if (u == par) continue;
        DFS(u, w);
        ways[w] = mul(newton(size[w] + size[u], size[w]), mul(ways[w], ways[u]));
        size[w] += size[u];
    }
    size[w]++;
}

void DFS2(int w, int par = -1) {
    ways[w] = 1;
    size[w] = 0;
    
    vector<int> prefWays;
    prefWays.push_back(1);
    vector<int> prefSize;
    prefSize.push_back(0);
    for (int u : V[w]) {
        ways[w] = mul(newton(size[w] + size[u], size[w]), mul(ways[w], ways[u]));
        size[w] += size[u];
        prefSize.push_back(size[w]);
        prefWays.push_back(ways[w]);
    }
    ans[w] = ways[w];
    size[w]++;
    
    int sufWays = 1;
    int sufSize = 0;
    
    for (int i = V[w].size() - 1; i >= 0; i--) {
        int u = V[w][i];
        int Wways = mul(newton(sufSize + prefSize[i], sufSize), mul(prefWays[i], sufWays));
        int wSize = size[w] - size[u];
        
        int oldWays = ways[w];
        int oldSize = size[w];
        
        ways[w] = Wways;
        size[w] = wSize;
        
        int sizeU = size[u];
        int waysU = ways[u];
        if (u != par) {
            DFS2(u, w);
        }
        
        ways[w] = oldWays;
        size[w] = oldSize;
        
        sufWays = mul(newton(sufSize + sizeU, sizeU), mul(waysU, sufWays));
        sufSize = sizeU + sufSize;
    }
}

int main() {
    
    scanf("%d", &n);
    fact[0] = 1;
    for (int i = 1; i <= n; i++) {
        fact[i] = mul(fact[i - 1], i);
    }
    
    factInv[n] = inv(fact[n]);
    for (int i = n - 1; i >= 0; i--) {
        factInv[i] = mul(factInv[i + 1], i + 1);
    }
    
    for (int i = 1; i < n; i++) {
        scanf("%d %d", &a, &b);
        V[a].push_back(b);
        V[b].push_back(a);
    }
    
    DFS(2);
    DFS2(2);
    
    for (int i = 1; i <= n; i++) {
        printf("%d\n", ans[i]);
    }
    
    return 0;
}


Measured memory_bytes: 21760
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
	#define dbg(x) cout << #x << " : " << x << endl;
#else 
	#define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;
const int PW = 42;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int mult(int a, int b) {
	if (double(a) * b >= BIG)
		return BIG;
	return a * b;
} 


int pw(int a, int b) {
	if (b == 0)
		return 1;
	if (b & 1) return mult(a, pw(a, b - 1));
	return pw(mult(a, a), b / 2);
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   	
   	int n, a;
   	cin >> n >> a;
   	int ans = n;
   	int x = 1e7;
   	fi(2, PW + 1) {
   		while (pw(x - 1, i) >= n)
   			--x;
   		int cur = (i - 1) * a;
   		if (pw(x, i) == n) {
   			cur += x * i;
   		} else {
   			int val = pw(x, i);
   			cur += x * i;
   			while (val / x * (x - 1) >= n) {
   				val /= x;
   				val *= (x - 1);
   				--cur;
   			}
   		}
   		mine(ans, cur);
   	}
   	cout << ans << '\n';
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'
#define int long long

typedef long long ll;

int n;

std::vector<int> enum_div(int n) //nの約数を列挙
{
    std::vector<int> ret;
    for (int i = 1; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i != 1 && i * i != n)
            {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

signed main(){
    cin >> n;

    int sum = 0LL;

    vector<int> v = enum_div(n);
    v.push_back(n);
    sort(ALL(v));

    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }

    for (int i = v.size()-1; i > 0; i--){
        if ((v[i]-1)*(n%(v[i]-1)) + n/(v[i]-1) == n)  {
            if (n % (v[i]-1) == n / (v[i] - 1)) {
                sum += (v[i]-1);
            } else {
                break;
            }
        }
    }

    cout << sum << endl;
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll MODULO = 1e9 + 7;

int main()
{
  int n;
  string s;
  cin >> n >> s;
  vll c(26);
  for (int i = 0; i < n; ++i) c[s[i] - 'a']++;
  ll result = 1;
  for (int i = 0; i < 26; ++i) result = result * (c[i] + 1) % MODULO;
  result = (result + MODULO - 1) % MODULO;
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 512
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N = int(input())
S1 = input()
S2 = input()
li = []

i = 0
while i < N:
	if i == N-1 or S1[i] != S1[i+1]:
		li.append(1)
		i += 1
	else:
		li.append(2)
		i += 2

if li[0] == 1:
	ans = 3
else:
	ans = 6

L = len(li)

for i in range(1,L):
	bef = li[i-1]
	now = li[i]
	if bef == 2 and now == 2:
		ans *= 3
	elif bef == 2 and now == 1:
		ans *= 1
	elif bef == 1 and now == 2:
		ans *= 2
	elif bef == 1 and now == 1:
		ans *= 2
	ans %= mod

print(ans)


Measured memory_bytes: 4204
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
int gcd(int x, int y, int z) {
	int m = max(x, y);
	m = max(m, z);
	for (int i = m; i >= 1; i--) {
		if (x % i == 0 && y % i == 0 && z % i == 0)
			return i;
	}
}
int gcd_(int a, int b) {
	int temp = a;
	while (a % b != 0) {
		a = b;
		b = temp % b;
		temp = a;
	}
	return b;
}
int main() {
	int k;
	cin >> k;
	long long int sum = 0;
	for (int a = 1; a <= k; a++)
	{
		for (int b = a + 1; b <= k; b++)
		{
			for (int c = b + 1; c <= k; c++)
			{
				sum += 6*gcd(a, b, c);
			}
		}
	}

	for (int a = 1; a <= k; a++)
	{
		for (int b =a+1; b!=a&&b <= k; b++) {
			sum += 6*gcd_(a, b);
		}
	}

	for (int a = 1; a <= k; a++)
	{
		sum += a;
	}
	cout << sum << endl;
}

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

int main() {
    string str, ans = "";
    cin >> str;
    rep(i, str.length()) if(i % 2 == 0) ans += str.at(i);
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>

using namespace std;

typedef long long ll;

ll n;

int main() {
	cin >> n;
	cout << (n % 1000 == 0 ? 0 : 1000 - n % 1000) << endl;

	return 0;
}

Measured memory_bytes: 3632
n = int(input())
l = list(map(int, input().split()))

l.sort()
l.reverse()

maxLen = l[0]
otherLen = 0

for i in range(len(l)):
    if not i == 0:
        otherLen += l[i]

# print(maxLen)
#print(otherLen)

if maxLen < otherLen:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
//  Shopping in JOI Kingdom.cpp
//  2013/01/06.

#if 1

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

const int INF = 1<<30;

int N, M, K;
int D[3000];
int C[3000][3000];
int used[3000];

int dfs(int pnt)
{
	rep(next, N) if(D[next] > D[pnt] + C[pnt][next])
	{
		D[next] = D[pnt] + C[pnt][next];
		dfs(next);
	}
}

void dijkstra(int pnt)
{
	memset(used, 0, sizeof used);
	
	while(true)
	{
		int v = -1;
		
		rep(u, N) if(!used[u] && (v == -1 || D[u] < D[v])) v = u;
		
		if(v == -1) break;
		
		used[v] = true;
		
		rep(u, N) chmin(D[u], D[v] + C[v][u]);
	}
}

int calc(int a, int b, int l)
{
	return round(min(a, b) + (l + max(a, b) - min(a, b)) / 2.0);
}

int main()
{
	rep(i, 3000) rep(j, 3000) D[i] = C[i][j] = INF;
	
	cin >> N >> M >> K;

	rep(m, M)
	{
		int a, b, c;
		cin >> a >> b >> c;
		
		C[a-1][b-1] = C[b-1][a-1] = c;
	}
	
	int s;
	rep(k, K)
	{
		cin >> s;
		
		D[s-1] = 0;
	}
	
	dijkstra(0);

	int ans = 0;
	
	rep(a, N) REP(b, a+1, N) if(C[a][b] < INF) chmax(ans, calc(D[a], D[b], C[a][b]));
	
	cout << ans << endl;
}

#endif

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

vector<ll> v;
const ll inf = 10000000000;
int main() {
  ll n; cin >> n;
  vector<ll> dp(n+1,inf);
  v.push_back(1);
  ll p6=6;
  while(p6<=n) {
    v.push_back(p6);
    p6*=6;
  }
  ll p9=9;
  while(p9<=n) {
    v.push_back(p9);
    p9*=9;
  }
  sort(v.begin(),v.end());
  dp[0]=0;
  for(int i=1; i<=n; i++) {
    for(auto x : v) {
      if(i-x<0) break;
      dp[i]=min(dp[i],dp[i-x]+1);
    }
  }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 1024
#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($( { splits.next().unwrap().parse::<$t>().unwrap() },)*)
    }}
}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (a, b) = input!(u64, f64);

    println!("{}", (a * ((b * 100.0).round() as u64) / 100));
}

fn main() {
    solve();
}

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

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

int main(){
	int x,y;
	cin>>x>>y;
	cout<<GCD(min(x,y),max(x,y))<<endl;
	return 0;
}



Measured memory_bytes: 3080
#include <stdio.h>
#include <string.h>
#include <unordered_map>

using namespace std;

int main() {
    int n;
    while (scanf("%d", &n) !=EOF) {
        unordered_map<int, int> ma;
        for (int i = 0; i < n; ++i) {
            int x; scanf("%d", &x); ma[x]++;
        }
        int res = 0;
        for (auto it : ma) {
            if (it.second & 1) res++;
        }
        printf("%d\n", res);
    }
    return 0;
}


Measured memory_bytes: 4128
#include<bits/stdc++.h>
#define     FAST            ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0);
typedef long long ll;
using namespace std;
int main()
{

        ll x;
        cin>>x;

        if(x>=30)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }







    return 0;
}


Measured memory_bytes: 3628
import java.io.*;
import java.util.*;
import java.lang.*;

class Main {

	public static void main(String[] args) {
		final FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt();
		switch (n % 10) {
			case 2:
			case 4:
			case 5:
			case 7:
			case 9:
				System.out.println("hon");
				break;
			case 0:
			case 1:
			case 6:
			case 8:
				System.out.println("pon");
				break;
			case 3:
				System.out.println("bon");
		}
	}

	static class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		public FastScanner(InputStream source) {
			in = source;
		}

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte()) return buffer[ptr++];
			else return -1;
		}

		private static boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 25272
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        sc.useDelimiter(",");
//        DecimalFormat df = new DecimalFormat("0.00000000");
        int a[] = new int[6];
        int b[] = new int[6];
        for (int i = 0; i < 6; i++) {
            a[i] = Integer.parseInt(sc.next());
        }
        for (int i = 0; i < 6; i++) {
            b[i] = Integer.parseInt(sc.next());
        }
        Dice d1 = new Dice(a);
        Dice d2 = new Dice(b);

        outer:
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 3; k++) {
                if (d1.getBack() == d2.getBack()) break outer;
                d2.rollSouth();
            }
            d2.rollEast();
        }
        for (int m = 0; m < 3; m++) {
            if (d1.getTop() == d2.getTop()) break;
            d2.rollEast();
        }
        out.println(d1.getRight() == d2.getRight() ? "Yes" : "No");

        out.flush();
    }
}
class Dice {
    private int top, front, back, left, right, down, temp;
    Dice(int[] a) {
        this.top = a[0];
        this.front = a[4];
        this.back = a[1];
        this.left = a[3];
        this.right = a[2];
        this.down = a[5];
    }
    void rollWest() {
        this.temp = this.left;
        this.left = this.top;
        this.top = this.right;
        this.right = this.down;
        this.down = this.temp;
    }
    void rollEast() {
        this.temp = this.right;
        this.right = this.top;
        this.top = this.left;
        this.left = this.down;
        this.down = this.temp;
    }
    void rollSouth() {
        this.temp = this.back;
        this.back = this.top;
        this.top = this.front;
        this.front = this.down;
        this.down = this.temp;
    }
    void rollNorth() {
        this.temp = this.front;
        this.front = this.top;
        this.top = this.back;
        this.back = this.down;
        this.down = this.temp;
    }
    int getTop() {
        return this.top;
    }
    int getFront() {
        return this.front;
    }
    int getBack() {
        return this.back;
    }
    int getRight() {
        return this.right;
    }
    int getLeft() {
        return this.left;
    }
}


Measured memory_bytes: 26396
#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>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

class union_find {
    private:
        vector<int> par;
        vector<int> ran;
        vector<ll> size;
    public:
        union_find(int n);
        int find(int x);
        void unite(int x, int y);
        bool same(int x, int y);
        ll show_size(int x);
};

union_find::union_find(int n){
    par.resize(n);
    ran.resize(n);
    size.resize(n);
    rep(i,n) par[i] = i;
    rep(i,n) ran[i] = 0;
    rep(i,n) size[i] = 1;
};

int union_find::find(int x) {
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
};

void union_find::unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    ll t = show_size(x)+show_size(y);
    size[x] = size[y] = t;
    if(ran[x] < ran[y]){
        par[x] = y;
        //size[y] += size[x];
    }
    else{
        par[y] = x;
        //size[x] += size[y];
        if(ran[x] == ran[y]) ran[x]++;
    }
};

ll union_find::show_size(int x) {
    if(par[x] == x) return size[x];
    return show_size(par[x] = find(par[x]));
}

bool union_find::same(int x, int y) {
    return (find(x) == find(y));
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<int> a(m), b(m);
	rep(i,m){
		cin >> a[i] >> b[i];
		--a[i]; --b[i];
	}
	int ans = 0;
	rep(i,m){
		union_find uf(n);
		rep(j,m){
			if(i == j) continue;
			uf.unite(a[j], b[j]);
		}
		bool bridge = false;
		rep(i,n){
			if(!uf.same(0, i)) bridge = true;
		}
		if(bridge) ++ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <complex>

using namespace std;
using pii = pair<int, int>;
using ll = long long;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b;
	cin >> a >> b;
	if (a >= 13) cout << b;
	else if (a >= 6) cout << b / 2;
	else cout << 0;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int X[100005];
int Y[100005];
int N,m,n,o,i,j,k,ex;
double A,B,C;
int main ()
{
	cin>>N;
	for(i=1;i<=N;i++)
	{
		cin>>m;
		X[i]=m;
	}
	sort(X+1,X+N+1);
	for(k=1;k<=N;k++)
	{
		if(k==1)
		{
			A+=1.0*X[k]/pow(2,(N-1));
		}
		else
		{
			A+=1.0*X[k]*pow(2,(k-2))/pow(2,(N-1));
		}
	}
	cout<<A;
	return 0;
}

Measured memory_bytes: 512
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    n = I()
    a = LI()
    if n % 2 == 0:
        print(*a[::-2],*a[::2])
    else:
        print(*a[::-2],*a[1::2])
main()

Measured memory_bytes: 96084