akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 100005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif


signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int h, w; cin>>h>>w;
    bool arr[h+1][w+1];
    int dp[h+1][w+1];
    memset(arr, 1, sizeof(arr));
    For(i, 1, h+1){
        For(j, 1, w+1){
            char c; cin>>c;
            if(c=='#')
                arr[i][j]=0;
            else
                arr[i][j]=1;
        }
    }
    For(i, 0, h+1){
        For(j, 0, w+1){
            dp[i][j]=INF;
        }
    }
    for(int i=1; i<=h; i++){
        for(int j=1; j<=w; j++){
            if(i==1 && j==1){
                dp[i][j]=1-arr[i][j];
                continue;
            }
            if(arr[i][j]){
                dp[i][j]=min(dp[i-1][j], dp[i][j-1]);
            }
            else{
                dp[i][j]=min(dp[i-1][j], dp[i][j-1])+1;
                if(!arr[i-1][j])
                    dp[i][j]=min(dp[i-1][j], dp[i][j]);
                if(!arr[i][j-1])
                    dp[i][j]=min(dp[i][j-1], dp[i][j]);
            }
        }
    }
    cout<<dp[h][w];
    return 0;
}






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

void Output(const vector<int>& Heap)
{
	for(int i = 1; i < Heap.size(); i++){
		int MyId     = i;
		int ParentId = MyId / 2;
		int LChildId = 2 * MyId;
		int RChildId = 2 * MyId + 1;
		cout << "node "  << MyId       << ": ";
		cout << "key = " << Heap[MyId] << ", ";
		if(ParentId >= 1){
			cout << "parent key = " << Heap[ParentId] << ", ";
		}
		if(LChildId <= Heap.size() - 1){
			cout << "left key = "   << Heap[LChildId] << ", ";
		}
		if(RChildId <= Heap.size() - 1){
			cout << "right key = "  << Heap[RChildId] << ", ";
		}
		cout << endl;
	}
}

int main()
{
	int H;
	cin >> H;
	vector<int> Heap(H+1);
	for(int i = 1; i <= H; i++){
		cin >> Heap[i];
	}
	Output(Heap);
	return 0;
}

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

int main(int argc, char const *argv[]) {
  string s;
   cin>>s;
   int ans=s.size();
   for(int i=0;i<s.size();i++){
       if(s[i]==s[i+1]){
           ans--;
           i+=2;
       }
   }
   cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#l = list(map(int, input().split()))

k = int(input())
a, b = map(int, input().split())

largest = b // k * k

if (largest < a):
    print("NG")
else:
    print("OK")


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

int N;
vector<int> ps_pre;
vector<int> ps;

int main() {
  cin >> N;
  int p;
  rep(i,N) {
    cin >> p;
    ps.push_back(p);
    ps_pre.push_back(p);
  }
  sort(ps.begin(), ps.end());
  int cnt=0;
  rep(i,N) {
    if(ps[i]!=ps_pre[i]) cnt++;
  }
  if(cnt == 0 || cnt == 2){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int used_map[128][128];

int main(void) {
	char my_word[12]="aaaaaaaaaa";
	char ai_word[4]="aa";
	int i;
	while(1) {
		my_word[0]=(ai_word[1]?ai_word[1]:ai_word[0]);
		printf("?%s\n",my_word);fflush(stdout);
		scanf("%s",ai_word);
		if(ai_word[0]!='a')break;
		if(used_map[ai_word[0]][ai_word[1]])break;
		used_map[ai_word[0]][ai_word[1]]=1;
		for(i=1;i<9;i++) {
			my_word[i]++;
			if(my_word[i]>'z') {
				my_word[i]='a';
			} else break;
		}
	}
	puts("!OUT");
	return 0;
}

Measured memory_bytes: 0
#include<cassert>
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<set>
#include<vector>
#include<queue>
#define FL "a"
using namespace std;
typedef long long ll;
typedef long double dd;
const int N=1e6+10;
const int M=1e6+10;
const dd pi=acos(-1);
const int inf=1e9;
const int eps=1e-6;
const ll INF=1ll<<60;
inline ll read(){
  ll d=0,w=1;char ch=getchar();
  while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
  if(ch=='-')w=-1,ch=getchar();
  while(ch<='9'&&ch>='0')d=d*10+ch-48,ch=getchar();
  return d*w;
}
inline void file(){
  freopen(FL".in","r",stdin);
  freopen(FL".out","w",stdout);
}

int m;pair<int,int>p[N];
inline void print(){
  printf("%d\n",m);
  for(int i=1;i<=m;i++)
    printf("%d %d\n",p[i].first,p[i].second);
}
int main()
{
  int n=read();
  for(int i=1;i<=n;i++)
    for(int j=i+1;j<=n;j++)
      if(i+j!=n+(~n&1))p[++m]=make_pair(i,j);
  print();
  return 0;
}


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

int main()
{
  int A, B, C, X;
  cin >> A >> B >> C >> X;

  int res = 0;
  rep(i,A+1){
    rep(j,B+1){
      rep(k,C+1){
        int sum  = i*500+j*100+k*50;
        if(sum==X) res++;
      }
    }
  }

  cout << res << endl;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
counter = 0

for i in range(a+1):
    oturi = x-500*i
    if oturi < 0:
        continue
    else:
        for j in range(b+1):
            oturi_2 = oturi-100*j
            if oturi_2 < 0:
                continue
            else:
                if oturi_2 // 50 <= c:
                    counter += 1
print(counter)

Measured memory_bytes: 3064
count = int(input())
ns = []*count
ns = input().split()
numcnt = 0
divcnt = [0]*count

for i in ns:
    num = int(i)
    while num%2 == 0:
        num = num/2
        divcnt[numcnt] += 1
    numcnt += 1
print(min(divcnt))


Measured memory_bytes: 2940
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();

        if (input.Where(x => x == 5).Count() == 2 && input.Where(x => x == 7).Count() == 1)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  int cnt=0;
  for(int i=0;i<n;i++){
	cin >> h.at(i);
    if(i==0){
      cnt++;
      continue;
    }
    for(int j=0;j<i;j++){
      if(h.at(i) < h.at(j)){
        break;
      }else if(j==(i-1)){
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
  
}

Measured memory_bytes: 256
k = [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]

i = int(input())
print(k[i - 1])

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int i=1;
  while(++i<=n){
    int x=i;
    if(x%3==0){
      cout << " " << i;
      continue;
    }
    while(x){
      if(x%10==3){
	cout << " " << i;
	break;
      }
      x/=10;
    }
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define llp 1000000007
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;


int32_t main(){
	ios::sync_with_stdio(false);
    int n, k;
    cin>>n>>k;
    double ans=0;
    for(int i=1;i<=n;i++){
        double temp=1.0/n;
        // double add=0;
        // double mul=k*1.0/ans;
        // if(mul==0){
            
        // }
        // else{
        //     while()
        // }
        int I=i;
        int times=0;
        while(I<k){
            I=I*2;
            times++;
            temp*=0.5;
        }
        // deb(times);
        // deb(i);
        // deb(temp);
        ans+=temp;
    }

    printf("%0.12lf\n",ans);



	return 0;
}

Measured memory_bytes: 256
// ABC160E - Red and Green Apples

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

int main() {
	int X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;

	vector<int> s;

	vector<int> a(A);
	for (int i = 0; i < A; i++) {
		cin >> a.at(i);
	}
	sort(a.begin(), a.end(), greater<int>());
	for (int i = 0; i < X; i++) {
		s.push_back(a.at(i));
	}

	vector<int> b(B);
	for (int i = 0; i < B; i++) {
		cin >> b.at(i);
	}
	sort(b.begin(), b.end(), greater<int>());
	for (int i = 0; i < Y; i++) {
		s.push_back(b.at(i));
	}

	for (int i = 0; i < C; i++) {
		int temp;
		cin >> temp;
		s.push_back(temp);
	}

	sort(s.begin(), s.end(), greater<int>());

	long long int answer = 0;
	for (int i = 0; i < X + Y; i++) {
		answer += s.at(i);
	}

	cout << answer << endl;

	return 0;
}


Measured memory_bytes: 3188
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) A[i] = sc.nextInt();
    int ans = 0;
    for (int i = 0; i < N; i++) if (A[i] != i + 1) ans++;
    System.out.println((ans <= 2) ? "YES" : "NO");
  }
}

Measured memory_bytes: 24020
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
#define INF 1<<30

int main()
{
    int N;
    cin >> N;
    vector<int> A(N),B(N);
    int p = 0;
    bool dup = false;
    REP(i,N){
        cin >> A[i];
    }
    sort(A.begin(),A.end());
    REP(i,N){
        //cout << A[i];
        if(i>0&&A[i]!=A[i-1])p ++;
        B[p] ++;
    }
    REP(i,N){
        //cout << B[i] << endl;
        if(B[i]>1)dup = true;
    }
    if(!dup)cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(void)
{
	int n,k,i,l[101],x,j;
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++) scanf("%d",&l[i]);
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			if(l[i]<l[j]){
				x=l[i]; l[i]=l[j]; l[j]=x;
			}
		}
	}
	x=0;
	for(i=0;i<k;i++) x+=l[i];
	printf("%d\n",x);
	return 0;
}	

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

int main() {
int a, b, c, d;
cin >> a >> b >> c >> d;
  if ( a + b == c + d ) {
    cout << "Balanced" << endl;
  }
  else if ( a + b > c + d ) {
    cout << "Left" << endl;
  } else 
      cout << "Right" << endl;
  }

Measured memory_bytes: 256
n = int(input())
a_ls = []
for i in range(n):
    a_ls.append(int(input()))
flg = False
cnt = 0
for a in a_ls:
    if flg:
        a += 1
    cnt += a // 2
    if flg and a == 1:
        flg = False
    else:
        flg = True if a % 2 == 1 else False
print(cnt)

Measured memory_bytes: 50976
# ABC178D Manhattan
n = int(input())
z = []
w = []
for i in range(n):
    x,y = map(int, input().split())
    z.append(x-y)
    w.append(x+y)
    
z_ans = max(z)-min(z)
w_ans = max(w)-min(w)
print(max(z_ans,w_ans))

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

int main() {
    int n;
    cin >> n;
    P p;
    vector<P> v(n);
    rep(i, n) {
        cin >> p.second >> p.first;
        v[i] = p;
    }
    sort(v.begin(), v.end());
    int passedTime = 0;
    rep(i, n) {
        // cout << "B:" << v[i].first << "A:" << v[i].second << endl;
        passedTime += v[i].second;
        if(passedTime > v[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main() {
	int n, a, b, c, x;
	while (scanf("%d%d%d%d%d", &n, &a, &b, &c, &x), n) {
		int cnt = 0;
		bool flag = true;
		rep(i, n) {
			int t; scanf("%d", &t);
			bool ok = false;
			for (; cnt <= 10000; cnt++) {
				if (x == t) {
					ok = true;
					break;
				}
				x = (a*x + b) % c;
			}
			if (i == n - 1 && ok == true) {
				printf("%d\n", cnt);
				flag = false;
			}
			x = (a*x + b) % c; cnt++;
		}
		if (flag)puts("-1");
	}
}

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

int main(){
    string s;cin>>s;
    bool isVaried=true;

    for(int i=0;i<s.size()-1;i++){
        for(int j=i+1;j<s.size();j++){
            if(s[i]==s[j]){
                isVaried=false;
                break;
            }
        }
        if(!isVaried) break;
    }
    
    if(isVaried) cout<<"yes"<<endl;
    else cout<<"no"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<atcoder/all>
#include<map>
using namespace std;
typedef long long li;
#define minimize(a,b) (a>(b)?a=(b),1:0)
#define maximize(a,b) (a<(b)?a=(b),1:0)
#define rep(i,n) for(li i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
void linear_sieve(int n,vector<int>& prime,vector<int>& seive){
  int a=seive.size()-1;
  if(a>=n or n<=1) return;
  seive.resize(n+1,0);
  seive[1]=1;
  rep(i,n/2+1){
    if(df)print("i,a",i,a);
    if(i<a)i=a;
    if(i<2){i=1;continue;}
    if(seive[i]==0){
      seive[i]=i;
      prime.push_back(i);
      if(df)printf("[%d]%d ",i,i);
    }
    for(int p:prime){
      if(p>seive[i] or i*p>n) break;
      seive[i*p]=p;
      if(df)printf("[%d]%d ",i*p,p);
    }
    if(df)print("");
  }
  rep(i,n+1){
    if(i==0) i=n/2;
    if(seive[i]==0){
      seive[i]=i;
      prime.push_back(i);
    } 
  }
}

void factorization(li n,map<li,int>& factors,int q=1){
  // require cmath
  factors.clear();
  static vector<int> prime,seive;
  const static int s_max=80000000;
  int a=seive.size()-1;
  int sq=sqrt(n)+1;
  if(q>sq) sq=n;
  //  if(df)print(sq);
  sq=min(sq,s_max);
  //  if(df)print(sq);
  if(a<sq) linear_sieve(sq,prime,seive);
  a=seive.size()-1;
  //  if(df)print("seive_size",a);
  while(n>a){
    for(int p:prime){
      while(n%p==0){
        factors[p]++;
        n/=p;
      }
      if(n<=a) break;
    }
    if(n>a){
      if(factors.size()==0){
        if(s_max<sqrt(n)+1)
          print(n,"has too large prime as factor!!!!!");
        else factors[n]++;
        return;
      }
      map<li,int> f;
      factorization(n,f);
      for(auto p:f){
        factors[p.first]+=p.second;
      }
      return;
    }
  }
  while(n!=1){
    int p=seive[n];
    factors[p]++;
    n/=p;
  }
}

li pow(li a,int r){
  li b=a,ans=1;
  while(r){
    if(r%2) ans*=b;
    b*=b;
    r/=2;
  }
  return ans;
}


int main(){
  li n; cin >>n;
  n*=2;
  //  print(n);
  map<li,int> factors;
  factorization(n,factors);
  
  vector<li> v;
  for(auto x:factors){
    v.push_back(pow(x.first,x.second));
  }
  int m=v.size(),lim=1<<m;
  li ans=n+1;
  vector<li> r(m);
  rep(bs,lim){
    rep(i,m) r[i]=-!!(bs&1<<i);
    pair<li,li> p=atcoder::crt(r,v);
    if(p.first==0) p.first+=p.second;
    if(df)print(p.first,p.second);
    minimize(ans,p.first);
  }
  print(ans);
}


Measured memory_bytes: 193908
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  vector<int> departure(N), arrival(N);
  int a, b;
  for(int i = 0; i < M; i++) {
    cin >> a >> b;
    if(a == 1) departure.at(b - 1) = 1;
    else if (a == N) arrival.at(b - 1) = 1;
    if(b == 1) departure.at(a - 1) = 1;
    else if (b == N) arrival.at(a - 1) = 1;
  }
  for(int i = 0; i < N; i++) {
    if(departure.at(i) == 1 && arrival.at(i) == 1) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

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

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int flag = false;
    if(abs(a - c) <= d) flag = true;
    if(abs(a-b) <= d && abs(b-c) <= d) flag = true;
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl; 
    return 0;
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
typedef long long ll;
int A, B, C, D, tmp;
int main(){
	cin.tie(0);
	cin.sync_with_stdio(0);
	cin >> A >> B >> C >> D;
	while(true){
		if(tmp&1){
			A-=D;
		}else{
			C-=B;
		}
		if(A<=0){cout << "No" << nl;break;}
		else if(C<=0){cout << "Yes" << nl; break;}
		tmp++;
	}
	return 0;
}


Measured memory_bytes: 3652
from collections import Counter
H,W,m = map(int,input().split())
ci = Counter([])
cj = Counter([])
s = set()
for i in range(m):
    h,w = map(int,input().split())
    ci[h] += 1
    cj[w] += 1
    s.add((h,w))
mi = max(ci.values())
mj = max(cj.values())
ci = sorted(ci.items(),key=lambda x:x[1], reverse=True)
cj = sorted(cj.items(),key=lambda x:x[1], reverse=True)
xi = [ci[i][0] for i in range(len(ci)) if ci[i][1] == mi]
xj = [cj[i][0] for i in range(len(cj)) if cj[i][1] == mj]
for i in xi:
    for j in xj:
        if (i,j) not in s:
            print(mi+mj)
            quit()
print(mi+mj-1)

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

int main() {
	int a, b = 0;
	scanf("%d %d", &a, &b);
	if (a > b)
		printf("a > b\n");
	else if (a < b)
		printf("a < b\n");
	else
		printf("a == b\n");
}


Measured memory_bytes: 2140
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    static void solve(Scanner sc) {
        char[] s = sc.nextLine().toCharArray();
        for (int i = 0; i < s.length; i+=2) {
            System.out.print(s[i]);
        }
        System.out.println();
    }
}

Measured memory_bytes: 30512
#include<stdio.h>

int main(void)
{
	unsigned long int a, r, g, b, N;
	unsigned long long int sum = 0;
	long int sumR, sumB, sumG;
	char mozi[4001];
	int tab;

	scanf("%ld", &N);
	scanf("%s", &mozi);

	sumR = 0;
	sumB = 0;
	sumG = 0;

	for (a = 0; a < N; a++) {
		if ('R' == mozi[a]) {
			sumR++;
		}

		if ('B' == mozi[a]) {
			sumB++;
		}
		if ('G' == mozi[a]) {
			sumG++;
		}
	}

	sum = sumR * sumB * sumG;

	for (a = 0; a <= (N / 2); a++) {
		for (b = 0; (b + 2 * a) < N; b++) {
			if ((mozi[b] != mozi[b + a]) && (mozi[b + 2 * a] != mozi[b + a]) && (mozi[b] != mozi[b + a * 2])) {
				sum--;
			}
		}
	}

	printf("%lld", sum);

	return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <tuple>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

using T = tuple<ll,ll>;
using Graph = vector<vector<T>>;

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

    ll a;
    double b;
    cin >> a >> b;

    ll bb = round(b * 100); 
    a *= bb;

    cout << a/100 << endl;

    return 0;
}


Measured memory_bytes: 3796
// By Qingyu
#include <bits/stdc++.h>

double z, f[320][33], t;
int n, c, m, a[9];
inline char nc()
{
	static char buf[1000000], *p1 = buf, *p2 = buf;
	return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2) ? EOF : *p1++;
}

inline int read()
{
	int res = 0, neg = 1;
	char ch;
	do 
	{
		ch = nc(); 
		if (ch == '-') neg = -1;
	} while (ch < 48 or ch > 57);
	do res = res * 10 + ch - 48, ch = nc(); while (ch >= 48 and ch <= 57);
	return res * neg;
}
int main() 
{
	n = read(), c = read(), m = n * c;
	for (int i = 1; i <= n; i++) a[i] = read();
	std::sort(a + 1, a + n + 1);
	do 
	{
		memset(f, 0, sizeof f);
		f[n * a[n]][0] = 1;
		for (int i = 0; i < m; i++) for (int j = i; j <= m; j++) for (int k = 0; k < (1 << (n - 1)); k++) 
		if (i % n && (k >> (i % n - 1) & 1) == 0) f[std::min(std::max(j, i + n * a[i % n]), n * c)][k | (1 << (i % n - 1))] += f[j][k];
		z += f[m][(1 << (n - 1)) - 1];
		++t;
	} while (std::next_permutation(a + 1, a + n));
	printf("%.15f", z / t / pow(c, n - 1));
	return 0;
}


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

const int mod = 998244353;
const int N = 3e5 + 10;

int fact[N];

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

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

int add(int x, int y) {
  x += y;
  if (x >= mod)
    x -= mod;
  return x;
}

int sub(int x, int y) {
  x -= y;
  if (x < 0)
    x += mod;
  return x;
}

int powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1)
      res = res * a % mod;
    a = a * a % mod;
  }
  return res % mod;
}

int mult(int x, int y) {
  return (1LL * x * y) % mod;
}

int divide(int x, int y) {
  return mult(x, powmod(y, mod - 2));
}

int c(int n, int k) {
  return divide(fact[n], mult(fact[n - k], fact[k]));
}

int main() {
  long long n, a, b;
  long long k;
  scanf("%lld %lld %lld %lld", &n, &a, &b, &k);
  fact[0] = 1;
  for (int i = 1; i <= n; ++i)
    fact[i] = mult(fact[i - 1], i);
  int ans = 0;
  for (int i = 0; i <= n; ++i) {
    if (k >= i * a && (k - i * a) % b == 0) {
      long long need_b = (k - i * a) / b;
      if (need_b <= n)
        add_self(ans, mult(c(n, i), c(n, need_b)));
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 1408
n, m = map(int, raw_input().split())
arr = []
for _ in range(n):
	a, b = map(int, raw_input().split())
	arr.append((a,  b))
arr.sort()
money = 0
i = 0
while m > 0:
	a, b = arr[i]
	if m < b:
		money += a*m
		m -= m
	else:
		money += a*b
		m -= b
	i += 1
print money

Measured memory_bytes: 18436
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <typeinfo>
#include <math.h>
#include <iostream>
using namespace std;
long long int n, a[100010], b[100010], cnt = 0;
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		scanf("%d %d", &a[i], &b[i]);
	}
	for (int i = n; i > 0; i--) {
		if ((cnt + a[i]) % b[i]) {
			cnt += b[i] - ((cnt + a[i]) % b[i]);
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>

using namespace std;
using ll = long long;

int main() {
	ll  x;
	cin >> x;
	ll sum = 0, ans;
	for (int i = 1; i <= x; i++) {
		sum += i;
		if (x <= sum) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
int isPrime(int x);
 
int main(void) {
    int n, i;
    int c = 0;
    int *p;
 
    scanf("%d", &n);
 
    p = (int*)malloc(sizeof(int) * n);
    if(p == NULL) {
        printf("memory error\n");
        exit(1);
    }
 
    for(i = 0; i < n; i++) {
        scanf("%d", &p[i]);
    }
 
    for(i = 0; i < n; i++) {
        if(isPrime(p[i]) == 1) {
            c++;
        }
    }
 
    printf("%d\n", c);
 
    free(p);
 
    return 0;
}
 
int isPrime(int x) {
    int i;
    int k = 3;
 
    if(x == 2) {
        return 1;
    } else if(x < 2 || (x % 2 == 0)) {
        return 0;
    } else {
        while(k <= (int)sqrt((double)x)) {
            if (x % k == 0) {
                return 0;
            }
            k += 2;
        }
        return 1;
    }
}
 

Measured memory_bytes: 628
x, y  = map(int,input().split())

def check(kame, tsuru):
    if kame*4 + tsuru*2 == y:
        return True
def checkWhole():
    for kame in range(x+1):
        if check(kame, x-kame):
            return True
    return False

if checkWhole():
    print("Yes")
else:
    print("No")



Measured memory_bytes: 9108
#include <stdio.h>
#define N 200000
int main()
{
  int num,a,arr[N],min,max;
  scanf("%d",&num);
  for(int i = 0; i < num ; i++){
    scanf("%d",&arr[i]);
    if(i == 0) continue;
    if(i ==1){
      min = arr[0];
      max = arr[1] - arr[0];
    }
    if(max < arr[i] - min) max = arr[i]-min;
    if(min > arr[i]) min = arr[i];
  }
  printf("%d\n",max);
}



Measured memory_bytes: 2632
import math

N,K=map(int,input().split())
p=math.ceil(math.log(K,2))
#print(p)
x=N*(2**p)
#print(x)
s=0

for n in range(1,N+1):
    if n>=K:
        s+=(x//N)
    else:
        q=math.ceil(math.log(K/n,2))
        s+=2**(p-q)
        #print(n,2**(p-q))

print(s/x)

Measured memory_bytes: 9080
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a,b,c;
    char d,e;
  	string s;
  	cin>>a>>b;
	
  if(a<=8&&b<=8)
    cout<<"Yay!"<<endl;
  else
    cout<<":("<<endl;
  
 return 0;
}

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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

int find(int b[],int m,int x)
{
	int start = 0,end = m - 1,res = -1;

	while(start <= end)
	{
		int mid = start + ((end - start)/2);
		if(b[mid] == x)
		{
			return mid;
		}
		else if(b[mid] < x)
		{
			res = mid;
			start = mid + 1;
		}
		else 
		{
			end = mid - 1;
		}
	}

	return res;
}
int32_t main()
{
//  c_p_c();
  int n,m,k;
  cin >> n >> m >> k;

  int a[n],b[m];
  for(int i=0;i<n;i++)
  {
  	cin >> a[i];
  }
  for(int i=0;i<m;i++)
  {
  	cin >> b[i];
  }

  int prea[n+1],preb[m+1];
  prea[0] = 0,preb[0] = 0;
  for(int i=1;i<=n;i++)
  {
  	prea[i] = prea[i-1] + a[i-1];
  }

  for(int i=1;i<=m;i++)
  {
  	preb[i] = preb[i-1] + b[i-1];
  }

  int ans = 0;
  for(int i = 0;i<n+1;i++)
  {
  	int rem = k - prea[i];
  	if(rem < 0)
  	{
  		break;
  	}
  	int num = find(preb,m+1,rem);
  	ans = max(ans,(num + i));
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 9888
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    D, N = map(int, readline().split())

    ans = pow(100, D)
    if N < 100:
        ans *= N
    else:
        ans *= 101

    print(ans)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9088
#include <iostream>
#include <cmath>
#include <map>
typedef long long ll;

using namespace std;

int main() {
    ll N, P, tmp;
    cin >> N >> P;
    map<ll, int> prime;
    tmp = P;
    for (ll p = 2; p * p <= P; p++) {
        int count = 0;
        while (tmp % p == 0) {
            tmp /= p;
            count++;
        }
        if (count != 0) {
            prime[p] = count;
        }
    }
    if (tmp > 1) {
        prime[tmp] = 1;
    }

    if (N == 1) {
        cout << P << endl;
        return 0;
    }
    ll gcd = 1;
    for (auto& p: prime) {
        if (p.second >= N) {
            gcd *= pow(p.first, (int)(p.second / N));
        }
    }
    cout << gcd << endl;
	return 0;
}

Measured memory_bytes: 256
N=input()
Ans=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 8, 8, 11, 11, 11, 11, 14, 14, 32, 32, 35, 35, 35, 35, 42, 42, 42, 42, 49, 49, 49, 49, 49, 49, 75, 75, 86, 86, 86, 86, 86, 86, 123, 123, 131, 131, 131, 131, 148, 148, 153, 153, 170, 170, 170, 170, 170, 170, 227, 227, 227, 227, 227, 227, 250, 250, 323, 323, 324, 324, 324, 324, 354, 354, 354, 354, 384, 384, 384, 384, 384, 391, 491, 491, 529, 529, 529, 529, 529, 529, 543]

print Ans[N]

Measured memory_bytes: 2696
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 逆から, zero_cardsに数を貯めて行き、bitで0に出来るか
T = ir()
for _ in range(T):
    N = ir()
    A = lr()
    S = sr()
    zero_cards = []
    for a, person in zip(A[::-1], S[::-1]):
        for z in zero_cards:
            a = min(a, a^z)
        if a:
            if person == '1':
                print(1)
                break
            zero_cards.append(a)
    else:
        print(0)


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

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

  string str;
  int val;
  int prev;
  string op;
  bool first = true;

  while(cin >> str, str != "="){
    if(first){
      val = atoi(str.c_str());
      first = false;
      continue;
    }
    if(isdigit(str[0])){
      if(op == "+"){
        val += atoi(str.c_str());
      }else if(op == "-"){
        val -= atoi(str.c_str());
      }else if(op == "*"){
        val *= atoi(str.c_str());
      }else if(op == "/"){
        val /= atoi(str.c_str());
      }
    }else{
      op = str;
    }
  }

  cout << val << endl;

  return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <map>
#include <list>
#include <algorithm>

using namespace std;
typedef char CHAR;
typedef unsigned char UCHAR;
typedef short SHORT;
typedef unsigned short USHORT;
typedef int INT;
typedef unsigned int UINT;
typedef long long LLONG;
typedef unsigned long long ULLONG;

#define LengthOf(x)    (sizeof(x) / sizeof(x[0]))
#define PI 3.14159265358979323846


//No.5

#if 0
//No.4
typedef struct {
	INT dist;
	INT prevRoom;
	vector<INT> link;
} NODE;

//深さ優先
void update(NODE* node, INT curRoom, INT prevRoom, INT dist, INT* roomCnt)
{
	//update dist
	if (dist < node[curRoom].dist) {
		if (node[curRoom].dist == 0x7FFFFFFF) { *roomCnt += 1; }	//reached room count.

		node[curRoom].dist = dist;
		node[curRoom].prevRoom = prevRoom;

		//next room
		for (int i = 0; i < node[curRoom].link.size(); ++i) {
			update(node, node[curRoom].link[i], curRoom, dist + 1, roomCnt);
		}
	}
}

//幅優先
typedef struct {
	INT curRoom;
	INT prevRoom;
	INT dist;
} QUERY;

void update2(NODE* node, INT curRoom, INT prevRoom, INT dist, INT* roomCnt, list<QUERY>* query)
{
	//update dist
	if (dist < node[curRoom].dist) {
		if (node[curRoom].dist == 0x7FFFFFFF) { *roomCnt += 1; }	//reached room count.

		node[curRoom].dist = dist;
		node[curRoom].prevRoom = prevRoom;

		//next room
		for (int i = 0; i < node[curRoom].link.size(); ++i) {
			//update(node, node[curRoom].link[i], curRoom, dist + 1, roomCnt);
			QUERY newQuery;
			newQuery.curRoom = node[curRoom].link[i];
			newQuery.prevRoom = curRoom;
			newQuery.dist = dist + 1;
			query->push_back(newQuery);
		}
	}

	if (query->empty() == false) {
		QUERY proc = query->front();
		query->pop_front();
		update2(node, proc.curRoom, proc.prevRoom, proc.dist, roomCnt, query);
	}
}

int main()
{
	INT N, M;
	cin >> N >> M;

	NODE* node = new NODE[N + 1];
	for (int i = 0; i < N + 1; ++i) {
		node[i].prevRoom = 0;
		node[i].dist = 0x7FFFFFFF;
	}

	for (int i = 0; i < M; ++i) {
		INT a, b;
		cin >> a >> b;
		node[a].link.push_back(b);
		node[b].link.push_back(a);
	}

	INT roomCnt = 0;
	//update(node, 1, 0, 0, &roomCnt);
	list<QUERY> query;
	update2(node, 1, 0, 0, &roomCnt, &query);

	if (roomCnt != N) {
		cout << "No";
	}
	else {
		cout << "Yes" << endl;
		for (int i = 2; i < N + 1; ++i) {
			cout << node[i].prevRoom << endl;
		}
	}

	return 0;
}
#endif

#if 1
//No.3
int main()
{
	//余弦定理
	INT A, B, H, M;
	cin >> A >> B >> H >> M;

	double theta_H = 360.0 * ((60.0 * H + M) / (60.0 * 12));
	double theta_M = 360.0 * (M / 60.0);

	double theta = abs(theta_H - theta_M);
	if (theta > 180) { theta = 360 - theta; }

	double c_pow2 = A * A + B * B - 2 * A*B*cos(2 * PI * (theta / 360));
	//cout << sqrt(c_pow2);
	printf("%.16lf", sqrt(c_pow2));

	return 0;
}
#endif


Measured memory_bytes: 4184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int A = in(),B = in();
    cout << max({A+B,A-B,A*B}) << "\n";
}


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

using namespace std;

int main(int argc, char *argv[]) {
    int64_t N;
    cin >> N;

    int64_t A, B, C, D, E;
    cin >> A >> B >> C >> D >> E;

    int64_t m = min({A, B, C, D, E});
    int64_t plus = (m == 1) ? 4 : 5;
    int64_t ans = (N / m) + plus;

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


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};
vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>l(n);
  rep(i,0,n)cin>>l[i];
  sort(ALL(l));
  rep(i,0,n)rep(j,i+1,n)rep(o,j+1,n){
    if(l[i]+l[j]>l[o]&&l[i]!=l[j]&&l[j]!=l[o])res++;
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 3676
N = int(input())
h = list(map(int,input().split()))

dp = [0 for i in range(N)]
dp[1] = abs(h[1]-h[0])

for i in range(2,N):
    dp[i] = min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2])
print(dp[N-1])


Measured memory_bytes: 13928
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define rev1(i,n) for(ll i=n;i>0;i--)
#define pb push_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int> >
#define vb vector<bool>
#define pii pair<int,int>
#define F first
#define S second
#define INF 1e9+7
typedef long long int ll;
const int N=1e5+7;
int ans[N];
int score;

void solve(){
    int n,m;cin>>n>>m;
    int arr[n];
    priority_queue<int> q;
    ll sum=0;
    rep(i,n) {cin>>arr[i];q.push(arr[i]);}
    rep(i,m){
        int tmp=q.top();
        q.pop();
        q.push(tmp/2);
    }
    rep(i,n){
        sum+=q.top();
        q.pop();
    }
    cout<<sum;
}
signed main() {
    // your code goes here
    IOS
    ll t=1;
    //cin>>t;
    rep1(i,t){
        solve(); 
    }
}

Measured memory_bytes: 1148
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1001001001;
const double PI = acos(-1);

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

int main() {
    int n;
    cin >> n;
    set<int> s;
    rep(i, n) {
        int b;
        cin >> b;
        s.insert(b);
    }

    if (s.size() % 2 == 0) {
        cout << s.size()-1 << endl;
    } else {
        cout << s.size() << endl;
    }
}


Measured memory_bytes: 4992
n, m = map(int, input().split())
h = list(map(int, input().split()))
f = [1]*n
li = []
for i in range(int(m)):
    li.append(list(map(int, input().split())))
    if h[int(li[i][0])-1] > h[int(li[i][1])-1]:
        f[li[i][1]-1] = 0
    elif h[li[i][0]-1] < h[li[i][1]-1]:
        f[li[i][0]-1] = 0
    else:
        f[li[i][1]-1] = 0
        f[li[i][0]-1] = 0

print(f.count(1))


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

int main(){
  ll ans=0;
  int n;
  cin>>n;
  if(n==0){
    int a;
    cin>>a;
    if(a==1){
      cout<<1<<endl;
      return 0;
    }
    cout<<-1<<endl;
    return 0;
  }
  if(n==1){
    int a,b;
    cin>>a>>b;
    if(a>=1){
      cout<<-1<<endl;
      return 0;
    }
    if(b<=2){
      cout<<1+b<<endl;
      return 0;
    }
    cout<<-1<<endl;
    return 0;
  }
  ll now=1;
  ll vec[n];
  ll vecb[n+1];
  for(int i=0;i<n+1;i++){
    cin>>vecb[i];
  }
  for(int i=0;i<n+1;i++){
    ll x=vecb[i];
    if(i==0&&x==1){
      cout<<-1<<endl;
      return 0;
    }
    vec[i]=now;
    now-=x;
    if(now<0){
      cout<<-1<<endl;
      return 0;
    }
    if(now==0){
      if(i!=n){
        cout<<-1<<endl;
        return 0;
      }
    }
    if(now>1e17||now<0){
      now=1e20+1;
    }
    else{
      now*=2;
    }
  }
  ll sum=0;
  for(int i=n;i>=0;i--){
    sum+=vecb[i];
    ans+=min(sum,vec[i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 5176
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20)
#define int long long
#define double long double
const int INF = 1e18, MOD = 1e9 + 7;

int h, w;
string b[2222];
int
    l[2222][2222] = {},
    r[2222][2222] = {},
    u[2222][2222] = {},
    d[2222][2222] = {};

signed main() {
    INCANT;
    cin>>h>>w;
    for (int i = 0; i < h; i++) {
        cin>>b[i];
        int now = 1;
        for (int j = 0; j < w; j++) {
            if (b[i][j] == '#') now = 0;
            else l[i][j] = now;
            now++;
        }
        now = 1;
        for (int j = w - 1; j >= 0; j--) {
            if (b[i][j] == '#') now = 0;
            else r[i][j] = now;
            now++;
        }
    }
    for (int j = 0; j < w; j++) {
        int now = 1;
        for (int i = 0; i < h; i++) {
            if (b[i][j] == '#') now = 0;
            else u[i][j] = now;
            now++;
        }
        now = 1;
        for (int i = h - 1; i >= 0; i--) {
            if (b[i][j] == '#') now = 0;
            else d[i][j] = now;
            now++;
        }
    }
    int res = -INF;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            res = max(res, l[i][j] + r[i][j] + u[i][j] + d[i][j]);
        }
    }
    cout<<res - 3<<endl;
}

Measured memory_bytes: 149888
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#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 DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1)
	{
		cerr << name << " = " << arg1 << endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args)
	{
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
		__f(comma+1, args...);
	}
#else
#define debug(...)
#endif

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

#define FAST_IO std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define ld long double
#define sz(a) (ll)(a).size()
#define endl "\n"

// priority_queue<ll, vector<ll>, less<ll>>pq;     // Max Heap
// priority_queue<ll, vector<ll>, greater<ll>>pq;  // Min Heap

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest
//cout << k << "kth (1 based indexing) smallest: " << *A.find_by_order(k - 1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

int main()
{
	FAST_IO;

 	ll n, k;
 	cin >> n >> k;
 	if(n % k == 0) cout << 0 << endl;
 	else
 	{
 		if(n < k) cout << min(n, k - n) << endl;
 		else
 		{
 			n = n - (n / k) * k;
 			cout << min(n, k - n) << endl;
 		}
 	}   
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n,m;
  cin>>n>>m;
  vector<int> count(n+1,0);
  int a,b;
  rep(i,m){
    cin>>a>>b;
    count[a]++;
    count[b]++;
  }
  REP(i,1,n+1){
    cout<<count[i]<<'\n';
  }
  return(0);
}


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

int main(){
  ll A,B,C,K;
  cin >> A >> B >> C >> K;

  if(A>=K)
    cout << K << "\n";
  
  else if(B>=K-A)
    cout << A << "\n";
    
  else cout << A-(K-(A+B)) << "\n";
  return 0;
}
      


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <cassert>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 2000;
int dp[5 + nmax * 3][5 + nmax * 4];

int main() {
  int n, modulo;
  std::cin >> n >> modulo;
  dp[0][nmax] = 1;
  for(int i = 1;i <= n * 3; i++) {
    for(int j = 0; j <= 4 * nmax; j++) {
      if(1 <= i && 1 <= j)
        dp[i][j] += dp[i - 1][j - 1];
      if(modulo <= dp[i][j])
        dp[i][j] -= modulo;
      if(2 <= i && j < 4 * nmax)
        dp[i][j] += 1LL * dp[i - 2][j + 1] * (i - 1) % modulo;
      if(modulo <= dp[i][j])
        dp[i][j] -= modulo;
      if(3 <= i)
        dp[i][j] += 1LL * dp[i - 3][j] * (i - 2) * (i - 1) % modulo;
      if(modulo <= dp[i][j])
        dp[i][j] -= modulo;
    }
  }
  int result = 0;
  for(int i = nmax; i <= 4 * nmax; i++) {
    result += dp[n * 3][i];
    if(modulo <= result)
      result -= modulo;
  }
  std::cout << result;
  return 0;
}


Measured memory_bytes: 191164
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<set>
#include<iostream>
#include<stdlib.h>
using namespace std;
typedef long long ll;


int main(void) {
	int a[3] = { 0 };
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	int cost = abs(a[2] - a[1]) + abs(a[1] - a[0]);
	cout << cost << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2147483647
#define int long long
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif

int ans;

signed main(){
	int n;
	vector<int> v;
	int need=0;
	
	int a[111111],b[111111];
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++){
		cin>>b[i];
		if(a[i]>b[i])v.push_back(a[i]-b[i]);
		if(a[i]<b[i]){need+=b[i]-a[i];ans++;}
	}
	if(need==0){
		cout<<0<<endl;
		return 0;
	}
	sort(v.begin(),v.end(),greater<int>());
	for(auto x:v){
		need-=x;
		ans++;
		if(need<=0){
			cout<<ans<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	

}

Measured memory_bytes: 2424