akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;

#define rint register int
#define gc() getchar()
inline int read(int r=0,int s=0,int c=gc()){for(;c<48||c>57;s=c,c=gc());for(;c>=48&&c<=57;(r*=10)+=c-48,c=gc());return s^'-'?r:-r;}
int a[105], b[105], c[105], d[105], g[105][105], n, Ans; int book[105], T, match[105];
bool DFS(int p)
{for(rint v = 1; v <= n; v++) if(book[v]<T && g[p][v] && (book[v]=T, !match[v] || DFS(match[v]))){match[v] = p; return true;} return false;}
void Hungary(){for(rint i = 1; i <= n; ++T, Ans += DFS(i), i++);}
int main()
{
	n = read(); for(rint i = 1; i <= n; a[i] = read(), b[i] = read(), i++); for(rint i = 1; i <= n; c[i] = read(), d[i] = read(), i++);
	for(rint i = 1, j; i <= n; i++) for(j = 1; j <= n; j++) if(a[i]<c[j]&&b[i]<d[j]) g[i][j] = true; Hungary(); printf("%d\n",Ans); return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#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++)
#define rrep(i,a,b) for(int i = a; i >= b; i--)
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define sq(a) (a)*(a)
#define nl "\n"
#define debug2(x, y) cout << #x << " = " << x << "   " << #y << " = " << y << nl;
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,
//tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
const int MAXN = 100005;
ll mod=1000000007;


int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t;
        t = 1;
        // cin>>t;
        while(t--) {
                int n, m, k;
                cin>>n>>m>>k;
                vector<ll> a(n),b(m);
                vector<ll> pre1(n+1,0), pre2(m+1,0);
                rep(i,0,n-1){
                        cin>>a[i];
                        pre1[i+1]+=pre1[i]+a[i];
                }
                rep(j,0,m-1){
                        cin>>b[j];
                        pre2[j+1]+=pre2[j]+b[j];
                }
                ll mx = 0;
                rep(i,0,n){
                        ll x = upper_bound(pre2.begin(), pre2.end(), k - pre1[i]) - pre2.begin() - 1;
                        if(x < 0)continue;
                        mx = max(mx, x + i);
                }
                cout<<mx<<nl;
        }
        return 0;
}


Measured memory_bytes: 9540
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin>>a[i];
	}
	sort(a,a+n);
	reverse(a,a+n);
	int dp[n+1]={0};
	int fk[n+1]={0};
	for(int i = 1; i <= n; i++){
		if((dp[i-1]+a[i-1])%10==0){
			if((fk[i-1]+a[i-1])%10!=0){
				dp[i] = fk[i-1]+a[i-1];
				fk[i] = max(dp[i-1],fk[i-1])+a[i-1];;
			}  
			else{
				dp[i] = dp[i-1];
				fk[i] = max(fk[i-1],dp[i-1])+a[i-1];
			}
		}
		else{
			if((fk[i-1]+a[i-1])%10!=0){
				dp[i] = max(dp[i-1],fk[i-1])+a[i-1];
				fk[i] = dp[i];
			}  
			else{
				dp[i] = dp[i-1]+a[i-1];
				fk[i] = max(dp[i-1],fk[i-1])+a[i-1];
			}
		}
	}
	cout<<dp[n]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

ll n, m;

int main(){
  cin >> n >> m;
  if( n > m ) {
    swap(n, m);
  }

  if(n > 2) {
    cout << (n - 2) * (m - 2) << endl;
  } else if (n == 1) {
    if(m > 2) {
      cout << m - 2 << endl;
    } else if(m == 2){
      cout << 0 << endl;
    } else if (m == 1) {
      cout << 1 << endl;
    }
  } else if (n == 2) {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
#define Endl endl
int kai_size = 100001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);

int RE() {
	vel v(3, 2);
	return v.at(4);
}
vel dis(int mid1, vvel &way) {
	int n = way.size();
	vel dist(n, -1); dist[mid1] = 0;
	queue<int> q;
	q.push(mid1);
	while (!q.empty()) {
		int st = q.front(); q.pop();
		rep(i, way[st].size()) {
			int to = way[st][i];
			if (dist[to] == -1) { 
				dist[to] = dist[st] + 1;
				q.push(to);
			}
		}
	}
	return dist;
}
int ret(int now, vvel &chi,vel &a) {
	int mx = 0;
	int sum = 0;
	if (chi[now].size() == 0) { return a[now]; }
	if (chi[now].size() == 1) {  
		int val = ret(chi[now][0], chi, a);
		if (val == a[now]) { return val; }
		return -1;
	}
	rep(i, chi[now].size()) {
		int nex = chi[now][i];
		int val = ret(nex, chi, a);
		if (val < 0) { return -1; }
		sum += val;
		mmax(mx, val);
	}
	if (a[now] < mx) { return -1; }
	if (sum > a[now] * 2) { return -1; }
	if (sum < a[now]) { return -1; }
	return a[now] * 2 - sum;
}
signed main() {
	int n; cin >> n;
	vel a(n);
	rep(i, n) { cin >> a[i]; }
	if (n == 2) {
		if (a[0] == a[1]) { cout << "YES" << Endl; return 0; }
		cout << "NO" << endl;
		return 0;
	}
	vel st(n - 1), to(n - 1);
	vvel way(n);
	rep(i, n-1) {
		cin >> st[i] >> to[i];
		st[i]--; to[i]--;
		way[st[i]].push_back(to[i]);
		way[to[i]].push_back(st[i]);
	}
	int start = 0;
	if (way[0].size() == 1) {
		start = way[0][0];
	}
	vel dist = dis(start, way);
	vvel chi(n);
	rep(i, n - 1) {
		if (dist[st[i]] + 1 == dist[to[i]]) {
			chi[st[i]].push_back(to[i]);
		}
		else {
			chi[to[i]].push_back(st[i]);
		}
	}
	int val = ret(start, chi, a);
	if (val == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 22528
#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)
#define chmin(x,y) x = min(x,y)

const int INF = 1e9 + 10;
 
int main() {
    int n;
    cin >> n;
    ll ans = 0;
    for (int i = 1; i < n; ++i) {
        ans += (n-1)/i;
    }
    cout << ans << endl;
    return 0;
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << (n + 999) / 1000 * 1000 - n << '\n';
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    vector<pair<string,bool> >v;
    string a,b;
    for(int i=0;i<n;i++){
      cin>>a>>b;
      v.push_back(make_pair(a,1));
      v.push_back(make_pair(b,0));
    }
    sort(v.begin(),v.end());
    int ans=0,k=0;
    for(int i=0;i<v.size();i++){
	if(v[i].second)k++;
	else k--;
	ans=max(k,ans);
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 4160
#!/usr/bin/env python3
import os


def main():
    inp = [int(x) for x in os.read(0, os.fstat(0).st_size).split()]
    n = inp[0]
    m = inp[1]

    wi = inp[2]
    vi = inp[3]

    dp = [0] * (m + 1)
    for j in range(wi, m + 1):
        dp[j] = vi

    for i in range(n - 1):
        wi = inp[2 * i + 4]
        vi = inp[2 * i + 5]
        for j in reversed(range(m + 1 - wi)):
            if dp[j + wi] < vi + dp[j]:
                dp[j + wi] = vi + dp[j]

    print(dp[-1])


main()


Measured memory_bytes: 41324
#include<bits/stdc++.h>
using namespace std ;
#define Fors(n) for(int i=1;i<=n;i++)
#define For(n) for(i=0;i<n;i++)
#define ll long long
#define vint(s) vector<int> s
#define pb(x)  push_back(x)
#define mpair(x,y) make_pair(x,y)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll x=0,y=0,s=0,n=0,i=0;

int main(){
    IOS;
    ll k;
    cin >> n >> k;
    ll a[n+1],b[n+1];
    For (n){
    	cin >> a[i];
    }
    b[0] = 0;
    for (i=1;i<n;i++){
    	ll d = INT_MAX;
    	 for (ll j = 1; j<= min(k,i); j++){
    	 	ll f = abs(a[i]-a[i-j]);
    	 	if(j == 1) d = b[i-j]+f;
    	 	else{
    	 		d = min(b[i-j]+f,d);
    	 	}
    	 }
    	 b[i] = d;
    }
    cout << b[n-1] << endl;
    return 0;
}



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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> vec(N);
  for(int i=0; i < N; i++){
  	cin >> vec.at(i);
  }
  int dis =0;
  	for (int i = 0; i < N; i++) {
    	if (vec.at(i) <= K-vec.at(i)){
        	dis += 2*vec.at(i);
        }
        else{
        	dis += 2*(K-vec.at(i));
        }
    }
   cout << dis << endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}
#define int long long

signed main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    int right = 0;
    int sum = 0;
    int ans = 0;
    for (int left = 0; left < n; left++) {
    	while (right < n && (sum ^ a[right]) == (a[right] + sum)) {
            sum += a[right];
            right++;
        }
        ans += right - left;
        if (left == right)
            right++;
        else
            sum -= a[left];
    }
    cout << ans << "\n";
    cout << flush;
}

Measured memory_bytes: 1792
n = int(input())
S = [int(s) for s in input().split()]
q = int(input())
T = [int(s) for s in input().split()]
def isOK(index,key):
    if S[index] >= key:
        return True
    else:
        return False
def search(key):
    ng = -1
    ok = len(S)
    while abs(ok-ng)>1:
        mid = int((ok+ng)/2)
        if isOK(mid,key):
            ok = mid
        else:
            ng = mid
    return ok
counter = 0
for t in T:
    index = search(t)
    if S[index] == t and index != -1 and index != len(S):
        counter += 1
print(counter)


Measured memory_bytes: 16900
#include<stdio.h>
#include<string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

char s[100010];
int main(){
	gets(s);
	int n=strlen(s);
	rep(i,0,n-1){
		if(s[i]==s[i+1]){
			printf("%d %d\n",i+1,i+2);
			return 0;
		}
		if(s[i]==s[i+2]){
			printf("%d %d\n",i+1,i+3);
			return 0;
		}
	}
	puts("-1 -1");
	return 0;
}

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

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main() {
	for (int n; cin >> n, n != 0; ) {
		int m; cin >> m;
		int g; cin >> g;
		int d; cin >> d;
		vector<string> amd(d);
		rep(i, d) cin >> amd[i];
		vi p(n);
		rep(i, n) p[i] = i;
		rep(i, d) rep(j, n - 1) if (amd[i][j] == '1') {
			swap(p[j], p[j + 1]);
		}
		if (p[g - 1] == m - 1) cout << 0 << endl;
		else {
			rep(k, d) rep(l, n - 1) {
				if (amd[k][l] == '1') continue;
				if (l > 0) if (amd[k][l - 1] == '1') continue;
				if (l + 1 < n - 1) if (amd[k][l + 1] == '1') continue;
				amd[k][l] = '1';
				rep(i, n) p[i] = i;
				rep(i, d) rep(j, n - 1) if (amd[i][j] == '1') {
					swap(p[j], p[j + 1]);
				}
				if (p[g - 1] == m - 1) {
					cout << k + 1 << ' ' << l + 1 << endl;
					goto next;
				}
				amd[k][l] = '0';
			}
			cout << 1 << endl;
			next:;
		}
	}
	return 0;
}

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

int main()
{
  string s;
  cin >> s;

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

  if(s[0] == s[1] && s[2] == s[3] && s[1] != s[2]){
    cout << "Yes" << endl;
  }

  else cout << "No" << endl;

  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()


int main(){
    int n; cin>>n;
    vector<pair<string,pair<int,int>>> v(n);
    rep(i,0,n){
        cin>>v[i].first>>v[i].second.first;
        v[i].second.second=i+1;
    }
    rep(i,0,n) v[i].second.first=-v[i].second.first;
    sort(v.begin(),v.end());
    rep(i,0,n){
        cout<<v[i].second.second<<endl;
    }
}

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

using namespace std;

typedef long long ll;
const int mxn = 1e5;

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

  int X;
  cin >> X;
  if (X>=30)
    cout << "Yes"<<endl;
  else
    cout << "No" << endl;


}


Measured memory_bytes: 3584
#お菓子
n = int(input())
times = [int(input()) for _ in range(n-1)]
dp = [10**20 for i in range(n+1)]
dp[0] = 0

for i in range(1,n):
    for j in range(i):
        if dp[j] > dp[i-j] + times[i-1]: 
          dp[j] = dp[i-j] + times[i-1]

        if dp[i-j] > dp[j] + times[i-1]: 
          dp[i-j] = dp[j] + times[i-1]

print(dp[n//2])


Measured memory_bytes: 6300
#include<bits/stdc++.h>
using namespace std;
int n,a[200010],l,r,Xor,Sum;
long long ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	l=1;
	r=1;
	ans=1;
	Sum=a[1];
	Xor=a[1];
	for(int i=2;i<=n;i++){
		r++;
		Sum+=a[i];
		Xor^=a[i];
		if(Sum!=Xor){
			while(Sum!=Xor&&l<r){
				Sum-=a[l];
				Xor^=a[l];
				l++;
			}
		}
		ans+=r-l+1;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;

public class Main {

	public static void main(String[] args) throws IOException,NumberFormatException{
		try {
		   FastScanner sc=new FastScanner();
		   long n=sc.nextLong(),d=sc.nextLong();
		   d*=d;
		   int count=0;
		   for(int i=0;i<n;i++) {
			   long x=sc.nextLong(),y=sc.nextLong();
			   if((x*x)+(y*y)<=d) {
				   count++;
			   }
		   }
		   System.out.println(count);
		}
		catch(Exception e) {
			return ;
		}

	}
	public static boolean isDigit(long n) {
		int count9=0;
		while(n!=0) {
			long temp=n%10;
			if(temp==0)
				return false;
			if(temp==9)
				count9++;
			n/=10;
		}
		if(count9>=1) {
			return true;
		}
		return false;
	}
	public static long prod(long n) {
		long prod=1;
		while(n!=0) {
			prod=prod*(n%10);
			n/=10;
		}
		return prod;
	}
	
	public static long LCM(long a,long b) {
			return (a*b)/GCD(a,b);
	}
	public static long GCD(long a,long b) {
		if(b==0)
			return a;
		return GCD(b,a%b);
	}
    
	public static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try { 
                                      st=new StringTokenizer(br.readLine());				               
                              } catch (IOException e) {}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		
	}
}


Measured memory_bytes: 56424
#include <iostream>
#include <string>
using namespace std;
string s;
int main(){
    cin>>s;
    if(s.size()<=25){
        int a[26]={};
        for(int i=0;i<s.size();i++)a[s[i]-'a']=1;
        cout<<s;
        for(int i=0;i<26;i++){
            if(a[i]==0){
                cout<<char('a'+i);
                return 0;
            }
        }
    }
    for(int i=s.size()-1;i;i--){
        if(s[i-1]<s[i]){
            for(int j=0;j<i-1;j++)cout<<s[j];
            for(int j=s.size();j>=i;j--){
                if(s[i-1]<s[j]){
                    cout<<s[j];
                    return 0;
                }
            }
        }
    }
    cout<<-1;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
    for(int n, res; cin >> n; cout << res << endl){
        int sum;
        sum = res = 0;

        vi p(n);
        rep(i, n) cin >> p[i];
        
        sort(all(p));

        rep(i, n){
            sum += p[i];
            res += sum;
        }
    }

	return 0;
}

Measured memory_bytes: 1216
import java.util.*;
import java.io.*;

public class Main
{
	public static void main(String [] Args)
	{
		Scanner in=new Scanner(System.in);		
		String s=in.next();
		int flag=0;
		for(int i=1;i<4;i++)
		{
			if(s.charAt(i)==s.charAt(i-1))
			{
				flag=1;
			}
		}
		if(flag==0)
			System.out.println("Good");
		else
			System.out.println("Bad");
	}
}
	

Measured memory_bytes: 23252
using System;
using System.Linq;

public class Program
{
	public static void Main()
	{
        int[] num = Console.ReadLine().Split(' ').Select(n => int.Parse(n)).ToArray();
        int ans = 0;
        if(num[0] == num[1] && num[2] == num[1])ans = 1;
        else if(num[0] == num[1] || num[0] == num[2] || num[2] == num[1])ans = 2;
        else ans = 3;
        Console.WriteLine(ans);
	}
}

Measured memory_bytes: 11220
n = int(input())
A = list(map(int,input().split()))
count = 0
flag = 0
while True:
	for i in range(n):
		A[i] /= 2
		if (A[i] % 2 != 0) or (A[i] == 0):
			flag += 1;
			break
	if flag is 1:
		break
	count += 1
if count is 0:
	print(count)
else:
	print(count+1)

Measured memory_bytes: 3060
#include <iostream>

int main() {
    int A, B, K;

    std::cin >> A >> B >> K;

    int count = 0, num = std::min(A, B) + 1;
    while (count < K) {
        num--;
        if (A % num == 0 && B % num == 0) count++;
    }
    std::cout << num << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
# define ll long long int
#define M 1000000007
#define ff first
#define ss second
#define pb push_back
#define inf 10000000000000

							
									//nestedcode


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,i,d,j;
    cin>>n;
    ll a[n+5],ans[n+5];
    vector<ll> v,vv;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(j=1;j<n;j++){
        v.pb(a[0] ^ a[j]);
    }

    vv.pb(v[n-2]);
    for(i=0;i<v.size()-1;i+=2){
        vv.pb(v[i]^v[i+1]);
    }

    d = 0;
    for(auto x: vv){
        d ^= x;
    }

    for(i=0;i<n;i++){
        ans[i] = d^a[i];
    }
    for(i=0;i<n;i++){
        cout<<ans[i]<<" ";
    }
}

Measured memory_bytes: 9772
#include <bits/stdc++.h>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  string s;cin>>s;
  int n = s.size();
  int a[n];
  REP(i,n){
    if(s[i]=='A'){
      a[i] = 1;
    }else if(s[i]=='B'){
      a[i] = 2;
    }else{
      a[i] = 3;
    }
  }

  int anum = 0;
  ll counter = 0;
  int now = 0;
  while(now>=0&&now<=n-3){
    if(a[now]==1&&a[now+1]==2&&a[now+2]==3){
      anum++;
      counter += anum;
      a[now] = 2;
      a[now+1] = 3;
      a[now+2] = 1;
      anum--;
      now += 2;
    }else{
      if(a[now] == 1){
        anum++;
      }else{
        anum = 0;
      }
      now++;
    }

  }

  cout<<counter<<endl;



 

  return 0;
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
  std::vector<int> a(5);
  for(int i = 0; i < 5; i++) scanf("%d", &a[i]);

  for(int i = 0; i < 5; i++) {
    if(a[i]) continue;
    printf("%d\n", i + 1);
  }
	return 0;
}


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

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

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

using namespace std;

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

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

typedef long long ll;

const ll MOD = 1e9 + 7;

class CNextPrime {
public:
    void solve(std::istream& in, std::ostream& out) {
        ll X;
        in >> X;
        vector<int> primes;
        REP(i,2,100004) {
            bool isPrime = true;
            for (const int prime : primes) {
                if (i % prime == 0) {
                    isPrime = false;
                    break;
                }
            }
            if (isPrime && i >= X) {
                out << i << "\n";
                return;
            }
            if (isPrime) {
                primes.emplace_back(i);
            }
        }
    }
};


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


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define st first
#define nd second 
using  namespace std;
using pii = pair<int, int>;
using ll = long long;
int main(){
	char c[50];
	scanf("%s",c+1);
	int n = strlen(c+1);
	if(n%2!=0) return !printf("No");
	for(int i = 1;i <= n; i+=2){
		if(c[i]!='h') return !printf("No");
	}
	for(int i =2; i<=n;i+=2){
		if(c[i]!='i') return !printf("No");
	}
	printf("Yes");
}	

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <deque>
#include <queue>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#define INF 10000000000
#define MOD 1000000007
using namespace std;
using ll = long long;
int main() {
    ll k,a,b;
    cin >> k >> a >> b;
    ll ans = 0;
    if(a+1<b){
        if(k>=a+1){
            k -= a+1;
            ans = b;
            while(k>=2){
                ans+=b-a;
                k-=2;
            }
            ans+=k;
        }else{
            ans=k+1;
        }
    }else{
        ans = k+1;
    }
    cout << ans << endl;
}

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

using namespace std;

void b_multiple_of_9(void) {
	string n;
	cin >> n;

	int sum = 0;
	for (int i = 0; i < n.size(); i++) {
		sum += (n[i] - '0');
	}

	if (sum % 9 == 0) cout << "Yes" << endl;
	else              cout << "No" << endl;

}

int main()
{
    b_multiple_of_9();

    return 0;
}

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

int t[2001][2001];

void f(int x, int y, int k) {
    int u = x + k - 1, v = y + k - 1;
    if (u < 0 || v < 0 || x >= 2*k || y >= 2*k) return;
    x = max(0, x); y = max(0, y); u = min(2*k-1, u), v = min(2*k-1, v);
    t[x][y]++;
    if (u < 2*k-1) t[u+1][y]--;
    if (v < 2*k-1) t[x][v+1]--;
    if (u < 2*k-1 && v < 2*k-1) t[u+1][v+1]++;
}

int main() {
    int n, k; cin >> n >> k;
    while (n--) {
        int x, y; char c;
        cin >> x >> y >> c;
        x += k+1; y += k+1;
        if (c == 'W') y += k;
        x %= 2*k; y %= 2*k;
        if (y >= k && x >= k) { x -= k; y -= k; }
        else if (y >= k) { x += k; y -= k; }
        f(x, y, k);
        f(x-k, y-k, k);
        f(x-2*k, y, k);
        f(x-k, y+k, k);
        f(x+k, y-k, k);
        f(x+k, y+k, k);
    }
    int ans = 0;
    for (int i = 0; i < 2*k; i++)
        for (int j = 0; j < 2*k; j++) {
            if (i > 0) t[i][j] += t[i-1][j];
            if (j > 0) t[i][j] += t[i][j-1];
            if (i > 0 && j > 0) t[i][j] -= t[i-1][j-1];
            ans = max(ans, t[i][j]);
        }
    cout << ans << endl;
}


Measured memory_bytes: 15872
# https://atcoder.jp/contests/agc041/tasks/agc041_a


def main():
    (n, a, b) = map(int, input().split(" "))
    ans = abs(a - b)
    if ans % 2 == 0:
        ans //= 2
    else:
        ato1 = a - 1
        bton = n - b
        if ato1 <= bton:
            # aを1に動かすほうが早い
            b = b - ato1
            if b % 2 == 0:
                ans = b // 2 + ato1
            else:
                ans = b // 2 + ato1 + 1
        else:
            # bをnに動かしたほうが早い
            a = a + bton
            if abs(n - a) % 2 == 0:
                ans = (n - a) // 2 + bton
            else:
                ans = (n - a) // 2 + bton + 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#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++)
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string que;
    priority_queue<int> PQ;
    while(true){
        cin>>que;
        if(que=="insert"){
            int key;
            cin>>key;
            PQ.push(key);
        }
        else if(que=="extract"){
            cout<<PQ.top()<<'\n';
            PQ.pop();
        }
        else{
            break;
        }
    }
    return(0);
}


Measured memory_bytes: 7032
N = int(input())
S = [input() for _ in range(N)]

print(("AC x {0}").format(S.count("AC")))
print(("WA x {0}").format(S.count("WA")))
print(("TLE x {0}").format(S.count("TLE")))
print(("RE x {0}").format(S.count("RE")))

Measured memory_bytes: 16080
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        int[] likes = new int[n];
        for (int i = 0; i < n; i++) {
            likes[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            if (likes[likes[i] - 1] - 1 == i) {
                ans++;
            }
        }

        System.out.println(ans / 2);
    }
}

Measured memory_bytes: 50160
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl
#define CE cout<<endl
#define pb push_back

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[2];
bool r,ra,rb,rc[200010];
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc,vd,ve,vaa,vbb;
set<int> st;

template<typename MAIN>
ostream & operator<<(ostream & osys,vector<MAIN> vtar){
    osys<<"[";
    for(int i=0;i<vtar.size();i++)osys<<vtar[i]<<(i==vtar.size()-1 ? "":",");
    osys<<"]";
    return osys;
}

int main(){
    cin>>a>>b>>c;
    va=vector<ll>(a,b-c);
    for(int i=0;i<c;i++){
        cin>>x;
        va[x-1]++;
    }
    //C va E;
    for(int i=0;i<a;i++){
        C (va[i]>0 ? "Yes":"No") E;  
    }

}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/rope>

#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-all-loops, no-stack-protector")
#pragma GCC target("avx,avx2,fma")

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

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

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define gcd __gcd
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define rep(i, n) for (int i=0; i<(n); i++)
#define rep1(i, n) for (int i=1; i<=(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned uint;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
template<typename _def> using ordered_set=tree<_def, null_type, less<_def>, rb_tree_tag, tree_order_statistics_node_update>;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;

int32_t main() {
    fastio;
    int n; cin>>n;
    int a[n][2], dp[n][2];
    rep(i, n) cin>>a[i][0]; rep(i, n) cin>>a[i][1];
    dp[0][0]=a[0][0], dp[0][1]=a[0][0]+a[0][1];
    rep1(i, n-1) {
        dp[i][0]=dp[i-1][0]+a[i][0];
        dp[i][1]=max(dp[i-1][1], dp[i][0])+a[i][1];
    }
    cout<<dp[n-1][1]<<endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int pri=998244353;

signed main(){
	string S; cin>>S;
	char t=S[S.size()-1];
	if(t=='2' or t=='4' or t=='5' or t=='7' or t=='9')cout<<"hon"<<endl;
	else if(t=='3')cout<<"bon"<<endl;
	else cout<<"pon"<<endl;
	return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cfloat>
#include <algorithm>
#define PB push_back
#define ll long long
#define ull unsigned long long
#define uint unsigned
#define PIE (3.14159265358979323846)
#define MOD 1000000007;
using namespace std;

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

    size_t n {};
    cin >> n;
    string s;
    cin >> s;

    size_t ans {};
    while (true) {
    	size_t ind {};
    	ind = s.find("ABC");
    	if (ind == string::npos) break;
    	else {
    		++ans;
    		s.at(ind) = '1';
    	}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#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;
using ll = long long;
using u64 = uint_fast64_t;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

const int MAX = 100000;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<ll> V(N+1),W(N+1);
    rep(i,N) cin >> V[i+1] >> W[i+1];

    int K = min(N,512);
    vector<vector<ll>> dp(K+1, vector<ll>(MAX+1));
    for (int v = 1; v <= K; v++) {
        int pv = v/2;
        rep(j,MAX+1) {
            chmax(dp[v][j],dp[pv][j]);
            if (j+W[v] <= MAX) chmax(dp[v][j+W[v]],dp[pv][j]+V[v]);
        }
    }

    int Q; cin >> Q;
    vector<ll> NV,NW;
    while (Q--) {
        int v,L; cin >> v >> L;
        if (v <= K) {
            cout << dp[v][L] << ln;
            continue;
        }
        NV.clear(); NW.clear();
        int cur = v;
        while (cur > K) {
            NV.emplace_back(V[cur]);
            NW.emplace_back(W[cur]);
            cur >>= 1;
        }
        int M = NV.size();
        ll ans = dp[cur][L];
        rep(mask,1<<M) {
            ll val = 0;
            ll ww = 0;
            rep(i,M) {
                if (mask&(1<<i)) {
                    val += NV[i];
                    ww += NW[i];
                }
            }
            if (ww > L) continue;
            chmax(ans,val+dp[cur][L-ww]);
        }
        cout << ans << ln;
    }
}

Measured memory_bytes: 410204
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
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
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int pwmd(int a, int n)
{
	if (!n)
		return 1;
	int pt = pwmd(a, n / 2);
	pt *= pt, pt %= mod;
	if (n & 1)
		pt *= a, pt %= mod;
	return pt;
}
double pow(double a,int b)
{
	double ans=1;
	while(b>0)
	{
		if(b&1)
			ans*=a;
		a*=a;
		b=b>>1;
	}
	return ans;
}
vector<pair<int,int>> vec;
bool compare(pair<int,int> v1,pair<int,int> v2)
{
	return v1.ss<v2.ss;
}

vector<int> adj[200005];
int dis[200005];

void dfs1(int par, int u)
{
	for(int x:adj[u])
	{
		if(x==par)
			continue;
		dis[x]=dis[u]+1;
		dfs1(u,x);
	}
}

void dfs(int par, int u,bool *vis)
{
	vis[u]=true;
	for(int x:adj[u])
	{
		if(x==par)
			continue;
		dfs(u,x,vis);
		vis[x]=true;
	}
}

int32_t main()
{       
    FIO;
    int a,b,n;
    cin>>a>>b>>n;
    int x=min(b-1,n);

    cout<<(a*x)/b<<endl;


}

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

using namespace std;

int keta(int n,int m){
    if(n <= 0)return -1;
    int count1 = 0,count2 = 0;
    for(;n;){
        n /= 10;
        count1++;
    }
    for(;m;){
        m /= 10;
        count2++;
    }
    return max(count1,count2);
}

int main(){
    int ans = 1000000;
    int64_t n;
    cin >> n;
    for(int i = 1;i <= sqrt(n);i++){
        if(n%i != 0)continue;
        ans = min(ans,keta(i,n/i));
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,random
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

A,B,T = inpl()
print(T//A*B)


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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for(int i = (int)(n); i > 0; --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(x), end(x), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(x), rend(x), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T>
constexpr int sz(const T& a) { return (int)a.size(); }
template<class T, class ... Args>
constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args>
constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class T>
constexpr T ceiling(const T a, const T b) { return (a + b - 1) / b; }
ll plusMod(ll& a, const ll b) { return a = (a + b) % mod; }
template<typename A, size_t N, typename T>
constexpr void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

int n;
int a[25], b[25], c[25];
void solve() {
    cin >> n;

    rep(i, n) {
        cin >> a[i];
        --a[i];
    }
    rep(i, n)
        cin >> b[i];
    rep(i, n - 1)
        cin >> c[i];

    int ans = 0;
    int before = -iinf;
    rep(i, n) {
        ans += b[a[i]];
        if (before + 1 == a[i])
            ans += c[before];
        before = a[i];

    }

    cout << ans << endn;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    solve();

    cout << flush;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()

int main() {
	int N;
	cin >> N;
	map<string, int> M;
	string S;
	for (int i = 0;i < N;i++) {
		cin >> S;
		if (M.count(S))M[S]++;
		else M.insert({ S,1 });
	}

	int mx = 0;
	for (auto i : M) {
		mx = max(mx, i.second);
	}
	for (auto i : M) {
		if (i.second == mx)cout << i.first << endl;
	}
}

Measured memory_bytes: 27136
#define MYDEBUG
//
#include <bits/stdc++.h>
#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#define dbp4(w,x,y,z) cout<<#w<<","<<#x<<","<<#y<<","<<#z<<": "<<w<<","<<x<<","<<y<<","<<z<<endl
#define ifcin(x) std::ifstream cin(x)
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#define dbp4(w,x,y,z)
#define ifcin(x)
#endif
#define ll long long
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)
#define REP(i, from, to) for(int i=from; i<=to; ++i)
using namespace std;
template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last) {
      out << ",";
    }
  }
  out << "]";
  return out;
}
template<typename T>
ostream& operator<<(ostream& out, const vector<vector<T> >& v) {
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i] << endl;
  }
  return out;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& p) {
  out << "{" << p.first << "," << p.second << "}";
  return out;
}
void solve() {

}

typedef pair<char, int> P;
static const int NMAX = 100000;
static const int SENTINEL = 2000000000;
P A[NMAX], B[NMAX], L[NMAX / 2 + 2], R[NMAX / 2 + 2];
int n;

void merge(P a[], int left, int mid, int right) {
  int n1 = mid - left, n2 = right - mid;
  rep(i,0,n1)
  {
    L[i] = a[i + left];
  }
  rep(j,0,n2)
  {
    R[j] = a[j + mid];
  }
  L[n1] = R[n2] = make_pair('\0', SENTINEL);
  int i = 0, j = 0;
  rep(k,left,right)
  {
    if (L[i].second <= R[j].second) {
      a[k] = L[i++];
    } else {
      a[k] = R[j++];
    }
  }
}

void mergeSort(P a[], int left, int right) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    mergeSort(a, left, mid);
    mergeSort(a, mid, right);
    merge(a, left, mid, right);
  }

}

int partition(P a[], int p, int r) {
  int i = p - 1;
  int x = a[r].second;
  rep(j,p,r)
  {
    if (a[j].second <= x) {
      i++;
      swap(a[i], a[j]);
    }
  }
  swap(a[i + 1], a[r]);
  return i + 1;
}

void quicksort(P a[], int p, int r) {
  if (p < r) {
    int q = partition(a, p, r);
    quicksort(a, p, q - 1);
    quicksort(a, q + 1, r);
  }
}

void print() {
  rep(i,0,n)
  {
    printf("%c %d : %c %d\n", A[i].first, A[i].second, B[i].first, B[i].second);
  }
}

bool check(P a[], P b[], int n) {
  rep(i,0,n)
  {
    if (a[i].first != b[i].first) {
      return false;
    }
  }
  return true;
}

int main() {
  scanf("%d", &n);
  char c[1];
  rep(i,0,n)
  {
    scanf("%s %d", c, &A[i].second);
    A[i].first = c[0];
    B[i] = A[i];
  }
  quicksort(A, 0, n - 1);
  mergeSort(B, 0, n);
  string stability;
  stability = check(A, B, n) ? "Stable" : "Not stable";
  printf("%s\n", stability.c_str());
  rep(i,0,n)
  {
    printf("%c %d\n", A[i].first, A[i].second);
  }
  return 0;
}



Measured memory_bytes: 5664
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int mxn=1000010;
int M,n,m,head[mxn],fa[mxn],stk[mxn],rnk[mxn],a[mxn],b[mxn];
LL f[mxn],g[mxn];
bool cmp(const int &x,const int &y){return a[x]<a[y];}
struct ed{int to,nxt;}edge[mxn];
void addedge(int u,int v){
	edge[++M]=(ed){v,head[u]},head[u]=M;
	edge[++M]=(ed){u,head[v]},head[v]=M;
}
int find(int x){
	if (fa[x]==x) return x;
	else return fa[x]=find(fa[x]);
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;++i) fa[i]=i,stk[i]=i;
	for (int i=1;i<=n;++i)
		scanf("%d%d",&a[i],&b[i]),a[i]=max(a[i]-b[i],0);
	sort(stk+1,stk+n+1,cmp);
	for (int i=1;i<=n;++i) rnk[stk[i]]=i;
	for (int i=1,x,y;i<=m;++i)
		scanf("%d%d",&x,&y),addedge(x,y);
	for (int j=1,u;j<=n;++j){
		u=stk[j],g[u]=b[u];
		LL mn=a[u];
		for (int i=head[u];i;i=edge[i].nxt){
			int v=edge[i].to,fx=find(v);
			if (fx!=u&&rnk[v]<rnk[u])
				g[u]+=g[fx],mn=min(mn,max(1ll*a[u],f[fx])-g[fx]),fa[fx]=u;
		}
		f[u]=g[u]+mn;
	}
	printf("%lld\n",f[stk[n]]);
	return 0;
}

Measured memory_bytes: 24320
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
const ll MOD = 998244353;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0}, dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int a, b;
	cin >> a >> b;
	cout << max(0, a - 2 * b) << endl;
	return 0;
}


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

using namespace std;

int main(){
	int H, W;
	string str;
	cin>>H>>W;
	vector < vector <int> > a;
	a.resize(H);
	int cnt=0;
	for(int i=0; i<H; i++){
		a[i].resize(W);
		cin>>str;
		for(int j=0; j<W; j++){
			a[i][j]=str[j];
			if(a[i][j]=='#'){
				cnt++;
			}
		}
	}
	if(cnt==H+W-1){
		cout<<"Possible"<<endl;
	}else{
		cout<<"Impossible"<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#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;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 300005

// it's swapnil07 ;)

vector<int> r;

signed main(){
    fast
    #ifdef SWAPNIL07
        freopen("/home/swapnil/Desktop/c++/input.txt","r",stdin);
        freopen("/home/swapnil/Desktop/c++/output.txt","w",stdout);
    #endif
    string s; cin>>s;
    int n = s.length();
    int ans[n]={0};
    For(i, 0, n-1){
        if(s[i]=='R' && s[i+1]=='L'){
            r.pb(i);
        }
    }
    For(i, 0, n){
        if(s[i]=='R'){
            int pos = lower_bound(all(r), i) - r.begin();
            int v = r[pos] - i;
            if(v%2){
                ans[r[pos]+1]++;
            }
            else{
                ans[r[pos]]++;
            }
        }
        else{
            int pos = upper_bound(all(r), i) - r.begin();
            pos--;
            int v = i - r[pos];
            if(v%2){
                ans[r[pos]+1]++;
            }
            else{
                ans[r[pos]]++;
            }
        }
    }
    For(i, 0, n){
        cout<<ans[i]<<" ";
    }   
    return 0;
}

Measured memory_bytes: 1864
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
#include <stdlib.h>
#include <iomanip>

using namespace std;

int main()
{
  int n,m;
  cin >> n >> m;
  int ans[51]={};
  for(int i=0;i<m;i++){
    int x,y;
    cin >> x >> y;
    x--;
    y--;
    ans[x]++;
    ans[y]++;
  }
  for(int i=0;i<n;i++){
    cout << ans[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 256