akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define llint long long
#define inf 1000000000

using namespace std;
typedef pair<llint, llint> P;

int n, X, A, O;
vector<int> G[1<<14], revG[1<<14];
vector<int> ans;
vector<int> topo;
bool used[1<<14];
int scc[1<<14];

void tpsort(int v)
{
	used[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		if(!used[G[v][i]]) tpsort(G[v][i]);
	}
	topo.push_back(v);
}
void sccdfs(int v, int id)
{
	used[v] = true;
	scc[v] = id;
	for(int i = 0; i < revG[v].size(); i++){
		if(!used[revG[v][i]]) sccdfs(revG[v][i], id);
	}
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> X >> A >> O;
	if(X == 0){
		cout << "No" << endl;
		return 0;
	}
	
	int N = 1<<(n+1);
	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if((i & j) == A || (i | j) == O){
				G[i].push_back(j^X);
				revG[j^X].push_back(i);
			}
		}
	}
	
	for(int i = 0; i < N; i++) if(!used[i]) tpsort(i);
	reverse(topo.begin(), topo.end());
	
	int id = 1;
	for(int i = 0; i < N; i++) used[i] = false;
	for(int i = 0; i < topo.size(); i++) if(!used[topo[i]]) sccdfs(topo[i], id++);
	
	//for(int i = 0; i < N; i++) cout<< scc[i] << " "; cout << endl;
	
	for(int i = 0; i < N; i++){
		if(i > (i^X)) continue;
		if(scc[i] == scc[i^X]){
			cout << "No" << endl;
			return 0;
		}
		if(scc[i] > scc[i^X]) ans.push_back(i);
		else ans.push_back(i^X);
	}
	cout << "Yes" << endl;
	for(int i = 0; i < ans.size(); i++){
		cout << ans[i];
		if(i < (int)ans.size()-1) cout << " ";
	}
	cout << endl;
	
	return 0;
}



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

inline void Min(int x, int y)
{
	if (x > y) cout << y << " " << x << endl;
	else cout << x << " " << y << endl;
}

int main()
{
	while (true)
	{
		int x, y;
		cin >> x >> y;
		if (x == 0 && y == 0) break;
		Min(x, y);
	}
	return 0;
}


Measured memory_bytes: 3008
#include <stdio.h>

int main(void){
  char S;
  scanf("%c",&S);

  if(S == 'A')
    printf("T\n");
  else if(S == 'C')
    printf("G\n");
  else if(S == 'G')
    printf("C\n");
  else if(S == 'T')
    printf("A\n");

  return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    // cout << setprecision(8) << setiosflags(ios::fixed);

    constexpr ll MOD = 1e9 + 7;

    ll n, m;
    cin >> n >> m;

    vector<ll> s(n + 1), t(m + 1);
    for (int i = 1; i <= n; ++i) cin >> s[i];
    for (int i = 1; i <= m; ++i) cin >> t[i];

    vector<vector<ll>> dp(n + 1, vector<ll>(m + 1));
    dp[0][0] = 1;
    for (int i = 0; i <= n; ++i) dp[i][0] = 1;
    for (int j = 0; j <= m; ++j) dp[0][j] = 1;

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            (dp[i][j] += dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - 1] + MOD) %= MOD;
            if (s[i] == t[j]) (dp[i][j] += dp[i - 1][j - 1]) %= MOD;
        }
    }

    cout << dp[n][m] << endl;

    return 0;
}


Measured memory_bytes: 31616
#include "bits/stdc++.h"

using namespace std;

typedef long long LL;
typedef unsigned long UL;

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

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

    vector<pair<int, int>> ab(n), cd(n);
    REP(i, n)
    {
        cin >> ab[i].first >> ab[i].second;
    }
    REP(i, n)
    {
        cin >> cd[i].first >> cd[i].second;
    }

    sort(ab.rbegin(), ab.rend());
    sort(cd.begin(), cd.end());

    int ans = 0, mj;
    vector<int> used(n, -1);

    REP(i, n)
    {
        mj = 2 * n;
        REP(j, n)
        {
            if (ab[i].first < cd[j].first && ab[i].second < cd[j].second && find(used.begin(), used.end(), j) == used.end() && cd[j].second == min(cd[j].second, mj))
            {
                used[i] = j;
                mj = cd[j].second;
            }
        }

        if (used[i] != -1)
        {
            ++ans;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7;
const int MAX_N=10000;
int h,w;
string s;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> h >> w;
	REP(i,1,h+1) REP(j,0,w){
		cin >> s;
		if(s=="snuke"){
			cout << (char)('A'+j) << i << endl;
			return 0;
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True
 
#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)
 
#xが属する集合の個数
def size(x):
    return -par[find(x)]
par = [-1]*(n+1)
for i in range(m):
    a, b = map(int, input().split())
    unite(a,b)
ans = 0
for i in range(1,n+1):
    if not same(1,i):
        unite(1,i)
        ans += 1

print(ans)

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<int> cnt(N-1, 0);
  for (int i = 1; i < N; i++) {
    string left = S.substr(0, i);
    string right = S.substr(i, N-1);
    for (char c = 'a'; c <= 'z'; c++) {
      if ((left.find(c) != string::npos) && (right.find(c) != string::npos)) {
        cnt[i-1]++;
      }
    }
  }
  sort(cnt.begin(), cnt.end());
  reverse(cnt.begin(), cnt.end());
  cout << cnt[0] << endl;
}

Measured memory_bytes: 256
#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;
template <class T> using treap = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;
vector<ii> dirs = {
    {1, 0}, {0, 1}, {-1, 0}, {0, -1},  // 4方向
    {1, 1}, {-1, 1}, {-1, -1}, {1, -1},  // 斜め
    {0, 0},  // 自身
};
template <class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <class T, class S> vector<T> make_vec(size_t n, S x) { return vector<T>(n, x); }
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...)); }

// debug
template <class T> ostream& operator<<(ostream& s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream& s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream& s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T> ostream& operator<<(ostream& s, set<T> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
template <class T> ostream& operator<<(ostream& s, multiset<T> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
template <class T, class S> ostream& operator<<(ostream& s, unordered_map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
    #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
    #define dump(...)
    #define endl "\n"
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(nullptr); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;
// *************** TEMPLATE END *************** 

signed main() {
    int a; cin >> a;
    cout << setprecision(10) << (double((a + 1) / 2) / a) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

ll N, D;
ll X[30][30];


bool check(ll i, ll j) {
	ll sum = 0;
	rep(k, D) {
		sum += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
	}

	ll s = sqrt(sum);

	return (s * s == sum) || ((s+1) * (s+1) == sum) || ((s-1) * (s-1) == sum);
}


int main(){

	cin >> N >> D;
	rep(i, N) rep(j, D) cin >> X[i][j];


	ll ans = 0;
	for(ll i = 0; i < N; i++) {
		for(ll j = i + 1; j < N; j++) {
			if(check(i, j)) ans++;
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 100000
int n,x,num=0;
int main()
{
	scanf("%d%d",&n,&x);
	if(x==1||x==2*n-1){printf("No\n");return 0;}
	printf("Yes\n");
	for(int i=1;i<=2*n-1;i++)
	{
		if(i>=n-1&&i<=n+1)printf("%d\n",n-i+x);
		else 
		{
			num++;if(num==x-1)num=x+2;
			printf("%d\n",num);//
		}
	}
}

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

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

	int i = 0;
	int left;
	while (true) {
		if(s.at(i) == 'A') {
			left = i;
			break;
		}
		i++;
	}

	i = s.size() - 1;
	int right;
	while (true) {
		if(s.at(i) == 'Z') {
			right = i;
			break;
		}
		i--;
	}

	cout << right - left + 1 << endl;

 	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
using namespace std;
int x[100];
vector<int> v;
signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<b+min(a+b+1,c)<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        int N = sc.nextInt();
        int K = sc.nextInt();
        sc.nextLine();
        String S = sc.nextLine();

        List<Integer> switches = new ArrayList<>();
        switches.add(0);
        boolean currentIsReverse = (S.charAt(0) == '1');

        for (int i = 1; i < N; i++) {
            boolean isReverse = (S.charAt(i) == '1');
            if (isReverse != currentIsReverse) {
                switches.add(i);
            }
            currentIsReverse = isReverse;
        }

        int numOfSwitch = switches.size();
        int maxSum = 0;


        for (int i = 0; i < numOfSwitch; i++) {
            boolean isFirstReverse = (S.charAt(switches.get(i)) == '1');

            int endIndex = i + 2 * K + (isFirstReverse ? 1 : 0);
            int sum = ((endIndex < numOfSwitch) ? switches.get(endIndex) : N) - switches.get(i);

            if (maxSum < sum) maxSum = sum;
        }

        System.out.println(maxSum);

    }
}


Measured memory_bytes: 30164
A=gets.to_i
B=gets.to_i
C=gets.to_i
X=gets.to_i
res = 0

(0..A).to_a.each{|i|
    (0..B).to_a.each{|j|
        (0..C).to_a.each{|k|
            if 500*i + 100*j + 50*k == X
                res+=1
            end
        }
    }
}

p res


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

typedef long long ll;

int main()
{
    int n,h;
    int i,j;
    cin >> h >> n;
    vector<int> a(n);
    vector<int> b(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i) >> b.at(i);
    }
    vector<int> dp(h+1,1e9);
    dp.at(0) = 0;
    for(i = 1;i <= h;++i){
        for(j = 0;j < n;++j){
            dp.at(i) = min(dp.at(max( 0,i-a.at(j) )) + b.at(j),dp.at(i));
        }
    }
    cout << dp.at(h) << endl;
    return 0;
}

Measured memory_bytes: 256
import math


def main():
    a, b, h, m = [int(e) for e in input().split()]

    ht = (h/12 + m/720) * 2 * math.pi
    mt = (m/60) * 2 * math.pi
    theta = min(abs(ht - mt), 2 * math.pi - abs(ht - mt))

    ans = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(theta))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62524
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <fstream>
#include <iostream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using uint64 = unsigned long long;
using vi = std::vector<int>;
using vl = std::vector<int64>;
using pii = std::pair<int, int>;
using pii = std::pair<int, int>;
using pll = std::pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(_) (_).begin(), (_).end()
#define rall(_) (_).rbegin(), (_).rend()
#define print(_) std::cout << (_) << '\n'
#define debug(_) std::cerr << #_ << ": " << (_) << '\n'
#define dbg(vec) for (size_t _ = 0; _ < vec.size(); ++_){std::cerr << #vec << "[" << _ << "] : " << vec[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;  // 1.073741823e9
const int64 INF64 = (1LL<<62) - 1;  // 4.611686018427387903e18
const int MOD = 1000000007;

bool visited[101010];
vector<int> connected[101010];

void dfs(int source) {
  visited[source] = true;
  for (auto next : connected[source]) {
    if (visited[next]) continue;
    dfs(next);
  }
}

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

  int n, m; cin >> n >> m;
  vi x(m), y(m), z(m);
  rep(i, m) {
    cin >> x[i] >> y[i] >> z[i];
    --x[i]; --y[i];
    connected[x[i]].emplace_back(y[i]);
    connected[y[i]].emplace_back(x[i]);
  }

  int ans = 0;

  for (int i = 0; i < n; ++i) {
    if (!visited[i]) {
      ++ans;
      dfs(i);
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 10112
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import Counter


class Combination:
    def __init__(self, n):
        self.fac = [1] * (n + 1)
        for i in range(1, n + 1):
            self.fac[i] = (self.fac[i - 1] * i) % mod
        self.invmod = [1] * (n + 1)
        self.invmod[n] = pow(self.fac[n], mod - 2, mod)
        for i in range(n, 0, -1):
            self.invmod[i - 1] = (self.invmod[i] * i) % mod

    def calc(self, n, k):  # nCk
        return self.fac[n] * self.invmod[k] % mod * self.invmod[n - k] % mod


def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


n, m = map(int, read().split())
mod = 10 ** 9 + 7
comb = Combination(n + 30)
ans = 1
for v in Counter(prime_decomposition(m)).values():
    ans *= comb.calc(n + v - 1, v)
    ans %= mod
print(ans)


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

int main() {
	ll n;
    cin >> n;
    ll ans = 0;
    for (ll a = 1; a < n; ++a) {
        ll b = (n-1) / a;
        ans += b;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {
	public static void main(String []args){
		//????????£????????????
		Scanner sc = new Scanner(System.in);
		//??\???????????????????????£?????????
		String word =sc.nextLine();
		//
		StringBuilder out = new StringBuilder();
		//??£?¨?
		 String w;
		 //
		 for(int i =0; i<word.length();i++){
			 w= word.substring(i,i+1);
			//?????£?????\?????????????°???????????????§???????????????
			 if(w.equals(w.toLowerCase())){
				 w = w.toUpperCase();
			//?????£?????\??????????????§?????????????°????????????????
			}else if(w.equals(w.toUpperCase())){
				w = w.toLowerCase();
			}
			 System.out.append(w);
		 }

		 //??¨???
		 System.out.println(out);
	}
}

Measured memory_bytes: 26936
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define F first
#define S second
#define MK make_pair




int main(){
    int n;
    cin>>n;
    int mx,mi;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(i==0){mx=a; mi=a;}
        mx=max(mx,a);
        mi=min(mi,a);
    }
    
    cout<<mx-mi<<endl;
    
    
    return 0;
}

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

int main(){
  int a=0, b=0, c=0;
  string d;
  cin >> d;
  for(int i = 0;i<3;i++){
    if(d.at(i)=='a')a++;
    else if(d.at(i)=='b')b++;
    else c++;
  }
  if(a==1&&b==1&&c==1)cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 3576
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, x int
	fmt.Scan(&n, &x)

	xl := make([]int, n + 1)
	for i := 0; i < n; i++ {
		fmt.Scan(&xl[i])
	}
	xl[n] = x

	sort.Ints(xl)

	min := 1000000000
	for i := n; i > 0; i-- {
		xl[i] = xl[i] - xl[i-1]
		if xl[i] < min {
			min = xl[i]
		}
	}

	xl = xl[1:]

	for i := min; i > 0; i-- {
		found := true
		for j := 0; j < n; j++ {
			if xl[j] % i != 0 {
				found = false
				break
			}
		}
		if found {
			fmt.Println(i)
			return
		}
	}
}

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

int main(){
    int K;
    string S;
    cin>>K>>S;
    if(S.size()<=K){
        cout<<S<<endl;
    }
    else{
        rep(i,K){
            cout<<S.at(i);
        }
        cout<<"..."<<endl;
    }
}

Measured memory_bytes: 3632
//98tarunkumar
#include<iostream>
#include<math.h>
using namespace std;
#define ll long long
#define pb push_back
#define rlop(i,n) for(int i=n;i>0;i--)
#define lli long long int
#define sf ios::sync_with_stdio(false); cin.tie(NULL);
#define ainp(a,n) for(int i=0;i<n;i++)cin>>a[i];
#define aout(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";
#define f(i, a, b) for(int i=a; i<b; i++)
#define lop(a,b) for(int i=a;i<b;i++)
#define ln cout<<"\n"
#define MOD 1e9+7

int main()
{ 
   	sf;
    

	lli n,x,t;
	int a=0;
	cin>>n>>x>>t;
	if(n%x!=0)
		a+=1;
	a=ceil(n/x)+a;
	cout<<a*t;
}

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

set<string> c;

bool correct(string a,string b){
	return a[a.size()-1] == b[0];
}

int main(){
	string my = "aa";
	string get;
	while(1){
		cout << "?" << my << endl;
		c.insert(my);
		cin >> get;
		if(c.count(get) || !correct(my,get) ){ cout << "!OUT" << endl; return 0;}
		c.insert(get);
		if(get == "a"){
			my = "aba";
		}else{
			my = string( 1 , get[get.size()-1]) + "a";
		}
	}
	
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int N;
    int A[1000];
    int sum=0,Ans=114514;
    cin >> N;
    REP(i,N){
        cin >> A[i];
        while(1){
            if(A[i]%2==0){
                sum++;
                A[i]/=2;
            }else{
                break;
            }
        }
        Ans=min(Ans,sum);
        sum=0;
    }
    
    cout << Ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
	int x, y, z;
	int K, S;
	int count = 0;

	scanf("%d %d", &K, &S);

	for (x = 0; x <= K; x++) {
		for (y = 0; y <= K; y++) {
			z = S - x - y;
			if (z >= 0 && z <= K) {
				count++;
			}
		}
	}
	printf("%d\n", count);

	return (0);
}

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

const int CASES = 4;

void solve(){
    ll Q, H, S, D, N; cin >> Q>> H >> S >> D >> N;
    Q *= 4;
    H *= 2;
    ll tmp = min(Q, min(H, S));
    ll ans1 = N * tmp;
    ll ans2 = (N/2) * D + (N%2)*tmp;
    cout << min(ans1, ans2) << endl;
}

int main() {
    #ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
    #else

    solve();

    #endif
    return 0;
}



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

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

ll INF = 1000000000;

ll N, L;

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

    ll min = INF, sum = 0;
    ll ans = 0;
    for(int i=1;i<=N;i++){
        ll res = L + i - 1;
        sum += res;
        if(abs(res) < min){
            min = abs(res);
            ans = res;
        }
    }

    cout << sum - ans << endl;
}

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

using namespace std;

int N, M, a[100005], b[100005];
vector<pair<int, int> > V;

int main(void) {

	cin >> N >> M;

	for (int i = 1; i <= M; i++) {
		cin >> a[i] >> b[i];
		V.push_back(make_pair(b[i], a[i]));
	}

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

	int ans = 0;

	int cur = -1;
	for (int i = 0; i < M; i++) {
		int B = V[i].first;
		int A = V[i].second;

		if (A < cur) { continue; }
		else {
			cur = B;
			ans++;
		}
	}

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

Measured memory_bytes: 1912
S = input()


ans = ['k', 'e', 'y', 'e', 'n', 'c', 'e']
i = 0
isKEYENCE = True
for s in S:
    if s == ans[i]: i += 1
    else: break

for j in range( len(S)-(7-i), len(S) ):
    if S[j] == ans[i]: i += 1
    else: 
       isKEYENCE = False
       break

if isKEYENCE: print( 'YES' )
else: print( 'NO' )

Measured memory_bytes: 3064
n,m,l=map(int,input().split())
s=[[float("INF")for i in range(n)]for i in range(n)]
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall as fw
for i in range(m):
    a,b,c=map(int,input().split())
    s[a-1][b-1]=c
    s[b-1][a-1]=c
s=fw(s)
t=[[float("INF")for i in range(n)]for i in range(n)]
for i in range(n):
    for j in range(n):
        if s[i][j]<=l:
            t[i][j]=1
t=fw(t)
for i in range(int(input())):
    a,b=map(int,input().split())
    if t[a-1][b-1]!=float("INF"):
        print(int(t[a-1][b-1])-1)
    else:
        print(-1)


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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  
  int sum = 0;
  
  for (int i = 1; i <= N; i++) {
    int num = i;
    int dig = 0;
    while (num > 0) {
      dig += (num % 10);
      num /= 10;
    }
    if (A <= dig && dig <= B) sum += i;
  }
  
  cout << sum << endl;
  return 0;
}


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

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll q;
  cin >> q;
  multiset<ll> set1={};//aたちの中で、sortしたときの前半分
  multiset<ll> set2={};//aたちの中で、sortしたときの後ろ半分

  ll p,a,b;
  cin >> p >> a >> b;
  set1.insert(a);
  ll s=b;

  for(int i=1;i<q;i++){
    cin >> p;
    if(p==1){
      cin >> a >> b;
      s+=b;
      if(set1.size()==set2.size()){
        if(a<*prev(set1.end())){
          s+=abs(a-*prev(set1.end()));          
          set1.insert(a);
        }
        else if(a>*set2.begin()){
          s+=abs(a-*set2.begin());
          ll f=*set2.begin();
          set1.insert(f);
          set2.erase(set2.begin());
          set2.insert(a);
        }
        else{
          set1.insert(a);
        }
      }
      else{
        if(a>=*prev(set1.end())){
          if(a<=*set2.begin()){
            s+=abs(a-*prev(set1.end()));
            set2.insert(a);
          }
          else{
            s+=abs(a-*prev(set1.end()));
            set2.insert(a);
          }
        }
        else{
          s+=abs(a-*prev(set1.end()));
          ll f=*prev(set1.end());
          set2.insert(f);
          set1.erase(prev(set1.end()));
          set1.insert(a);
        }
      }
    }
    else{
        cout << *prev(set1.end()) << " " << s << endl;
    }
  }

}

Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <cmath>
#include <complex>

#define EPS (1e-10)

using namespace std;

int count( vector<complex<double>> &vpos );

int main(int argc, char const *argv[]) {
    int n, result;
    double x, y;
    vector<complex<double>> vpos;
    vector<int> results;

    while(1){
        cin>>n;
        if( n == 0 ) break;
        for(int i = 0; i < n; i++){
            cin>>x>>y;
            vpos.push_back( complex<double> (x,y) );
        }
        results.push_back( count( vpos ) );
        vpos.clear();
    }

    for (auto it = results.begin(); it != results.end(); it++) {
        cout<<*it<<endl;
    }

    return 0;
}

int count( vector<complex<double>> &vpos ){
    int count = 0;
    int tmp_count1, tmp_count2;
    int size = vpos.size();
    bool flag = false;
    complex<double> m, n1, n2, center1, center2;

    if( size == 1 ) return 1;

    for(int i = 0; i < size; i++){
        for(int j = i + 1; j < size ; j++){
            if( vpos[i].real() == vpos[j].real() ) continue;
            tmp_count1 = 0;
            tmp_count2 = 0;

            m = ( vpos[i] + vpos[j] ) / 2.0;
            n1 = ( vpos[i] -  vpos[j] ) * complex<double> ( 0.0, 1.0 );
            n1 = n1 / abs(n1);
            n2 = ( vpos[i] -  vpos[j] ) * complex<double> ( 0.0, -1.0 );
            n2 = n2 / abs(n2);

            double x = abs( vpos[i] -  vpos[j] ) / 2.0;
            center1 =  m + n1 * sqrt( 1.0 - x * x );
            center2 =  m + n2 * sqrt( 1.0 - x * x );

            if( center1.real() > 0.0 ) flag = true;
            if( center2.real() > 0.0 ) flag = true;

            for(int k = 0; k < size; k++){
                double dist1 = abs( center1 - vpos[k] );
                double dist2 = abs( center2 - vpos[k] );
                if( dist1 <= 1.0 + EPS ){
                    tmp_count1++;
                }
                if( dist2 <= 1.0 + EPS ){
                    tmp_count2++;
                }
            }
            if( count < max(tmp_count1, tmp_count2) ){
                count = max(tmp_count1, tmp_count2);
            }
        }
    }

    if(!flag) return 1;
    return count;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> ab[n];
    rep(i,m)
    {
        int a, b;
        cin >> a >> b;
        a--, b--;
        ab[a].push_back(b);
    }
    rep(i, n)
        sort(ab[i].begin(), ab[i].end());
    
    int ans = 0;
    int life = n + 1;
    rep(i, n)
    {
        life--;
        if (life == 0)
        {
            ans++;
            life = n - i + 1;
        }

        if (ab[i].size() > 0)
            life = min(life, ab[i][0] - i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5760
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a,b,x=0,i=1,j=0;
scanf("%d%d",&a,&b);
if(a<2||b<1||a>20||b>20)
{
exit(0);
}
if(b==1)
{
    printf("%d",0);
    return 0;
}
while(x<b)
{
x=a*i-j;
i++;
j++;
}
printf("%d",i-1);
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
int N;
int Array[300005];
void Read()
{
    cin >> N;
    N *= 3;
    for(int i = 1; i <= N; i++)
        cin >> Array[i];
    sort(Array + 1, Array + N + 1);
}

void Solve()
{
    int first = 1, last = N;
    int cnt = N;
    long long ans = 0;
    while(cnt > 0)
    {
        ans += Array[last - 1];
        last -= 2;
        first++;
        cnt -= 3;
    }
    cout << ans << "\n";
}
int main()
{
    Read();
    Solve();
    return 0;
}


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
#define PI 3.141592653589
double getRadian(double x, double y, double x2, double y2) {
    double radian = atan2(y2 - y,x2 - x);

    return radian;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    double a,b,x;
    double ans;
    cin >> a >> b >> x;
    if(a*a*b/2 > x){
        x *= 2;
        a = x / (b*a);
        ans =90.0 - atan(a/b) * 180.0 / PI;
    }else{
        b = 2.0*b - 2.0*x/(a*a);
        ans = 90.0 - atan(a/b) * 180.0 / PI;
    }
    cout << setprecision(8) <<ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

//素数列挙
//pには充分な要素数の配列のアドレス、返り値は個数
#include <stdbool.h>
#define n0 16000 //上限/2
#define n1 180    //sqrt(上限)/2

int prime(int *p){
  bool fp[n0]={};
  int i,j,np=1,s;
  for(i=0;i<n1;i++){
    if(fp[i]) continue;
    s=(i<<1)+3;
    for(j=(i+1)*3;j<n0;j+=s){
      fp[j]=1;
    }
  }
  p[0]=2;
  for(i=0;i<n0;i+=1){
    if(fp[i]^1){
      p[np]=(i<<1)+3;
      np++;
    }
  }
  return(np);
}
int main(){
  int p[100005],n,a,b,z=0,l[100005]={},np,i,j,m,x=0;
  np=prime(&p);
  scanf("%d",&n);
  scanf("%d",&m);
  for(i=0;i<n;i++){
    scanf("%d",&a);
    a>>=1;
    for(j=0;j<np;j++){
      if(a==1) break;
      b=0;
      while(a%p[j]==0){
        a/=p[j];
        b++;
      }
      if(j==0){
        if(i==0){
          z=b;
        }else if(z!=b){
          z=-1;
          break;
        }
      }
      if(l[j]<b){
        l[j]=b;
      }
    }
    if(a!=1){
      p[np]=a;
      l[np]=1;
      np++;
    }
    if(z==-1) break;
  }
  if(z!=-1){
    x=1;
    for(i=0;i<np;i++){
      for(j=0;j<l[i];j++){
        if((long)x*p[i]>(long)m)break;
        x*=p[i];
      }
      if(j!=l[i]){
        x=0;
        break;
      }
    }
  }
  if(x!=0){
    printf("%d",((m+x)>>1)/x);
  }else{
    printf("0");
  }
  return(0);
}

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

int main() {
  int N, K, S;
  cin >> N >> K >> S;
  for (int i=0; i<N; i++) {
    if (S!=pow(10,9)) {
      if (i<K) cout << S << " ";
      else if (i<N-1) cout << S+1 << " ";
      else cout << S+1 << endl;
    }
    else {
      if (i<K) cout<<S<<" ";
      else if (i<N-1) cout<<S-1<<" ";
      else cout<<S-1<<endl;
    }
  }
}


Measured memory_bytes: 1280
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if((x>=1&&x<=9)&&(y>=1&&y<=9)){
			System.out.println(x*y);
		}else{
			System.out.println(-1);
		}
	}
}

Measured memory_bytes: 21844
#include <stdio.h>

int main(){
    int n, m;
    scanf("%d", &n);
    int input[n];
    for (m=0; ++m<=n;)
        scanf("%d", &input[m-1]);
    printf("%d", input[n-1]);
    for (m=n-1; --m>=0;)
        printf(" %d", input[m]);
    printf("\n");
}



Measured memory_bytes: 1912
#include <stdio.h>
#include <string.h>
 
int main(void){
   char T[101],H[101];
   int i,n,t=0,h=0;
    
   scanf("%d",&n);
   for(i=0;i<n;i++){
       scanf("%s %s",T,H);
       if(strcmp(T,H)==0) {
           t+=1;
           h+=1;
       }
       else if(strcmp(T,H)>0) t+=3;
       else if(strcmp(T,H)<0) h+=3;
   }
    
   printf("%d %d\n",t,h);
    
    return 0;
}


Measured memory_bytes: 2048
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        private const long COMDIV = 1000000007;

        static void Main(string[] args)
        {
            long limit = 1000000000000000000;
            var N = int.Parse(Console.ReadLine());
            var As = Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();
            long ret = 1;
            if (As[0] == 0)
            {
                Console.WriteLine(0);
                return;
            }

            try
            {
                checked
                {

                    for (int i = 0; i < N; i++)
                    {
                        ret *= As[i];
                    }

                    if (ret > limit) throw new Exception();
                    Console.WriteLine(ret);
                }
            }
            catch
            {
                Console.WriteLine(-1);
            }

        }
    }
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    double h1 = 2.0 * PI / 12.0, m1 = 2.0 * PI / 60.0;
    double hp = h + (double)m / 60.0;
    double ans = sqrt(a*a + b*b - 2*a*b*cos(h1*hp-m1*m));
    printf("%.10f\n", ans);
    return 0;
}


Measured memory_bytes: 4120
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(int i = 0; i < (int)n; i++)
using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int ans;
  if(b<c||a>d){
    ans = 0;
  }else{
    ans = min(b,d)-max(a,c);
  }
  cout << ans << endl;
}


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


using namespace std;


#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()


ll sum(int n);

void go(){
	int n;cin>>n;
	set<int> a;
	for(int i=0;i<n;i++) {
		int x;
		cin>>x;
		a.insert(x);
	}
	string ans=sz(a)==n?"YES":"NO";
	cout << ans;
}
int main(){
   
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);

   go();

   return 0;
}

ll sum(int n){                
   if(n == 0){
      return n;
   }else{
      return sum(n/10) + n%10;
   }
}


Measured memory_bytes: 9600
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int inf = 2e9;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

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

  int n = s.size(), idx = 0;
  while (idx < u.size()) {
    bool flag = true;
    rep(i, n) {
      if (i + idx >= u.size() || u[i + idx] != s[i]) {
        flag = false;
        break;
      }
    }
    if (!flag) {
      b--;
      idx += t.size();
    }
    else {
      a--;
      idx += n;
    }
  }
  cout << a << " " << b << endl;


  
  return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++) 

typedef long long ll;

ll fac[200000];
ll fac_inv[200000];

const ll mod = 1e9 + 7;

ll mod_pow(ll a,ll n) {
    ll ret = 1;

    while(n > 0) {
        if(n & 1)(ret *= a) %= mod;

        (a *= a) %= mod;

        n >>= 1;
    }
    return ret;
}

void pre_compute(ll n) {
    fac[0] = fac[1] = 1;
    fac_inv[0] = fac_inv[1] = 1;

    rep(i,n+1) {
        if(i < 2)continue;

        fac[i] = fac[i - 1] * i % mod;
    }

    fac_inv[n] = mod_pow(fac[n],mod - 2);

    for(ll i = n;i > 2;i--) {
        fac_inv[i - 1] = fac_inv[i] * i % mod;
    }
}

ll combination(ll n,ll k) {
    if(n < k || n < 0 || k < 0)return 0;
    return fac[n] * fac_inv[k] % mod * fac_inv[n - k] % mod;
}

ll n,a[200000],cou[200000];

int main() {
    cin >> n;
    rep(i,n+1) {cin >> a[i];a[i]--;}

    rep(i,n+1)cou[a[i]]++;

    pre_compute(n + 1);

    ll l;
    rep(i,n)if(cou[i]==2)l = i;

    ll mini = 1e9,maxi = 0;

    rep(i,n+1) {
        if(l == a[i]) {
            mini = min(mini,(ll)i);
            maxi = max(maxi,(ll)i);
        }
    }

    ll m = n + 1 - (maxi - mini) - 1;

    for(int k = 1;k <= n + 1;k++) {
        ll ans = combination(n + 1,k) - combination(m,k-1);
        ans %= mod;
        if(ans < 0) ans += mod;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 6528
#include <stdio.h>

int main(void)
{
    int x, y;

    while(1){
        scanf("%d %d", &x, &y);
        if(x == 0 && y == 0){
            break;
        }
        if(x < y){
            printf("%d %d\n", x, y);
        }else{
            printf("%d %d\n", y, x);
        }
    }
    return 0;
}


Measured memory_bytes: 2056
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		BigDecimal[] b = new BigDecimal[a];

		for (int i = 0; i < a; i++) {
			b[i] = sc.nextBigDecimal();
		}

		BigDecimal[] c = new BigDecimal[a];

		for (int i = a - 1; i >= 0; i--) {
			if (i < a - 1) {
				c[i] = c[i + 1].add(b[i]);
			} else {
				c[i] = b[i];
			}
		}
		
		BigDecimal answer = new BigDecimal("0");
		
		for (int i = a - 2; i >= 0; i--) {
			answer = answer.add(b[i].multiply(c[i + 1]));
		}

		answer = answer.remainder(new BigDecimal("1000000007"));

		System.out.println(answer);
	}
}


Measured memory_bytes: 83296
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds; 
using namespace std;



typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
 
 
//defines
typedef long long ll;
typedef long double ld;

ll n,m,k,tar,a,b,d,e;
void solve()
{
    ld i,o;cin>>i>>o;
    cout<<(ll)(i*o);
    /*vector<ll>v(n);
    for(ll i=0;i<n;i++)cin>>v[i];
    sort(v.begin(),v.end());
    ll p=1,f=0;
    for(auto l:v){p*=l;
        
        
        if(p>1000000000000000000LL){
            f++;
            cout<<-1;
            break;
        }
        else if(p==0)
        {
            cout<<0;
            f++;break;
        }
    }
    if(f==0)
    cout<<p;*/
// if(t>0)cout<<"\n";

}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
   
        solve();
    
    
        
    return 0;
}

Measured memory_bytes: 3748
n=int(input())
s=[]
for i in range(n):
    x=input()
    s.append(x)
a={}
for i in range(n):
    
    if not s[i] in a:
        a[s[i]]=1
    else:
        a[s[i]]+=1
a=sorted(a.items(), key=lambda x:x[1],reverse=True)
maxv=a[0][1]
ans=[]
for i in a:
    if i[1]==maxv:
        ans.append(i[0])
ans.sort()
for i in ans:
    print(i)

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

#define N 100000
#define INFLL 1000000000007

#define max(a,b) (a>b?a:b)
#define min(a,b) (a>b?b:a)

typedef long long ll;

ll n, l, s[N];
ll solve(int i, int d) {
  if(d==0) {
    if(s[i-1]<s[i] || i==0) return l-s[i];
    return (l-s[i]) + solve(i-1, 0);
  }else {
    if(s[i]>s[i+1] || i==n-1) return l-s[i];
    return (l-s[i]) + solve(i+1, 1);
  }
}

int main() {
  cin >> n >> l;
  ll ans = 0;
  for(int i=0; i<n; ++i) cin >> s[i];
  for(int i=0; i<n; ++i) {
    if((i==0 || s[i-1]>=s[i]) && (i==n-1 || s[i]<=s[i+1])) {
      ll l = solve(i, 0), r = solve(i, 1);
      ans = max(ans, max(l, r));
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1940
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if((a+b)>=10){
            System.out.println("error");
        }else{
            System.out.println(a+b);
        }


    }

}


Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main()
{
	long i,n,biggest=0,bigger=0,big;
	cin >> n;
	long a[n+1];
	for(i=0;i<n;i++){
		cin >> a[i];
		if(a[i]>biggest){
			biggest=a[i];
			big = i;
		}
		else if(a[i]>bigger){
			bigger=a[i];
		}
	} 
	for(i=0;i<n;i++){
		if(i==big){
			cout << bigger << endl;
		}
		else{
			cout << biggest << endl;
		}
	} 
	return 0;
}


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

int main() {

int n, x=0;
cin >> n;
int ans = 0;
string s;
cin >> s;


for ( int i = 0; i < n; i++){
  if(s[i] == 'I') x++;
  else if(s[i] == 'D') x--;
  if (ans < x) ans = x;
}
cout << ans<< endl;
return 0;

}

Measured memory_bytes: 256
N,T=map(int,input().split())
t=list(map(int,input().split()))
ans=0
for i in range(N):
    if i!=N-1:
        if t[i+1]-t[i]>=T:
            ans+=T
        else:
            ans+=t[i+1]-t[i]
    else:
        ans+=T
print(ans)

Measured memory_bytes: 26708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef multiset<ll> sl;
const int MN = 200200;
sl ls,rs;
ll lv[MN],rv[MN];
ll ld,rd;
void balance() {
	while(rs.size() > ls.size()) {
		auto it = rs.begin();
		ls.insert(*it-ld+rd);
		rs.erase(it);
	}
	while(ls.size() > rs.size()) {
		auto it = (--ls.end());
		rs.insert(*it-rd+ld);
		ls.erase(it);
	}
}
int main() {
	ld = rd = 0;
	int n;
	scanf("%d",&n);
	ll fl,sl;
	ll res = 0;
	for(int i=0;i<n;i++) {
		scanf("%d %d",&lv[i],&rv[i]);
		fl = rv[i]-lv[i];
		if(i > 0) {ld -= fl;rd += sl;}
		sl = fl;
		ll lf,rt;
		if(i > 0) {
			lf = *(ls.end()--);
			rt = *(rs.begin());
			lf += ld;
			rt += rd;
		} else {
			lf = rt = 0;
		}
		if(lv[i] > rt) {
			rs.insert(lv[i]-rd);
			rs.insert(lv[i]-rd);
		} else {
			ls.insert(lv[i]-ld);
			ls.insert(lv[i]-ld);
		}
		balance();
		res += lv[i]-ld;
	}
	ll x = ld,m = -n;
	for(auto& it: ls) {
		res += m*(it+ld-x);
		x = it+ld;
		m++;
	}
	printf("%lld\n",res);
}


Measured memory_bytes: 11136
#include <stdio.h>
int main(void){
    int count[100]={0},temp,max=0;
    while(scanf("%d",&temp)!=EOF) count[temp-1]++;
    for(temp=0;temp<100;temp++){
        if (count[temp]>max) max=count[temp];
    }
    for(temp=0;temp<100;temp++) {
        if (count[temp]==max) printf("%d\n",temp+1);
    }
    return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

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

    public static void solve(Scanner sc) {
        int n = sc.nextInt();
        System.out.println(24 - n + 24);
    }
}

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

int a[200005],n;

int main() {
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+n+1);
    for(int i=1;i<n;i++) {
        if(a[i]==a[i+1]) {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
}


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

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

	string	s;
	cin >> s;
	int count1;
	int count2;
	count1 = 0;
	count2 = 0;
	rep(i, s.size())
	{
		if ((i % 2) && s.at(i) == '0')
			count1++;
		else if (!(i % 2) && s.at(i) == '1')
			count1++;
	}
	rep(i, s.size())
	{
		if ((i % 2) && s.at(i) == '1')
			count2++;
		else if (!(i % 2) && s.at(i) == '0')
			count2++;
	}
	cout << min(count1, count2) << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ain(i,n,a) for(long long i=0;i<(long long)(n);i++){cin>>a[i];}
#define vsort(v) sort((v).begin(), (v).end())
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
int main(){
  vector<int> a(5);int k,i;ain(i,5,a);cin>>k;
  cout<<((a[4]-a[0]>k)?":(":"Yay!")<<endl;  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>

using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio{
  int it,len;
  char s[LEN + 5];
  fastio(){
    it = len = 0;
  }
  char get(){
    if(it < len) return s[it++];
    it = 0, len = fread(s,1,LEN,stdin);
    return len ? s[it++] : EOF;
  }
  bool notend(){
    char c;
    for(c = get();c == ' ' || c == '\n';c = get());
    if(it) it--;
    return c != EOF;
  }
  void put(char c){
    if(it == LEN) fwrite(s,1,LEN,stdout), it = 0;
    s[it++] = c;
  }
  void flush(){
    fwrite(s,1,it,stdout);
  }
}buff,bufo;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline ll getll(){
  char c; ll res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline void putint(int x,char suf){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[15];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline void putll(ll x,char suf){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[25];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline char get_char(){
  char c;
  for(c = buff.get();c == ' ' || c == '\n';c = buff.get());
  return c;
}
int n,k,s;
int main(){
  n = getint(), k = getint(), s = getint();
  int r = (s == 1000000000 ? 1 : s + 1);
  for(int i = 1;i <= k;i++) printf("%d%c",s,i == n ? '\n' : ' ');
  for(int i = k + 1;i <= n;i++) printf("%d%c",r,i == n ? '\n' : ' ');
  return 0;
}


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

using namespace std;

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

    cin >> a >> b >> c;

    if ((a == b && b != c) || (b == c && c != a) || (c == a && a != b)) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }

    return 0;
}


Measured memory_bytes: 888