akhauriyash/Code-Regression huggingface dataset:
def main():
    nums = list(map(int, input().split(' ')))
    directs = input()

    d = Dice(nums)

    for c in directs:
        if 'N' == c:
            d.toN()

        if 'S' == c:
            d.toS()

        if 'E' == c:
            d.toE()

        if 'W' == c:
            d.toW()

    print(d.top)

class Dice:
    def __init__(self, labels):
        self.labels = labels

        self._tb = (0, 5)
        self._fb = (1, 4)
        self._lr = (3, 2)

    def toN(self):
        tb = self._tb
        self._tb = self._fb
        self._fb = tuple(reversed(tb))

        return self

    def toS(self):
        tb = self._tb
        self._tb = tuple(reversed(self._fb))
        self._fb = tb

        return self

    def toW(self):
        tb = self._tb
        self._tb = tuple(reversed(self._lr))
        self._lr = tb

        return self

    def toE(self):
        tb = self._tb
        self._tb = self._lr
        self._lr = tuple(reversed(tb))

        return self

    def get_top(self):
        return self.labels[self._tb[0]]

    top = property(get_top)

if __name__ == '__main__':
    main()

Measured memory_bytes: 7776
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int t,n;
	int i;
	int x,y;
	int sum;
	while(1){
		cin>>t;
		if(t==0)	break;
		cin>>n;
		sum=0;
		for(i=0;i<n;i++){
			cin>>x>>y;
			sum+=y-x;
		}
		if(sum>=t){
			cout<<"OK"<<endl;
		}
		else{
			cout<<t-sum<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int num[]={0,2,5,5,4,5,6,3,7,6};
int a[10];
int n,m;

void changeString(string &t,string p){
    if(t=="0") t=p;
    else if(t.size()<p.size()) t=p;
    else if(t.size()==p.size()){
        if(t<p) t=p;
    }
}

int main(){
  cin>>n>>m;
  for(int i=0;i<m;i++){
      cin>>a[i];
  }
  string dp[n+100];
  for(int i=0;i<=n;i++) dp[i]="0";
  dp[0]="";
  for(int i=0;i<=n;i++){
      if(dp[i]=="0") continue;
      for(int j=0;j<m;j++){
          changeString(dp[i+num[a[j]]],dp[i]+(char)(a[j]+'0'));
          //dp[i+num[a[j]]]=(dp[i+num[a[j]]],dp[i]+(char)(a[j]+'0'));
      }
  }
  cout<<dp[n]<<endl;
  

  return 0;
}


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

int main() {
int a[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<<a[k-1];
return 0;
}

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

using namespace std;

int main(){
  string s;
  cin >> s;
  int a = 0;
  int z = 0;
  bool once = true;
  for (int i = 0; i < s.size(); i++){
    if(once){
      if (s.at(i) == 'A'){
      	a = i;
        once = false;
    	}
    }
  }
  for (int i = 0; i < s.size(); i++){
    if (s.at(i) == 'Z'){
      	z = i;
    	}
  }
  cout << z-a +1 << endl;
}



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

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

#define pb push_back
#define mp make_pair

const int N = 32;

int n;
vector<pii> V[N];
int f[N];

bool ok(int st){
    for(int i=0; i<n; i++){
        f[i] = st >> i & 1;
    }

    for(int i=0; i<n; i++){
        if(!f[i])   continue;
        for(int j=0; j<V[i].size(); j++){
            if(f[V[i][j].first] != V[i][j].second)   return 0;
        }
    }

    return 1;
}

int main(){
    scanf("%d", &n);

    int m, x, y;
    for(int i=0; i<n; i++){
        scanf("%d", &m);
        for(int j=0; j<m; j++){
            scanf("%d %d", &x, &y);
            x--;
            V[i].pb(mp(x, y));
        }
    }

    int ans = 0;
    for(int i=0; i<(1<<n); i++){
        if(ok(i)){
            ans = max(ans, __builtin_popcount(i));
        }
    }

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

    return 0;
}


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

struct UnionFind{
  Int n;
  vector<Int> r,p;
  UnionFind(){}
  UnionFind(Int sz):n(sz),r(sz,1),p(sz,0){iota(p.begin(),p.end(),0);}
  Int find(Int x){
    return (x==p[x]?x:p[x]=find(p[x]));
  }
  bool same(Int x,Int y){
    return find(x)==find(y);
  }
  void unite(Int x,Int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) swap(x,y);
    r[x]+=r[y];
    p[y]=x;
  }
  Int size(Int x){
    return r[find(x)];
  }
};

//INSERT ABOVE HERE
signed main(){
  Int n,m,k;
  cin>>n>>m>>k;
  vector<Int> c(n);
  for(Int i=0;i<n;i++) cin>>c[i];
  using T = tuple<Int, Int, Int>;
  vector<T> v;
  for(Int i=0;i<m;i++){
    Int a,b,w;
    cin>>a>>b>>w;
    a--;b--;
    v.emplace_back(w,a,b);
  }
  sort(v.begin(),v.end());

  Int ans=0,cnt=1;
  UnionFind uf(n+k);
  for(Int i=0;i<n;i++){
    c[i]--;
    if(~c[i]) uf.unite(i,n+c[i]);
    else cnt++;
  }
  
  priority_queue<Int> pq;
  for(Int i=0;i<m;i++){
    if(uf.size(0)==n+k) break;
    Int w,a,b;
    tie(w,a,b)=v[i];
    if(uf.same(a,b)) continue;
    ans+=w;
    uf.unite(a,b);
    pq.emplace(w);
  }
  
  for(Int i=0;i<n+k;i++)
    if(uf.find(i)==i) cnt--;
  
  while(cnt>0){
    ans-=pq.top();pq.pop();
    cnt--;
  }
  if(cnt<0) ans=-1;
  cout<<ans<<endl;
  return 0;
}


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

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

    int a, b;
    cin >> a >> b;

    if(a * b % 2) {
        cout << "Odd" << endl;
    } else {
        cout << "Even" << endl;
    }
}

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

using namespace std;

const int MAX_N = 1e5 +6;
 
vector<int> edg[MAX_N];
bool visit[MAX_N];
int depth[MAX_N];
int p[MAX_N];
int sz[MAX_N];
 
void dfs(int id,int pp,int cur_depth) {
    visit[id]=1;
    sz[id]=1;
    p[id] = pp;
    depth[id] = cur_depth;
    for (int i:edg[id]) {
        if (!visit[i]) {
            dfs(i,id,cur_depth+1);
            sz[id] += sz[i];
        }
    }
}
 
int main () {
    int n;
    scanf("%d",&n);
    for (int i=1;n>i;i++) {
        int a,b;
        scanf("%d %d",&a,&b);
        edg[a].push_back(b);
        edg[b].push_back(a);
    }
    dfs(1,1,1);
    int delta=depth[n] - depth[1];
    int cnt=(delta-1)/2;
    int tmp=n;
    while (cnt--) tmp=p[tmp];
    int cntb=sz[tmp],cnta=n-sz[tmp];
    if (cnta > cntb) puts("Fennec");
    else puts("Snuke");
}

Measured memory_bytes: 13184
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long A,B,c;
    cin>>A>>B;
    c=A+B;
    if(c%2!=0)
    {
        cout<<"IMPOSSIBLE"<<endl;
    }
    else
        cout<<c/2<<endl;
    return 0;
}


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

using namespace std;

const int N = 200010;

int cnt[N];

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  memset(cnt, 0, sizeof cnt);
  for (int i = 0; i < n; ++i) {
    int foo;
    scanf("%d", &foo);
    ++cnt[foo];
  }
  vector <int> a;
  for (int i = 0; i < N; ++i) {
    if (cnt[i] != 0) {
      a.push_back(cnt[i]);
    }
  }
  sort(a.begin(), a.end());
  int ans = 0;
  for (int i = 0; i < (int)a.size() - k; ++i) {
    ans += a[i];
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 2168
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    int n, m;
    int[] a;
    int[] b;
    int[] c;
    long[] dp;
    void run() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();

        a = new int[m];
        b = new int[m];
        c = new int[m];
        dp = new long[1 << n];


        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            for (int j = 0; j < b[i]; j++) {
                int cc = sc.nextInt() - 1;
                c[i] |= 1 << cc;
            }
        }

        long INF = (1L << 50);

        Arrays.fill(dp, (1L << 50));
        dp[0] = 0;

        for (int i = 0; i < m; i++) {
            for (int j = 0; j < 1 << n; j++) {
                int next = j | c[i];
                dp[next] = Math.min(dp[next], dp[j] + a[i]);
            }
        }
        System.out.println(dp[(1 << n) - 1] == INF ? -1 : dp[(1 << n) - 1]);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }

}


Measured memory_bytes: 34280
#include <bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <math.h>
#include<algorithm>
using namespace std;
#define MAX 500000

int H[MAX+1],n;

int parent(int i){
  return i/2;
}

int left(int i){
  return i*2;
}

int right(int i){
  return i*2+1;
}

void maxHeapify(int i){
  int l=left(i);
  int r=right(i);
  int largest;
  if(l<=n && H[l]>H[i]) largest=l;
  else largest=i;
  if(r<=n && H[r]>H[largest]) largest=r;

  if(largest!=i){
    swap(H[i],H[largest]);
    maxHeapify(largest);
  }
}

void buildMaxHeap(){
  for(int i=n/2;i>=1;i--){
    maxHeapify(i);
  }
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>H[i+1];
  }
  buildMaxHeap();

  for(int i=0;i<n;i++){
    cout<<" "<<H[i+1];
  }
  cout<<endl;

}



Measured memory_bytes: 5056
//Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define file_input
//#define multitest
//#define measure_time
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<v32>
#define p32 pair<int,int>
#define p64 pair<ll,ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
#define debug(x) cerr << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream& operator<<(ostream& out, const pair<T,U>& p){
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename ...Args>
void print_container(const ContainerType<ValueType, Args...>& c){
	cout << "{ ";
	for(const auto& v : c)
		cout << v << ' ';
	cout << '}' << ln;
}


void solve()
{
	string s,t;
	cin >> s >> t;
	string ans = t + s;
	cout << ans << ln;
	return;
}

int main()
{
	FASTIO;
#ifdef file_input
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	clock_t start,stop;
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
#ifdef measure_time
	start = clock();
#endif
	for(int tc = 1;tc < t + 1;tc++) solve();
#ifdef measure_time
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<random>
#include<stack>
#include<queue>
#include<bitset>
#include<sstream>

#define rep(i,n) for(int i=0;i<(n);i++) 
#define rep1(i,n) for(int i=1;i<(n);i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]){
    ll n;
    string s;
    cin >> n >> s;
    ll m=0;
    

    while(1){
        vector<ll> a(s.size());
        a[0] = n;
        ll i=1,j=0;
        while(i<s.size()){
            while((i+j)<s.size()&&s[i+j]==s[j]) ++j;
            a[i] = j;
            if(j==0){i++; continue;}
            int k=1;
            while((i+k)<s.size()&&(k+a[k])<j){
                a[i+k]=a[k];
                ++k;
            }
            i+=k; j-=k;
        }
        for(ll i=0;i<s.size();i++){
            m = max(m,min(a[i],i));
        }
        s = s.substr(1,s.size()-1);
        if(s.size()==1) break;
    }
    co(m);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
constexpr ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    ll H,W;
    cin >> H >> W;
    vector<string> S(H);
    REP(i,H)cin >> S[i];
    map<char,int> m;
    REP(i,H){
        REP(l,W){
            m[S[i][l]]++;
        }
    }
    bool ok = 1;
    if((H%2) + (W%2) == 0){
        for(auto itr = m.begin();itr != m.end();itr++){
            if((itr->S) %4 != 0)ok = 0;
        }
    }else if((H%2) + (W%2) == 1){
        ll a2 = 0;
        for(auto itr = m.begin();itr != m.end();itr++){
            if((itr->S) %4 == 2){
                a2++;
            }else if((itr->S) %4 != 0)ok = 0;
        }
        if(W % 2 == 1){
            if(a2 > H/2)ok = 0;
        }else{
            if(a2 > W/2)ok = 0;
        }
    }else{
        ll a2 = 0;
        ll a1 = 0;
        for(auto itr = m.begin();itr != m.end();itr++){
            if((itr->S) %4 == 2){
                a2++;
            }else if((itr->S) %4 == 1){
                a1++;
            }else if((itr->S) %4 == 3){
                a2++;
            }
        }
        if(a1 > 1)ok = 0;
        if((H+W-1)/2 < a2)ok = 0;
    }
    cout << (ok ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 3568
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;


public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int times = 0;
		int[][][] map = new int [5][5][4];
		
		for(int[][] m1:map){
			m1 = new int[5][4];
		}
		
		for(int[][] m1:map){
			for(int[] m2:m1){
				m2 = new int[4];
			}
		}
		
		while(times < 9){
			String str = sc.nextLine();
			if(times % 2 == 0){
				for(int i = 0;i < 4;i++){
					map[times/2][i][0] = Integer.parseInt(String.valueOf(str.charAt(i))); // right
				}
				for(int i = 1;i < 5;i++){
					map[times/2][i][2] = Integer.parseInt(String.valueOf(str.charAt(i-1))); // left
				}
			}else{
				for(int i = 0;i < 5;i++){
					map[times/2][i][1] = Integer.parseInt(String.valueOf(str.charAt(i))); // down
				}
				for(int i = 0;i < 5;i++){
					map[times/2+1][i][3] = Integer.parseInt(String.valueOf(str.charAt(i))); // up
				}
			}
			
			times++;
		}
		
		int dir = 0;
		int x = 1,y = 0;
		System.out.print("R");
		
		while(x != 0 || y != 0){
			if(dir == 0){
				if(map[y][x][3] == 1){
					dir = 3;
					y--;
					System.out.print("U");
					continue;
				}else if(map[y][x][0] == 1){
					dir = 0;
					x++;
					System.out.print("R");
					continue;
				}else if(map[y][x][1] == 1){
					dir = 1;
					y++;
					System.out.print("D");
					continue;
				}else{
					dir = 2;
					x--;
					System.out.print("L");
					continue;
				}
			}else if(dir == 1){
				if(map[y][x][0] == 1){
					dir = 0;
					x++;
					System.out.print("R");
					continue;
				}else if(map[y][x][1] == 1){
					dir = 1;
					y++;
					System.out.print("D");
					continue;
				}else if(map[y][x][2] == 1){
					dir = 2;
					x--;
					System.out.print("L");
					continue;
				}else{
					dir = 3;
					y--;
					System.out.print("U");
					continue;
				}
			}else if(dir == 2){
				if(map[y][x][1] == 1){
					dir = 1;
					y++;
					System.out.print("D");
					continue;
				}else if(map[y][x][2] == 1){
					dir = 2;
					x--;
					System.out.print("L");
					continue;
				}else if(map[y][x][3] == 1){
					dir = 3;
					y--;
					System.out.print("U");
					continue;
				}else{
					dir = 0;
					x++;
					System.out.print("R");
					continue;
				}
			}else if(dir == 3){
				if(map[y][x][2] == 1){
					dir = 2;
					x--;
					System.out.print("L");
					continue;
				}else if(map[y][x][3] == 1){
					dir = 3;
					y--;
					System.out.print("U");
					continue;
				}else if(map[y][x][0] == 1){
					dir = 0;
					x++;
					System.out.print("R");
					continue;
				}else{
					dir = 1;
					y++;
					System.out.print("D");
					continue;
				}
			}
		}
		
		System.out.println("");
	}
}

Measured memory_bytes: 11000
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template<typename T> 
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;


#pragma GCC optimize("O3")

#define pb push_back
#define ff first
#define ss second 
#define memo(a,b) memset(a,b,sizeof(a))
#define all(x) x.begin(),x.end() 

typedef pair<int,int> pii;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);	
	int a,b,c;cin>>a>>b>>c;
	if(c<=b+a+1)cout<<c+b<<endl;
	else cout<<(a+2*b+1)<<endl;
	return 0;
}



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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long H){
    LL ans = 0;
    LL add_cnt = 1;
    while(H != 0) {
        ans += add_cnt;
        add_cnt *= 2LL;
        H /= 2;
    }
    cout << ans << endl;
}

int main(){
    long long H;
    scanf("%lld",&H);
    solve(H);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#define PI acos(-1.0)
#define LL long long
#define MAX 0x3fffffff
using namespace std;

int n;
map<string, int> ma;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		ma[s]++;
	}
	int m = 0;
	for (auto it = ma.begin(); it != ma.end(); it++) {
		m = max(m, it->second);
	}
	for (auto it = ma.begin(); it != ma.end(); it++) {
		if (it->second == m)cout << it->first << endl;
	}
	return 0;
}

Measured memory_bytes: 24960
N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
ans = -10**18

for i in range(1, 2**10):
    A = [0]*10
    
    for j in range(10):
        if (i>>j)&1:
            A[j] = 1
        
    ans_cand = 0
    
    for j in range(N):
        c = 0
        
        for k in range(10):
            if F[j][k]==1 and A[k]==1:
                c += 1
        
        ans_cand += P[j][c]
    
    ans = max(ans, ans_cand)

print(ans)

Measured memory_bytes: 42988
//Code by Anshuman Das Gupta

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MOD 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define loop(I,N) for(int i=I;i<N;i++)
#define sortvec(V) sort(V.begin(),V.end())
#define vec vector<int>
#define endl "\n"
using namespace std;
int fast_power(int base, int power) {
    int result = 1;
    while (power > 0) {

        if (power & 1 == 1) {
            result = (result * base) % MOD;
        }
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result % MOD;
}

bool isPrime(int x) {
    for (int i = 2; i <= sqrt(x); i++) {
        if (x % i == 0)
            return false;
    }
    if (x == 1)
        return false;
    return true;
}

int binsearch(int a[], int f, int r, int x) {
    while (f <= r) {
        int mid = (f + r) / 2;
        if (a[mid] == x)
            return mid;
        else if (a[mid] > x) {
            r = mid - 1;
        }
        else {
            f = mid + 1;
        }
    }
    return -1;
}
void sieve(int a[], int n) {
    a[0] = 0;
    a[1] = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i] == 1) {
            for (int j = i + i; j <= n; j += i) {
                a[j] = 0;
            }
        }
    }
}
int vis[100005];
int par[100005];
vector<vector<int> > v(100005);
void bfs(vector<int> root) {
    vector<int> child;
    for (auto it : root) {
        vis[it]++;
        for (int i = 0; i < v[it].size(); i++) {
            if (vis[v[it][i]] == 0) {
                par[v[it][i]] = it;
                vis[v[it][i]]++;
                child.pb(v[it][i]);
                //cout << v[it][i] << " ";
            }
        }
    }
    //cout << endl;
    if (child.size() == 0)
        return;
    else {
        bfs(child);
    }
}
int32_t main() {
#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("out.txt", "w", stdout);
#endif
    fastio;
    int t = 1;
    //cin >> t;
    while (t--) {
        int n, m;
        cin >> n >> m;
        loop(0, m) {
            int t1, t2;
            cin >> t1 >> t2;
            v[t1].pb(t2);
            v[t2].pb(t1);
        }
        vector<int> root;
        root.pb(1);
        int flag = 0;
        bfs(root);

        loop(2, n + 1) {
            if (vis[i] == 0) {
                flag = 1;
                break;
            }
        }
        if (flag == 1) {
            cout << "No\n";
        }
        else {
            cout << "Yes\n";
            loop(2, n + 1) {
                cout << par[i] << endl;
            }
            //cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 29740
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<string.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#include <iomanip>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;

ll N,K;
double p;

int main(){
	cin.tie(0);
	cout.tie(0);

	ios::sync_with_stdio(false);
	cin >> N>>K;

	
	FOR(i, 1, N+1) {
		double cnt = 1.0;
		int cur = i;
		while(cur<K){
			cnt=cnt*2.0;
			cur *= 2;
		}
		p +=1.0/(double(N)*cnt) ;
	}
	CST(15);
	cout << p << endl;


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n,k;
	double ans=0.0;
	cin>>n>>k;
	if(n>=k) ans+=(double)(n-k+1)/(double)n;
	for(int i=min(n,k-1);i>=1;i--){
		int sum=0,t=i;
		while(t<k){
			t*=2;
			sum++;
		}
		ans+=pow(0.5,(double)sum)/(double)n;
	}
	printf("%.15f\n",ans);
}

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int sx,sy,tx,ty;cin>>sx>>sy>>tx>>ty;

  int px = sx;
  int py = sy;
  while(px<tx){cout<<'R';px++;}
  while(py<ty){cout<<'U';py++;}

  while(px>sx){cout<<'L';px--;}
  while(py>sy){cout<<'D';py--;}

  cout<<'L';px--;
  while(py<ty+1){cout<<'U';py++;}
  while(px<tx){cout<<'R';px++;}
  cout<<'D';py--;

  cout<<'R';px++;
  while(py>sy-1){cout<<'D';py--;}
  while(px>sx){cout<<'L';px--;}
  cout<<'U';

  cout<<endl;

  return 0;
}


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

int main(){
	int n, k;
  	int x, y;
	cin>>n>>k;
 	cin>>x>>y;
 	
  if(n<=k){
    cout<<n*x<<endl;
  }else{
    cout<<x*k+y*(n-k)<<endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp10
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Console.ReadLine().ToCharArray().Zip(Console.ReadLine().ToCharArray(), (x, y) => x == y).Count(x => x));
        }
    }
}


Measured memory_bytes: 13268
#include<stdio.h>
int main(){
  int n,i,b,f,r,v,total[5][4][11]={0};
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d %d",&b,&f,&r,&v);
    total[b][f][r]+=v;
  }
  for(b=1;b<5;b++){
    for(f=1;f<4;f++){
      for(r=1;r<11;r++){
	if(total[b][f][r]<0)total[b][f][r]=0;
	if(total[b][f][r]>9)total[b][f][r]=9;
	printf(" %d",total[b][f][r]);
      }
      printf("\n");
    }
    if(b!=4)printf("####################\n");
  }
  return 0;
}

Measured memory_bytes: 612
#include <stdio.h>
#include <string.h>

int main() {
  
  char w[11], t[1001];
  int count = 0;

  scanf("%s", w);
  do {
    scanf("%s", t);

    if (strcmp(t, "END_OF_TEXT") != 0) {
      for (int i = 0; i < strlen(t); i++) {
        if (t[i] >= 'A' && t[i] <= 'Z') {
          t[i] = t[i] + 32;
        }      
      }
    
      if (strcmp(w, t) == 0)
        count = count + 1;
    }

  } while (strcmp(t, "END_OF_TEXT") != 0);

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

  return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int A, B, C;
    long long X, Y;
    cin >> A >> B >> C >> X >> Y;
    // AをX枚
    // BをY枚
    if(A + B <= 2 * C) {
        cout << X * A + Y * B << endl;
        return 0;
    } else {
        long long m = min(X, Y);
        long long res = 0;
        res += 2 * m * C;
        res += A * (X - m);
        res += B * (Y - m);
        if(res <= 2 * max(X, Y) * C) {
            cout << res << endl;
            return 0;
        } else {
            cout << 2 * max(X, Y) * C << endl;
        }
        return 0;
    }
}

Measured memory_bytes: 256
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    int raw, n, ans = 0; 
    cin >> raw;
    n = raw;
    while(n != 0){
        ans += n % 10;
        n /= 10;
    }
    if(raw % ans == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;
typedef long long int ll;

int main()
{
    ll a, b, c;
    scanf("%lld/%lld/%lld", &a, &b, &c);

    if (b > 4)
    {
        cout << "TBD" << endl;
    }
    else
    {
        cout << "Heisei" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int x = scan.nextInt();
		int y = scan.nextInt();
		int z = scan.nextInt();
		
		System.out.printf("%d %d %d\n",z,x,y);
	}
}

Measured memory_bytes: 22356
#include<cstdio>
#include<bitset>
#include<algorithm>
using namespace std;

bitset<10000> cake[10];

int main()
{
    int r, c;
    int result, ans, tmp;
    while(~scanf("%d%d", &r, &c))
    {
       if(r==0 &&c==0) break;
       for(int i=0; i<r; i++)
         for(int j=0; j<c; j++)
         {
            bool upwards;
            scanf("%d", &upwards);
            cake[i][j]=upwards;
         }
       int cnt=1<<r;
       result=0;
       for(int i=0; i<cnt; i++)
       {
           for(int j=0; j<r; j++)
           {
               if(i&(1<<j))
                cake[j].flip();
           }
           ans=0;
           for(int j=0; j<c; j++)
           {
               tmp=0;
               for(int k=0; k<r; k++)
               {
                   if(cake[k][j])
                    tmp++;
               }
               ans+=max(tmp, r-tmp);
           }
           for(int j=0; j<r; j++)
           {
               if(i&(1<<j))
                cake[j].flip();
           }
           if(result<ans) result=ans;
       }
       printf("%d\n", result);
    }

    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<vector<bool>> table(N, vector<bool>(N, false)); //trueなら道あり
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    table[a-1][b-1] = true;
    table[b-1][a-1] = true;
  }

  vector<int> v(N); //1~N
  for (int i = 0; i < N; i++) {
    v[i] = i;
  } //sort済み

  int cnt = 0;
  do {
    if (v[0] != 0) {
      break;
    }
    bool flag = true;
    for (int i = 0; i < N - 1; i++) {
      if (!table[v[i]][v[i+1]]) {
        flag = false;
        break;
      }
    }

    if (flag) cnt++;
  } while (next_permutation(v.begin(), v.end()));

  cout << cnt << endl;
}



Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        do{
        String line1 = scanner.next();
        String line2 = scanner.next();
        String line3 = scanner.next();

        int a = Integer.parseInt(line1);
        int b = Integer.parseInt(line3);

        if(line2.equals("+")){
            System.out.println(a+b);
        }else if(line2.equals("-")){
            System.out.println(a-b);
        }else if(line2.equals("*")){
            System.out.println(a*b);
        }else if(line2.equals("/")){
            System.out.println(a/b);
        }else if(line2.equals("?")){
            break;
        }
        }while(true);
    }
}


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

using namespace std;

#define F first
#define S second
#define int long long

typedef long long ll;
typedef long double ld;

const int maxn = 2e5+10;
const int mod = 1e9+7;
const ll inf = 1e18+10;
const int Log = 21;

int n, m, k;
int h[maxn], par[maxn][20];
int jahat[maxn], la[maxn];
bool mark[maxn];
vector<pair<int,int>> g[maxn];
int I[maxn];

void dfs(int v)
{
    mark[v] = 1;
    for(int i = 1; (1<<i) <= h[v]; i++)
        par[v][i] = par[par[v][i-1]][i-1];
    for(auto e : g[v])
    {
        int u = e.F, id = e.S;
        if(!mark[u])
        {
            h[u] = h[v] + 1;
            I[u] = id;

            dfs(u);

            la[v] += la[u];
        }
    }
}

int get_par(int v, int H)
{
    int i = 0;
    while(H)
    {
        if(H&1)
            v = par[v][i];
        i++;
        H >>= 1;
    }
    return v;
}

int lca(int u, int v)
{
    if(h[u] > h[v]) swap(u,v);
    v = get_par(v,h[v]-h[u]);
    if(u == v) return v;

    for(int i = 19; i >= 0; i--)
        if(par[v][i] != par[u][i])
        {
            v = par[v][i];
            u = par[u][i];
        }
    return par[v][0];
}

int deg[maxn];
pair<int,int> edge[maxn];

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

    cin>> n >> m;
    if(m&1) return cout<< -1, 0;

    for(int i = 1, u, v; i <= m; i++)
    {
        cin>> u >> v;
        g[u].push_back({v,i});
        g[v].push_back({u,i});
        deg[u]++;
        edge[i] = {u,v};
    }
    dfs(1);

    int v = 0;
    for(int i = 1; i <= n; i++)
        if(deg[i]&1)
        {
            if(v == 0) v = i;
            else
            {
                la[v]++;
                la[i]++;
                la[lca(i,v)] -= 2;
                v = 0;
            }
        }
    memset(mark, 0, sizeof mark);
    dfs(1);

    for(int i = 1; i <= n; i++)
        if(la[i] & 1)
            jahat[I[i]] ^= 1;

    for(int i = 1; i <= m; i++)
        if(jahat[i])
            cout<< edge[i].S <<" "<< edge[i].F <<"\n";
        else
            cout<< edge[i].F <<" "<< edge[i].S <<"\n";
}





Measured memory_bytes: 41856
def m(n): # n次元バーガーの層数
    if n == 0:
        return 1
    else:
        a = 1
        for i in range(n):
            a = a * 2 + 3
        return a

def paty(n): # n次元バーガーのパティの数
    a = 1
    if n >= 1:
        for i in range(n):
            a = a * 2 + 1
    return a

def a(n, x): #これが答えを返す
    x = x - 1
    if x == 0 and n == 0:
        return 1
    elif x == 0:
        return 0
    elif x == m(n-1) + 1:
        return paty(n-1) + 1
    elif x == m(n):
        return paty(n)
    elif x > m(n-1):
        return paty(n-1) + 1 + a(n - 1, x - m(n-1) - 1)
    else:
        n = n - 1
        return a(n, x)

n, x= map(int, input().split())
print(a(n, x))

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

int main() {
	int h, w;
	for (;;) {
		cin >> h >> w;
		if (h == 0 && w == 0) break;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (i == 0 || i == h - 1 || j == 0 || j == w - 1) cout << "#";
				else cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	int N;
	cin>>N;
	if(N<2){
		ce('1')
	}else{
		int n=2;
		while(n<<1<=N){
			n=n<<1;
		}
		ce(n)
	}
	
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

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

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int n = input();

    range(i, n, 1000) {
        string s = to_string(i);
        whole(sort, s);
        s.erase(whole(unique, s), s.end());
        if (s.size() == 1) {
            cout << i << endl;
            return;
        }
    }
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        mut a: [i64; n],
    }
    let prod = a.into_iter().fold(1_i64, |acc, x| acc.saturating_mul(x));
    let ans = if prod > 1_000_000_000_000_000_000 {
        -1
    } else {
        prod
    };
    println!("{}", ans);
}


Measured memory_bytes: 4552
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>

using namespace std;



int main() {

	int k,x;

	cin >> k >> x;

	for (int i = x - k + 1; i < x + k; i++) {
		cout << i;
		cout << ' ';
	}

	cout << endl;
	return 0;
}



Measured memory_bytes: 256
import itertools
n = int(input())
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]

l = list(int(i) for i in range(1,n+1))
test = []
cnt = 0
for i in itertools.permutations(l,n):
	i = list(i)
	cnt += 1
	if p == i:
		cntp = cnt
	if q == i:
		cntq = cnt

print(abs(cntp - cntq))

Measured memory_bytes: 3064
n = int(input())

def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


if n==1:
    print(0)
else:
    div = []
    count = 0
    fct = factorize(n)
    div += [num(div) for div in divisorize(fct)]
    div = sorted(div)
    #div = div
    for i in div[1:]:
        fct2 = factorize(i)
        if n%i==0 and len(fct2)==1:
            n = n/i
            count += 1
        if n==1:
            break
    print(count)


Measured memory_bytes: 9656
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
long double a,b,c;
cin>>a>>b>>c;

if(a+b+2*sqrtl(a*b)-c<0){
    cout<<"Yes"<<endl;
}
else{
    cout<<"No"<<endl;
}
//system("pause");
return 0;
}

Measured memory_bytes: 256
n = int(input())
x = list()
y = list()
l = 0
t = 0

for i in range(n):
    m = list(map(int,input().split()))
    x.append(m[0])
    y.append(m[1])
    
for i in range(n - 1):
    for j in range(n - 1 - i):
        l_0 = (((x[i] - x[j + i + 1]) ** 2) + ((y[i] - y[j + i + 1]) ** 2)) ** (1 / 2)
        l += l_0

for i in range(n - 1):
    t += i + 1
    
print((n - 1) * l / t)
    

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main() {
	int N, X, m[110];
	cin >> N >> X;
	for (int i = 0; i < N; i++) {
		cin >> m[i];
	}
	int sum=0;
	for (int i = 0; i < N; i++) {
		sum += m[i];
	}
	int ans = X - sum;
	int cheap=11111;
	for (int i = 0; i < N; i++) {
		cheap = min(m[i], cheap);
	}

	cout << ans/cheap + N << endl;
	

}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int h=scn.nextInt();
		int w=scn.nextInt();
		int []arr=new int[n];
		for(int i=0;i<n;i++) {
			arr[i]=scn.nextInt();
		}
		Arrays.sort(arr);
		int c1=0,c2=0,c3=0;
		for(int i=0;i<n;i++) {
			if(arr[i]<=h) {
				c1++;
			}else {
				if(arr[i]<w+1) {
					c2++;
				}else {
					c3++;
				}
			}
		}
		System.out.println(Math.min(c1, Math.min(c2, c3)));
	}

}


Measured memory_bytes: 21844
N = int(input())
A = [int(a) for a in input().split(" ")]

cont = {i : 0 for i in range(max(A) + 1)}
for a in A:
  cont[a] += 1

# all pattern
all_pair = 0
for key in cont:
  all_pair += (cont[key] * (cont[key] - 1)) // 2
  
for a in A:
  print(all_pair - (cont[a] - 1))

Measured memory_bytes: 38524
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <cmath>
#include <numeric>
#include <functional>
#include <stack>
#include <iomanip>
#include <map>

int main() {
	int a[] = { 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 b;

	std::cin >> b;

	std::cout << a[b - 1] << std::endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define vll vector<pair<ll, ll> >
#define vl vector<ll>
#define vi vector<int>
#define vii vector<pair<int, int> >
const ll mod = 1e9 + 7;
using namespace std;

ll power_mod(ll x, ll y, ll p)
{
	ll ans = 1;
	x = x%p;
	if(x==0)
	return p;

	while(y>0)
	{
		if(y&1)
		{
			ans = (ans*x)%p;
		}
		y = y>>1;
		x = (x*x)%p;
	}
	return ans;
} 

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
		
		ll i,j,k,l,m,n;
		cin>>n;
		int check[n][3];
		int a[n], b[n], c[n];
		for(i=0;i<n;i++)
		{
		    cin>>a[i]>>b[i]>>c[i];
		    check[i][0] = a[i];
		    check[i][1] = b[i];
		    check[i][2] = c[i];
		    
		}
		
		//int max = 0;
		for(i=n-2;i>=0;i--)
		{
		    check[i][0] = check[i][0] + max(check[i+1][1], check[i+1][2]);
		    check[i][1] = check[i][1] + max(check[i+1][0], check[i+1][2]);
		    check[i][2] = check[i][2] + max(check[i+1][0], check[i+1][1]);
		}
		
		
		cout<<max(check[0][0], max(check[0][1], check[0][2]));
	
	return 0;
}


Measured memory_bytes: 5912
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 55;
int d[N];
int n;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ina(n, d);
    int ans = 0;
    rep(i, 1, n) {
        rep(j, i + 1, n) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import deque
s = input()
S1 = deque()
S2 = deque()
total = 0
for i in range(len(s)):
    if s[i] == '\\':
        S1.append(i)
    elif s[i] == '/':
        if len(S1) != 0:
            a = S1.pop()
            total += i - a
            area = i - a
            if len(S2) != 0:
                while S2[-1][0] > a:
                    area += S2.pop()[1]
                    if len(S2) == 0:
                        break
                S2.append([a ,area])
            else:
                S2.append([a, area])
        else:
            pass
print(total)
if total == 0:
    print(0)
else:
    print(len(S2), ' '.join(map(lambda x: str(x[1]), S2)))


Measured memory_bytes: 6556
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n) {return REPS(n).map(i->getInt());}
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}

	public static void main(String[]$){
		int
		a=getInt(),
		b=getInt(),
		c=getInt(),
		d=getInt(),
		e=getInt(),
		f=getInt();

		int rw=100*a,rs=0;
		double max=0;

		for(int i=0;true;++i) {
			int va=100*a*i;
			if(va>f)
				break;
			for(int j=0;true;++j) {
				int vb=100*b*j;
				if(va+vb>f)
					break;
				for(int k=0;true;++k) {
					int vc=c*k;
					if(va+vb+vc>f)
						break;
					for(int l=0;true;++l) {
						int vd=d*l;
						if(va+vb+vc+vd>f)
							break;
						if(max<calc(va+vb,vc+vd,e)) {
							max=calc(va+vb,vc+vd,e);
							rw=va+vb;
							rs=vc+vd;
						}
					}
				}
			}
		}
		System.out.println(rw+rs+" "+rs);
	}
	private static double calc(int w,int s,int e){
		double r=w==0?0:100.0*s/(w+s);
		return w/100*e<s?0:r;
	}
}

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

int gcd(int x, int y) {
    int r;
    while (0!=(r=x%y)) {
        x=y;
        y=r;
    }
    return y;
}

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

    int ans = 0;
    for (int i=1; i<=x; i++) {
        for (int j=1; j<=x; j++) {
            for (int k=1; k<=x; k++) {
                ans += gcd(i, gcd(j,k));
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N=1e6+5,inf=1e18,mod=1e9+7;
#define test ll testcases;cin>>testcases; while(testcases--)
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))
const ld pi=3.141592653589793238;

bool check_prime(ll n)
{
	ll flag=0,i;
	for(i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			flag=1;
			break;
		}
	}
	if(n==1)
	{
		return false;
	}
	else if(flag==0 || n==2 || n==3)
	{
		return true;
	}
	else
	{
		return false;
	}
}

ll fastexpo(ll a,ll b,ll MOD) 
{
	ll result=1;
	while(b>0)
	{
		if(b%2==1)
		{
			result=(result*a)%MOD;
		}
		a=(a*a)%MOD;
		b=b/2;
	}
	return result;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b;
    cin>>a>>b;
    cout<<6-a-b<<"\n";
	return 0;
}

Measured memory_bytes: 3612