akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		/*
		 ** Constraint* *
		    0 ≤ x, y ≤ 10000
		 	the number of datasets ≤ 3000
		 */
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] streamLine;
		while (true) {
			streamLine = br.readLine().split(" ");
			if ( streamLine[0].equals("0") && streamLine[1].equals("0")) break;
			System.out.println(swap(streamLine[0], streamLine[1]));
		} 
	}
	public static String swap(String str1, String str2) {
		int a = Integer.parseInt(str1);
		int b = Integer.parseInt(str2);

		if ( a <= b ) {
			return str1 + " " + str2; 
		}else {
			return str2 + " " + str1; 
		}

 	}
}


Measured memory_bytes: 27396
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<numeric>
#include<vector>
#include<tuple>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
typedef long long ll;
const int MOD = 1e9 + 7;

ll N;
int ans = 0, k[20];
int main(void)
{
	cin >> N;
	int cnt = 0;;
	for (ll i = N; i > 0; i /= 10) {
		k[cnt] = i % 10;
		cnt++;
	}ll ans = k[cnt-1]+(cnt-1)* 9;
	for (ll i = 0; i < cnt-1; i++) {
		if (k[i] != 9) {
			ans--;
			break;
		}
	}
	ct(ans);
	return 0;
}


Measured memory_bytes: 256
import sys
n=int(input())
x=[int(i) for i in sys.stdin]
x.sort()
stack=0
for i in x:
  if i%10!=0:
    stack=i
    break
if sum(x)%10!=0:
  print(sum(x))
else:
  if stack==0:
    print(0)
  else:
    print(sum(x)-stack)

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

int main()
{
    int A, B;
    cin >> A >> B;
    if(A >= 13)
        cout << B << "\n";
    else if(6 <= A && A << 12)
        cout << B / 2 << "\n";
    else
        cout << 0 << "\n";
    return 0;
}

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

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first

int n,x,ans=1;

int main(){
  cin >> n;
  for(int i=0;i<n;++i){
    cin >> x;
    if(x%2==0){
      if(x%3 && x%5){ans=0;}
    }
  }
  if(ans){cout << "APPROVED";}
  else{cout << "DENIED";}
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

class UnionFind {
private:
	vector<int>par;
public:
	UnionFind(int n) {
		rep(i, n) {
			par.push_back(-1);
		}
	}

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	void unite(int x, int y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

signed main() {
	int n, m, ans = 0;
	int p[100001];
	cin >> n >> m;
	UnionFind uf(n);
	rep(i, n) {
		int a;
		cin >> a;
		p[a - 1] = i;
	}
	rep(i, m) {
		int x, y;
		cin >> x >> y;
		uf.unite(x - 1, y - 1);
	}
	rep(i, n) {
		if (uf.same(p[i], i)) {
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1908
#include<stdio.h>
int main(){
int first=0,second=0,third=0;
int height;
int i;
for(i=0;i<10;i++){
scanf("%d",&height);
if(first<height){
third=second;
second=first;
first=height;
}else if(second<height){
third=second;
second=height;
}else if(third<height){
third=height;
}
}
printf("%d\n%d\n%d\n",first,second,third);
return 0;
}

Measured memory_bytes: 600
import numpy as np

N = int(input())
A_list = np.array([int(A) for A in input().split(' ')])

# print(N)
# print(A_list)

A_sorted_index = np.argsort(A_list) + 1
A_sorted_index = A_sorted_index.astype(str)
A_sorted_index_str = ' '.join(A_sorted_index)

print(A_sorted_index_str)


Measured memory_bytes: 33936
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

std::vector<int> Zalgorithm(const std::string& s){
  int ret = 0;
  int n = s.length();
  std::vector<int> z(n, 0);

  int L = 0, R = 0;
  for(int i=1; i<n; i++){
    if(i>R){
      L = R = i;
      while(R<n && s[R-L] == s[R]) R++;
      z[i] = R-L;
      R--;
    }else{
      int k = i-L;
      if(z[k] < R-i+1){
        z[i] = z[k];
      }else{
        L = i;
        while(R<n && s[R-L] == s[R]) R++;
        z[i] = R-L;
        R--;
      }
    }
    ret = std::max(ret, z[i]);
  }
  return z;
}

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

  string ss = s;
  while(ss.size() < 2*t.size()) ss += s;
  if(ss.size() == s.size()) ss += s;
  
  string m = t + "$" + ss;

  vector<int> res = Zalgorithm(m);
  vector<int> ok(s.size(), 0);
  rep(i,s.size()){
    if(res[t.size()+1+i] == t.size()) ok[i] = 1;
  }

  vector<int> dp(s.size(),-1);
  rep(tt,10){
    bool update = false;
    rep(i,s.size()){
      int p = i - (int)(t.size() % s.size());
      if(p<0) p += s.size();
      if(ok[i] == 0){
        dp[i] = 0;
      }else{
        if(dp[p] >= 0){
          int prev = dp[i];
          dp[i] = dp[p] + 1;
          if(dp[i] != prev) update = true;
        }else{
          dp[i] = 1;
        }
      }
    }
    if(tt==9 && update){
      cout << -1 << endl;
      return 0;
    }
  }

  int ret = 0;
  rep(i,s.size()){
    ret = max(ret, dp[i]);
  }

  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 16820
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long int LL;
typedef pair<LL,LL> P;
const int INF=1000000000;
const int MOD_2=998244353;

P ene[200010];
int main()
{
	LL n,d,a;
	LL ans=0;
	LL count=0;
	queue<P> hoge;
	cin>>n>>d>>a;
	d*=2;
	for(int i=0;i<n;i++)cin>>ene[i].first>>ene[i].second;
	sort(ene,ene+n);
	
	for(int i=0;i<n;i++)
	{
		LL x=ene[i].first,h=ene[i].second;
		
		while(hoge.size())
		{
			if(hoge.front().first>=x)break;
			else{
				count-=hoge.front().second;
				hoge.pop();
			}
		}
		h-=a*count;
	        if(h>0)
		{
			LL kougeki=0;
			if(h%a==0)kougeki=h/a;
			else kougeki=h/a+1;	
			ans+=kougeki;
			hoge.push(P(x+d,kougeki));
			count+=kougeki;
		}
	}
	cout<<ans<<"\n";
	return 0;
}
	

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

struct BIT{
  ll bit[600001];

  void init(){
    memset(bit,0,sizeof(bit));
  }

  ll sum(int i){
    ll s=0;
    while(i>0){
      s+=bit[i];
      i-=i&-i;
    }
    return s;
  }

  void add(int i,ll v){
    while(i<=600000){
      bit[i]+=v;
      i+=i&-i;
    }
  }
};

ll n,cnt;
BIT bit;

int main(){
  scanf("%lld",&n);
  bit.init();
  rep(i,n){
    ll x;
    scanf("%lld",&x);
    if(x>=600000){
      cnt++;
      cout<<"Yes"<<endl;
    }else{
      if(bit.sum(1)==1||(bit.sum(x+1)==x&&(bit.sum(600000)-bit.sum(x+1)>0||cnt>0))){
        cout<<"No"<<endl;
      }else{
        cout<<"Yes"<<endl;
        ll crt=x+1;
        while(crt>0&&bit.sum(crt)-bit.sum(crt-1)==1){
          bit.add(crt,-1);
          crt--;
        }
        bit.add(crt,1);
      }
    }
  }
  return 0;
}



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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

const lli mod = 1000000007;


lli factorial(lli n){
  static lli dp[100000];
  if(dp[n]) return dp[n];
  if(n == 0) return dp[n] = 1;
  return dp[n] = (n*factorial(n-1))%mod;
}

lli pow(lli x,lli r,lli mod = 1000000007){
  lli ret = 1;
  for(;r != 0;r >>= 1){
    if(r&1 != 0) ret *= x,ret %= mod;
    x *= x,x %= mod;
  }
  return ret;
}

lli inverse(lli x,lli mod = 1000000007){
  return pow(x,mod-2,mod);
}


lli combination(lli n,lli m,lli mod = 1000000007){
  static lli dp[100][100];
  if(m == 0) return dp[n][m] = 1;
  if(n == 0) return dp[n][m] = 0;
  if(dp[n][m]) return dp[n][m];
  if(n < m) return dp[n][m] = 0;
  return dp[n][m] = combination(n-1,m-1)+combination(n-1,m);
}


lli n,a,b;
vll v;
lli sum_ans = 0;
lli n_ans = 0;
lli ans = 0;

int main(){
  cin >> n >> a >> b;
  v = vll(n);
  for(lli i = 0;i < n;i++) cin >> v[i];
  for(lli i = 0;i < n;i++) v[i] *= -1;
  sort(v.begin(),v.end());
  for(lli i = a;i <= b;i++){
    lli sum = -accumulate(v.begin(),v.begin()+i,0ll);
    // cout << sum << " ";
    // cout << sum_ans << endl;
    if(sum*n_ans < sum_ans*i) continue;
    if(sum*n_ans > sum_ans*i) ans = 0;
    // cout << sum*n_ans << " " << sum_ans*i << endl;
    sum_ans = sum;
    n_ans = i;
    lli x = v[i-1];
    lli a = upper_bound(v.begin(),v.end(),x) - lower_bound(v.begin(),v.end(),x);
    lli b = v.begin()+i - lower_bound(v.begin(),v.end(),x);
    // cout << a << " " << b << endl;
    ans += combination(a,b);
  }
  cout << setprecision(17);
  cout << (double)sum_ans/(double)n_ans << endl;
  cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
w = [input() for i in range(N)]
a=[w[0]]
for i in range(N-1):
   if w[i+1] in a:
       print('No')
       exit()
   else:
       if w[i][-1] ==w[i+1][0]: 
           a.append(w[i+1])
       else:
           print('No')
           exit()
print('Yes')

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

#define MAXN 200007

int n ;
vector < int > v[ MAXN ] ;

long long ans = 0 ;

long long calc ( int x , int y ) {
    
    return 1LL * x * ( n - x + 1 ) - 1LL * ( min ( x , y ) ) * ( n - max ( x , y ) + 1 ) ;
}

void dfs ( int vertex , int prv ) {
    ans += calc ( vertex , prv ) ;
    int sz = v[ vertex ].size ( ) ;
    for ( int i = 0 ; i < sz ; ++ i ) {
        if ( v[ vertex ][ i ] == prv ) { continue ; }
        dfs ( v[ vertex ][ i ] , vertex ) ;
    }

}

void input ( ) {
    cin >> n ;
    for ( int i = 1 ; i < n ; ++ i ) {
        int x , y ;
        cin >> x >> y ;
        v[ x ].push_back ( y ) ;
        v[ y ].push_back ( x ) ;
    }
}

void solve ( ) {
    dfs ( 1 , 0 ) ;
    cout << ans << "\n" ;
}


int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}


Measured memory_bytes: 23784
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
signed main(){
  string s;
  cin>>s;
  YesNo(s.substr(0,4)=="YAKI");
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

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


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll N, M; std::cin >> N >> M;
  std::vector<ll> a(N);
  rep(i,N) std::cin >> a[i];

  // check
  std::set<int> s;
  rep(i,N) {
    ll t = a[i];
    int cnt = 0;
    while( t % 2 == 0 ) {
      t /= 2;
      cnt++;
    }
    if ( i != 0 && s.count(cnt) == 0 ) {
      std::cout << 0 << std::endl;
      return 0;
    }
    s.insert(cnt);
  }

  rep(i,N) a[i] /= 2;

  ll v = 1;
  rep(i,N) v = lcm(v,a[i]);

  if ( M - v < 0 ) {
    std::cout << 0 << std::endl;
    return 0;
  }
  std::cout << (M+v)/(2*v) << std::endl;
 
  return 0;
}


Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**6)


def main():
    input = sys.stdin.readline
    n, q = map(int, input().split())
    e = [list(map(int, input().split())) for _ in range(n-1)]
    p = [list(map(int, input().split())) for _ in range(q)]

    e2 = [{} for _ in range(n)]
    for ee in e:
        a, b = ee
        e2[a-1][b-1] = 1
        e2[b-1][a-1] = 1

    counters = [0 for _ in range(n)]
    for pp in p:
        counters[pp[0]-1] += pp[1]

    def dfs(x, p_sum):
        counters[x] += p_sum
        for y in e2[x]:
            del e2[y][x]
            dfs(y, counters[x])

    dfs(0, 0)
    print(*counters)


main()


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

using namespace std;

typedef long long ll;
const ll inf = 0x3f3f3f3f;
#define case(i) "Case #" << i << ": "
 
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
    out << '(' << p.first << ", " << p.second << ')';
    return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
    ll l = v.size();
    for (ll i = 0; i < l - 1; i++) out << v[i] << ' ';
    if (l > 0) out << v[l - 1];
    return out;
}

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

    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;

    if(u == s) cout << a - 1 << " " << b << endl;
    else cout << a << " " << b - 1 << endl;
}

Measured memory_bytes: 256
n, k = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i)

ans = (n - k + 1).times.map do |i|
  xl = xs[i]
  xr = xs[i + k - 1]

  lr = xl.abs + (xr - xl).abs
  rl = xr.abs + (xl - xr).abs

  lr <= rl ? lr : rl
end.min

puts ans


Measured memory_bytes: 8964
#include<iostream>
using namespace std;
int main(){
 int y,x;
 scanf("%2d%2d",&x,&y);
 int a,b;a=b=0;
 if(x<=12&&x)a=1;if(y<=12&&y)b=1;
 if(!x&&!b||!y&&!a)cout<<"NA";
 else
 if(a&&b)cout<<"AMBIGUOUS";
 else if(a)cout<<"MMYY";
 else if(b)cout<<"YYMM";
 else cout<<"NA";
 }


Measured memory_bytes: 256
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 int arr[2*100+2];
 int arr_2[2*100+2];
  
 int main()
 {
   int N;
   cin>>N;
   
     for(int i=1;i<=2*N;i++) arr[i]=i;
     int m;
     cin>>m;
     while(m--)
     {
       int oper;
       cin>>oper;
       //if(oper==0) break;
       if(oper==0)
       {
         int count=1;
         for(int i=1;i<=N;i++)
         {
           arr_2[count++]=arr[i];
           arr_2[count++]=arr[i+N];          
         }       
         for(int i=1;i<=2*N;i++) arr[i]=arr_2[i];
       }          
       else
       {
         for(int i=1+oper;i<=2*N;i++) arr_2[i-oper]=arr[i];
         for(int i=1;i<=oper;i++) arr_2[2*N-oper+i]=arr[i];
         for(int i=1;i<=2*N;i++) arr[i]=arr_2[i];    
       }
     }            
     for(int i=1;i<=2*N;i++) cout<<arr[i]<<endl;
   
   //while(1);      
   return 0;    
 }

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

int main(){
  int a[] = {1,3,1,2,1,2,1,1,2,1,2,1};
  int x,y;
  cin >>x>>y;
  
  string ans;
  a[x-1]==a[y-1] ? ans="Yes" : ans="No";
  cout <<ans<< endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define f(i,a,n) for(i=a;i<n;i++)
#define fast() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define test() ll tc;cin>>tc;while(tc--)

using namespace std;


int main()
{
        fast();
        ll n,i,w,j;
        cin>>n>>w;
        ll prices[n];
        ll weight[n];
        f(i,0,n)
        {
            cin>>weight[i]>>prices[i];
        }

        ll dp[n+1][w+1]={0};
        //cout<<dp[20][5];
        f(i,0,n+1)
        {
            f(j,0,w+1)
            {
                if(i==0||j==0)
                {
                    dp[i][j]=0;
                }
                else{
                    ll inc=0,exc=0;

                    if(weight[i-1]<=j)
                    {
                        inc = prices[i-1]+dp[i-1][j-weight[i-1]];
                    }

                    exc=dp[i-1][j];
                    dp[i][j]=max(inc,exc);

                }
            }
        }
        cout<<dp[n][w];

        return 0;
}


Measured memory_bytes: 79232
#if debug
#include<iostream>

using namespace std;
int H=0;
int A[2000000+2];

void maxHeapify(int i){
	int l=2*i;
	int r=2*i+1;
	int largest;
	if(l<=H&&A[l]>A[i]){
		largest=l;
	}
	else
		largest=i;
	if(r<=H&&A[r]>A[i])
			largest=i;
	if(largest!=i){
		swap(A[largest],A[i]);
		maxHeapify(largest);
	}
}

int extract(){
	int maxv;
	if(H<1) return -1e9;
	maxv=A[1];
	A[1]=A[H--];
	maxHeapify(1);
	return maxv;
}

void increaseKey(int i,int key){
	if(key<A[i]) return;
	A[i]=key;
	while(i>1&&A[i/2]<A[i]){
		swap(A[i/2],A[i]);
		i/=2;
	}
}

void insert(int key){
	H++;
	A[H]=-1e9;
	increaseKey(H,key);	
}
#include<string>
int main(){
	int key;
	string s;
	while(cin>>s){
		if(s=="insert"){
			cin>>key;
			insert(key);
		}
		else if(s=="extract"){
			cout<<extract()<<endl;
		}
		else 
			break;
	}
	return 0;
}
#endif

#include<iostream>
#include<queue>
using namespace std;

int main(){
	char s[20];
	priority_queue<int> que;
	while(1){
		cin>>s;
		if(s[0]=='e'&&s[1]=='n') break;
		if(s[0]=='i'){
			int key;
			cin>>key;
			que.push(key);
		}
		else if(s[0]=='e'){
			cout<<que.top()<<endl;
			que.pop();
		}
	}
}

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

#define MAX 100005
#define NIL -1

struct Node{ int p, l, r; };

Node T[MAX];
int n, D[MAX];

void print(int u){
    int i ,c;
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].p << ", ";
    cout << "depth = " << D[u] << ", ";

    if(T[u].p == NIL) cout << "root, ";
    else if(T[u].l == NIL) cout << "leaf, ";
    else cout << "internal node, ";

    cout << "[";
    for(int i = 0, c =  T[u].l; c != NIL; i++, c = T[c].r){
        if(i) cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
}

int rec(int u, int p){
    D[u] = p;
    if(T[u].r != NIL) rec(T[u].r, p);
    if(T[u].l != NIL) rec(T[u].l, p + 1);
}

int main(){
    int i, j, d, v, c, l, r;
    cin >> n;
    for(i = 0; i < n; i++) T[i].p = T[i].r = T[i].l = NIL;

    for(i = 0; i < n; i++){
        cin >> v >> d;
        for(j = 0; j < d; j++){
            cin >> c;
            if(j == 0) T[v].l = c;
            else T[l].r = c;
            l = c;
            T[c].p = v;
        }
    }
    for(i = 0; i < n; i++){
        if(T[i].p == NIL) r = i;
    }

    rec(r, 0);
    for(i = 0; i < n; i++){
        print(i);
    }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s, t; cin >> s >> t;
  cout << t + s << endl;
}


Measured memory_bytes: 256
#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 INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  ll N, C;
  cin >> N >> C;
  ll D[C][C];
  REP(i, C) {
    REP(j, C) { cin >> D[i][j]; }
  }
  ll c[N][N];
  REP(i, N) {
    REP(j, N) {
      cin >> c[i][j];
      c[i][j]--;
    }
  }

  vector<vector<ll>> cost(3, vector<ll>(C, 0));
  REP(i, N) {
    REP(j, N) {
      REP(k, C) { cost[(i + j) % 3][k] += D[c[i][j]][k]; }
    }
  }
  ll ans = INF;
  REP(i, C) {
    REP(j, C) {
      REP(k, C) {
        if (i == j || j == k || k == i) {
          continue;
        }
        ans = min(ans, cost[0][i] + cost[1][j] + cost[2][k]);
      }
    }
  }
  cout << ans;

  return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
// #define mp make_pair
#define S second
#define F first
ll mod=1e9+7 ;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define input_from_file  freopen("input.txt", "r", stdin);
using namespace std::chrono; 

int main(){                         fastIO
  // input_from_file
  ll n,a,b,c;cin>>n;vector<ll> vec(n,0);ll ans=0;
  // if(n<2)
  for(int i=0;i<n;i++) cin>>vec[i];
  // for(int i=0;i<n;i++) cout<<vec[i]<<" ";cout<<endl;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
        if(vec[i]==vec[j] || vec[j]==vec[k] || vec[k]==vec[i])
          continue;
        a=vec[i];b=vec[j];c=vec[k];
        if(a+b>c && b+c>a && c+a>b){
          ans++;
          // cout<<i+1<<" "<<j+1<<" "<<k+1<<endl;
        }

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

Measured memory_bytes: 3612
import math
"""
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
"""
K = int(input())
ans = 0
"""
for a in range(1 , K+1):
    for b in range(1 ,K+1):
        for c in range(1 , K+1):
            ans = ans + gcd(a,b,c)
       """
for a in range(1,K + 1):
    for b in range(1, K + 1):
        ab = math.gcd(a , b)
        for c in range(1, K+1):
            ans += math.gcd(ab , c)
        
print(ans)

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

int main() {
	long len;
    cin >> len;
	
    long sum = 0;
    map<long, long> numCount;
	for (int i = 0; i < len; i++) {
    	long a;
        cin >> a;
      	sum += a;
        numCount[a] += 1;
    }
  
    long q;
    cin >> q;
    for (long i = 0; i < q; i++) {
    	long b, c;
        cin >> b >> c;
      	
      	long amount = numCount[b];
        sum += amount * (c - b);
        cout << sum << endl;
      	
      	numCount[c] += amount;
      	numCount[b] = 0;
    }
}


Measured memory_bytes: 9488
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
#include <ios>
#include <sstream>
using namespace std;

int main(){
    int n;
    cin >> n;
    cout << (n % 111 != 0 ? ((n/111)+1)*111 : n) << endl;
    return 0;
}


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


int main() {

int N;
cin>>N;
vector<int> a(N);

vector<int> b(1000005);
vector<int> c(1000005);


for(int i=0;i<N;i++) {
  cin>>a[i];
  b[a[i]]++;
}
vector<int> p;
sort(a.begin(),a.end());

int ans=0;

for(int i=0;i<N;i++){
  int m=1;
  if(c[a[i]]==0){
    p.push_back(a[i]);
    while(m*a[i]<1000005){
      c[m*a[i]]=1;
      m++;
    }
  }
}



for(int i=0;i<p.size();i++){
  if(b[p[i]]<2) ans++;
}
cout<<ans<<endl;

}


Measured memory_bytes: 12772
import bisect

n,m,k = map(int,input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

A_sum = [0]*(n+1)
B_sum = [0]*(m+1)

for i in range(n):
    A_sum[i+1] = A_sum[i] + A[i]

for i in range(m):
    B_sum[i+1] = B_sum[i] + B[i]

A_limit = bisect.bisect_right(A_sum,k) - 1
mc = 0
B_i = 0
for i in range(A_limit,-1,-1):
    remain_k = k - A_sum[i]
    while((remain_k-B_sum[B_i])>=0):
        B_i += 1
        if(B_i==(m+1)):
            break
    B_i -= 1
    mc = max(mc,(i+B_i))

print(mc) 

Measured memory_bytes: 48496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
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; }

int main() {
    ll N; cin >> N;

    ll ans = N + 1 - 2;
    for (ll i = 1; i * i <= N; ++i) {
        if (N % i == 0) ans = min(ans, i + N/i - 2);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int main() {
    int n, a;
    cin >> n >> a;
    n %= 500;
    if(n <= a)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define debug(x) {cerr<<#x<<" = "<<(x)<<endl;}
using namespace std;
ll a[200005],b[200005],qzha[200005]={0},qzhb[200005]={0},k;//前缀和数组 
int m,n,ans=-1;
int findm(ll k)//剩k分钟，还能从第二堆里读几本
{
    if(k<qzhb[1])      
        return 0;
    if(k>=qzhb[m])
        return m;
    int pos = upper_bound(qzhb+1,qzhb+1+m,k) - qzhb - 1;
    return pos;
}
int main()
{
    ios::sync_with_stdio(false);    //消除缓存，节省时间 
    cin>>n>>m>>k;            //输入值 
    for(int i=1;i<=n;i++)              //进行初始化 
    {
        cin>>a[i];
        qzha[i]=qzha[i-1]+a[i];               //前缀和数组初始化 
    }
    for(int i=1;i<=m;i++)               //b的初始化 
    {
        cin>>b[i];
        qzhb[i]=qzhb[i-1]+b[i];            //前缀和数组初始化 
    }

    for(int i=0;i<=n;i++)                //从0开始遍历前缀和数组 
    {
        if(qzha[i]>k)                    //前缀和条件判断 
            break;
        int book=i;                         
        ll remind=k-qzha[i];
        book += findm(remind);
        ans=max(ans,book);
    }
    cout<<max(ans,0);
    return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b) - 1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define rb(i,x) for (auto& i : x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define UNIQUE(x) (x).resize(unique(all(x)) - begin(x))

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define F first
#define S second

#define pow10(n) stoll("1"+string(n,'0'))

#define debug(x) cout << ">>> " << #x << ": " << x << '\n'

const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LNF = 1e18;

void setIO(string s) {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen((s+".in").c_str(),"r",stdin);
//	freopen((s+".out").c_str(),"w",stdout);
#endif
}

int main() {
    
    setIO("input");
    int t; cin >> t;
    while(t--) {
        int n; cin >> n;
        vpi left, right;
        ll ans = 0;
        for(int i=0; i<n; ++i) {
            int k,l,r; cin >> k >> l >> r;
            ans += min(l, r);
            if(l > r) {
                left.eb(l-r, k);
            }
            else if(r > l) {
                right.eb(r-l, n-k);
            }
        }

        sort(rall(left));
        sort(rall(right));
        auto proc = [&](vpi& a) {
            set<int> pos;
            for(int i=1; i<=n; ++i)
                pos.insert(i);
            for(auto& i : a) {
                auto it = pos.upper_bound(i.S);
                if(it != pos.begin()) {
                    pos.erase(--it);
                    ans += i.F;
                }
            }
        };

        proc(left);
        proc(right);
        cout << ans << '\n';
    }
    
}

/*  ! CHECK THIS IF YOU GET IT WRONG !
	* int overflow, array bounds, NO VLAs
	* uninitialized local variables, rounding errors
	* intermediate result type, scientific
	* special cases (n = 0 or 1?)
	* reset your variables in scope
	* INF not large enough for ans, adding value to _MAX
	* using wrong variables, sorting extra 0s in global array
	* comment out input from file
	* operator precedence
*/

Measured memory_bytes: 14220
from collections import defaultdict


def factorize2(n):
    """
    nの値を素因数分解し、素因数とその指数をtupleにまとめたリストを返す
    """
    b = 2
    fct = []
    while b * b <= n:
        cnt = 0
        while n % b == 0:
            cnt += 1
            n //= b
        if cnt > 0:
            fct.append((b, cnt))
        b += 1
    if n > 1:
        fct.append((n, 1))
    return fct


MOD = 10 ** 9 + 7
N = int(input())
d = defaultdict(int)
for i in range(1, N + 1):
    for n, c in factorize2(i):
        d[n] += c

ans = 1
for n, c in d.items():
    ans *= c + 1
    ans %= MOD
print(ans)


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>

template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }

void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}

const double EPS =1e-9;
const long INF =2147483647;//32bit 2*1e+9
const long MOD =1e+9+7;
#define PI 3.14159265258979

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

int main(void){
	string S;
	int counter=0;
	cin>>S;
	REP(i,(int)S.length())
		if(S[i]=='1') counter++;

	print(counter);
	return 0;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.14159265358979323846264338327950
signed main()
{
    SPEED;
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    double ang=(h+m/60)/12-m/60;
    ang=ang*2*PI;
    double dist=(a*a+b*b-2*a*b*cosl(ang));
    cout<<fixed<<setprecision(10)<<sqrt(dist);
}

Measured memory_bytes: 4180
#!/usr/bin/env python3
import sys


def solve(N: int):
    count = 0
    for i in range(1,N+1):
        if len(str(i)) in [1,3,5]:
            count += 1
    print(count)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int>a(N);
    for(int i=0;i<N;i++){
        cin>>a.at(i);
    }
    int count=0;
    for(int i=0;i<N;i++){
        if(a.at(a.at(i)-1)-1==i){count++;}
    }
    cout<<count/2<<endl;
    return 0;
}

Measured memory_bytes: 640
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll

int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
	#endif

	int n;
	cin>>n;
	vector<pair<int,int>> job(n);
	for(int i=0;i<n;i++)cin>>job[i].second>>job[i].first;

	sort(job.begin(),job.end());
	
	int cur=0;
	for(int i=0;i<n;i++)
	{
		cur+=job[i].second;
		if(cur>job[i].first)
		{
			puts("No");return 0;
		}
	}
	puts("Yes");


	
	
}

Measured memory_bytes: 6408
"use strict"
function main(arg) {
    arg = arg.trim().split("\n")[1].split(' ').map(Number).sort((a,b) => a- b)
    const n = arg.length
    const c = n / 2
    // console.log(arg[c-1]) 
    // console.log(arg) 
    let min = arg[c-1]
    let max = arg[c]
    let ans = 0
    for (let i = max; i > min; i--) {
        ans++
    }
    console.log(ans) 
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 28488
a,b,c,d=map(int,input().split())
n=max(a,b)-min(a,b)
m=max(b,c)-min(b,c)
o=max(a,c)-min(a,c)
if o<=d:
    print('Yes')
elif n<=d and m<=d:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FScanner sc = new FScanner();
		int N = sc.nextInt();
		for (int i = 1; i < 10; i++) {
			for (int j = 1; j < 10; j++) {
				if (N == i * j) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
		return;

	}

}

class FScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

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

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

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

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

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

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

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

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

Measured memory_bytes: 21332
#pragma GCC optimize("O3")

#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;

typedef long long ll;
tree<int,int,greater<int>,rb_tree_tag,tree_order_statistics_node_update> map_t;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define sz(x) (int)x.size()
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define REV(x) reverse(x.begin(),x.end())
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
const double PI=3.141592653589793;

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(15);

    double a,b,h,m;
    cin >> a >> b >> h >> m;
    double hang=((h + m/60)/12) * 2*PI;
    double mang=m/60 * 2*PI;
    cout << sqrt(a*a + b*b - 2*a*b*cos(hang-mang));

    return 0;
}


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

int main(){
	int n;
	cin >> n;
	vector<int>a;
	for(int i = 0; i < n; i++){
		int ai;
		cin >> ai;
		a.push_back(ai);
	}
	int min = INT_MAX;
	for(int i = 0; i < n; i++){
		int count = 0;
		while(!(a[i]%2)){
			a[i] /= 2;
			++count;
		}
		if(count < min)
			min = count;
	}
	cout << min << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(x) cerr <<__LINE__<< ": " <<#x<< " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    vector<int> A(3);
    rep(i, 3) cin >> A[i];
    sort(all(A));
    A.erase(unique(all(A)), A.end());
    if (A.size() == 2) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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


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

class Dice{
    public:
    int face[6];
    Dice(){}
    int roll(int a, int b, int c, int d){
        int temp = face[a]; face[a] = face[b]; face[b] = face[c]; face[c] = face[d]; face[d] = temp;
        return 0;
    }
    int move(char c){
        if (c == 'W') roll(0, 2, 5, 3);
        if (c == 'E') roll(0, 3, 5, 2);
        if (c == 'S') roll(0, 4, 5, 1);
        if (c == 'N') roll(0, 1, 5, 4);
        return 0;
    }
};

int right(Dice dice, int top, int front){
    for (int i = 0; i <= 6; i++){
        if (dice.face[1] == front){
            for (int j = 0; j < 4; j++){
                if (dice.face[0] == top){
                    printf("%d\n", dice.face[2]);
                    return 0;
                }
                else dice.move('W');
            }
        }
        else{
            if (i == 3) dice.move('W');
            dice.move('N');
        }
    }
    return 0;
}

int samedice(Dice dice1, Dice dice2){
    for (int i = 0; i <= 6; i++){
        if (dice1.face[1] == dice2.face[1]){
            for (int j = 0; j < 4; j++){
                if (dice1.face[0] == dice2.face[0]){
                    if (dice1.face[2] == dice2.face[2] && dice1.face[3] == dice2.face[3] && dice1.face[4] == dice2.face[4] && dice1.face[5] == dice2.face[5]){
                        return 1;
                    } 
                }
                else dice1.move('W');
            }
        }
        else{
            if (i == 3) dice1.move('W');
            dice1.move('N');
        }
    }
    return 0;
}

int multi_samedice(Dice dices[], int num_of_dice){
    for (int i = 0; i < num_of_dice; i++){
        for (int j = 0; j < num_of_dice; j++){
            if (i == j) break;
            if (samedice(dices[i], dices[j])){
                printf("No\n");
                return 0;
            }
        }
    }
    printf("Yes\n");
    return 0;
}

int main(void){
    int num_of_dice;
    Dice dices[100];
    scanf("%d", &num_of_dice);
    for (int i = 0; i < num_of_dice; i++){
        scanf("%d%d%d%d%d%d", &dices[i].face[0], &dices[i].face[1], &dices[i].face[2], &dices[i].face[3], &dices[i].face[4], &dices[i].face[5]);
    }
    multi_samedice(dices, num_of_dice);
    return 0;
}

Measured memory_bytes: 2664
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

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(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#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 EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18


int main() {

	vector<vector<int>> tb(3, vector<int>());
	tb[0] = { 1,3,5,7,8,10,12 };
	tb[1] = {4,6,9,11 };
	tb[2] = {2 };

	int x, y; cin >> x >> y;

	int numx, numy;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < tb[i].size(); j++) {
			if (tb[i][j] == x) {
				numx = i;
			}

			if (tb[i][j] == y) {
				numy = i;
			}
		}
	}

	if (numx == numy) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI acos(-1)
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 
const int N = 0;
 
typedef long long int ll;
using namespace std;
 
int main(){
    FIN;
    //freopen("../input.txt", "r", stdin);

    int T;cin>>T;
    string word;cin>>word;

    fore(i,0,min(T,SZ(word))){
        cout<<word[i];
    }
    if(T<SZ(word)){
        cout<<"...";
    }
    return 0;
}

// ============== Notes =============== //
// common bugs
// - remove reader 
// - fastio
// - int overflow (especially intermediate expressionns)
// - array bounds (indices bigger than MAXN?, is MAXN correct?)
// - special cases (n=1, graph not connected?)
// - re-initialize efficiently between test cases

Measured memory_bytes: 3652
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

int main(void){
    int matrix[100][100];
    int matrix2[100][100];
    int n,m,l;

    cin >> n >> m >> l;

    // matrix1
    for(int i = 0;i < n;++i){
        for(int j = 0;j < m;++j){
            cin >> matrix[i][j];
        }
    }
    
    // matrix2
    for(int i = 0;i < m;++i){
        for(int j = 0;j < l;++j){
            cin >> matrix2[i][j];
        }
    }

    // 計算
    // n = 3 m = 2 l = 3
    for(int i = 0;i < n;++i){
        for(int j = 0;j < l;++j){
            long long int num = 0;
            for(int k = 0;k < m;++k){
                num += matrix[i][k] * matrix2[k][j];
            }
            cout << num;
            if(j + 1 < l){
                cout << " ";
            }
        }
        cout << endl;
    }

    return 0;
}


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

#define ll long long
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

int main()
{
    int H,W,h,w;
    int area;
    cin >> H >> W >> h >>w;
    area = H*W-h*W-H*w+h*w;
    cout << area;
    return 0;
}


Measured memory_bytes: 256
//061 C - Big Array 2017/05/13

#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

int main(){
    int64 n , k; cin >> n >> k;
    int64 num[100001]={0};
    rep(i ,n){
        int a , b;
        cin >> a >> b;
        num[a]+=b;
    }
    rep(i , 1000001){
        if(k <= num[i]){
            cout << i << endl;
            break;
        }
        k -=num[i];
    }
}

Measured memory_bytes: 1024