akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int find_index(const vector<pair<int, int>> &v, int l) {
    if (v.back().first < l)
        return -1;
    if (v.front().first >= l)
        return 0;

    int lower = 0;
    int upper = v.size() - 1;
    do {
        int cur = (lower + upper) / 2;
        if (v[cur].first >= l)
            upper = cur;
        else
            lower = cur;
    } while (upper - lower > 1);
    return upper;
}

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<int>> cnt(m, vector<int>(n));
    vector<pair<int, int>> range(m);
    for (int i = 0; i < m; ++i) {
        int l, r;
        cin >> l >> r;
        --l;
        --r;
        range[i] = {l, r};
    }
    sort(range.begin(), range.end());
    for (int i = m - 1; i >= 0; --i) {
        for (int j = 0; j < n; ++j) {
            if (i + 1 < m)
                cnt[i][j] = cnt[i + 1][j];
            if (range[i].second <= j)
                ++cnt[i][j];
        }
    }
    for (int i = 0; i < q; ++i) {
        int p, q;
        cin >> p >> q;
        --p;
        --q;
        int idx = find_index(range, p);
        if (idx != -1) cout << cnt[idx][q] << endl;
        else
            cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 401024
fun main(args: Array<String>) {
    readLine()?.split(" ")?.map { it.toInt() }?.let {
        var a = it[0]
        val b = it[1]
        var c = it[2]
        val d = it[3]

        while (true) {
            c -= b
            if (c < 1) {
                println("Yes")
                break
            }
            a -= d
            if (a < 1) {
                println("No")
                break
            }
        }

    }
}

Measured memory_bytes: 36288
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <tuple>
#include <random>
#include <map>
using namespace std;

const double pi = acos(-1);
#define nyan cout << "(=^•ω•^=)" << endl;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop while(true)
#define YN(f) f?cout<<"YES"<<endl:cout<<"NO"<<endl;
#define yn(f) f?cout<<"Yes"<<endl:cout<<"No"<<endl;

int n,h,w;
int a[2000];
int b[2000];
int ans;

signed main(){
	cin>>n>>h>>w;
	rep(i,n)cin>>a[i]>>b[i];
	rep(i,n){
		if(a[i]>=h&&b[i]>=w)ans++;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
    //int a, n, card[4][13] = { {} }, x = 0, y = 0, k = 0, q[52], tmp;
    int n, b, f, r, v, room[10][3][4] = { {{}} };
    
    //char ch,p[52];
     
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> b >> f >> r >> v;
        room[r-1][f-1][b-1] += v;

    }

    for (int k = 0; k < 4; k++) {
        for (int j = 0; j < 3; j++) {
            for (int i = 0; i < 10; i++) {
                
                //if(i==9) printf("%d", room[i][j][k]);
                printf(" %d", room[i][j][k]);
            }
            printf("\n");
        }
        if (k == 3) printf("");
        else printf("####################\n");
    }
    return 0;
}

/*
    for (int i = 0; i < n-1; i++) {
        for (int j = i; j < n; j++) {

           if (a[i] < a[j]) {
                tmp = a[i];
                a[i] = a[j];
                a[j] = tmp;
            }
        }
    }
            */


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cerr<<' ';cout<<elem;}cerr<<endl;}

//解説参考. 解法2.
int main(){
	int n,k;
	cin>>n>>k;
	
	vector<llong> v(n);
	int cnt=0;
	REP(i,n){
		cin>>v[i];
		if(v[i]<0) cnt++;
	}
	
	if(cnt==n and k%2==1){
		sort(ALL(v),greater<llong>());
		llong anss=1;
		REP(i,k) anss=anss*(MOD+v[i])%MOD;
		cout<<anss<<endl;
		return 0;
	}
	
	vector<llong> a,b;
	REP(i,n){
		if(v[i]<0) a.push_back(v[i]);
		else b.push_back(v[i]);
	}
	sort(ALL(a));
	sort(ALL(b),greater<llong>());
	
	llong ans=1;
	int pa=0, pb=0;
	while(k>0){
		if(k==1){
			if(pb==b.size()) ans=ans*(MOD+a[pa++])%MOD;
			else ans=ans*b[pb++]%MOD;
			k--;
		}else{
			if(pa==a.size()){
				ans=ans*b[pb++]%MOD;
				k--;
			}else if(pb==b.size()){
				ans=ans*(MOD+a[pa++])%MOD;
				k--;
			}else{
				if(a.size()-pa>=2 and b.size()-pb>=2){
					if(b[pb]*b[pb+1]>a[pa]*a[pa+1]){
						ans=ans*b[pb++]%MOD;
						k--;
					}else{
						REP(i,2) ans=ans*(MOD+a[pa++])%MOD;
						k-=2;
					}
				}else if(a.size()-pa==1){
					ans=ans*b[pb++]%MOD;
					k--;
				}else{
					REP(i,2) ans=ans*(MOD+a[pa++])%MOD;
					k-=2;
				}
			}
		}
		
		//debug(ans);
		//debug(k);
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 6928
#include <stdio.h>
#include<math.h>

int main(void)
{
	double  ave,bun,sa,bunsa,hensa, poi[1000], gou;
	int n,i;

	while(1) {
		gou = 0;
		bunsa = 0.0;

		scanf("%d", &n);
		if (n == 0) {
			break;
		}
		
		for (i = 0; i < n; i++) {
			scanf("%lf", &poi[i]);
			gou += poi[i];
		}
		ave = gou * 1.0 / n;

		
		

		sa = 0.0;
		hensa = 0.0;
		bunsa = 0.0;
		for (i = 0; i < n; i++) {
			sa = poi[i] - ave;
			bunsa = bunsa + (sa * sa);
		}
		hensa = sqrt(bunsa/n);

		printf("%f\n", hensa);
		
	}

	return 0;
}


Measured memory_bytes: 2044
package main

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

func main() {
	var str string
	// s := wordScanner()
	// scanStrings(s, &str)
	fmt.Scanln(&str)

	sample := strings.Repeat("10", 50001)

	fmt.Println(min(sub(str, sample), sub(str, sample[1:])))
}

func sub(s, t string) int {
	c := 0
	for i := range s {
		if s[i] != t[i] {
			c++
		}
	}
	return c
}

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

func scanStrings(s *bufio.Scanner, vals ...*string) {
	for i := range vals {
		s.Scan()
		*vals[i] = s.Text()
	}
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}


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

//Write your function here!



int main()
{
	long long N;
	cin >> N;
	long long count = N / 2 + 1;
	long long ans = 1;
	for (long long i = 0;i < count;i++) {
		if (i * i <= N && i != 0) {
			ans = i * i;
		}
	}

	cout << ans << endl;
}


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

int main() {
    int n;
    string s;

    cin >> n;

    switch (n % 10) {
        case 3:
            s = "bon";
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            s = "pon";
            break;
        default:
            s = "hon";
            break;
    }

    cout << s << endl;
}




Measured memory_bytes: 3620
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}

		String blank = " ";
		for (int i = array.length-1; i >-1; i--) {
			if (i == 0) {
				System.out.print(array[i]);
			} else {
				System.out.print(array[i] + blank);
			}
		}
		System.out.println("");
	}
}

Measured memory_bytes: 26448
#include<iostream>
#include<fstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<ctime>
#include<random>
#include<algorithm>
#define ll long long
using namespace std;
int n;
int h[200];
int ans=0;

bool check()
{
    for (int i=0; i<n; ++i)
        if (h[i]>0) return 1;
    return 0;
}
void work()
{
    int i,j;
    for (i=0; i<n; ++i)
        if (h[i])
        {
            ans++;
            h[i]--;
            for (j=i+1; j<n; ++j)
            {
                if (h[j]==0)
                {
                    break;
                }else
                {
                    h[j]--;
                }
            }
            i=j;
        }
}
int main()
{
    cin>>n;
    for (int i=0; i<n; ++i)
        cin>>h[i];
    while (check())
    {
        work();
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int i=0;i<N;i++)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

struct edge{int to;};
int V,E;
vector<vector<edge> >G;
map<int,int>dp;

//vからの最大の深さ
int dfs(int v){
  int l = 0;
  if(G[v].size()==0) return dp[v] = 0;
  if(dp.count(v)!=0) return dp[v];
  REP(i,G[v].size()){
    l = max(l,dfs(G[v][i].to)+1);
  }
  return dp[v] = l;
}

int main(void){
  cin >> V >> E;
  G.resize(V);
  REP(e,E){
    int from,to;
    cin >> from >> to;
    from--;to--;
    G[from].push_back({to});
  }
  int maximum = 0;
  REP(v,V){
    maximum = max(maximum,dfs(v));
  }
  cout << maximum << endl;
  return 0;
}


Measured memory_bytes: 13824
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

int n, k;
int a[200010];
int pos[200010];

int bit[200010];
int lowbit(int x){return x&(-x);}
void modify(int x, int y)
{
    while(x<=n)
    {
        bit[x] += y;
        x += lowbit(x);
    }
}
int presum(int x)
{
    if(!x) return 0;
    int ans = 0;
    while(x)
    {
        ans += bit[x];
        x -= lowbit(x);
    }
    return ans;
}
int query(int x, int y)
{
    //cout << "query " << x << " " << y << endl;
    return presum(y) - presum(x-1);
}

int R[200010];
int L[200010];
int ac[200010];
int S[200010];

int main()
{
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> n >> k;
    Forn(i, n)
    {
        int x;
        cin >> x;
        x++;
        a[i] = x;
        pos[x] = i;
    }

    //cout << "ok" << endl;

    Forn(i, n)
    {
        //cout << "i = " << i << endl;
        modify(pos[i], 1);
        //cout << "modify " << pos[i] << " 1" << endl;
        int l = pos[i]+1;
        int r = pos[i]+k-1;

        //if(1<=l && r<=n) cout << l << " " << r << " " << query(l, r) << endl;

        if(1<=l && r<=n && query(l, r) == 0) R[pos[i]] = 1;
        r = pos[i]-1;
        l = pos[i]-k+1;

        //if(1<=l && r<=n) cout << l << " " << r << " " << query(l, r) << endl;

        if(1<=l && r<=n && query(l, r) == k-1) L[pos[i]] = 1;
    }



    //cout << "ok" << endl;

    Forn(i, n-1)
    {
        if(a[i]<a[i+1]) ac[i] = 1;
    }
    int sum = 0;
    Forn(i, k-1) sum += ac[i];
    if(sum ==  k-1) S[1] = 1;
    //cout << "1 " << sum << endl;
    for(int i=2; i+k-2<=n; i++)
    {
        //cout << i << " " << sum << endl;
        sum += ac[i+k-2];
        sum -= ac[i-1];
        if(sum == k-1) S[i] = 1;
    }

    //cout << "ok" << endl;

    /*Forn(i, n)
    {
        cout << R[i] << " " ;
    }
    cout << endl;
    Forn(i, n)
    {
        cout << L[i] << " " ;
    }
    cout << endl;
    Forn(i, n)
    {
        cout << ac[i] << " " ;
    }
    cout << endl;
    Forn(i, n)
    {
        cout << S[i] << " " ;
    }
    cout << endl;*/



    int ans = 0;
    int now;
    int counted = 0;
    if(S[1])
    {
        ans = 1;
        counted = 1;
        now = 1;
    }
    else
    {
        ans = 1;
        counted = 0;
        now = 0;
    }
    for(int i=2; i+k-1<=n; i++)
    {
        if(S[i])
        {
            now = 1;
            if(!counted) ans++;
            counted = 1;
        }
        else
        {
            if(!(R[i-1] && L[i+k-1]))
            {
                ans++;
                now = 0;
            }
        }
        //cout << i << " " << ans << " " << counted << endl;
    }
    cout << ans << endl;
}


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

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

  int a, b;
  cin >> a >> b;
  cout << max({a + b, a - b, a * b}) << endl;
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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


int main()
{
  int N, T;
  cin >> N >> T;

  int ans = INF;
  REP(i, N) {
    int c, t;
    cin >> c >> t;
    if (t <= T) {
      ans = min(ans, c);
    }
  }
  if (ans == INF)
    cout << "TLE" << endl;
  else
    cout << ans << endl;
	return 0;
}



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

using namespace std;

int main(void)
{
    long N;
    cin >> N;

    long A[N];
    for (int i = 0; i < N; ++i)
    {
        cin >> A[i];
    }

    long Q;
    cin >> Q;

    long num[100001] = {0};
    long long ans = 0;
    for (int i = 0; i < N; ++i)
    {
        num[A[i]] = num[A[i]] + A[i];
        ans = ans + A[i];
    }

    long B[Q], C[Q];

    for (int i = 0; i < Q; ++i)
    {
        cin >> B[i] >> C[i];
    }

    for (int i = 0; i < Q; ++i)
    {
        ans = ans - num[B[i]] + (C[i] * num[B[i]] / B[i]);
        num[C[i]] = num[C[i]] + (C[i] * num[B[i]] / B[i]);
        num[B[i]] = 0;
        cout << ans << "\n";
    }
}


Measured memory_bytes: 6284
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n,i,v[100000];
    cin >> n;
    for(i=0;i<n;i++) cin >> v[i];
    sort(v,v+n);
    double ans=v[0];
    for(i=1;i<n;i++){
        ans = (ans+v[i])/2;
    }
    cout << ans << endl;
}

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

if __name__ == "__main__":
    n = int(input())
    dum = list(map(int, input().split()))
    t, a = dum[0], dum[1]
    h = list(map(int, input().split()))

    diff = [0. for _ in range(n)]
    for i in range(n):
        temp = t - (h[i]*0.006)
        diff[i] = abs(a - temp)

    target = min(diff)
    flag = 0
    for i in range(n):
        if diff[i] == target:
            flag = i+1

    print(flag)

Measured memory_bytes: 3064
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int N;
int M;
int X;
int C[12];
int A[12][12];
int cur[12];
int main(){
  int i, mask;
  int res = 1073709056;
  int tmp;
  rd(N);
  rd(M);
  rd(X);
  for(i=(0);i<(N);i++){
    rd(C[i]);
    {
      int Q5VJL1cS;
      for(Q5VJL1cS=(0);Q5VJL1cS<(M);Q5VJL1cS++){
        rd(A[i][Q5VJL1cS]);
      }
    }
  }
  for(mask=(0);mask<(1<<N);mask++){
    int j;
    tmp = 0;
    for(j=(0);j<(M);j++){
      cur[j] = 0;
    }
    for(i=(0);i<(N);i++){
      if(((mask) &(1<<(i)))){
        tmp += C[i];
        for(j=(0);j<(M);j++){
          cur[j] += A[i][j];
        }
      }
    }
    int a2conNHc;
    int hCmBdyQB;
    if(M==0){
      hCmBdyQB = 0;
    }
    else{
      hCmBdyQB = cur[0];
      for(a2conNHc=(1);a2conNHc<(M);a2conNHc++){
        hCmBdyQB = min_L(hCmBdyQB, cur[a2conNHc]);
      }
    }
    if(hCmBdyQB< X){
      continue;
    }
    chmin(res, tmp);
  }
  if(res==1073709056){
    wt_L(-1);
    wt_L('\n');
  }
  else{
    wt_L(res);
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// int N, M, X, C[12], A[12][12];
// int cur[12];
// {
//   int res = int_inf, tmp;
//   rd(N,M,X);
//   rep(i,N) rd(C[i], A[i](M));
//   rep(mask,1<<N){
//     tmp = 0;
//     rep(j,M) cur[j] = 0;
//     rep(i,N) if(BIT_ith(mask,i)){
//       tmp += C[i];
//       rep(j,M) cur[j] += A[i][j];
//     }
//     if(min(cur(M)) < X) continue;
//     res <?= tmp;
//   }
//   wt(if[res==int_inf,-1,res]);
// }


Measured memory_bytes: 3516
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	var n, ans, min, p int

	sc.Split(bufio.ScanWords)
	n = next()

	ans, min = 0, math.MaxInt64
	for i := 0; i < n; i++ {
		p = next()
		if p < min {
			min = p
			ans++
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define DEKAI 1000000007
#define INF (1<<28)
#define int long long
/* ┗(^o^)┛ｗｗｗｗｗ┏(^o^)┓ﾄﾞｺﾄﾞｺﾄﾞｺﾄﾞｺｗｗｗｗｗ */

signed main(){
	int n;
	cin>>n;
	int a,b;
	cin>>a>>b;
	if(n==1) cout<<"Hello World"<<endl;
	else cout<<a+b<<endl;	

	return 0;
}


Measured memory_bytes: 256
n = int(input())
a_i = list(map(int,input().split(" ")))

def count_howmany_divide(val):
  result = 0

  while(True):
    if val % 2 != 0:
      break
    else:
      val /= 2
      result += 1

  return result
    

a_i_divided = list(map(count_howmany_divide, a_i))

print(min(a_i_divided))

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 1e5+5;

ll n , q , a[N] , freq[N] , ans=0;

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

    cin >> n;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        freq[a[i]]++;
        ans += a[i];
    }
    cin >> q;
    while(q--)
    {
        ll b,c,tmp,tmp2;
        cin >> b >> c;
        tmp = freq[b];
        ans -= b*freq[b];
        ans += c*freq[b];
        freq[c] += freq[b];
        freq[b]=0;
        cout << ans << '\n';
    }


    return 0;
}

Measured memory_bytes: 5148
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN 12
#define MAXM 1000
#define INF 1000000000
int dp[(1<<MAXN)+5];
int n,m,a[MAXM+5],cnt;
int ul[MAXM+5];
int main()
{
	memset(dp,0x3f,sizeof(dp));
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&a[i],&cnt);
		for(int j=1;j<=cnt;j++){
			int c;
			scanf("%d",&c);
			ul[i]|=(1<<(c-1));
		}
	}
	dp[0]=0;
	for(int S=0;S<(1<<n);S++){
		for(int i=1;i<=m;i++)
		dp[S|ul[i]]=min(dp[S|ul[i]],dp[S]+a[i]);
	}
	if(dp[(1<<n)-1]>INF)printf("-1");
	else printf("%d",dp[(1<<n)-1]);
}

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

int main(){
  int n; cin>>n;
  int count=0;
  for(int i=1;i<=n;i++){
    ll x; cin>>x;
    if(x!=i)count++;
  }
  if(count==0 || count==2)
    cout<<"YES";
  else cout<<"NO";
  return 0;
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
 PROGRAM-ID. TEST121.

 ENVIRONMENT DIVISION.

 DATA DIVISION.
 WORKING-STORAGE SECTION.

 01 INP   PIC X(100).
 01 H1    PIC 9(2).
 01 W1    PIC 9(2).
 01 H2    PIC 9(2).
 01 W2    PIC 9(2).
 01 WK    PIC 9(5).
 01 ANS   PIC ZZZZ9.

 PROCEDURE DIVISION.

 ACCEPT INP.
 UNSTRING INP DELIMITED BY ' '
  INTO H1 W1.

 ACCEPT INP.
 UNSTRING INP DELIMITED BY ' '
  INTO H2 W2.

 COMPUTE WK = (H1 - H2) * (W1 - W2).
 MOVE WK TO ANS.
 DISPLAY ANS.

 STOP RUN.  

Measured memory_bytes: 384
def toBinary(block):
    return [sum(1 << i for i,bb in enumerate(b) if bb == "#") for b in block]

def toStr(bfield):
    return ["".join("." if f & (1<<i) == 0 else "#" for i in xrange(W)) for f in bfield]

def rotated(block):
    return map(lambda x:"".join(x),zip(*[b[:] for b in block]))[::-1]

def striped(block):
    ret = [b[:] for b in block]
    while ret[-1] == "." * len(ret[0]):
        ret.pop(-1)
    while ret[0] == "." * len(ret[0]):
        ret.pop(0)
    return ret

def canPut(x, y):
    if not(0 < x + w <= W or 0 < y + h <= H):
        return False
    for f,b in zip(bfield[y:y+h], bblock):
        if (f & (b << x)) != 0:
            return False
    return True

def puted(x, y):
    ret = bfield[:]
    for i,b in zip(xrange(y,y+h), bblock):
        ret[i] = ret[i] | (b << x)
    #print "\n".join(toStr(ret)),"\n"
    return ret

def count(bfield):
    return sum(1 for f in bfield if f == (1 << W) -1)

for _ in xrange(input()):
    block = striped(rotated(striped([raw_input() for _ in xrange(map(int, raw_input().split())[0])])))
    h, w = len(block), len(block[0])
    H, W = map(int, raw_input().split())
    field = [raw_input() for _ in xrange(H)]
    bfield = toBinary(field)
    ini = count(bfield)
    FLAG = False
    ans = 0
    for _ in xrange(4):
        block = rotated(block)
        h, w = w, h
        bblock = toBinary(block)
        for y in xrange(0, H - h + 1):
            for x in xrange(0, W - w + 1):
                if canPut(x, y):
                    FLAG = True
                    ans = max(ans, count(puted(x, y)))
                    if ini + max(h, w) == ans:
                        break
            if ini + max(h, w) == ans:
                break
    print ans if FLAG else -1

Measured memory_bytes: 4436
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N, K = MAP()

print("YES" if K <= -(-N//2) else "NO")


Measured memory_bytes: 5144
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    from collections import defaultdict
    S = list(input())
    d = defaultdict(int)
    for s in S:
        d[s] += 1
    if (d["N"] == 0 and d["S"] > 0) or (d["N"] > 0 and d["S"] == 0) or (d["W"] == 0 and d["E"] > 0) or (d["W"] > 0 and d["E"] == 0):
        print("No")
    else:
        print("Yes")

    return


if __name__ == "__main__":
    main()


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

struct shop {
    int no,P;
    string S;

    bool operator<(const shop& another) const {
    if (S != another.S)
      return S < another.S;
    if (P != another.P)
      return P > another.P;
    return no < another.no;
  }
};


int main(){
    int i, N;
    cin >> N;
    vector<shop> vec(N);
    for(int i=0; i < N; i++){
        vec.at(i).no = i;
        cin >> vec.at(i).S >> vec.at(i).P;
    }
    sort(vec.begin(), vec.end());
    for(int i=0;i<vec.size();i++){
        cout << vec.at(i).no +1 << endl;
    }
}

/*
int main(){
    int N;
    vector<int> P(100),tmp(100);
    vector<string> S(100),cpS(100);
    
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> S.at(i) >> P.at(i);
        cpS.at(i) = S.at(i);
    }
    sort(cpS.begin(), cpS.end());
    for(int j=0; j<N; j++){
        int init = 0;
        for(int k=0; k<N; k++){   
            if(S.at(k)==cpS.at(j)){
                tmp.at(init)=P.at(k);
                init++;
            }
        }
        sort(tmp.begin(),tmp.end());
        reverse(tmp.begin(),tmp.end());
        for(int l=0; l<init; l++){
            cout << tmp.at(l) << endl;
        }
    }
}
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int x,y,z;
cin >> x >> y;
if(y%x==0) {
  cout << x+y << endl;
} else {
  cout << y-x << endl;
}
return 0;
}


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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }


int n;
string s;
bool use[15][15][15];
bool lsum[30005][15], rsum[30005][15];
void solve() {
    cin >> n >> s;

    rep(i, n) {
        if (i != 0)
            rep(j, 10) lsum[i][j] = lsum[i - 1][j];
        lsum[i][s[i] - '0'] = true;
    }

    repd(i, n) {
        rep(j, 10) rsum[i][j] = rsum[i + 1][j];
        rsum[i][s[i] - '0'] = true;
    }

    rep(l, 10) rep(r, 10) loop(i, 1, n - 1) {
        if (lsum[i - 1][l] && rsum[i + 1][r])
            use[l][s[i] - '0'][r] = true;
    }

    int ans = 0;
    rep(i, 10) rep(j, 10) rep(k, 10) if (use[i][j][k]) ++ans;

    cout << ans << endn;

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  ll h;
  cin >> h;
  ll ans = 0;
  ll cnt = 0;
  while (h >= 1) {
    h /= 2;
    ans += pow(2, cnt);
    cnt++;
  }
  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 4036
'''
i<j としたとき求めたいのは
i + Ai = j - Aj の組み合わせの数
そこで各々の Li = i + Ai, Ri = i - Aiを計算し辞書型で保持しておく
'''
from collections import defaultdict

N =int(input())
A = list(map(int,input().split()))
Li = defaultdict(int)
Ri = defaultdict(int)
for i,a in enumerate(A,start=1):
    Li[i+a] += 1
    Ri[i-a] += 1

ans = 0
for k,v in Li.items():
    if k in Ri:
        ans += Li[k]*Ri[k]

print(ans)

Measured memory_bytes: 53704
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
     
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        while(true){
            final int N = sc.nextInt();
             
            if(N == 0){
                break;
            }
             
            
            int sum = 1, left = 1, right = 1;
            int count = 0;
            
            while(right < N){
            	if(sum < N){
            		right++;
            		sum += right;
            	}else if(sum > N){
            		sum -= left;
            		left++;
            	}else{
            		count++;
            		
            		right++;
            		sum += right;
            	}
            }
            
            System.out.println(count);
        }   
         
    }
 
}

Measured memory_bytes: 19884
#include<fstream>
#include<string>
#include<iostream>
#include<sstream>
#include<iterator>
#include<cmath>

using namespace std;

int main(){
 int N;
 int D;
 cin >> N >> D;
 int x[N][D];
 int i;
 int j;
 for(i=0;i<N;++i){
   for(j=0;j<D;++j){
     cin >> x[i][j];
   }}
  int count = 0;
  int sum = 0;
  int k;
 for(i=0;i<N;++i){
   for(j=i+1;j<N;++j){
     sum = 0;
     for(k=0;k<D;++k){
       sum += (x[i][k] - x[j][k])*(x[i][k] - x[j][k]);
     }
     if(abs(sqrt(sum)-(int)sqrt(sum)) == 0)count++;
   }
 }
  cout << count;
 return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    int c = 0;
    for (int i = 1; i <= n; i++)
    {
        if (to_string(i).length() % 2 == 0)
        {
            continue;
        }
        c++;
    }
    cout << c << endl;

    return 0;
}

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

int main() {
  vector<char> A(3);
  int count = 0;
  for (int i = 0; i < 3; i++) {
     cin >> A.at(i);
     if ( A.at(i) == '1'){
       count++;
     }
  }
  cout << count << endl;
}
  

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
   int W,H,x,y,r;
   cin>>W>>H>>x>>y>>r;
   if (0<=x-r&&0<=y-r&&W>=x+r&&H>=y+r){
       cout<<"Yes"<<endl;
   }
   else { 
       cout<<"No"<<endl;
   }
}



Measured memory_bytes: 3104
#!/usr/bin/ruby
t={'\\'=>-1,'/'=>1,'_'=>0}
a=[0]
gets.chomp.each_char{|c|a<<(a.last+t[c])}
ma=a.max

#left=a.index(ma)
right=a.rindex(ma)
depth=nil
amount=0

water1=[]
i=0
while i<right
	if !depth
		if a[i]>a[i+1]
			depth=a[i]
		end
	end
	if depth
		amount+=(depth-a[i])+(depth-a[i+1])
	end
	if a[i+1]==depth
		depth=nil
		raise if amount%2>0
		water1<<amount/2
		amount=0
	end
	i+=1
end
raise if depth || amount>0

water2=[]
i=a.size-1
while i>right
	if !depth
		if a[i]>a[i-1]
			depth=a[i]
		end
	end
	if depth
		amount+=(depth-a[i])+(depth-a[i-1])
	end
	if a[i-1]==depth
		depth=nil
		raise if amount%2>0
		water2<<amount/2
		amount=0
	end
	i-=1
end
raise if depth || amount>0

water=water1+water2.reverse
p water.reduce(:+)||0
puts water.size.to_s+water.map{|e|' '+e.to_s}*''

Measured memory_bytes: 6336
#include <cmath>
#include <cstdio>

#include <algorithm>
#include <iostream>
#include <vector>


using namespace std;


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

    vector<int> x, y;
    x.reserve(n);
    y.reserve(n);

    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    vector<int> indices(n);
    for (int i = 0; i < n; i++) {
        indices[i] = i;
    }

    double sum = 0;
    int count = 0;
    
    do {
        double t = 0;
        for (int i = 0; i < n - 1; i++) {
            double u = (x[indices[i]] - x[indices[i + 1]]) * (x[indices[i]] - x[indices[i + 1]]) +
                        (y[indices[i]] - y[indices[i + 1]]) * (y[indices[i]] - y[indices[i + 1]]);
            t += sqrt(u);        
        }
        sum += t;
        count++;
    } while (next_permutation(indices.begin(), indices.end()));

    printf("%.15f\n", sum / count);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define MAX_SIZE 500010
#define INFTY 2000000000
using namespace std;

struct Node {
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int k) {
    Node *z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;
    Node *y = NIL;
    Node *x = root;
    while (x != NIL) {
        y = x;
        if (z->key < x->key) x = x->left;
        else x = x->right;
    }
    z->parent = y;
    if (y == NIL) root = z;
    else if (z->key < y->key) y->left = z;
    else y->right = z;
}

Node* find(int k) {
    Node *x = root;
    while (x != NIL && k != x->key) {
        if (k < x->key) x = x->left;
        else x = x->right;
    }
    return x;
}

void findPrint(int k) {
    if (find(k) == NIL) cout << "no";
    else cout << "yes";
    cout << endl;
}

void preorder(Node* u) {
    if (u == NIL) return;
    cout << " " << u->key;
    preorder(u->left);
    preorder(u->right);
}

void inorder(Node* u) {
    if (u == NIL) return;
    inorder(u->left);
    cout << " " << u->key;
    inorder(u->right);    
}

void postorder(Node* u) {
    if (u == NIL) return;
    postorder(u->left);
    postorder(u->right);
    cout << " " << u->key;
}

void print() {
    inorder(root);
    cout << endl;
    preorder(root);
    cout << endl;
}

int main(){
    int n, k;
    char cmd[10];
    root = NIL;
    cin >> n;
    for (int i=0; i < n; i++) {
        scanf("%s%d\n", cmd, &k);
        // cout << cmd << k << endl;
        if (cmd[0] == 'i') insert(k);
        else if (cmd[0] == 'f') findPrint(k);
        else if (cmd[0] == 'p') print();
    }
    return 0;
} 


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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int h,w,k;
    cin >> h >> w >> k;
    string s[805];
    for (int i = 0;i < h;++i) cin >> s[i];
    int d[4] = {0,1,0,-1};
    vector<vector<bool>> used(h,vector<bool>(w,false));
    queue<P> que;
    for (int i = 0;i < h;++i) for (int j = 0;j < w;++j) if (s[i][j] == 'S') {
        que.push(make_pair(i,j));
        used[i][j] = true;
    }
    for (int i = 0;i < k;++i) {
        int t = que.size();
        for (int j = 0;j < t;++j) {
            P p = que.front();
            que.pop();
            for (int l = 0;l < 4;++l) {
                int x = p.first+d[l],y = p.second+d[l^1];
                if (x < 0 || x >= h || y < 0 || y >= w) continue;
                if (!used[x][y] && s[x][y] == '.') {
                    used[x][y] = true;
                    que.push(make_pair(x,y));
                }
            }
        }
    }
    int ans = 1000;
    for (int i = 0;i < h;++i) for (int j = 0;j < w;++j) if (used[i][j]) ans = min(ans,(min({i,j,h-i-1,w-j-1})+k-1)/k+1);
    cout << ans << endl;
    return 0;    
}


Measured memory_bytes: 1280
#include<stdio.h>
#include<math.h>
#include<sys/time.h>
#define alpha 0.999999

long long llmax(long long a,long long b){if(a>b){return a;}return b;}

unsigned long long seed;

unsigned long long xorshift(){
  seed=seed^(seed<<13);
  seed=seed^(seed>>7);
  seed=seed^(seed<<17);
  return seed;
}

long long getrand(long long lim){
  return (xorshift()%lim)+1;
}

long long getrand_zero(long long lim){
  return (xorshift()%(lim+1));
}

int main(){
  struct timeval tv;
  gettimeofday(&tv, NULL);
  seed=(tv.tv_sec*1000000+tv.tv_usec);
  long long n,a[128],b[128],i,t,typ,fx,fy,ck[128],c=0;
  long long ma[128],mb[128];
  long long p,q,nr=0,res=0,w,tr=0;
  double pr,k;
  scanf("%lld",&n);
  for(i=0;i<n;i++){
    scanf("%lld%lld",&a[i],&b[i]);
    ma[i]=a[i];
    mb[i]=b[i];
  }
  for(typ=0;typ<4;typ++){
    p=0;q=0;c=0;
    if(typ/2==0){fx=1;}else{fx=-1;}
    if(typ%2==0){fy=1;}else{fy=-1;}
    for(i=0;i<n;i++){
      a[i]=ma[i];
      b[i]=mb[i];
      if(a[i]*fx>=0 && b[i]*fy>=0){
        p+=a[i];q+=b[i];
        continue;
      }
      if(a[i]*fx<=0 && b[i]*fy<=0){
        continue;
      }
      c++;
      ck[c]=i;
    }
    if(c==0){
      res=p*p+q*q;
      tr=llmax(res,tr);
      continue;
    }
    for(t=0;t<10000000;t++){
      k=100.0*(10000000-t)/10000000.0;
      nr=p*p+q*q;
      w=ck[getrand(c)];
      p+=a[w];q+=b[w];
      a[w]*=-1;b[w]*=-1;
      res=p*p+q*q;
      tr=llmax(res,tr);
      pr=getrand(1000000000000000000);
      pr/=1.0e18;
      if(res<nr && exp(sqrt(res)-sqrt(nr)/k)<pr){
        p+=a[w];q+=b[w];
        a[w]*=-1;b[w]*=-1;
      }
    }
  }
  printf("%.12lf\n",sqrt(tr));
}


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

using namespace std;

char val(char d, int n) {
	for (int i = 0; i < n; i++) {
		d = (d == 'Z') ? 'A' : ((char)(d + 1));
	}
	return d;
}

int main() {
	int n;
	string s;
	cin>>n;
	cin>>s;
	for (int i = 0; i < s.size(); i++) {
		cout<<val(s[i], n);
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std ;
int main()
{
  int a ;
  cin >> a ;
  if(a==25)
    cout << "Christmas" ;
  else if(a==24)
    cout << "Christmas Eve" ;
  else if(a==23)
    cout << "Christmas Eve Eve" ;
  else if(a==22)
    cout << "Christmas Eve Eve Eve" ;
  return 0 ;
}

Measured memory_bytes: 256
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: u64,
        k: u64,
        a: [u64; n],
    }

    for i in (k + 1)..(n + 1) {
        if a[(i - k - 1) as usize] >= a[(i - 1) as usize] {
            println!("No");
        } else {
            println!("Yes");
        }
    }
}


Measured memory_bytes: 5684
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

class Graph {
	private int totalTime;
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void runDFS() {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int[][] v = new int[n+1][n];
		int[] d = new int[n+1];
		int[] f = new int[n+1];
		
		for (int i = 0; i < n; i++) {
			int u = sc.nextInt();
			int k = sc.nextInt();
			for (int a = 0; a < k; a++) {
				v[u][a] = sc.nextInt();
			}
		}
		for (int i = 1; i <= n; i++) {
			if (d[i] == 0) {
				dfs(v,d,f,i);
			}
		}
		
		for (int i = 1; i <= n; i++) {
			System.out.println(i + " " + d[i] + " " + f[i]);
		}
		
	}

	
	public void dfs(int[][] v, int[] d, int[] f, int u) {
		d[u] = ++totalTime;
		for (int i = 0; i < v[u].length && v[u][i]>0; i++) {
			if (d[v[u][i]] == 0) {
				dfs(v, d, f, v[u][i]);
			}
		}
		f[u] = ++totalTime;
		
	}
}

public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.runDFS();
	}
}



Measured memory_bytes: 28364
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> a(n);
	int res=0;
	int one=0;
	map<int,int> mp;
	for(int i=0;i<n;i++){
		cin >> a[i];
		mp[a[i]]++;
		if(a[i]==1){
			one++;
		}
	}
	if(one>0){
		if(one==1){
			printf("1\n");
		}
		else{
			printf("0\n");
		}
	}
	else{
		vector<bool> ok(n,true);
		for(int i=0;i<n;i++){
			for(int j=2;j*j<=a[i];j++){
				if(a[i]%j==0){
					if(mp[j]){
						ok[i]=false;
						break;
					}
					if(mp[a[i]/j]){
						ok[i]=false;
						break;
					}
				}
			}
			if(mp[a[i]]>=2)ok[i]=0;
		}
		for(int i=0;i<n;i++){
			if(ok[i])res++;
		}
		printf("%d\n",res);
	}
}

Measured memory_bytes: 32884
"use strict";

function main(arg) {
    const input = arg.trim().split("\n");
    const N = Number(input.shift())
    const A = input.map(x=>Number(x.split(" ")[0])).sort((a,b)=>a-b);
    const B = input.map(x=>Number(x.split(" ")[1])).sort((a,b)=>a-b);
    
    let a, b, sum
    if(N%2) {
        const id0 = parseInt((N+1)/2)-1
        a = A[id0]
        b = B[id0]
        sum = b-a+1
    } else {
        const id0 = parseInt(N/2)-1
        const id1 = parseInt(N/2+1)-1
        a = (A[id0] + A[id1])/2
        b = (B[id0] + B[id1])/2
        sum = (b-a)*2+1
    }

    console.log(sum)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 73692
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
int main(void){
    int a[3];
    for(int i=0;i<3;i++)cin>>a[i];
    sort(a,a+3);
    cout<<a[0]*a[1]/2<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
//                               //
    // author : samars_diary //
    // 18-09-2020 │ 18:48:39 //
//                               //

#include <iostream>
using namespace std;

void solve(){
    long long int a,b ; cin>>a>>b;
    if (2*a<=b && 4*a>=b && b%2==0){
        cout<<"Yes"<<'\n';
    }else{
        cout<<"No"<<'\n';
    }

}

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

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

    int t = 1;
    while(t--){
        solve();
    }

    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
using namespace std;
#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++)

int main(void) {
    int r,c,t;
    cin >> r >> c;
    vector<vector<int>> v(r, vector<int>(c));
    for(auto& v1 : v) for(auto& d : v1) cin >> d;
    REP(i,r) {
        t = 0;
        REP(j,c) {
            t += v[i][j];
            cout << v[i][j] << " ";
        }
        cout << t << endl;
    }
    REP(i,c) {
        t = 0;
        REP(j,r) {
            t += v[j][i];
        }
        cout << t << " ";
    }
    t = 0;
    REP(i,r) {
        REP(j,c) {
            t += v[i][j];
        }
    }
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 3172
#include<bits/stdc++.h>
#define maxn 500005
#define int long long
using namespace std;
inline int read()
{
	char x = getchar();
	int lin = 0, f = 1;
	while(x < '0' || x > '9')
	{
		if(x == '-') f = -1;
		x = getchar();
	}
    while(x >= '0' && x <= '9')
	{
		lin = lin * 10 + x - '0';
		x = getchar();
	}
	return lin * f;
}
#define PII pair<int,int>
#define fir first
#define sec second
#define ma(a,b) make_pair(a,b)
int n,x;
int get(int a,int b)
{
	if(a > b) swap(a,b);
	if(!a) return -b;
	return 2 * a * (b / a) + get(a,b % a);
}
signed main(){
	n = read(); x = read();
	cout << get(x,n - x) + n;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    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: 600
import java.util.*;
public class Main {

	public static void main(String[] args) {
	Scanner cin = new Scanner(System.in);
	while(true){
		int n,m;
		n=cin.nextInt();
		m=cin.nextInt();
		if(n==0 && m==0){
			break;
		}
		int[] t=new int[n];
		int[] h=new int[m];
		int z,tg=0,hg=0,ta=101,ha=101;
		/*tg=太郎合計　hg=花子合計*/
		for(int s=0;s<n;s++){
			t[s]=cin.nextInt();
		}
		for(int p=0;p<m;p++){
			h[p]=cin.nextInt();
		}
		for(int i=0;i<n;i++){
			z=t[i];
			for(int j=0;j<m;j++){
				t[i]=h[j];
				h[j]=z;
				tg=0;
				hg=0;
				for(int q=0;q<n;q++){
					tg=tg+t[q];
				}
				for(int w=0;w<m;w++){
					hg=hg+h[w];
				}
				if(tg==hg && t[i]+h[j]<ta+ha){
					ta=h[j];
					ha=t[i];
				}
				h[j]=t[i];
				t[i]=z;
			}
		}
		if(ta==101 && ha==101){
			ta=-1;
			ha=-1;
		}
		if(ta<0 && ha<0){
			System.out.println(ta);
		}
		else if(ta>=0 && ha>=0){
			System.out.println(ta+" "+ha);
		}
	}
	}
}

Measured memory_bytes: 22792
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll w,h,x,y;
  cin >> w >> h >> x >> y;
  if(x*2==w&&y*2==h){
    printf("%.12f 1\n",w*h*1.0/2);
  }else{
    printf("%.12f 0\n",w*h*1.0/2);
  }
  return 0;
}


Measured memory_bytes: 256
s = list(input())
if s[0] == 'A' and s[2:-1].count('C') == 1 and s.count('C') == 1:
     s.remove('A')
     s.remove('C')
     if (''.join(s)).islower() == True:
          print('AC')
     else:
          print('WA')
else:
     print('WA')

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

int main() {
    int n[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << n[k-1] << endl;   
}

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

int main(void){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    vector <string> str;
    std::set<string> st;

    cin >> n;

    string buf;
    for(int i = 0;i<n;i++){
        cin >> buf;
        st.insert(buf);
    }

    cout << st.size() << endl;


    return 0;
}

Measured memory_bytes: 19244
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = 1e9 + 1;

int main() {
  double n,x[10],y[10];
  cin >> n;
  double p = 1;
  for(int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    p *= i+1;
  }

  double sum = 0;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      if(i != j) {
        double dist_x = (x[i]-x[j])*(x[i]-x[j]);
        double dist_y = (y[i]-y[j])*(y[i]-y[j]);
        sum += sqrt(dist_x + dist_y);
      }
    }
  }
  sum *= p/n;
  cout << fixed << setprecision(15) << sum/p << endl;
}

Measured memory_bytes: 3816