akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define foreach(i,n) for(auto&i:(n))
#define all(x) (x).begin(),(x).end()
using ll = long long;

template<class t>
auto collect(int n,t f){
    vector<decltype(f())> res(n);
    for(auto &i:res){
        i = f();
    }
    return res;
}

template<class t,class f>
auto mapcar(t x,f func){
    int n = x.size();
    vector<typename t::value_type> res(n);
    auto itr = res.begin();
    for(auto &i:x){
        *itr = func(i);
        ++itr;
    }
    return res;
}
template<class t,class f>
void mapc(t x,f func){
    for(auto &i:x){
        func(i);
    }
}
template<class t,class u>
auto sellect(t x,u f){
    vector<typename t::value_type> res;
    for(auto &i:x){
        if(f(i)){
            res.push_back(i);
        }
    }
    return res;
}

ll in(){
    ll res;
    scanf("%d",&res);
    return res;
}

int main(){
    ll h,n;
    h = in();
    n = in();
    vector<ll> line = collect(n,in);
    if(h<=accumulate(all(line),0)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>

using namespace std;

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

int main(){
    int H,N,ans, tmp;
    vector<int> A;
    cin >> H >> N;
    for (int i = 0; i< N; i++){
        cin >> tmp;
        ans += tmp;
    }
    if(ans>=H){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#define pr(x) printf("%s %lld\n", #x , x)

int main()
{
    //freopen("in.txt", "w", stdout);
	char string[5];
    scanf("%s",string);
    int flag = 0;
    int i;
    for(i = 0 ; i < 3; i++){
        if(string[i] == '7'){
            printf("Yes\n");
            break;
        }
    }
    if(i == 3){
        printf("No\n");
    }

}   

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

using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define lin "\n"
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(0)

void solve() {
    string a, b, c;
    cin >> a >> b >> c;
    cout << a[0] << b[1] << c[2];
}

int main() {
    fast_io;
    int t = 1;
//    cin >> t;
    int c = 1;
    while (t--) {
//        printf("Case %lld: ",c);
//        cout<<"Case "<<c<<": ";
        solve();
        c++;
    }
}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
const int inf = 1 << 30;
const ll linf = 1e18;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N;
ll M;
vector<ll> as;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> M;
    bool oe[2] = {};
    for(int i = 0; i < N; i++){
        ll a;
        cin >> a;
        as.push_back(a / 2);
        oe[(a / 2) % 2] = true;
    }
    if(oe[0] && oe[1]){
        cout << 0 << endl;
        return 0;
    }
    ll s = as[0];
    for(int i = 1; i < N; i++){
        ll g = __gcd(s, as[i]);
        if((s / g) % 2 == 0 || (s / g) % 2 == 0){
            cout << 0 << endl;
            return 0;
        }
        s = s * as[i] / g;

    }
    ll ans = M / s;
    cout << (ans + 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e6 + 5;

int not_prime[N];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll a, b;
    cin >> a >> b;
    ll gcd = __gcd(a, b);
    int ans = 1;
    for(ll i = 2; i * i <= gcd; i++){
        if(gcd % i == 0){
            gcd /=i;
            ans++;
        }
        while(gcd % i == 0){
            gcd /= i;
        }
    }
    if(gcd != 1) ans++;
    cout << ans;

    return 0;

}


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

int main(){
  double a,b,x;
  cin >> a >> b >> x;
  
  double ang;
  
  if(x>=a*a*b/2){
    
    ang = atan((b-x/a/a)/(a/2)) * 180/M_PI;
    
  }else{
    
    ang = atan(a*b*b/x/2) * 180/M_PI;
    
  }
  
  printf("%.10lf\n", ang);
  
  return 0;
}




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

/*

dp[u]= \prod (dp[v]+1)

*/

const int M=1e5+5;
vector<int> g[M];
int n,m;

inline int add(int x,int y)
{
	return (x+y)%m;
}
inline int mul(int x,int y)
{
	return 1LL*x*y%m;
}

int ldp[M],rdp[M];
int dp[M];

void dfs(int u,int fa)
{
	//cout<<"dfs "<<u<<endl;
	dp[u]=1;
	for(int v:g[u])
	{
		if(v==fa) continue;
		dfs(v,u);
		dp[u]=mul(dp[u],add(dp[v],1));
	}
	//cout<<"here"<<endl;
	int ndp=1;
	for(int v:g[u])
	{
		if(v==fa) continue;
		ldp[v]=ndp;
		ndp=mul(ndp,add(dp[v],1));
	}
	ndp=1;
	for(int i=g[u].size()-1;i>=0;i--)
	{
		int v=g[u][i];
		if(v==fa) continue;
		rdp[v]=ndp;
		ndp=mul(ndp,add(dp[v],1));
	}
	//cout<<"out dfs "<<u<<endl;
}

int ans[M];
void dfs2(int u,int fa)
{
	//cout<<"dfs2 "<<u<<endl;
	ans[u]=dp[u];
	int ndp=1;
	for(int v:g[u])
	{
		//if(v==fa) continue;
		ldp[v]=ndp;
		ndp=mul(ndp,add(dp[v],1));
	}
	ndp=1;
	for(int i=g[u].size()-1;i>=0;i--)
	{
		int v=g[u][i];
		//if(v==fa) continue;
		rdp[v]=ndp;
		ndp=mul(ndp,add(dp[v],1));
	}
	for(int v:g[u])
	{
		if(v==fa) continue;
		int dpu=dp[u],dpv=dp[v];
		dp[u]=mul(ldp[v],rdp[v]);
		dp[v]=mul(dp[v],add(dp[u],1));
		dfs2(v,u);
		dp[u]=dpu;
		dp[v]=dpv;
	}
	//cout<<"out dfs2 "<<u<<endl;
}

int main()
{
	//freopen("V.in","r",stdin);
	scanf("%d%d",&n,&m);
	int u,v;
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&u,&v);
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(1,0);
	dfs2(1,0);
	for(int i=1;i<=n;i++)
		printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 13824
#include <iostream>
#include <vector>
using namespace std;
int main(){
  long long n,a,b;cin>>n>>a>>b;
  vector<long long> A(n);
  long long mn = 0;
  long long mx = 0;
  for(int i = 0; n > i; i++){
    cin>>A[i];
    mx = max(mx,(A[i]-1)/b+1);
  }
  long long ce = (mx+mn)/2;
  while(mx-mn > 1){
    long long wan = 0;
    for(long long i = 0; n > i; i++){
      if(A[i]-(ce*b) > 0){
        wan += ((A[i]-(ce*b))-1)/(a-b)+1;
      }
    }
    if(wan > ce){
      mn = ce;
    }else{
      mx = ce;
    }
    ce = (mx+mn)/2;
  }
  cout << mx << endl;
}


Measured memory_bytes: 1024
n=int(input())
l=list(map(int,input().split()))
import collections
d=collections.defaultdict(int)
for i in l:
    d[i]+=1
l.sort(reverse=True)
ans=0
for i in l:
    if d[i]>0:
        d[i]-=1
        if d[2**i.bit_length()-i]>0:
            ans+=1
            d[2**i.bit_length()-i]-=1
print(ans)

Measured memory_bytes: 56820
n,l = map(int,input().split(" "))
ll = []
total=0;
for i in range(0,n):
	s = l+i
	total = total+s
	ll.append(s)
kam = 1000000
for i in range(0,n):
	if(abs(ll[i])<abs(kam)):
		kam=ll[i]
print(total-kam)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
//#include <string>
#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    LL n;
    cin >> n;
    vector<LL> d(n);
    for(LL i=0; i<n; i++){
        cin >> d[i];
    }
    sort(d.begin(),d.end());
    LL ans=1;
    for(LL i=1; i<n; i++){
        if(d[i]>d[i-1]){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


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

void solve() {
	ll n;
	cin>>n;
	vector<ll> a(n);
	unordered_map<ll, ll> mp;
	for (auto &i : a) {
		cin>>i;
        mp[i]++;
	}
	ll sum = 0;
	for (auto &i : mp) sum += i.second*(i.second-1)/2;
	for (auto i : a) cout<<sum-mp[i]+1<<"\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout<<fixed;
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 9160
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		// TODO ABC_088_B
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();

		List<Integer> A = new ArrayList<Integer>();
		int i=0, j=0, tmp = 0;
		int ret = 0;

		for(i = 0;i < N; i++) {

			tmp = sc.nextInt();

			for(j=0; j<=i; j++) {
				if(j == i) {
					A.add(tmp);
				} else {
					if(A.get(j) <= tmp) {
						A.add(j, tmp);
						break;
					}
				}
			}
		}
		// Scannerクラスのインスタンスをクローズ
		sc.close();

		for(i = 0;i < N; i++) {
			if(i%2 == 0) {
				ret += A.get(i);
			} else {
				ret -= A.get(i);
			}
		}

		// 出力
		System.out.println(ret);

	}
}


Measured memory_bytes: 36248
#include<bits/stdc++.h>
using namespace std;
int main(){long long x,b=-1,p,q,a=1;cin>>x;while(1){p=a*a*a*a*a;q=b*b*b*b*b;if(p-q>x)b++;else if(p-q<x){a++;b=-a;}else break;}
cout<<a<<' '<<b<<endl;}

Measured memory_bytes: 3644
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll A, B, N, x;
  cin >> A >> B >> N;
  x = min(N, B - 1);
  cout << ((A * x) / B) - (A * (x / B)) << endl;
}


Measured memory_bytes: 3160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		solve(sc, out);
		
		out.flush();
	}
	
	public static void solve(FastScanner sc, PrintWriter out){
		String s = sc.next();
		
		int res = 700;
		
		for(int i = 0; i < s.length(); i++) {
			res+=s.charAt(i)=='o'?100:0;
		}
		
		out.println(res);
	}

	public static int gcd(int a, int b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 22612
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

vll fac(300000,1),inv(300000,1),finv(300000,1) ;

ll ncr(int n,int r){
	if(r>n||n<0||r<0) return 0 ;
	if(r==0||n==r) return 1 ;
	return fac.at(n)*finv.at(n-r)%mod*finv.at(r)%mod ;
}

int main(){
	for(int i=2;i<fac.size();i++){
		fac.at(i) = fac.at(i-1)*i%mod ;
		inv.at(i) =  mod-inv.at(mod%i)*(mod/i)%mod;
		finv.at(i) = finv.at(i-1)*inv.at(i)%mod ;
	}
	ll h,w,a,b ;
	cin >> h >> w >> a >> b ;
	ll ans = 0 ;
	for(int i=0;i<h-a;i++){
//		cout << ans << endl ;
		ll sub = ncr(i+b-1,b-1) ;
		sub = sub*ncr(h-1-i+w-b-1,w-b-1)%mod ;
		ans += sub ;
		ans %= mod ;
	}
	cout << ans << endl ;
}


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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	//freopen("in.txt", "r", stdin);
	int n, t, a; cin >> n >> t >> a;
	double m = 1e9 + 7, id = 0;
	for(int i = 0; i < n; ++i){
		int h; cin >> h;
		double x = abs((double)(t - h * 0.006) - (double)a);
		if(x < m){
			m = x;
			id = i + 1;
		}
	}
	cout << id << '\n';
	return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> v, vm;  // マイナス用とそうでない用
  for (int i = 0; i < n; i++) {
    ll res;
    cin >> res;
    if (res < 0)
      vm.push_back(res);
    else
      v.push_back(res);
  }

  sort(v.begin(), v.end());
  sort(vm.begin(), vm.end());

  // めぐる式にぶたん
  ll mi = -1000000000000000001ll, ma = 1000000000000000001ll;
  while (ma - mi > 1) {
    ll mid = (mi + ma) / 2;
    ll count = 0;  // 以下の数をカウントしたい
    // めぐる式にぶたん(2 マイナス*プラス)
    for (int i = 0; i < vm.size(); i++) {
      ll l, r;
      l = -1, r = v.size();
      while (r - l > 1) {
        ll m = (l + r) / 2;
        if (mid < vm[i] * v[m])  // 大きくて使えない
          l = m;
        else  // 使える
          r = m;
      }
      count += v.size() - r;

      // マイナス*マイナス
      l = i, r = vm.size();
      while (r - l > 1) {
        ll m = (l + r) / 2;
        if (vm[i] * vm[m] > mid)  // 大きくて使えない
          l = m;
        else  // 使える
          r = m;
      }
      count += vm.size() - r;
    }

    // cout << mid << " " << count << endl;
    // めぐる式にぶたん(2 プラス*プラス)
    for (int i = 0; i < v.size(); i++) {
      ll l, r;
      l = i, r = v.size();
      while (r - l > 1) {
        ll m = (l + r) / 2;
        if (v[i] * v[m] <= mid)  // まだ行ける
          l = m;
        else  // 使える
          r = m;
      }
      count += l - i;
    }
    // cout << mid << " " << count << endl;

    if (count < k)  // 足りず…
      mi = mid;
    else
      ma = mid;
  }
  cout << ma << endl;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, M, S[1<<18];
std::multiset<int, std::greater<int>> s;

bool can(){    
    s.emplace(S[0]);
    S[0] = -1;

    for(int i=1;i<M;i*=2){
        int k = 0;

        std::stack<int> st;

        for(int x : s){
            while(k < M && (S[k] == -1 || S[k] >= x)){
                k += 1;
            }

            if(k == M){
                return false;
            }

            st.emplace(S[k]);
            S[k] = -1;
        }

        until(st.empty()){
            s.emplace(st.top());
            st.pop();
        }
    }
    
    return true;
}

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

  std::cin >> N;

  for(int i=0;i<(1<<N);++i){
      std::cin >> S[i];
  }

  M = 1 << N;

  std::sort(S, S + M);
  std::reverse(S, S + M);

  if(can()){
      std::cout << "Yes" << std::endl;
  }else{
      std::cout << "No" << std::endl;
  }
}


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

typedef long long LL;
typedef vector<long long> VLL;
typedef vector<string> VS;
typedef vector<pair<LL, LL> > VP;
 
 
#define For(in) for (LLi i = 0; i < (n); i++)
#define FOR(in) for(LLi i=1; i <= (n); i++)
#define pb push_back
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define no "NO"
#define yes "YES"
#define con continue;


int main()
{
    ios_base::sync_with_stdio(false);
	long long t, q;
	
	//seive();
	LL a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,r=0,u=0,w=0,x=0,y=0,z=0;
	//LL aa[10000];
	LL flag=0, flag1=0, co=0, co1=0, co2=0, co3=0, x1=0, x2=0, y1=0, y2=0, z1=0, z2=0;
	LL ma=0, mi=100000000;
	LL mid=0, temp=0, stop=0, start=0, ans=0;
	double pi= 3.141592653589793;
	double d1=0.0, d2, d3, d4;
	VLL v,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10;
	VS vs, vs1, vs2, vs3, vs4;
	VP vp, vp1,vp2;
	char ch, ch1, ch2[1001];
	string str, str1, str2, str3, str4, str5;
	pair<LL, LL> pa;
	list<LL> li, li1;
	map<LL, LL> mp, mp1;
	set<LL> st;
	map<LL ,LL> :: iterator imll;
	VLL :: iterator ivl, low, up;
	set<LL> :: iterator it;
	VP :: iterator ivp;	
	
	
	cin>>a>>b>>c;
	if(b*c>=a)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	

	return 0;
 
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int main(){
int a,b;cin>>a>>b;
b=2*b+1;
if(a%b==0)cout<<a/b<<endl;
else cout<<a/b+1<<endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+10;
int n;char s[N];;int pre[N],suf[N];//向右 
int main(){
	scanf("%d",&n);scanf("%s",s+1);
	for(int i=1;i<=n;i++){
		pre[i+1]=pre[i];
		if(s[i]=='E') pre[i+1]++;
	}
	for(int i=n;i>=1;i--){
		suf[i-1]=suf[i];
		if(s[i]=='E') suf[i-1]++;
	}
	int ans=N;
	for(int i=1;i<=n;i++){
		int cmp=(i-1-pre[i])+suf[i];
		ans=min(ans,cmp);
	}
	printf("%d\n",ans);
	return 0;
} 

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

int main() {
  string s,t;
  int j;
  cin>>s;
  int N=s.size();
  N=(N+1)/2;
  for(int i=0;i<N;i++){
    j=2*i;
    t+=s[j];
  }
  cout<<t<<endl;
}

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

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	long long int res = 0;
	long long int count[5] = {0,};
	string str = "MARCH";
	int n;
	string s;

	cin >> n;

	for(int i=0;i<n;i++)
	{
		cin >> s;
		
		for(int j=0;j<5;j++)
		{
			if(s[0]==str[j])
			{
				count[j]++;
				break;
			}
		}
	}

	for(int i=0;i<5;i++)
	{
		for(int j=i+1;j<5;j++)
		{
			for(int k=j+1;k<5;k++)
			{
				res += (count[i]*count[j]*count[k]);
			}
		}
	}

	cout << res << '\n';
	
	return 0;
}

Measured memory_bytes: 892
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	string s,t;
    cin>>s>>t;
    int c=0,ln=s.length();
    FOR(i,0,ln){
        if(s[i]!=t[i])c++;
    }
    cout<<c;
}


Measured memory_bytes: 3828
#include<stdio.h>
#include<vector>
#include<algorithm>

using namespace std;

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

int main()
{
	int N, a, b, c, d;
	scanf("%d%d%d%d%d", &N, &a, &b, &c, &d);
	ll s = a+(ll)c*(N-1), e = a+(ll)d*(N-1);
	for(int i = 0; i < N; i++){
		if( s <= b && b <= e ) return !printf("YES\n");
		s += -d-c; e += -d-c;
	}
	printf("NO\n");
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#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++)
using namespace std;
typedef long long ll;

int main() {
  int K; string S; cin >> K >> S;
  if (S.size() > K) S = S.substr(0,K) + "...";
  cout << S << endl;
  return 0;
}

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

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

  vector<bool> num(26);
  for (int i = 0; i < 26; i++)
  {
    num.at(i) = false;
  }

  for (int i = 0; i < s.size(); i++)
  {
    num.at(s.at(i) -'a') = true;
  }
  
  for (int i = 0; i < 26; i++)
  {
    if(!num.at(i)){
      char ans = i + 'a';
      cout << ans << endl;
      return 0;
    }
  }

  puts("None");
}


Measured memory_bytes: 512
#include<iostream>
#include<queue>
using namespace std;
priority_queue<int> q1;
long long int s[105];
int main(){
	long long int n;
	long long int a,b,c;
	long long int i,j,k;
	long long int s1,s2;
	k=0;
	while(cin>>n && n){
		b=0;
		for(i=0;i<n;i++){
			cin>>a;
			b+=a;
		}
		for(i=0;i<n-1;i++){
			cin>>a;
			q1.push(a);
		}
		c=n;
		s1=b*c;
		for(i=0;i<n-1;i++){
			a=q1.top();
			q1.pop();
			b+=a;
			c--;
			if(s1<b*c){
				s1=b*c;
			}else{
				break;
			}
		}
		s[k]=s1;
		k++;
		while(!q1.empty()){
			q1.pop();
		}
	}
	for(i=0;i<k;i++){
		cout<<s[i]<<endl;
	}
	return 0;
}

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

long long choose2(long long n){
  return n*(n-1)/2;
}

int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for(long long i=0;i<n;i++){
    cin >> a.at(i);
    a.at(i) -=1;
  }
  vector<long long> cnt(n);
  for(long long i=0;i<n;i++){
    cnt.at(a.at(i))++;
  }
  long long total=0;
  for(long long i=0;i<n;i++){
    total +=cnt.at(i)*(cnt.at(i)-1)/2;
  }
  for(long long i=0;i<n;i++){
    long long ans=total;
    ans -= choose2(cnt.at(a.at(i))) - choose2(cnt.at(a.at(i))-1);
    cout << ans << endl;
  }
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
const int maxn=200+10;
const int inf=0x3f3f3f3f;
int g[maxn][maxn];

int main()
{
    int n,m,r;
    int x;
    while(cin>>n>>m>>r){
	    memset(g,inf,sizeof(g));
	    vector<int> e;
	    for(int i=0;i<r;i++){
	        cin>>x;
	        e.push_back(x);
	    }
	    for(int i=0;i<m;i++){
	        int a,b,c;
	        cin>>a>>b>>c;
	        g[a][b]=c;
	        g[b][a]=c;
	    }
	    for(int k=1;k<=n;k++){
	        for(int i=1;i<=n;i++){
	            for(int j=1;j<=n;j++){
	                if(g[i][k]<inf&&g[k][j]<inf&&g[i][j]>g[i][k]+g[k][j]){
	                    g[i][j]=g[i][k]+g[k][j];
	                }
	            }
	        }
	    }
	    int ans=0x3f3f3f3f;
	    string s;
	    s.clear();
	    for(int i=1;i<=r;i++)
	        s.push_back(i+'0');
	   		int tmp=0;
	        for(int i=0;i<r-1;i++){
	            int x=s[i]-'0';
	            int y=s[i+1]-'0';
	            int xx=e[x-1];
	            int yy=e[y-1];
	            tmp+=g[xx][yy];
	        }
	        ans=min(ans,tmp);
	    	while(next_permutation(s.begin(),s.end())){
	        tmp=0;
	        for(int i=0;i<r-1;i++){
	            int x=s[i]-'0';
	            int y=s[i+1]-'0';
	            int xx=e[x-1];
	            int yy=e[y-1];
	            tmp+=g[xx][yy];
	        }
	        ans=min(ans,tmp);
	    }
	    cout<<ans<<endl;
	}
    return 0;
}

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

int main()
{
 int n,k;
  while(cin>>n>>k){
	int temp = abs(n-k)/2;
    if(abs(n-k)%2==0){
      cout<<temp+min(n,k)<<endl;
    }
    else{
      cout<<"IMPOSSIBLE"<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  long long K;
  cin >> S >> K;
  if (K>100) {K=100;}
    string r="0";
    for (int i=0;i<K;i++) {
      if (S[i]!='1' && r=="0") {r=S[i];}
    }
    if (r=="0") {cout << 1 << endl;}
    else {cout << r << endl;}
  
}


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

int main()
{ 
    //HP    At
    int A,   B;//Takahashi
    int C,   D;//Aoki

    cin >> A >> B >> C >> D;

    for(;;)
    {
        C -= B;
        if(C <= 0)
        {
            cout << "Yes" << endl;
            return 0;
        }



        A -= D; 
        if(A <= 0 )
        {
            cout << "No" << endl;
            return 0;
        }

    }



}


Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>
#include <functional>
#include <queue>

#define int long long
int inf = (1LL <<  62);
using namespace std;


signed main(){
    int n, k;
    cin >> n >> k;
    int a = n / k;
    int b = n - a * k + 1;
    if(k == 1){
        cout << 0;
        exit(0);
    }
    cout << b - a;
    
}

Measured memory_bytes: 256
#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>;
const int INF=1001001001;

int main() {
  int a,b;
  cin>>a>>b;
  int c=6-a-b;
  cout<<c;

}


Measured memory_bytes: 256
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    a = []
    for i in range(n):
        a.append(f()[0])
    
    a = list(set(a))

    print(len(a))

solve()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
	int i,j,k,m,n;
	char c;
	scanf("%c",&c);
	if(c=='A')printf("T");
	if(c=='T')printf("A");
	if(c=='G')printf("C");
	if(c=='C')printf("G");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mk make_pair
using namespace std;
 
const int N = 805;
const int mod = 1e9;
const int inf = 1e9;
  
int n, m, k, ans, dis[N][N];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
queue< pair<int, int> > Q;
pair<int, int> st;
bool bo[N][N];
char s[N][N];

void bfs() {
	memset(dis, 127, sizeof(dis)); 
	Q.push(st);
	bo[st.first][st.second] = 1;
	dis[st.first][st.second] = 0;
	while (!Q.empty()) {
		int x = Q.front().first;
		int y = Q.front().second;
		Q.pop();
		for (int i = 0; i < 4; i++) {
			int xx = x + dx[i];
			int yy = y + dy[i];
			if (xx < 1 || xx > n || yy < 1 || yy > m || s[xx][yy] == '#' || bo[xx][yy]) continue;
			bo[xx][yy] = 1;
			dis[xx][yy] = dis[x][y] + 1;
			Q.push(mk(xx, yy));
		}
	}
}

int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  for (int i = 1; i <= n; i++)
  	for (int j = 1; j <= m; j++)
  		if (s[i][j] == 'S') st = mk(i, j);
  ans = inf;
  bfs();
  for (int i = 1; i <= n; i++) {
  	for (int j = 1; j <= m; j++) {
  		if (dis[i][j] > k) continue;
  		int tmp = min(i - 1, n - i);
  		tmp = min(tmp, j - 1);
  		tmp = min(tmp, m - j);
  		ans = min(ans, 1 + (tmp + k - 1) / k);
		}
	}
	cout << ans;
}

Measured memory_bytes: 4096
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as MV

main :: IO ()
main = do
    n <- fst . fromJust . B.readInt <$> B.getLine
    as <- sortBy (flip compare) . map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    mv <- V.unsafeThaw (V.fromList as)
    ans <- f mv (1 :: Int) (0 :: Int) n 1
    print ans
    where
        f mv a c n i
            | i >= n = return 0
            | otherwise = do
                x <- MV.unsafeRead mv i
                y <- MV.unsafeRead mv (i - 1)
                if x == y
                    then do
                        let b = a * x
                        MV.unsafeWrite mv i (-1)
                        if c + 1 == 2
                            then return b
                            else f mv b (c + 1) n (i + 1)
                    else f mv a c n (i + 1)


Measured memory_bytes: 16764
n = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
ds = [abs(x - y) for x, y in zip(xs, ys)]
for i in range(1, 4):
    ans = 0
    for d in ds:
        ans += d**i
    print(ans**(1/i))
print(max(ds))


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

char toggle(char i)
{
    if (i == '0')
        i = '1';
    else
        i = '0';

    return i;
}

int main() {
    string s;
    cin >> s;
    char init = s[0];
    string s_aux = s;
    char init_n = toggle(init);
    int count1 = 0, count2 = 1;
    for (int i = 1; i < s_aux.length(); i++)
    {
        if (s_aux[i] == init)
        {
            s_aux[i] = toggle(s_aux[i]);
            count1++;
        }
        init = toggle(init);
    }
    for (int i = 1; i < s.length(); i++)
    {
        if (s[i] == init_n)
        {
            s[i] = toggle(s[i]);
            count2++;
        }
        init_n = toggle(init_n);
    }

    if (count2 < count1)
        cout << count2;
    else
        cout << count1;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  ll t = x/d;
  x -= d*t;
  k -= abs(t);
  if (k < 0) {
    x += -1*k*d;
    cout << abs(x) << '\n';
    return 0;
  }
  if (k%2 == 0) cout << abs(x) << '\n';
  else cout << min(abs(x+d),abs(x-d)) << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

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

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define PI 3.14159265359
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define fr(it, a, b) \
    for (int it = (a); it < (b); it++)
#define tr(con, it) \
    for (auto it = con.begin(); it != con.end(); it++)
#define present(con, ele) (con.find(ele) != con.end())
#define cpresent(con, ele) (find(all(con), ele) != con.end())
#define maximum(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
#define minimum(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
typedef long long ll;
typedef long double lf;
typedef pair<int, int> pi;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
int32_t main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string ans = "";
    ll n, s = 26, cnt = 1;
    cin >> n;
    while (n - s >= 1)
    {
        cnt++;
        n -= s;
        s *= 26;
    }
    s /= 26;
    fr(i, 0, cnt)
    {
        ans += (n - 1) / s + 'a';
        n -= s * ((n - 1) / s);
        s /= 26;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int main ()
{
    int a, b, c, x;
    cin >> a>> b >>c;
    if (a>b) {
        x=a;
        a=b;
        b=x;
    }
       if(b > c){
      x = b;
      b = c;
      c = x;

 

   }
   
   if(a > b){
      x = a;
      a = b;
      b = x;
      
   }
   
   cout << a << " " << b << " " << c << endl;
   
   return 0;
}


Measured memory_bytes: 3084
/*
 * main.c
 *
 *  Created on: 2020/03/28
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}

void yesno(int ans) {
	if (ans == 1) {	printf("Yes\n");
	} else {		printf("No\n");	}
	return;
}

void okng(int ans) {
	if (ans == 1) { printf("OK\n");
	} else { 		printf("NG\n");	}
	return;
}

int main()
{
	int A = 0, B = 0, C = 0, K = 0;
	int ans = 0;
	scanf("%d %d %d %d", &A, &B, &C, &K);

	if (K >= A) {
		ans += A * 1;
		K = K - A;
	} else {
		ans += K * 1;
		K = 0;
	}
	if (K != 0) {
		if (K >= B) {
			K = K - B;
		} else {
			K = 0;
		}
	}
	if (K != 0) {
		if (K >= C) {
			ans += (C * -1);
		} else {
			ans += (K * -1);
			K = 0;
		}
	}

	printf("%d\n", ans);

	//yesno(ans);
	//okng(ans);
	return 0;
}


Measured memory_bytes: 1728
n, k = map(int, input().split())
a = list(map(int, input().split()))

# binary search
left = 1
right = 10 ** 9

while left < right:
    center = (left + right) // 2

    total = 0
    for i in a:
        if i % center == 0:
            i -= 1
        total += i//center
    
    if total > k:
        left = center + 1
    else:
        right = center

print(left)

Measured memory_bytes: 103588
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define SORT(v) sort(v.begin(),v.end())
#define fori(i,a,b) for(ll i=a;i<b;i++)
#define M 1000000007
#define deb(x) cout<< #x << " " << x << endl;

double pi=3.14159265358979323846;

typedef pair<int,int> pii;
typedef pair<long long int, long long int>pll;
typedef vector<int>vi;
typedef vector<long long int>vl;
#define MAXN 10000001
 
int main ()
{
    ll T;
   T=1;
   //cin>>T;
    while(T--)
    {	
    ll n;
    cin>>n;
    vi a(n),b(n),c(n);
    fori(i,0,n)cin>>a[i]>>b[i]>>c[i];
    vi dpa(n,-1),dpb(n,-1),dpc(n,-1);
    dpa[0]=a[0];dpb[0]=b[0];dpc[0]=c[0];
    ll mn=INT_MAX;
    for(ll i=1;i<n;i++){
    	dpa[i]=a[i]+max(dpb[i-1],dpc[i-1]);
    	dpb[i]=b[i]+max(dpa[i-1],dpc[i-1]);
    	dpc[i]=c[i]+max(dpa[i-1],dpb[i-1]);
    }
    
	cout<<max(dpa[n-1],max(dpb[n-1],dpc[n-1]))<<endl;
    }
    return 0;
}


Measured memory_bytes: 5640
function main(s) {
	s = s.split("\n")[0].split(" ").map(x => Number(x));
	console.log((s[0]%3===0)||(s[1]%3===0)||((s[0]+s[1])%3===0)?"Possible":"Impossible");
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 7372
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int  numS = scanner.nextInt();//要素数
		int arrayS[] = new int[numS];
		
		for(int i = 0; i < numS; i ++ ){
			arrayS[i] = scanner.nextInt();
		}
		int  numT = scanner.nextInt();//要素数
		int arrayT[] = new int[numT];
		
		for(int i = 0; i < numT; i ++ ){
			arrayT[i] = scanner.nextInt();
		}
		
		LinearSearch(numS,arrayS,numT,arrayT);
		
		scanner.close();
	}
	
	public static void LinearSearch(int numS,int[] arrayS,int numT, int[] arrayT){ 
		int count = 0;
		int match = 0;
		int i;
		
		for(i = 0; i < numT; i ++ ){
			count = 0;
			while( count < numS ){
				if(arrayT[i] == arrayS[count]){
					match ++;
					break;
				}
				count ++;
			}
		}
		
		System.out.println(match);	
	}
}


Measured memory_bytes: 68760
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)

int main (){
	int NN,MM,tempa,tempb,temp;
	cin >> NN >> MM;
	pair<int,int> temppair;
	vector <pair< int , int > > cuts;
	rep(i,MM){
		cin >> tempa >> tempb;
		if(tempa>tempb)	{temp = tempa;tempa = tempb;tempb = temp;}
		cuts.push_back(make_pair(tempa,tempb));
	}
	sort(cuts.begin(),cuts.end());
	int ff = cuts[0].first;
	int fb = cuts[0].second;
	int ans = 1;
	rep(i,MM){
		if(cuts[i].first == ff)	continue;
		if ( fb <= cuts[i].first ){
			ff = cuts[i].first;
			fb = cuts[i].second;
			ans ++;
		}
		if( fb > cuts[i].second ){
			fb = cuts[i].second;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
typedef long long ll;
inline ll read() {ll x = 0;char ch = getchar(), w = 1;while(ch < '0' || ch > '9') {
if(ch == '-') w = -1;ch = getchar();}while(ch >= '0' && ch <= '9') {x = x * 10 + ch - '0';
ch = getchar();}return x * w;}
void write(ll x) {if(x < 0) putchar('-'), x = -x;if(x > 9) write(x / 10);putchar(x % 10 + '0');}
inline void writeln(ll x) {write(x);puts("");}
void setIO() {
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
using namespace std;
const int N = 9999;
int n;
int a[N];
double res = 0;
int main() {
	n = read();
	for(int i = 1; i <= n; ++i) {
		a[i] = read();
		res += 1.0 / a[i];
	}
	res = 1.0 / res;
	printf("%.10lf\n", res);
	return 0;
}

Measured memory_bytes: 256
#define MAX 10000005
int p[MAX];
int four[1000];

int main(void)
{
  int i,j,f=0;

  for(i=2;i<MAX;i++)
    if(p[i]==0)
      for(j=i*2;j<MAX;j+=i)
	p[j]=1;
  
  for(i=3 ; i < MAX-7 ; i+=2){
    if(p[i] == 0 && p[i+2]==0 && p[i+6]==0 && p[i+8]==0)
      {
	four[f++]=i+8;
      }
    four[f]=10000005;
  }
  
  for(;scanf("%d",&j);)
    {
      if(j==0)
	exit(0);
      for(i=0 ;four[i]<=j; i++);
      printf("%d\n",four[i-1]);
    }
  
  return 0;
}

Measured memory_bytes: 0
def a_digits_sum(N):
    # A+B のk桁目を c_k、Nのk桁目をn_kとおくと、筆算の考え方より、
    # c_k=n_k となるようにすればいい。つまり解はNの各桁の和に等しい。
    # ただし、Nが10の冪乗のときは、上の考え方では片方がNに等しくなってしまう。
    # この場合、 N=10^k とすると、 A=a*10^(k-1), B=b*10^(k-1) (ただし a+b=10)
    # の形にするしかない。よってA+Bの各桁の和は常に10。
    ans = 0
    n = str(N)
    for c in n:
        ans += int(c)
    if ans == 1:
        # 最上位桁に1が出て、その後0しか出ていない。Nは10の冪乗だった
        ans = 10
    return ans

N = int(input())
print(a_digits_sum(N))

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<cstring>
#include<queue>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstdlib>
#include <math.h>
#define INF 0x3f3f3f3f
using namespace std;
int main()
{
	int h,w,n;
	int a[10001],ans[101][101];
	scanf("%d %d %d\n",&h,&w,&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]); 
	} 
	int p=1,j=0;
	for(int i=0;i<h;i++)
	{
		if(j<=0)
		{
			  for(j=0;j<w;j++)
	        {
		      ans[i][j]=p;
		      a[p]--;
		      if(a[p]==0)
		      p++;
	        }
	        
		}
		else
		{
			for(j=w-1;j>=0;j--)
        	{
		       ans[i][j]=p;
		       a[p]--;
		      if(a[p]==0)
		      p++;
        	}
		}
    }
    for(int i=0;i<h;i++)
    {
    	for(int j=0;j<w;j++)
    	{
    		printf("%d",ans[i][j]);
    		if(j!=w-1)
    		printf(" ");
		}
		printf("\n");
	}
}

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


#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ll long long
#define pair < int , int > pii


ll x, y;


int main(){

	cin >> x >> y;
	int ans = 0;
	while(x <= y){
		x *= 2;
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
# coding: utf-8
a, b, c = map(int, input().split())
k = int(input())
if(a > b and a > c):
    for aa in range(k):
        a = a * 2
elif(b > a and b > c):
    for bb in range(k):
        b = b * 2
else:
    for cc in range(k):
        c = c * 2
print(a+b+c)


Measured memory_bytes: 3060
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    S = [0] * (10**5)
    for a in A: S[a] += 1
    ans = max(S[0] + S[1], S[-1] + S[-2])
    for i in range(1, 10**5 - 1):
        ans = max(ans, S[i - 1] + S[i] + S[i + 1])
    print(ans)

if __name__ == "__main__":
    main()


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

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

int main(){
    int n;
    cin >> n;
    int h[n];
    rep(i, n) cin >> h[i];
    bool flag = true;
    for (int i = n - 1; i; i--){
        if (h[i - 1] - 1 == h[i])
            h[i - 1]--;
        if (h[i - 1] - 1 > h[i])
            flag = false;
    }
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int r = n%10;
    if(r==0||r==1||r==6||r==8){
        cout<<"pon"<<endl;
    }else if(r==3){
        cout<<"bon"<<endl;
    }else{
        cout<<"hon"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i, s, n) for(int i=s; i<n; i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

int main() {
  int A[3][3];
  int N;
  rep(i, 3) {
    rep(j, 3) {
      cin >> A[i][j];
    }
  }
  cin >> N;
  int b;
  rep(k, N) {
    cin >> b;

    rep(i, 3) {
      rep(j, 3) {
        if(A[i][j]==b) {
          A[i][j] = -1;
        }
      }
    }
  }

  bool bingo = false;

  rep(i, 3) {
    int sum = 0;
    rep(j, 3)
    {
      sum += A[i][j];
    }

    if(sum==-3) {
      bingo = true;
      break;
    }
  }

  rep(i, 3) {
    int sum = 0;
    rep(j, 3)
    {
      sum += A[j][i];
    }

    if(sum==-3) {
      bingo = true;
    }
  }

  int sum = 0;
  rep(i, 3)
  {
    sum += A[i][i];
  }
  if(sum==-3) {
    bingo = true;
  }

  sum = 0;
  rep(i, 3)
  {
    sum += A[i][2-i];
  }
  if(sum==-3) {
    bingo = true;
  }

  if(bingo) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long int;

const ll INF = 1LL << 60;

void chmin(ll &a, ll b) {
  a = min(a, b);
}

int main() {
  int N, M, L, S, T;
  while(1) {
    scanf("%d%d%d%d%d", &N, &M, &L, &S, &T);
    if(N == 0) break;
    
    S--;
    vector<ll> siro(L), time(L);
    vector< vector<ll> > dist(N, vector<ll>(N, INF)), dp(1<<L, vector<ll>(L, INF));

    for(int i=0; i<N; i++) {
      dist[i][i] = 0;
    }

    for(int i=0; i<M; i++) {
      int a, b, c; scanf("%d%d%d", &a, &b, &c);
      a--; b--;
      chmin(dist[a][b], c);
      chmin(dist[b][a], c);
    }
    for(int i=0; i<L; i++) {
      scanf("%lld%lld", &siro[i], &time[i]);
      siro[i]--;
    }

    for(int k=0; k<N; k++) {
      for(int i=0; i<N; i++) {
        for(int j=0; j<N; j++) {
          chmin(dist[i][j], dist[i][k] + dist[k][j]);
        }
      }
    }

    dp[0][0] = 0;
    for(int bit=0; bit<(1<<L); bit++) {
      for(int k=0; k<L; k++) {
        for(int i=0; i<L; i++) {
          if(bit >> i & 1) continue;

          int nbit = bit | (1 << i);
          
          int u = (bit == 0 ? S : siro[k]);
          int v = siro[i];
          ll cost = dist[u][v] + time[i];

          // printf("u = %d, v = %d, cost = %lld\n", u+1, v+1, cost);
          chmin(dp[nbit][i], dp[bit][k] + cost);
        }
      }
    }

    ll ans = 0;
    for(int bit=0; bit<(1<<L); bit++) {
      for(int k=0; k<L; k++) {
        ll cost = dp[bit][k] + dist[ siro[k] ][S];
        // printf("bit = %d, k = %d, cost = %lld\n", bit, k, cost);
        if(cost > T) continue;
        ans = max(ans, (ll)__builtin_popcount(bit));
      }
    }

    printf("%lld\n", ans);
  }

  return 0;
}



Measured memory_bytes: 13888
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int X, N;
    cin >> X >> N;
    vector<int> P(N);
    rep(i, N) cin >> P[i];
    int ans = -100;
    for (int i = 0; i <= 101; i++) {
        if (count(P.begin(), P.end(), i)) continue;
        if (abs(ans - X) > abs(i - X)) ans = i;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3600
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, M = map(int, input().split())
adj = [[] for _ in range(N)]

for _ in range(M):
    a, b = map(lambda x: int(x)-1, input().split())
    adj[a].append(b)
    adj[b].append(a)

for l in adj:
    print(len(l))


Measured memory_bytes: 3060