akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define ll long long
typedef vector<vector<ll> > matrix;
#define pb push_back
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double PI  =3.141592653589793238463;
long long MOD = 1000000007;

int stringToInteger(string x){
    int gg=0;
    stringstream geek(x);
    geek >> gg;
    return gg;
}

ll powmod(ll a,ll b,ll m)
{
    ll ans=1;
    while(b>0){ if(b%2)
        {ans*=a; ans%=m;}
         b/=2; a=a*a; a=a%m;
        }
        return ans%m;
}
ll gcd(ll a,ll b)
{

    return __gcd(a,b);
}
ll mulmod(ll a,ll b,ll m)
{  ll ans=0;
    a %=m;
    while (b>0)
    {       if(b&1) ans = (ans + a) % m;
        a = (a * 2)%m;
        b /= 2;
    }
    return ans % m;
}

ll f[2000001];



ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a;
 while(b > 0)
 	{
 		if(b%2 == 1)
 	{
 		x=(x*y);
 		if(x>MOD) x%=MOD;
 	}
 	y = (y*y);
 	if(y>MOD) y%=MOD;
 	b /= 2;
 	}
 return x;
}

/* Modular Multiplicative Inverse
 Using Euler's Theorem
 a^(phi(m)) = 1 (mod m)
 a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD)
{
 return pow(n,MOD-2,MOD);
}

bool prime[100005];
void seive()
{  memset(prime,true,sizeof(prime));
    for(int i=2;i*i<=100005;i++)
    {
         if(prime[i]==true) {
        for(int j=2*i;j<=(100005);j+=i)
           { prime[j]=false;}
           }

    }
}
bool in(float x1,float y1,float x,float y,float r )
{
    if(abs(x1-x)*abs(x1-x)+abs(y1-y)*abs(y1-y)<=r*r) return true;
    return false;
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{

        return (a.second<b.second);
}
//
//vector<vector<int> >matrix;
matrix mul(matrix A,matrix B)
{
    matrix C(3, vector<ll>(3));
    for(int i=1;i<=2;i++)
    for(int j=1;j<=2;j++)
     for(int k=1;k<=2;k++)
         C[i][j] = (C[i][j] + A[i][k] * B[k][j]);
    return C;

}
matrix pow(matrix A, int p)
{
    if (p == 1)
        return A;
    if (p % 2)
        return mul(A, pow(A, p-1));
    matrix X = pow(A, p/2);
    return mul(X, X);
}
ll fib(int N,int a,int b)
{
    vector<ll> F1(3);
    F1[1] = a;
    F1[2] = b;
    matrix T(3, vector<ll>(3));
    T[1][1] = 0, T[1][2] = 1;
    T[2][1] = -1, T[2][2] = 1;
    if (N == 1)
        return a;
    if(N==2) return b;
    T = pow(T, N-1);
    ll res = 0;
    for(int i=1;i<=2;i++)
        res = (res + T[1][i] * F1[i]+ MOD)%MOD ;
    return res;
}

//1 2 3 4 5
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

 int t =1;
 while(t--)
  {
      int n;
      cin>>n;
      vector<int>v;
      map<int,ll>mp;
      ll ans=0;
      for(int i=0;i<n;i++)
      {
          ll a;
          cin>>a;
          if(a==i+1) v.pb(i+1);

      }
     int nn = v.size();
      for(int i=0;i<nn;i++)
      {
          if(i!=nn-1)
          {
              if(v[i+1]==v[i]+1)
                {ans++;
                i++;
                }
            else
                ans++;
          }
          else
            ans++;
      }
     // 3 0 3 0 3
     cout<<ans;

  }
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
// use gp_hash_table<int,int,custom_hash> m;
// in place of map
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
// This custom_hash is for unordered_map 
// use map<int, int, custom_hash> mp;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::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 n;
	// cin>>n;
	// string s,t;
	// cin>>s>>t;
	// rep(i,n){
	// 	cout<<s[i]<<t[i];
	// }	
	ll a,b;
	cin>>a>>b;
	ll g = gcd(a,b);
	ll ans = a/g*b;
	cout<<ans;
	return 0;
}

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

using namespace std;

typedef long long ll;

#define x first
#define y second

pair<int,int> a[100010],b[100010];


int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int w,h;scanf("%d%d",&w,&h);
	for (int i=0;i<w;i++)
	{
		scanf("%d",&a[i].x);a[i].y=i;
	}
	for (int i=0;i<h;i++)
	{
		scanf("%d",&b[i].x);b[i].y=i;
	}
	sort(a,a+w);sort(b,b+h);
	int p=0,q=0;ll ans=0;
	while (p<w||q<h)
		if (p<w&&(q>=h||a[p].x<b[q].x))
		{
			ans=ans+ll(h+1-q)*a[p].x;p++;
		}
		else
		{
			ans=ans+ll(w+1-p)*b[q].x;q++;
		}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
str1 = input()
str2 = input()

dict1 = dict()
ans = "Yes"

for i in range(len(str1)):
    if(str1[i] in dict1.keys()):
        if(dict1[str1[i]] != str2[i]):
            ans = "No"
    else:
        if(str2[i] in dict1.values()):
            ans = "No"
        dict1[str1[i]] = str2[i]

print(ans)


Measured memory_bytes: 3632
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

int main(void) {
  int N, M;
  scanf("%d %d", &N, &M);
  vector<int> A, B;
  REP(i, M) {
    int x;
    scanf("%d", &x);
    if (x % 2) {
      B.push_back(x);
    } else {
      A.push_back(x);
    }
  }

  vector<int> a = A;
  if (B.size() > 0) {
    a.insert(a.begin(), B.back());
    B.pop_back();
  }

  if (B.size() > 0) {
    a.push_back(B.back());
    B.pop_back();
  }

  if (B.size() > 0) {
    puts("Impossible");
    return 0;
  }

  vector<int> b;
  if (a.size() == 1) {
    b.push_back(1);
    if (a[0] > 1) b.push_back(a[0] - 1);
  } else {

  REP(i, (int)a.size()) {
    int x = a[i];
    if (i == 0) {
      x--;
    } else if (i == (int)a.size() - 1) {
      x++;
    }

    if (x > 0) b.push_back(x);
  }
  }

  for (int x: a) printf("%d ", x);
  printf("\n");
  printf("%d\n", (int)b.size());
  for (int x: b) printf("%d ", x);
  printf("\n");

  return 0;
}


Measured memory_bytes: 256
import math, collections
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input())
a = list(map(int, input().split()))
al = collections.Counter(a)
res = [0]*(n+1)
dp = [0]*(n+1)
for i in al:
    if al[i]==1: 
        continue
    if dp[al[i]] == 0:
        res[i] += combinations_count(al[i], 2)
        dp[al[i]] += res[i]
    else: res[i] = dp[al[i]]
sum_ = sum(res)
for i in a:
    if al[i]==1:
        print(sum_)
        continue
    if al[i]==2:
        print(sum_-res[i])
        continue
    if dp[al[i]-1] == 0:
        dp[al[i]-1] = combinations_count(al[i]-1, 2)
        print(sum_-res[i]+ dp[al[i]-1])
    else: print(sum_-res[i]+ dp[al[i]-1])

Measured memory_bytes: 121164
#include <iostream>
#include <vector>
#include <cmath>
#include <complex>
#include <algorithm>

using namespace std;

typedef complex<int> P;

struct l {
	int n;
	vector<P> p;
};

P rotate(P p, int n) {
	int x = p.real(), y = p.imag();

	return
		  n == 0 ? P(x,  y)
		: n == 1 ? P(-y, x)
		: n == 2 ? P(y,  -x)
		:          P(-x, -y)
		;
}

int main() {
	int n;
	while (cin >> n, n) {
		vector<l> lines(++n);

		for (int i = 0; i < n; ++i) {
			cin >> lines[i].n;
			for (int j = 0; j < lines[i].n; ++j) {
				int x, y;
				cin >> x >> y;
				lines[i].p.push_back( P(x, y) );
			}
		}

		vector<l> pattern(8);
		for (int i = 0; i < 4; ++i) {
			l new_line;
			for (int j = 0; j < lines[0].n; ++j)
				new_line.p.push_back( rotate(lines[0].p[j], i) );

			pattern[i+4] = pattern[i] = new_line;
			reverse( pattern[i+4].p.begin(), pattern[i+4].p.end() );
		}

		for (int i = 1; i < n; ++i) {
			if (lines[i].n != lines[0].n) continue;
			for (int j = 0; j < 8; ++j) {
				P d = pattern[j].p[0] - lines[i].p[0];
				bool same = true;
				for (int k = 1; k < lines[i].n; ++k)
					same &= lines[i].p[k] + d == pattern[j].p[k];

				if (same) {
					cout << i << endl;
					break;
				}
			}
		}

		cout << "+++++" << endl;
	}
}

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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int main(){
	int R, G, B, N;
	cin >> R >> G >> B >> N;
	int count = 0;
	REP(r,N/R+1){
		REP(g,N/G+1){
			if((N-r*R-g*G)%B==0&&r*R+g*G<=N) count++;
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

int main() {
	IOS;
	int n;
	cin >> n;
	put((n + 1) / 2);
	return 0;
}

Measured memory_bytes: 256
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

S = s()
T = s()

Sd = ''.join(sorted(S))
Td = ''.join(sorted(T, reverse=True))

if Sd < Td:
    print('Yes')
else:
    print('No')




Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
using namespace std;

double const pi = 3.1415926535;
int const mod = 1000000007;
int const inf = 2147483647;

bool flag[3];

int main() {

	string s; cin >> s;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'a')flag[0] = true;
		if (s[i] == 'b')flag[1] = true;
		if (s[i] == 'c')flag[2] = true;
	}
	bool ans = true;
	for (int i = 0; i < 3; i++) {
		if (flag[i] == false)ans = false;
	}
	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define int ll

int n,m;
vector<P> v;

signed main(){
  cin>>n>>m;

  rep(i,m){
    int x,y;
    cin>>x>>y;
    v.push_back(P(y,x));
  }

  sort(all(v));

  int ans=0,t=0;
  rep(i,m){
    
    if(t<=v[i].S){
      ans++;
      t = v[i].F;
    }
  }

  cout<<ans<<endl;
}

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

int main(){
  
  int a, b, c, d;
  
  cin >> a >> b >> c >> d;
  
  if(abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) cout << "Yes" << endl;
  else cout << "No" <<endl;
  
  return 0;
}

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

int main(){
	int H,W;

	while(1){
		cin >>H>>W;
		if (W==0 && H==0) break;
		for (int i=1; i<=H; i++){
			
			for (int k=1; k<=W; k++){
				if ((i+k)%2==0) cout <<"#";
				else cout << ".";
			}
			cout <<"\n";
		}
		cout << "\n";
	}
	
	return 0;
}

Measured memory_bytes: 1120
using System;
using System.Collections.Generic;
//using System.Linq;
class Program
{
  //static List<string> list;
	static void Main(string[] args)
	{
		// 入力フェーズ
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        long Y = long.Parse(input[1]);

        for(int x=0; x<=N; x++)
        {
          // 1万円札x枚の時
          for(int y=0; y<=(N-x); y++)
          {
            // 5千円札y枚の時、z=N-(x+y)
            int z = N - (x+y);
            if(z<0) continue; // zが負の数の時はのぞく

            long tama = x*10000 + y*5000 + z*1000;
            if(tama == Y)
            {
              Console.WriteLine(x + " " + y + " " + z);
              return;
            }
          }
        }

    // 出力
        Console.WriteLine("-1 -1 -1");
    }
		class myClass{ //自作クラス
			public int ID {set; get;}
			public long Point {set; get;}
		}

}


Measured memory_bytes: 11092
n , a , b = gets.split.map{|v| v.to_i}

loop do
    if a < n && a < b - 1
        a += 1
        if a + 1 < b
            b -= 1
        elsif b < n
            b += 1
        else
            puts "Alice"
            break
        end
    elsif 1 < a
        a -= 1
        b -= 1
    else
        puts "Borys"
        break
    end
end

Measured memory_bytes: 1788
#include <stdio.h>
#include <string.h>
// #include <math.h>

int main() {
    int h,w,i,j;
    char s[300]="";
    while(1){
        scanf("%d %d",&h,&w);
        if(h==0&&w==0){
            break;
        }
        for(i=0;i<h;i++){
            for(j=0;j<w;j++){
                if(i==0||i==h-1){
                    printf("#");
                }else{
                    if(j==0||j==w-1){
                        printf("#");
                    }else{
                        printf(".");
                    }
                }
            }
            printf("\n");
        }
        printf("\n");
        memset(s,0,sizeof(s));
    }
    
    return 0;
}


Measured memory_bytes: 2040
import sys
while True:
    ins = input().split()
    h = int(ins[0])
    w = int(ins[1])
    if h == 0 and w == 0:
        break
    for i in range(h):
        for j in range(w):
            if (i + j) % 2 == 0:
                sys.stdout.write('#')
            else:
                sys.stdout.write('.')
        sys.stdout.write('\n')
    print("")

Measured memory_bytes: 8252
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		for(int tt=0;tt<t;tt++) {
			int n = sc.nextInt();
			int[] h = new int[n];
			for(int i=0;i<n;i++) {
				h[i] = sc.nextInt();
			}
			int up = 0;
			int down = 0;
			for(int i=0;i<n-1;i++) {
				up = Math.max(up,h[i+1]-h[i]);
				down = Math.max(down,h[i]-h[i+1]);
			}
			System.out.println(up + " " + down);
		}
	}

}

Measured memory_bytes: 27500
N = int(input())
hoge = []
for i in range(0,N):
	b = [x for x in input().split()]
	hoge.append(b)

for i in range(N):
	hoge[i].append(i+1)
	
for i in range(N):
	hoge[i][1] = int(hoge[i][1])

for i in range(N):
	print(sorted(hoge, key=lambda x:(x[0],-x[1]))[i][2])

Measured memory_bytes: 3064
#include <iostream>
#include <bits/stdc++.h>
// Input macros
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%lld",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
// Useful constants
#define INF                         (int)1e9
#define EPS                         1e-9
// Useful hardware instructions
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
// Useful container manipulation / traversal macros
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
// Some common useful functions
#define maX(a,b)                     ( (a) > (b) ? (a) : (b))
#define miN(a,b)                     ( (a) < (b) ? (a) : (b))
#define checkbit(n,b)                ( (n >> b) & 1)
#define DREP(a)                      sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind)               (lower_bound(all(arr),ind)-arr.begin())
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int MAXN=1e5+5;
int arr[MAXN];
int g[105][105];

int main()
{
    int h,w, n;
    s(h);
    s(w);
    s(n);
    forall(i,1,n+1){
        s(arr[i]);
    }
    int c = 1;
    forall(i,1,h+1){
        if (i & 1){
            forall(j,1,w+1){
                if (arr[c] > 0){
                    g[i][j] = c;
                    arr[c]--;
                } else if (arr[c] == 0){
                    c++;
                    g[i][j] = c;
                    arr[c]--;
                }
            }
        } else {
            for(int j = w; j > 0; j--){
                if (arr[c] > 0){
                    g[i][j] = c;
                    arr[c]--;
                } else if (arr[c] == 0){
                    c++;
                    g[i][j] = c;
                    arr[c]--;
                }
            }
        }
    }
    forall(i,1,h+1){
        forall(j,1,w+1){
            printf("%d ", g[i][j]);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 384
from collections import deque

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

rooms = [-1] * N
def bfs(u):
    q = deque()
    q.append(u)
    while 0 < len(q):
        v = q.popleft()
        for e in edges[v]:
            if rooms[e] == -1:
                rooms[e] = v + 1
                q.append(e)

bfs(0)
print("Yes")
print(*rooms[1:], sep="\n")


Measured memory_bytes: 96008
/*input
8 8
*/
/**
    Author: Kristopher Paul
    Date Created: 01-09-2019
    Contest Name:
                _/    _/   _/_/_/_/   _/   _/_/_/_/
               _/  _/     _/    _/   _/   _/
              _/_/       _/_/_/_/   _/   _/_/_/_/
             _/  _/     _/  _/     _/         _/
            _/    _/   _/    _/   _/   _/_/_/_/
**/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int ll
#define pb push_back
#define INF 1e18
#define MOD 1000000007
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap unordered_map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset

int ModExp(int x,int y,int m){
    int res = 1;
    x = x % m;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % m;

        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

void solve(){
    int a,b;
    cin >> a >> b;
    int tot = 1;
    int ans = 0;
    while(tot < b){
        tot += a;
        tot--;
        ans++;
    }
    cout << ans << endl;
}

signed main(){
    FastIO;
    int t = 1;
//    cin >> t;
    WL(t){
        solve();
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> anys;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(anys{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	vector<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 K; cin >> K;
	cout << A[K-1] << endl;

	return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
 
min = 100000000
(1...n).each do |a|
  b = n - a
  as = a.to_s.each_char.map(&:to_i).inject(&:+)
  bs = b.to_s.each_char.map(&:to_i).inject(&:+)
  if as + bs < min
    min = as + bs
  end
end
puts(min)

Measured memory_bytes: 1916
#include <iostream>
#include <vector>
using namespace std;
using pint = pair<int,int>;
 
int main() {
    int N; cin >> N;
    vector<pint> res;
    int dame = N;
    if (N % 2 == 1) --dame;
 
    for (int i = 1; i <= N; ++i) {
        for (int j = 1; j <= N; ++j) {
            if (j <= i || j == dame) continue;
            res.push_back(pint(i, j));
        }
        --dame;
    }
 
    cout << res.size() << endl;
    for (auto p : res) {
        cout << p.first << " " << p.second << endl;
    }
}       

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    int n;
    cin >> n;
    map<int, bool> mp;
    REP(i, 100){
        REP(j, 100){
            mp[i*4 + j*7] = true;
        }
    }
    cout << (mp[n] ? "Yes" : "No" ) << endl;
}


Measured memory_bytes: 256
from itertools import product
n, m = map(int, input().split())
xyzxyz = [list(map(int, input().split())) for _ in range(n)]
ans_best = 0
for s0, s1, s2 in product([-1, 1], [-1, 1], [-1, 1]) :
    ans = []
    for x, y, z in xyzxyz :
        a = x*s0 + y*s1 + z*s2
        ans.append(a)
    ans.sort(reverse=True)
    ans_best = max(sum(ans[:m]), ans_best)
print(ans_best)

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

using namespace std;

int main()
{
    int n,c=0,x;
    cin>>n;
    for(int i=n;i>0;i=i/10)
    {
        c++;
    }
        if(c==1)
        {
            x=n-0;
        }
        else if(c==2)
        {
            x=9;
        }
        else if(c==3)
        {
            x=n-99+9;
        }
        else if(c==4)
        {
            x=999-99+9;
        }
        else if(c==5)
        {
            x=n-9999+999-99+9;
        }
        else
        {
            x=99999-9999+999-99+9;
        }
        cout<<x;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,1,0,-1 };
struct Compress {
	map<int, int>mp;
	map<int, int>revmp;

	Compress(vector<int>vs) {
		sort(vs.begin(), vs.end());
		for (int i = 0; i < vs.size(); ++i) {
			mp[vs[i]] = i;
			revmp[i] = vs[i];
		}
	}
	Compress(const set<int>&vs) {
		int num = 0;
		for(auto v:vs){
			mp[v] = num;
			revmp[num] = v;
			num++;
		}
	}
};
struct rect {
	int l, t, r, b;
};
int field[300][300][4];
int main() {
	while (1) {
		memset(field, 0, sizeof(field));
		int N; cin >> N;
		if (!N)break;
		set<int>xs, ys;
		vector<rect>rects;
		for (int i = 0; i < N; ++i) {
			int l, t, r, b; cin >> l >> b>> r >>t;
			xs.emplace(l); xs.emplace(r);
			ys.emplace(t); ys.emplace(b);
			rects.push_back(rect{ l,t,r,b });
		}
		Compress xc(xs);
		Compress yc(ys);
		for (auto &re : rects) {
			re.b = yc.mp[re.b];
			re.t = yc.mp[re.t];
			re.l = xc.mp[re.l];
			re.r = xc.mp[re.r];
		}
		for (auto &re : rects) {
			re.b *= 2;
			re.t *= 2;
			re.l *= 2;
			re.r *= 2;
			re.b += 20;
			re.t += 20;
			re.l += 20;
			re.r += 20;
		}
		for (auto &re : rects) {
			for (int x = re.l; x < re.r;++x) {
				field[re.t][x][3] = true;
				field[re.t - 1][x][1] = true;
				field[re.b][x][3] = true;
				field[re.b - 1][x][1] = true;
			}
			for (int y = re.t; y < re.b; ++y) {
				field[y][re.l][0] = true;
				field[y][re.l - 1][2] = true;
				field[y][re.r][0] = true;
				field[y][re.r - 1][2] = true;
			}
		}
		UnionFind uf(90000);
		for (int y = 1; y < 299; ++y) {
			for (int x = 1; x < 299; ++x) {
				const int ahash = y * 300 + x;
				for (int way = 0; way < 4; ++way) {
					if (!field[y][x][way]) {
						const int ny = y + dy[way];
						const int nx = x + dx[way];
						const int bhash = ny * 300 + nx;
						uf.unionSet(ahash, bhash);
					}
				}
			}
		}
		set<int>aset;
		for (int y = 1; y < 299; ++y) {
			for (int x = 1; x < 299; ++x) {
				const int ahash = y * 300 + x;
				aset.emplace(uf.root(ahash));
			}
		}
		cout << aset.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 5032
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000010;
constexpr ll INF= 1000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

ll RS(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P < 0) {
        return 0;
    }
    if(P%2==0){
        ll t = RS(N, P/2, M);
        return t*t % M;
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    int ret = 0;
    for(int i = 0;i < N;i++) {
        if(i % 2 == 0 && vec.at(i) % 2 == 1) {
            ret++;
        }
    }
    cout << ret << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    ll x,y;
    cin >> x >> y;
    ll ctr=1;
    while(x*2<=y){
        x*=2;
        ctr++;
    }
    print(ctr);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 3556
#include<iostream>
using namespace std;
int main()
{
    int n,x,t,count = 0;
    cin>>n>>x>>t;
    while(1){
        if(x<=n){
            count = count + t;
            n = n-x;
        }
        else if(x>n && n>0){
            count = count + t;
            n = n-x;
        }
        else{
            break;
        }
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3624
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Util{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		int[] NXT = ria();

		Console.WriteLine(Math.Ceiling(NXT[0] / (double)NXT[1]) * NXT[2]);
		Console.ReadLine();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
    static int[] generateNums(int num, int N){return Enumerable.Repeat(num, N).ToArray();}
    static int[] generateSuretsu(int N){return Enumerable.Range(0, N).ToArray();}
}

public static class Combination {
	//使い方:int[][] Is = Combination.Enumerate(nums, k, withRepetition:false).ToArray();
    public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition) {
        if (k == 1) {
            foreach (var item in items)
                yield return new T[] { item };
            yield break;
        }
        foreach (var item in items) {
            var leftside = new T[] { item };

            // item よりも前のものを除く （順列と組み合わせの違い)
            // 重複を許さないので、unusedから item そのものも取り除く
            var unused = withRepetition ? items : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList();

            foreach (var rightside in Enumerate(unused, k - 1, withRepetition)) {
                yield return leftside.Concat(rightside).ToArray();
            }
        }
    }
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int a;
    cin >> a;
    if(a <= 599) cout << 8 << endl;
    else if(a <= 799) cout << 7 << endl;
    else if(a <= 999) cout << 6 << endl;
    else if(a <= 1199) cout << 5 << endl;
    else if(a <= 1399) cout << 4 << endl;
    else if(a <= 1599) cout << 3 << endl;
    else if(a <= 1799) cout << 2 << endl;
    else cout << 1 << endl;
    return 0;
}



Measured memory_bytes: 3608
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    if (args.length > 0 && args(0) == "TEST") {
      println(test())
    } else {
      val input = io.Source.stdin.getLines().mkString("\n")
      println(solve(input).trim())
    }
  }

  def solve(input: String): String = {
    val s: Scanner = new Scanner(input)
    s.useDelimiter("/")
    val year, month, day = s.next
    s"2018/01/$day"
  }

  val tests = List(
    """2017/01/07""".stripMargin -> """2018/01/07""",
    """2017/01/31""".stripMargin -> """2018/01/31"""
  )

  def test(): String = tests.map { case (i, o) => (i.trim(), o.trim()) }
    .zipWithIndex.map {
    case ((input, outputExpect), i) =>
      val output = solve(input).trim()
      val tnum = i + 1
      s"test$tnum:" + (
        if (output == outputExpect) "Passed"
        else s"Failed\nexpect:\n$outputExpect\noutput:\n$output")
  }
    .mkString("\n")
}

Measured memory_bytes: 25416
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>

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

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
ll INF = 1LL<<40;

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

    ll A, B;
    cin >> A >> B;
    if((A+B)%2==0){
        cout << (A+B)/2 << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}


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

using namespace std;

#define MOD 1000000007
#define N 100005
#define M 30
#define ll long long 
#define ld long double
#define pb push_back
#define ff first
#define ss second

int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ld n, a;
	ld ans = 0;
	cin>>n;
	while(n--){
		cin>>a;
		ans = ans + (1.0/a);
	}
	ans = 1.0/ ans;
	cout<<setprecision(20)<<fixed<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
int N;
int x[10],y[10];

double dist(int i,int j){
      double dx = x[i] - x[j];
      double dy = y[i] - y[j];
      return sqrt(dx * dx + dy * dy);
}
int main(void){
    cin >> N;
    for(int i = 1;i <= N;i++){
          cin >> x[i] >> y[i];
    }
    vector<int>v(N);
    for(int i = 0;i < N;i++){
          v[i] = i + 1;
    }
    double sum = 0.0;
    do{
          for(int i = 0;i < N - 1;i++){
                sum += dist(v[i],v[i + 1]);
          }
    }while(next_permutation(v.begin(),v.end()));
    int f = 1;
    for(int i = 2;i <= N;i++)f *= i;
    printf("%0.10f\n",sum / f);
}


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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  ll sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  ll dx = tx - sx;
  ll dy = ty - sy;

  cout << string(dy, 'U') << string(dx, 'R');
  cout << string(dy, 'D') << string(dx, 'L');
  cout << "L" << string(dy+1, 'U') << string(dx+1, 'R') << "D";
  cout << "R" << string(dy+1, 'D') << string(dx+1, 'L') << "U";
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
d = [[float("inf")] * n for i in range(n)]
edge = []
for i in range(m):
    a, b = map(int, input().split())
    edge.append((a, b))
    d[a - 1][b - 1] = 1
    d[b - 1][a - 1] = 1
ans = 0
for a in range(m):
    d_s = [x[:] for x in d]
    x, y = edge[a]
    d_s[x - 1][y - 1] = float("inf")
    d_s[y - 1][x - 1] = float("inf")
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d_s[i][j] = min(d_s[i][j], d_s[i][k] + d_s[k][j])
    flag = 0
    for i in range(n):
        if flag:
            break
        for j in range(n):
            if flag:
                break
            if d_s[i][j] == float("inf"):
                ans += 1
                flag = 1
print(ans)

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

using namespace std;

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

void solve() {
  ll n;
  cin >> n;
  vector<ll> ret;
  ret.resize(50);
  for(int i = 0; i < 50; i++) ret[i] = 49;
  ll fullInc = n/50;
  n %= 50;
  for(int i = 0; i < 50; i++) ret[i] += fullInc;
  int f = 0;
  while(n--) {
    ret[f] += 50;
    for(int i = 0; i < 50; i++) if(i != f) ret[i]--;
    f++;
  }
  cout << "50\n";
  for(int i = 0; i < 50; i++) {
    cout << ret[i];
    if(i == 49) cout << endl;
    else cout << " ";
  }
}

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


Measured memory_bytes: 256
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
abs = []

for i in range(n):
    ab = list(map(int, input().split()))
    abs.append(ab)

abs = sorted(abs, key=lambda x: x[0])

money = 0
count = 0

for i in range(n):
    money = money + abs[i][0] * abs[i][1]
    count = count + abs[i][1]
    if count >= m:
        money = money - abs[i][0] * (count - m)
        break

print(money)

Measured memory_bytes: 29788
import sys
input = sys.stdin.buffer.readline
import numpy as np

def main():
    N = int(input())
    a = np.array(list(map(int,input().split())),dtype = int)
    MOD = 10**9+7
    ans = 0
    for n in range(60):
        bit = (a>>n)&1
        nonzero = np.count_nonzero(bit)
        zero = N-nonzero
        count = nonzero*zero
        for _ in range(n):
            count *= 2
            count %= MOD
        ans += count
        ans %= MOD
    
    print(ans)

if __name__ == "__main__":
    main()

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

using namespace std;

void Main() {
    int N, T;
    cin >> N >> T;
    vector<int> A(N, 0);
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> A[i];
    }

    int accumMin = A[0];
    int accumDiff = 0;
    int counter = 0;
    for (int i = 1; i < N; ++i) {
        if (A[i] < accumMin) {
            accumMin = A[i];
        }
        else if (A[i] - accumMin > accumDiff) {
            accumDiff = A[i] - accumMin;
            if (counter == 0) {
                ++counter;
            }
            else {
                counter = 1;
            }
        }
        else if (A[i] - accumMin == accumDiff) {
            ++counter;
        }
    }
    cout << counter << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3796
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
  long n, k;
  cin >> n >> k;
  long ends[100001] = {0};
  for(long i = 0; i < n; i++){
    long a, b;
    cin >> a >> b;
    ends[a] += b;
  }

  for(long i = 0; i < 100001; i++){
    k -= ends[i];
    if(k <= 0){
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define debug(x) cout<<#x<<"="<<x<<endl;
#define LL long long 
using namespace std;
const int N=1e5+10;
map<int,int> mp;
int main()
{
	int n;
	cin>>n;
	mp.clear();
	rep(i,0,n)
	{
		int tmp;
		cin>>tmp;
		mp[tmp]++;
	}
	LL ans=0;
	for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++)
	{
		//cout<<it->first<<"="<<it->second<<endl;
		if(it->first>it->second)ans+=it->second;
		else ans+=(it->second-it->first);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4736
import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		long n = sc.nextLong();
		long k = sc.nextLong();
		n %= k;
		println(Math.min(n, k - n));
	}
}


Measured memory_bytes: 23636
N,D=map(int,input().split())
XY=[map(int,input().split()) for i in range(N)]
X,Y=[list(n) for n in zip(*XY)]
count=0
for n in range(N):
    if (X[n]**2+Y[n]**2)**0.5 <=D:
        count+=1
print(count)


Measured memory_bytes: 116724
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

int main() {
    
    
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> b(n);
    rep(i, n) cin >> b[i];
    vector<int> c(n - 1);
    rep(i, n - 1) cin >> c[i];
    rep(i, n) a[i]--;
    
    int ans = 0;
    rep(i, n) {
        ans += b[a[i]];
    }
    
    rep(i, n - 1) {
        if (a[i] + 1 == a[i + 1]) {
            ans += c[a[i]];
        }
    }
    
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <typeinfo>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    string si;
    vector<vector<int>> d(n, vector<int>(n, 10000));
    map<int, vector<int>> de;
    for(int i=0; i<n; i++){
        cin >> si;
        for(int j=0; j<n; j++){
            if(si[j]=='1'){
                d[i][j] = 1;
                if(de.find(i)!=de.end()){
                    de[i].push_back(j);
                }else{
                    de[i] = {j};
                }
                if(de.find(j)!=de.end()){
                    de[j].push_back(i);
                }else{
                    de[j] = {i};
                }
            }
        }
    }


    vector<int> c(n,0);
    queue<int> q;
    q.push(0);
    c[0] = 1;
    int x;
    while(q.size()>0){
        x = q.front();
        q.pop();
        for(auto it = de[x].begin(); it!=de[x].end(); it++){
            if(c[*it]==0){
                c[*it] = c[x] + 1;
                q.push(*it);
            }else{
                if((c[*it]-c[x])%2 == 0){
                    cout << -1 << endl;
                    exit(0);
                }
            }
        }
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            for(int k=0; k<n; k++){
                d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
            }
        }
    }
    int ans = 0;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(d[i][j] < 10000 and i!=j){
                ans = max(ans, d[i][j]);
            }
        }
    }
    cout << ans + 1 << endl;
}


Measured memory_bytes: 896
use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::cmp::*;
use std::collections::HashSet;
use std::iter::Iterator;

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
  input! {
  mut s: Chars,
  }

  let s2 = s[0];

  if s2 == s[0].to_ascii_lowercase() {
    println!("a");
  } else {
    println!("A")
  }
}


Measured memory_bytes: 2144
import java.util.*;
public class Main {
	static int N;
	static List<ArrayList<Edge>> g;
	static int ans[];
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		g = new ArrayList();
		for(int i=0;i<N;i++) g.add(new ArrayList<Edge>());
		
		//連結リスト作成
		for(int i=0;i<N-1;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			a--;b--;
			g.get(a).add(new Edge(i,b));
			g.get(b).add(new Edge(i,a));
		}
		sc.close();
		
		ans = new int[N-1];//edgeの色
		
		dfs(0, -1, -1);//最初はcolorもparentもいないので-1を入れる
		
		//出力 
		int max = 0;
		for(int t :ans) {
			max = Math.max(max, t);
		}
		StringBuilder sb = new StringBuilder();
		sb.append(max + "\n");
		for(int t :ans) {
			sb.append(t + "\n");
		}
		System.out.println(sb.toString());
		
	}
	static void dfs(int to, int color, int p) {
		int k = 1;
		for(Edge e:g.get(to)) {
			if(e.to == p)continue;
			if(k==color)k++;
			ans[e.id]=k;
			dfs(e.to, k, to);
			k++;
		}
	}
}

class Edge{
	
	Edge(int id, int to){
		this.id = id;
		this.to = to;
	}
	
	int id;
	int to;
	
}

Measured memory_bytes: 102568