akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#define N 200010
using namespace std;
char str1[N],str2[N];
bool num1[N],num2[N];
int t1[N],t2[N],n;
int work()
{
	int tot1=0,tot2=0;
	for(int i=1;i<n;i++) if(!num1[i] && num1[i+1]) t1[++tot1]=i;
	tot2=n;
	memset(t2,0,sizeof(t2));
	for(int i=1;i<n;i++) if(!num2[i] && num2[i+1]) t2[++tot2]=i;
	for(int i=1;i<=n;i++) t2[++tot2]=n;
	int ans=1000000000;
	for(int i=1;i<=tot2-tot1+1;i++)
	{
		int res=0;
		for(int j=1;j<i;j++) res+=t2[j];
		for(int j=1;j<=tot1;j++) res+=abs(t1[j]-t2[i+j-1]);
		for(int j=i+tot1;j<=tot2;j++) res+=n-t2[j];
		ans=min(ans,res);
	}
	return ans;
}
int main()
{
	scanf("%d",&n);
	scanf("%s%s",str1+1,str2+1);
	for(int i=1;i<=n;i++) num1[i]=str1[i]=='1',num2[i]=str2[i]=='1';
	if(n<=2)
	{
		int ans=0;
		for(int i=1;i<=n;i++) ans+=num1[i]!=num2[i];
		printf("%d\n",ans);
		return 0;
	}
	int res=work();
	for(int i=1;i<=n;i++)
	num1[i]=!num1[i],num2[i]=!num2[i];
	res+=work();
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 1024
s=input()
A=int(s[:2])
B=int(s[2:])
if 0<A<=12 and 0<B<=12:
    print("AMBIGUOUS")
elif (A==0 or A>12) and 0<B<=12:
    print("YYMM")
elif 0<A<=12 and (B==0 or B>12):
    print("MMYY")
else:
    print("NA")

Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
    if a[i] <= b[i]:
        ans += a[i]
        b[i] -= a[i]
        if a[i + 1] <= b[i]:
            ans += a[i + 1]
            a[i + 1] = 0
        else:
            ans += b[i]
            a[i + 1] -= b[i]
    else:
        ans += b[i]
print(ans)

Measured memory_bytes: 18624
k = int(input())

if k < 50:
    print(2)
    if k % 2 == 0:
        print(str(1 + k // 2) + ' ' + str(1 + k // 2))
    else:
        print(str(k // 2) + ' ' + str(3 + k // 2))
else:
    print(50)
    a = k // 50 + 49
    if k % 50 == 0:
        l = [str(a)] * 50
        print(' '.join(l))
    else:
        alpha = k % 50
        l = [str(a + 51 - alpha)] * alpha + [str(a - alpha)] * (50 - alpha)
        print(' '.join(l))

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

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (int k = 0; k < n; ++k) cin >> a[k];
    ll q;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        ll b, e, k;
        cin >> b >> e >> k;
        int ans = 0;
        for (int j = b; j < e; ++j) {
            if (a[j] == k) ans++;
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3124
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define dll(x) scanf("%I64d",&x)
#define xll(x) printf("%I64d\n",x)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll powmod(ll a,ll b,ll MOD){ll ans=1ll;while(b){if(b&1)ans=ans*a%MOD;a=a*a%MOD;b>>=1;}return ans;}
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
const int N=2003;
struct node
{
	int hang;
	int lie;
	int v;
}dp[N][N];
char a[N][N];
int n,m,q;
int x1,x2,y11,y2;
int main()
{
	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\in.txt.txt","r",stdin);
	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\out.txt.txt","w",stdout);
	gbtb;
	cin>>n>>m>>q;
	repd(i,1,n)
	{
		repd(j,1,m)
		{
			cin>>a[i][j];
		}
	}
	repd(i,1,n)
	{
		repd(j,1,m)
		{
			dp[i][j].v=dp[i][j-1].v+dp[i-1][j].v-dp[i-1][j-1].v+(a[i][j]=='1'?1:0);
			dp[i][j].lie=dp[i][j-1].lie+dp[i-1][j].lie-dp[i-1][j-1].lie;
			dp[i][j].hang=dp[i][j-1].hang+dp[i-1][j].hang-dp[i-1][j-1].hang;

			if(a[i][j]=='1')
			{
				if(a[i][j]==a[i-1][j])
				{
					dp[i][j].lie++;
				}
				if(a[i][j]==a[i][j-1])
                {
                    dp[i][j].hang++;
//                    num++;
                }
			}

		}
	}
	repd(qq,1,q)
	{
		cin>>x1>>y11>>x2>>y2;
		int cnt=dp[x2][y2].v-dp[x2][y11-1].v-dp[x1-1][y2].v+dp[x1-1][y11-1].v;
		cnt-=dp[x2][y2].hang-dp[x2][y11].hang-dp[x1-1][y2].hang+dp[x1-1][y11].hang;
		cnt-=dp[x2][y2].lie-dp[x1][y2].lie-dp[x2][y11-1].lie+dp[x1][y11-1].lie;
		cout<<cnt<<endl;
	}


    return 0;
}

inline void getInt(int* p) {char ch;do {ch = getchar();}
while (ch == ' ' || ch == '\n');if (ch == '-') {*p = -(getchar() - '0');
while ((ch = getchar()) >= '0' && ch <= '9') {*p = *p * 10 - ch + '0';}}
else {*p = ch - '0';while ((ch = getchar()) >= '0' && ch <= '9')
{*p = *p * 10 + ch - '0';}}}


Measured memory_bytes: 52736
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    string S;
    cin >> S;

    int len = S.length();
    S = S + 'R';
    int nChilds[len];
    REP(i, len) nChilds[i] = 0;
    bool isR = true;
    int cr = 1;
    int cl = 0;
    FOR(i, 1, len + 1) {
        if (isR && S[i] == 'R') cr++;
        else if (isR && S[i] == 'L') {
            cl++;
            isR = false;
        }
        else if (!isR && S[i] == 'L') cl++;
        else if (!isR && S[i] == 'R') {
            nChilds[i - cl - 1] = (cr + 1) / 2 + (cl / 2);
            nChilds[i - cl] = (cr / 2) + (cl + 1) / 2;
            cr = 1;
            cl = 0;
            isR = true;
        }
    }
    cout << nChilds[0];
    REP(i, len - 1) cout << " " << nChilds[i + 1];
    cout << endl;
    return 0;
}


Measured memory_bytes: 1020
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//
//    #pragma GCC optimize("unroll-loops")
//    #pragma GCC optimize("Ofast")
//    #pragma GCC optimize("-O3")
//    #pragma GCC optimize("no-stack-protector")
//    #pragma GCC optimize("fast-math")

#define fi first
#define f first
#define se second
#define s second
#define vi_a vector<int>a;
#define p_b emplace_back
////////////////////////////////???????????????CHECK THIS OUT???????????????//////////////////////////////
#define ll long long
////////////////////////////////???????????????CHECK THIS OUT???????????????//////////////////////////////
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define fast_io cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
#define getfiles    ifstream cin("input.txt");ofstream cout("output.txt");
#define pw(x) (1ll << x)
#define sz(x) (ll)x.size()
#define endl "\n"
#define rall(x) x.rbegin(),x.rend()
#define len(a) (ll)a.size()
#define rep(x,l,r) for(ll x=l;x<r;x++)
//#define for(int i=0;i<n;i++) for(ll i=0;i<n;i++)
using namespace std;
//using namespace __gnu_pbds;
ld eps = (ld)1 / 1e7;
ll inf = 1e18, mod2 = 998244353, mod1 = 1e9 + 7;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
ll binmult(ll a, ll b, ll mod) { return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod : (2 * binmult(a, b / 2, mod)) % mod) : 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//const ll to[5]={0,4,6,7,9};
//const ll N=2*1e5+1;
const ll R=1e4;
//const ll to[7]={1,2,3,1,3,2,1};
const ll tx[4]={2,-1,2,1};
const ll ty[4]={-1,2,1,2};
const char rev_to[4]={'E','W','N','S'};
const int N=2*1e5+1;
void brute(vector<ll> a,ll val){

}
signed main(){
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    n++;
    for(ll i=k;i<=n;i++){
        ans+=1+((n-i)%mod1*i)%mod1;
        ans%=mod1;
    }
    cout<<ans;
    return 0;
}
/*

    если WA , то чекер говно, поэтому почекай l8 строчку

*/


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
const int N=1000005;
int n,r[N],l[N],cnt[3],p[3];
char s[N];
int cmp(int a,int b){
	return cnt[a]<cnt[b];
}
void del(int x){
	r[l[x]]=r[x];
	l[r[x]]=l[x];
}
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	s[0]='D';s[n+1]='E';
	r[n+1]=n+1;
	for (int i=0;i<=n+1;i++)r[i]=i+1,l[i]=i-1;
	for (int i=2;i<=n;i++)
		if (s[i]==s[i-1])del(i);
		else cnt[s[i]-'A']++;
	cnt[s[1]-'A']++;
	p[0]=0;p[1]=1;p[2]=2;
	sort(p,p+3,cmp);
	if (cnt[p[1]]!=cnt[p[2]]){
		for (int i=r[0];i!=n+1;i=r[i])
			if (s[i]==p[2]+'A'&&s[l[i]]!=s[r[i]]){
				cnt[p[2]]--;del(i);
				if (cnt[p[2]]==cnt[p[1]])break;
			}
		if (cnt[p[1]]!=cnt[p[2]])
			for (int i=r[0];i!=n+1;i=r[i])
				if (s[l[i]]==p[0]+'A'&&s[i]==p[2]+'A'){
					cnt[p[0]]--,cnt[p[2]]--,del(l[i]),del(i);
					if (cnt[p[2]]==cnt[p[1]])break;
				}
	}
	if (cnt[p[0]]<cnt[p[1]]){
		for (int i=r[r[0]];i!=n+1;i=r[i])
			if (s[l[l[i]]]!=s[r[i]])
				if (s[l[i]]==p[1]+'A'&&s[i]==p[2]+'A'||s[l[i]]==p[2]+'A'&&s[i]==p[1]+'A'){
					cnt[p[1]]--;del(l[i]);del(i);
					if (cnt[p[0]]==cnt[p[1]])break;
				}
	}
	for (int i=r[0];i!=n+1;i=r[i])putchar(s[i]);
}


Measured memory_bytes: 9984
# -*- coding: utf-8 -*-

a, b = map(int, input().split())
x = (a + b) / 2
# https://qiita.com/sak_2/items/b2dd8bd1c4e4b0788e9a
round = lambda x: int((x * 2 + 1) // 2)
print(round(x))

Measured memory_bytes: 2940
n=int(input())
*b,=map(int,input().split())
a=[0]+b+[0]
sum=0
for i in range(n+1):
    sum+=abs(a[i+1]-a[i])
for i  in range(n):
    print(sum-abs(a[i+1]-a[i])-abs(a[i+2]-a[i+1])+abs(a[i+2]-a[i]))

Measured memory_bytes: 16096
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    int k, s;
    cin >> k >> s;
    int ans = 0;
    for(int x = 0; x <= k; x++){
        for(int y = 0; y <= k; y++){
            int z = s - x - y;
            if(z >= 0 && z <= k){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

int dy[5] = { 0,0,1,-1,0 };
int dx[5] = { 1,-1,0,0,0 };


int main(void) {
	string s;
	string t;

	cin >> s;

	/*FOR(i, 0, s.size() - 1) {
		if (s[i] == '0') {
			t += '0';
		}
		else if (s[i] == '1') {
			t += '1';
		}
		else {
			if (t != "") {
				t[t.size() - 1] = '2';
			}
		}
	}*/

	FOR(i, 0, s.size() - 1) {
		if (s[i] == 'B') {
			RFOR(j, i - 1, 0) {
				if (s[j] == '0' || s[j] == '1') {
					s[j] = '2';
					break;
				}
			}
		}
	}

	//cout << t << endl;

	FOR(i, 0, s.size() - 1) {
		if (s[i] == '1' || s[i] == '0') {
			cout << s[i];
		}
	}
	cout << endl;

	/*FOR(i, 0, t.size() - 1) {
		if (t[i] == '1' || t[i] == '0') {
			cout << t[i];
		}
	}
	cout << endl;*/

	return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,c;
  cin >> n >> m;
  ll a[n] ={},ans[n] = {};
  rep(i,n){
    cin >> a[i];
  }
  rep(j,m){
    cin >> c;
    rep(i,n){
      if(c >= a[i]){
        ans[i]++;
        break;
      }
    }
  }
  cout << 1+max_element(ans,ans+n) - ans<<endl;
  return 0;
}

Measured memory_bytes: 3160
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int r = scan.nextInt();
		
		if(n>=10) {
			System.out.println(r);
		}else {
			System.out.println(r+100*(10-n));
		}
		
	}
}




Measured memory_bytes: 21716
#include <iostream>
#include <string>
using namespace std;
using ll = long long;

int main() {
    // input
    string S;
    cin >> S;
    const ll BIT_0 = (1<<0);
    const ll BIT_1 = (1<<1);
    const ll BIT_2 = (1<<2);
    
    // calculation
    ll A = S[0] - '0', B = S[1] - '0', C = S[2] - '0', D = S[3] - '0';
    ll bit = 1, res;
    bool flag_A, flag_B, flag_C;
    for (ll i = 0; i < (bit<<3); ++i) {
        res = A;
        flag_A = BIT_0 & i, flag_B = BIT_1 & i, flag_C = BIT_2 & i;
        res = res + (flag_A ? B: -B);
        res = res + (flag_B ? C: -C);
        res = res + (flag_C ? D: -D);
        if (res == 7) break;
    }
    
    cout << A << (flag_A ? '+': '-') << B << (flag_B ? '+': '-') << C << (flag_C ? '+': '-') << D << "=7" << "\n";
    
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
from collections import Counter
C=Counter(A)
Q=int(input())

ANS=0
for i in C:
    ANS+=i*C[i]
    
for qq in range(Q):
    B,X=map(int,input().split())
    ANS+=X*C[B]
    C[X]+=C[B]

    ANS-=B*C[B]

    del(C[B])

    print(ANS)


Measured memory_bytes: 88320
n = int(input())
a = list(map(int,input().split()))
l = [0]*32

for i in a:
    for j in range(32):
        if i >> j & 1:
            l[j] += 1

ans = [0]*n

for i in range(32):
    if l[i]%2 == 0:
        for j in range(n):
            if a[j]>>i & 1:
                ans[j] += 1<<i
    else:
        for j in range(n):
            if not a[j] >> i & 1:
                ans[j] += 1<<i
print(*ans)

Measured memory_bytes: 95932
N = int(input())

count = 0
ans = "No"
for _ in range(N):
  d1, d2 = map(int, input().split())
  if d1 == d2:
    count += 1
  else:
    count = 0
  if count == 3:
    ans = "Yes"
    break
print(ans)

Measured memory_bytes: 9176
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int N;
  vector <int> L;
  cin >> N;
  for(int i=0; i<N; i++){
    int l;
    cin >> l;
    L.push_back(l);
  }
  sort(L.begin(), L.end());
//  auto result = unique(L.begin(), L.end());
//  L.erase(result, L.end());
  int n = L.size();
  int ans = 0;
  for(int i=0; i<n-2; i++){
    for(int j=i+1; j<n-1; j++){
      int a = L[i], b = L[j];
      for(int k=n-1; k>j; k--){
        if(a+b > L[k]){
          ans += k-j;
          break;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 888
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];
        int[] B = new int[N];
        for(int i=0;i<N;i++){
            A[i] = sc.nextInt();
            B[i] = A[i];
        }
        Arrays.sort(A);

        for(int i=0;i<N;i++){
            if(B[i] == A[N-1]){
                System.out.println(A[N-2]);
            } else {
                System.out.println(A[N-1]);
            }

        }


    }

}


Measured memory_bytes: 93668
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int ans = 0;
        for (int i = 1; i < s.length; i++) {
            if (s[i] == s[i - 1]) {
                ans++;
                if (s[i] == '0') {
                    s[i] = '1';
                } else {
                    s[i] = '0';
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 27604
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func newScanner() *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	return scanner
}

var sc = newScanner()

func scanInt() int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func scanString() string {
	if sc.Scan() {
		return sc.Text()
	}
	panic(sc.Err())
}

func main() {
	s := scanString()
	if strings.ToLower(s) == s {
		fmt.Println("a")
	} else {
		fmt.Println("A")
	}
}

func debug(a ...interface{}) {
	fmt.Println(a...)
}


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

int main() {
  int n;
  int ans = 0;
  cin >> n;
  vector<int> a(n);
  for(int i = 0;i<n;i++){
    cin >> a.at(i);
    if(i % 2 == 0){
      if(a.at(i) % 2 == 1){
        ans = ans +1;
      }
    }
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) rrepi(i,0,n)
#define debug(var)  do{std::cout << #var << " : "; view(var);}while(0)
using namespace std;
typedef long long ll;
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){for(const auto& v : vv){ view(v); } }
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void viewarr(T arr[], int n) { for(int i = 0; i < n; ++i) std::cout << arr[i] << " "; std::cout << std::endl; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;

int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int dist[20][20][20][20];

int main() {
    int H, W, ans = 0;
    cin >> H >> W;
    rep(i,W)rep(j,H)rep(k,W)rep(l,H) dist[i][j][k][l] = INF;
    vector<string> mp(H);
    rep(i,H) {
        cin >> mp[i];
    }
    rep(y,H) {
        rep(x,W) {
            if(mp[y][x] == '#') continue;
            queue<pair<int,int>> que;
            que.emplace(x,y);
            dist[x][y][x][y] = 0;
            while(!que.empty()) {
                pair<int,int> p = que.front();
                que.pop();
                rep(i,4) {
                    int cx = p.first + dx[i];
                    int cy = p.second + dy[i];
                    if(0 <= cx && cx < W && 0 <= cy && cy < H && mp[cy][cx] != '#' && dist[x][y][cx][cy] == INF) {
                        dist[x][y][cx][cy] = dist[x][y][p.first][p.second] + 1;
                        que.emplace(cx,cy);
                    }
                }
            }
            rep(i,H) rep(j,W) if(dist[x][y][j][i] != INF) chmax(ans, dist[x][y][j][i]);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
lli pow(lli base, lli power){
    lli res = 1;
    while(power){
        if(power&1)res*=base;
        base*=base;
        power>=1;
    }
    return res;
}
int main(){
    double n,k;
    cin >> n >> k;
    double ans = 1/n;
    //cout << ans<<endl;
    double temp = 0;
    for(int i =1;i<=n;i++){
        lli num =i;
        lli counter = 0;
        while(num<k){
                num*=2;
                counter+=1;
        }
        temp+=(1/pow(2,counter));
    }
    cout << fixed ;
    cout << setprecision(15) << ans*temp << endl;
}


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

using namespace std;

typedef long long ll;

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

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

    if((a==b and c!=a) or (a==c and b!=c) or (b==c and a!=c)) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}

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

using namespace std;

int main(void)
{
	int a,b,t;
	int ans=0,time=0;

	cin>>a>>b>>t;

	while(time<t+0.5){
		time+=a;
		if(time>t+0.5) break;
		ans+=b;
	}

	cout<<ans<<endl;

	return 0;
}


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

#define rep(i,x,y) for(int (i)=(x);(i)<(y);(i)++)

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

  rep(i,0,n){
    int Y,M,D;
    int count=0;
    cin>>Y>>M>>D;

    while(!(Y==1000&&M==1&&D==1)){
      count++;
      if(Y%3==0){
        D++;
        if(D>20){
          D=1;
          M++;
        }
      }else{
        D++;
        if(M%2==1){
          if(D>20){
            D=1;
            M++;
          }
        }else{
          if(D>19){
            D=1;
            M++;
          }
        }
      }
      if(M>10){
        M=1;
        Y++;
      }
    }

    cout<<count<<endl;
  }

  return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("myfile.gir","r",stdin);freopen ("myfile.cik","w",stdout);
#define mod 1000000007
using namespace std;

ll n,ar[N],sum;

int main()
{
    fast;
    for(int i=1;i<=3;i++)
        cin>>ar[i];
    sort(ar+1,ar+4);
    sum=ar[1]*ar[2];
    sum/=2;
    cout<<sum;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define NFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); --i)
#define endl "\n"
#define mp make_pair
#define X first
#define Y second
#define inf 1e9
#define mod 1000000007
#define pb push_back
#define Case cout<<"Case #"<<++cas<<": ";
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) v.begin(),v.end()
#define sz(x) int(x.size())
// #define lli int
typedef long long int lli;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef pair<lli,lli> pll;
typedef vector<lli> vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef complex <long double> complex_t;
const long double PI = acos((long double)-1.0);

#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}

int main() {
    string s;
    cin >> s;
    int n = sz(s);
    vi pos;
    FOR(i, 0, sz(s)-2) {
        if (s[i] != s[i+1]) {
            pos.pb(i+1);
        }
    }
    FOR(i, 0, sz(pos)-1) {
        pos[i] = max(pos[i], n-pos[i]);
    }
    if (pos.empty()) {
        cout << n << endl;
    } else {
        int answer1 = pos[0];
        for (auto v : pos) { answer1 = min(answer1, v);}
        cout << answer1 << endl;
    }
return 0;}

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

#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define rep(i, n) for(ll i=0; i < (n); i++)

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq_int; // sho-jun
typedef priority_queue<ll, vector<ll>, less<ll> > lpq_int; // ko-jun

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

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

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

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

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



void fact(ll a, ll fact[]){
  ll i=2;
  ll original = a;
  fact[1]=1;
  rep(i, 1000000-1){
    int ii = i+2;
    while(a%ii==0){
      fact[ii] +=1;
      a = a/ii;
    }
  }
  if(a>1){
    fact[0]=a;
  }
  
  return;
}

int N, K;
vector<ll> pos;
vector<ll> neg;

int main(){
  cin >>N >> K;
  rep(i, N){
    int tmp; cin >> tmp;
    if(tmp>=0){
      pos.push_back(tmp);
    }else{
      neg.push_back(-tmp);
    }
  }
  sort(ALL(pos));
  sort(ALL(neg));
  int sizepos = pos.size();
  int sizeneg = neg.size();
  pos.insert(pos.begin(), 0);
  neg.insert(neg.begin(), 0);

  ll ans=1e12;
  for(int i=0;i<=K;i++){
    int j= K-i;
    //cout << i << " " << j << endl;
    if(i>sizepos || j>sizeneg){
      continue;
    }
    ll tmp1 = min(pos[i], neg[j]);
    ll tmp2 = max(pos[i], neg[j]);
    //cout << i << " " << j << tmp1 << " " << tmp2 << endl;
    ans = min(ans, tmp1*2+tmp2);
  }
  cout << ans;
}


Measured memory_bytes: 1656
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int X, A;

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

  cin >> X >> A;

  if (X < A) {
    cout << 0 << endl;
  } else {
    cout << 10 << endl;
  }

  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1000000007;
const ll N=998244353;
ll power(ll x,ll n){ll res=1;while(n>0){if(n&1) res=res*x%MOD;x=x*x%MOD;n>>=1;}return res;}
ll modinverse(ll a){return power(a, MOD-2);}
void solve()
{
    ll n, x, m;
    cin>>n>>x>>m;
    map<ll, ll> mp1, pos;
    mp1[x]++;
    vl ans;
    ans.pb(x);
    pos[x]=0;
    ll dupl=0;
    for(ll i=0;; i++)
    {
    	ll ele=ans.back();
    	ele=(ele*ele)%m;
    	if(mp1.find(ele)!=mp1.end())
    	{
    		dupl=ele;
    		break;
    	}
    	mp1[ele]++;
    	pos[ele]=(i+1);
    	ans.pb(ele);
    }
    ll times=(n%(ll)ans.size());
    ll sum=0, kid=0;
    ll n2=(ll)ans.size();
    //cout<<ans.size()<<endl;
    if(ans.back()==0)
    {
    	forr(i, min((ll)ans.size(), n))
    		sum+=ans[i];
    	cout<<sum<<endl;
    	return;
    }
    for(ll i=pos[dupl]; i<(ll)ans.size(); i++)
    {
    	kid+=ans[i];
    }
    ll cycle_len=(n2-pos[dupl]);
    if(n<=(n2))
    {
    	ll sumsum=0;
    	forr(i, n)
    		sumsum+=ans[i];
    	cout<<sumsum<<endl;
    	return;
    }
    forr(i, pos[dupl])
    {
    	sum+=ans[i];
    	//cout<<ans[i]<<endl;
    }
    n-=(pos[dupl]);
    sum=sum+(n/cycle_len)*kid;
    times=(n%cycle_len);
    for(ll j=pos[dupl]; j<=pos[dupl]+times-1; j++)
    	sum+=ans[j];
    cout<<sum<<endl;
}
int main()
{
	#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 10028
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int B = 100000007;
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
lint power(lint x, lint n, lint mod) {
  lint ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N;
  cin >> N;
  vector<lint> a(N);
  REP(i, N) cin >> a[i];
  vector<lint> b(N);
  REP(i, N) cin >> b[i];
  vector<lint> pa(N);
  vector<lint> pb(N);
  REP(i, N) {
    pa[i] = a[i] ^ a[(i+1)%N];
    pb[i] = b[i] ^ b[(i+1)%N];
  }
  lint hash = 0;
  lint target = 0;
  REP(i, N) {
    hash = (hash + pa[i]*power(B, i, MOD)) % MOD;
    target = (target + pb[i]*power(B, i, MOD)) % MOD;
  }
  vector<pair<lint, lint>> ans;
  REP(i, N) {
    //cout << hash << " " << target << endl;
    if(hash == target) {
      lint x = b[0] ^ a[i];
      ans.push_back(make_pair(i, x));
    }
    hash = hash * power(B, MOD-2, MOD) % MOD;
    hash = (hash - pa[i]*power(B, MOD-2, MOD) % MOD + pa[i]*power(B, N-1, MOD) + MOD) % MOD;
  }
  sort(ans.begin(), ans.end(), [](auto const &a, auto const &b) { return a.first < b.first; });
  REP(i, ans.size()) {
    cout << ans[i].first << " " << ans[i].second << "\n";
  }

}

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

#define int           long long
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (long long )(1e18+1)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){
    cerr << name << " = " << arg1 << endl;
}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args){
    const char *name = strchr(names, ',');
    cerr.write(names, name-names) << " = " << arg1 << endl;
    _F(name+2, args...);
}
template<typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2> &q){
    in >> q.F >> q.S; return in;
}
template<typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> &q){
    out << q.F << " " << q.S; return out;
}
template< typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F+p2.F, p1.S+p2.S};
}
template< typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){
    return {p1.F-p2.F, p1.S-p2.S};
}

void solve(){
    int n;
    cin >> n;
    set<string> ss;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        ss.insert(s);
    }
    cout << si(ss) << endl;
}

signed main(){

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

    int t = 1;
    start = clock(); 

    cout << fixed << setprecision(12);

   // #ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
    //freopen("error.txt", "w", stderr);
    //#endif

    //cin >> t;

    for(int i = 1; i <= t; ++i){
        //cout << "Case #" << i << ": "; 
        solve();
       // cout << endl;
    }
    //cerr << time(start);
    return 0;
}

Measured memory_bytes: 19212
#include<bits/stdc++.h>
using namespace std;
int main(){
 string s;
  cin>>s;
  int a[26]={0};
  int count=0;
  for(char c:s)a[c-'A']++;
  for(int i=0;i<26;i++){
  if(a[i]==2)count++;
  }
    if(count==2)cout<<"Yes";
    else cout<<"No";
  
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>

typedef long long ll;
using namespace std;

int main()
{
    int a, b, c;

    cin >> a >> b >> c;

    if ( b / a > c) cout << c << endl;
    else cout << b / a << endl;
    return 0;
}

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

using namespace std;

int main(){
	string s,t;
	ll n,hana=0,taro=0,i;
	char w;
	
	cin>>n;
	
	for(i=1;i<=n;i++){
		cin>>s>>t;
		if(s.compare(t)==0) hana++,taro++;
		  else if(s.compare(t)>0) hana+=3;
		    else taro+=3;
	}
	
	cout<<hana<<" "<<taro<<"\n";
}


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

using namespace std;
#define endl "\n"

const int MOD = 1000000007;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	vector<int> v;
	v.push_back(a);
	v.push_back(b);
	v.push_back(c);
	sort(v.begin(),v.end());
	if(v[0] + v [1] == v[2]) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> vll;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

ll count_gteq1(vll& arr1, vll& arr2, ll val){
  ll res = 0;
  ll idx2 = (ll) arr2.size();
  rep(idx1, arr1.size()){
    while(arr1[idx1] * arr2[idx2-1] >= val && idx2 > 0) idx2--;
    res += arr2.size() - idx2;
  }
  return res;
}

ll count_gteq2(vll& arr, ll val){
  ll res = 0;
  ll idx2 = (ll) arr.size();
  rep(idx1, arr.size()){
    while(arr[idx1] * arr[idx2-1] >= val && idx2 > 0) idx2--;
    res += arr.size() - idx2 - (idx1 >= idx2);
  }
  return res / 2;
}

int main(){
  ll N, K;
  cin >> N >> K;
  ll A[N];
  rep(i, N) cin >> A[i];

  vll pos;
  vll neg;
  rep(i, N){
    if(A[i] > 0) pos.push_back(A[i]);
    if(A[i] < 0) neg.push_back(-A[i]);
  }
  sort(pos.begin(), pos.end());
  sort(neg.begin(), neg.end());

  ll n_pos = pos.size() * (pos.size() - 1) / 2 + neg.size() * (neg.size() - 1) / 2;
  ll n_neg = pos.size() * neg.size();
  ll n_zero = N * (N - 1) / 2 - n_pos - n_neg;

  ll ans = 0;
  if(K <= n_neg){
    ll l = 0, r = LLONG_MAX, m;
    while(r - l > 1){
      m = (r + l) / 2;
      if(count_gteq1(pos, neg, m) < K) r = m;
      else l = m;
    }
    ans = -l;
  }
  else if(K > n_neg + n_zero){
    K = N * (N-1) / 2 - K + 1;
    ll l = 0, r = LLONG_MAX, m;
    while(r - l > 1){
      m = (r + l) / 2;
      // printf("l:%lld r:%lld cnt:%lld\n", l, r, count_gteq2(pos, m));
      if(count_gteq2(pos, m) + count_gteq2(neg, m) < K) r = m;
      else l = m;
    }
    ans = l;
  }

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


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    int m1 = INT_MAX, m2 = INT_MIN, m3 = INT_MIN, m4 = 0;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        m1 = min(m1, x + y);
        m2 = max(m2, x - y);
        m3 = max(m3, y - x);
        m4 = max(m4, x + y);
    }
    int res = max(m4 - m1, m3 + m2);
    cout << res << endl;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;



int n;
string s;
vector<int> ind[26];



struct BIT {
    vector<ll> t;
    int n;
    int init_calls=0;
    BIT() { init_calls = 0; }
    void init(int n) {
	assert( ++init_calls == 1);
	this->n = n;
	t.resize(n+10);
    }
    void clear() {
	init_calls = 0;
	n = 0;
	t.clear();
    }
    ll get(int i) {
	ll res = 0;
	while (i>0) {
	    res += t[i];
	    i-=i&-i;
	}
	return res;
    }
    void update(int i, ll dx) {
	while (i<=n) {
	    t[i] += dx;
	    i+=i&-i;
	}
    }
};

BIT bit;

//0-indexed rangeQuery
ll rangeQuery(int l, int r) {
    if (l>r) return 0;
    return bit.get(r + 1) - bit.get(l-1 + 1);
}

//0-indexed update
void update(int i, ll dx) {
    bit.update(i+1, dx);
}


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    cin>>s;
    n = s.length();

    bit.init(n+10);
    //bit contains right elem inversions
    

    for (int i=0; i<n; i++) {
	ind[s[i]-'a'].push_back(i);
    }

    int odd=-1;
    for (int i=0; i<26; i++) {
	if (int(ind[i].size())%2) {
	    if (odd!=-1) out(-1);
	    odd = i;
	}
    }

    ll ans = 0;

    if (odd != -1) {
	int mid = ind[odd][int(ind[odd].size()) / 2];
	for (int c=0; c<26; c++) {
	    int len = ind[c].size();
	    for (int i=0; i<len/2; i++) {
		int a = ind[c][i];
		int b = ind[c][len-i-1];
		if (a > mid) ans++;
		if (b < mid) ans++;
	    }
	}
    }

    vector<pair<int,int>> ev;
    for (int c=0; c<26; c++) {
	int len = ind[c].size();
	for (int i=0; i<len/2; i++) {
	    int a = ind[c][i];
	    int b = ind[c][len-i-1];
	    ev.push_back({a,b});
	}
    }


    sort(ev.begin(), ev.end());

    //we can regard each pair of chars unique chars with predetermined destinations
    //the sum of destinations of pairs will always be N-1 (0-indexed), so it's optimal
    //to place left char where it is, and move right char to where it needs to be.

    for (auto p: ev) {
	int l = p.first; int r = p.second;
	ans += 2LL*rangeQuery(0, l);
	//previous r_elems on the way to the right will pass l and r.
	//passing l is obvious because r_elem needs to get to the right of l
	//passing r will occur because our r is more left than r_elem.

	ans += rangeQuery(l, r);
	//r_elem will only pass r.

	update(r, +1);	
    }



    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 4620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  for (int i = 0;i<N;i++) {
    cin >> A.at(i);
    B.at(A.at(i)-1) = i+1;
  };
  for (int i = 0;i<N;i++) {
    cout << B.at(i) << " ";
  };
}

Measured memory_bytes: 1536
local par={}
local rank={}
local size={}

local function init(n)
    for i=1,n do
        par[i]=i
        rank[i]=1
        size[i]=1
    end
end

local function root(x)
    return par[x]==x and x or root(par[x])
end

local function same(x,y)
    return root(x)==root(y)
end

local function unite(x,y)
    x=root(x)
    y=root(y)
    if x==y then
        return
    end
    if rank[x]>rank[y] then
        par[x]=y
        size[y]=size[y]+size[x]
    else
        par[x]=y
        size[y]=size[y]+size[x]
        if rank[x]==rank[y] then
            rank[y]=rank[y]+1
        end
    end
end

local function getsize(x)
    return size[root(x)]
end

----------

local n,m=io.read("n","n")
local a,b={},{}
for i=1,m do
    a[i],b[i]=io.read("n","n")
end

local counter=0
for i=1,m do
    init(n)
    for j=1,m do
        if i~=j then
            unite(a[j],b[j])
        end
    end
    if not same(a[i],b[i]) then
        counter=counter+1
    end
end
print(counter)

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

int main(){
	float v, h;
	int n, a;
	while (true){
		cin >> v;
		if (cin.eof()) { break; }
		h = v * v / 19.6;
		for (n = 0;;n++){
			a = 5 * n - 5;
			if (a >= h) { break; }
		}
		cout << n << endl;
	}
	return 0;
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  cout << max(H2*60+M2-(H1*60+M1)-K, 0) << endl;
  return 0;
}


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

using namespace std;
int main() {
	long a, b, c, d;
  	vector<long> arr(4);
  	cin >> a >> b >> c >> d;
  	arr[0] = a*d;
  	arr[1] = a*c;
  	arr[2] = c*b;
  	arr[3] = b*d;
  	sort(arr.begin(), arr.end());
  	cout << arr[3] << '\n';
}

Measured memory_bytes: 3628
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <queue>
#include <sstream>
using namespace std;
#define mp make_pair
#define pb push_back
#define re return
#define fi first
#define se second
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<pii> vpii; 
typedef vector<string> vs;
typedef vector<vi> vvi;
int px[100010],py[100010],par[100010];
pii sx[100010],sy[100010];
int find(int x){
	return x==par[x] ? x : par[x]=find(par[x]);
}
int unite(int u,int v){
	u=find(u);
	v=find(v);
	if(u==v)return 0;
	par[u]=v;
	return 1;
}
int dist(int x,int y){
	return min(abs(px[x]-px[y]),abs(py[x]-py[y]));
}
int main() {
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>px[i]>>py[i];
		par[i]=i;
		sx[i]=mp(px[i],i);
		sy[i]=mp(py[i],i);
	}
	sort(sx,sx+n);
	sort(sy,sy+n);
	set<pair<int,pii> > st;
	for(int i=0;i<n-1;i++){
		st.insert(mp(dist(sx[i].second,sx[i+1].second),mp(sx[i].second,sx[i+1].second)));
		st.insert(mp(dist(sy[i].second,sy[i+1].second),mp(sy[i].second,sy[i+1].second)));
	}
	long long ans=0;
	while(st.size()){
		pair<int,pii> cur=*st.begin();
		st.erase(cur);
		int u=cur.second.first,v=cur.second.second;
		ans+=unite(u,v)*dist(u,v);
	}
	cout<<ans<<endl;
    return 0;
}

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

int main()
{
    int A, B, C, D;
    int ans_t = 0, ans_a = 0;
    cin >> A >> B >> C >> D;
    if (A % D != 0)
    {
        ans_t = 1;
    }
    if (C % B != 0)
    {
        ans_a = C / B;
        ans_a = 1;
    }
    ans_t += (A / D);
    ans_a += (C / B);
    if (ans_t >= ans_a)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3624
#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>;
#define chmax(x,y) x = max(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

vector<int> d(1000005);

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    int ans = 0;
    for (int x : a) {
      if (d[x] != 0) {
        d[x]++;
        continue;
      }
      for (int j = x; j <= 1000000; j += x) {
        d[j]++;
      }
    }
    for (int x : a) {
      if (d[x] == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8000
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), m = sc.nextInt();
        Map<Integer, ArrayList<Long>> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            long b = sc.nextInt();
            ArrayList<Long> q = map.getOrDefault(a, new ArrayList<>());
            q.add(-b);
            map.put(a, q);
        }

        long cnt = 0;
        PriorityQueue<Long> q = new PriorityQueue<>();
        for (int i = m; i >= 0; i--) {
            if (map.containsKey(m - i)) {
                q.addAll(map.get(m - i));
            }
            if (!q.isEmpty()) {
                cnt += q.remove();
            }
        }

        System.out.println(-cnt);

    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }

}


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

int main() {
  
  int a;
  cin >> a;
  
  if(a < 1200) cout << "ABC" << endl;
  else if(a < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
  
}


Measured memory_bytes: 256
from collections import defaultdict

def solve():
    N = int(input())
    d = defaultdict(int)
    for _ in range(N):
        a = input()
        d[a] += 1

    m = 0
    for k, v in d.items():
        m = max(m, v)
    
    l = []
    for k, v in d.items():
        if m == v:
            l.append(k)
    l.sort()
    for ans in l:
        print(ans)
    
solve()

Measured memory_bytes: 32480