akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#include <set>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    int H,W;
    cin >> H >> W;
    vector<string> A(H);
    for (int i = 0; i < H; ++i) {
        cin >> A[i];
    }
    int cnt = 0;
    for (int i = 0; i < H; ++i) {
        for (int k = 0; k < W; ++k) {
            if (A[i][k] == '#') {
                cnt++;
            }
        }
    }
    if (cnt == H+W-1) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);

#define dbg1(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
	os << "{";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << *it;
	}
	return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin()) os << ", ";
		os << *it;
	}
	return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << it -> first << " = " << it -> second ;
	}
	return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () { cerr << endl; }

template <typename T>
void faltu( T a[], int n ) {
	for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
	cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) { cerr << arg << ' '; faltu(rest...); }
// Program showing a policy-based data structure.
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less 
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
// GNU link : https://goo.gl/WVDL6g
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

/**___________________________________________________**/



int main()
{
	FASTIO
	///*
// #ifndef ONLINE_JUDGE
// 	freopen("in.txt", "r", stdin);
// 	freopen("out.txt", "w", stdout);
// 	freopen("error.txt", "w", stderr);
// #endif
//*/
	int T;
	//scanf("%d", &T);
	T = 1;
	for (int cs = 1; cs <= T; cs++) {
		int n;
		string s;
		cin >> n >> s;
		string red = "red";
		cout << ((n < 3200) ? red : s);
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <map>
using namespace std;

const int MAX_NUM = 100;

int main()
{
	map<string, int> blue;
	map<string, int> red;
	map<string, int>::iterator iter;

	int N;
	cin >> N;
	string blue_str[MAX_NUM];
	for ( int i = 0; i < N; ++i ) {
		cin >> blue_str[i];
	}

	for ( int i = 0; i < N; ++i ) {
		if ( ( iter = blue.find( blue_str[i] ) ) != blue.end() ) {
			++(iter->second);
		}
		else {
			blue.insert( make_pair( blue_str[i], 1 ) );
		}
	}

	int M;
	cin >> M;
	string red_str[MAX_NUM];
	for ( int i = 0; i < M; ++i ) {
		cin >> red_str[i];
	}

	for ( int i = 0; i < M; ++i ) {
		if ( ( iter = red.find( red_str[i] ) ) != red.end() ) {
			++(iter->second);
		}
		else {
			red.insert( make_pair( red_str[i], 1 ) );
		}
	}

	int res = 0;
	int score;
	map<string, int>::iterator b_iter, r_iter;
	for ( b_iter = blue.begin(); b_iter != blue.end(); ++b_iter ) {
		score = b_iter->second;
		if ( ( r_iter = red.find( b_iter->first ) ) != red.end() ) {
			score -= r_iter->second;
		}

		if ( res < score ) res = score;
	}

	cout << res << endl;
	return 0;
}

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

int main(void){
    char c[3];
    int a = 0,maxa;
    cin >> c;
    maxa = a;

    for(int i=0;i<3;i++){
        if(c[i] == 'R'){
            a++;
            maxa = max(maxa,a);
        }else{
            a = 0;
        }
    }
    cout << maxa << endl;
    return 0;
}

Measured memory_bytes: 3592
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#define int long long
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
int n,k;
pair<int,int>p[100005];
bool occur[100005];
bool tmp[100005];
vector<int>first,second;
void solve(){
	for(int i=1;i<=n;i++){
		if(tmp[p[i].second])occur[i]=true;
		tmp[p[i].second]=true;
	}
	first.push_back(0);second.push_back(0);
	for(int i=1;i<=n;i++)
		if(occur[i])
			second.push_back(p[i].first);
		else 
			first.push_back(p[i].first);
	sort(first.begin()+1,first.end());
	reverse(first.begin()+1,first.end());
	sort(second.begin()+1,second.end());
	reverse(second.begin()+1,second.end());
	vector<int>pref(100005,0),pres(100005,0);
	for(int i=1;i<first.size();i++){
		pref[i]=pref[i-1]+first[i];
	}
	for(int i=1;i<second.size();i++){
		pres[i]=pres[i-1]+second[i];
	}
	int ans=0;
	for(int diftype=1;diftype<=first.size()&&diftype<=k;diftype++){
		ans=max(ans,diftype*diftype+pref[diftype]+pres[k-diftype]);
	}
	cout<<ans<<endl;
}
signed main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>p[i].second>>p[i].first;
	sort(p+1,p+n+1);
	reverse(p+1,p+n+1);
	solve(); 
	return 0;
}

Measured memory_bytes: 4472
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

A = [[0] + [sum(A[i][:j+1]) for j in range(N)] for i in range(2)]
print(max([A[0][j] + A[1][-1] - A[1][j-1] for j in range(1, N + 1)]))


Measured memory_bytes: 3060
a, b = (int(i) for i in input().split())
while a != 0 and b != 0:
    cow = '#'
    for i in range(1, b):
        cow += '#'
    print('{0}'.format(cow))
    for i in range(1, a-1):
        row = '#'
        for j in range(1, b-1):
            row += '.'
        row += '#'
        print('{0}'.format(row))
    cow = '#'
    for i in range(1, b):
        cow += '#'
    print('{0}'.format(cow))
    print()
    a, b = (int(i) for i in input().split())

Measured memory_bytes: 7740
#include <bits/stdc++.h>
#define MOD 998244353

using namespace std;

typedef long long ll;

ll pow_mod(ll x,int k) {
  ll ans=1;
  while (k) {
  	if (k&1) ans=ans*x%MOD;
  	x=x*x%MOD;
  	k>>=1;
  }
  return ans;
}

ll facd[8005],facv[8005];

void pre(int n) {
  facd[0]=1;
  for(int i=1;i<=n;i++) facd[i]=facd[i-1]*i%MOD;
  facv[n]=pow_mod(facd[n],MOD-2);
  for(int i=n-1;i>=0;i--) facv[i]=facv[i+1]*(i+1)%MOD;
}

inline ll C(int n,int m) {
  return (n<m)?0:facd[n]*facv[m]%MOD*facv[n-m]%MOD;
}

const int Maxn=1<<14;

ll *w[14];

void ntt_init() {
  for(int i=2,t=1;i<=Maxn;i<<=1,t++) {
  	w[t]=new ll[i>>1];
  	ll wn=pow_mod(3,(MOD-1)/i);
  	w[t][0]=1;
  	for(int j=1;j<(i>>1);j++) w[t][j]=w[t][j-1]*wn%MOD;
  }
}

void rev(ll *p,int len) {
  int j=len>>1;
  for(int i=1;i<len-1;i++) {
  	if (i<j) swap(p[i],p[j]);
  	int k=len>>1;
  	while (j>=k) {
  		j-=k;
  		k>>=1;
	  }
	if (j<k) j+=k;
  }
}

void ntt(ll *p,int len,int check) {
  rev(p,len);
  for(int i=2,t=1;i<=len;i<<=1,t++)
    for(int j=0;j<len;j+=i)
      for(int k=j;k<j+(i>>1);k++) {
      	ll u=p[k];
      	ll v=w[t][k-j]*p[k+(i>>1)];
      	p[k]=(u+v)%MOD;
      	p[k+(i>>1)]=(u-v)%MOD;
	  }
  if (check==-1) {
  	reverse(p+1,p+len);
  	ll nev=pow_mod(len,MOD-2);
  	for(int i=0;i<len;i++) p[i]=(p[i]+MOD)*nev%MOD;
  }
}

int f[2][8005],cur;

inline void update(int &x,ll y) {
  x=(x+y)%MOD;
}

inline ll S(int n) {
  return n*(n-1)>>1;
}

void dp(int n) {
  static ll p[Maxn],q[Maxn];
  cur^=1;
  memset(f[cur],0,sizeof(f[cur]));
  for(int i=0;i<=n;i++) update(f[cur][i],f[cur^1][i]*(S(i+1)+1));
  int len=1;
  while (len<((n+1)<<1)) len<<=1;
  memset(p,0,sizeof(ll)*len);
  memset(q,0,sizeof(ll)*len);
  for(int i=0;i<=n;i++) p[i]=f[cur^1][i]*facv[i]%MOD;
  for(int i=1;i<=n;i++) q[i]=facv[i+2];
  ntt(p,len,1);
  ntt(q,len,1);
  for(int i=0;i<len;i++) p[i]=p[i]*q[i]%MOD;
  ntt(p,len,-1);
  for(int i=1;i<=n;i++) update(f[cur][i],p[i]*facd[i+2]);
}

int main() {
  ntt_init();
  int n,m;
  scanf("%d%d",&n,&m);
  pre(n+2);
  f[0][0]=1;
  for(int i=1;i<=m;i++) dp(n);
  int ans=0;
  for(int i=0;i<=n;i++) update(ans,f[cur][i]*C(n,i));
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 768
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(true) {
            int h = scanner.nextInt();
            int w = scanner.nextInt();
            if (h == 0 && w == 0) break;
            StringBuilder outW = new StringBuilder();
            StringBuilder outUD = new StringBuilder();
            for(int a = 0; a < w; a++){
                outUD.append("#");
                if (a == 0 || a == w-1) {
                    outW.append("#");
                } else {
                    outW.append(".");
                }
            }
            for(int b = 0; b < h; b++) {
                if (b == 0 || b == h-1) {
                    System.out.println(outUD);
                } else {
                    System.out.println(outW);
                }
            }
            System.out.println("");
        }
    }
}



Measured memory_bytes: 27600
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

std::vector<ll> fac, finv, inv;

struct Combination{        
	Combination(int max=6e5){
		fac.resize(max+1);
		finv.resize(max+1);
		inv.resize(max+1);
                fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
                for(int i=2; i<=max; i++){
                        fac[i] = fac[i-1] * i % MOD;
                        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
                        finv[i] = finv[i-1] * inv[i] % MOD;
                }
        }

        ll C(int n, int r) const {
                if(n<0 or n<r) return 0;
                return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD;
        }

        ll H(int n, int r) const {
                if(n<0 or r<0) return 0;
                if(r==0) return 1;
                return C(n+r-1, r);
        }
};

int main(){
	int n, k;
	scanf("%d %d", &n, &k);
	Combination comb;
	ll ans = 0;
	REP(i, 0, std::min(n, k+1)){
		ans += comb.C(n, i) * comb.H(n-i, i) % MOD;
		ans %= MOD;
	}
	printf("%ld\n", ans);
	return 0;
}



Measured memory_bytes: 14336
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		
		int[][] matrix = new int[n+1][n+1];
		Vertex[] v = new Vertex[n + 1];
		
		for(int i = 0; i <= n; i++){
			Arrays.fill(matrix[i], 0);
		}
		for(int i = 1 ; i <= n; i++){
			String[] tmpArray = br.readLine().split(" ");
			
			for(int j = 2 ; j < tmpArray.length ; j++){
				int tmp = Integer.parseInt(tmpArray[j]);
				matrix[i][tmp] = 1;
			}
			
			v[i] = new Vertex(i);
		}
		
		/*
		for(int i = 1; i <= n; i++){
			for(int j = 1 ; j <= n ; j++){
				if(j == 1){
					System.out.print(matrix[i][j]);
				}
				else {
					System.out.print(" "+matrix[i][j]);
				}
			}
			System.out.println();
		}*/
		
		bfs(matrix, v, 1);
		
		for(int i = 1; i <= n; i++){
			if(v[i].distance != Integer.MAX_VALUE){
				System.out.println(i + " " + v[i].distance);
			}
			else {
				System.out.println(i + " -1");
			}
		}
	}
	
	static void bfs (int[][] matrix, Vertex[] v, int start){
		v[start].color = Vertex.WHITE;
		v[start].distance = 0;
		
		Queue<Vertex> queue = new LinkedList<Vertex>();
		queue.add(v[start]);
		
		while(queue.size() != 0){
			Vertex u = queue.poll();
			for(int i = 1; i < v.length ; i++){
				if(matrix[u.id][i] == 0){
					continue;
				}
				
				Vertex tmpV = v[i];
				
				if(tmpV.color == Vertex.WHITE){
					tmpV.color = Vertex.GRAY;
					tmpV.distance = u.distance + 1;
					tmpV.parent = u;
					queue.add(tmpV);
				}
			}
			u.color = Vertex.BLACK;
		}
		
	}
}

class Vertex {
	static final int WHITE = 0;
	static final int GRAY = 1;
	static final int BLACK = 2;
	int color;
	int distance;
	Vertex parent;
	int id;
	
	public Vertex (int id){
		this.id = id;
		color = WHITE;
		distance = Integer.MAX_VALUE;
		parent = null;
	}
}

Measured memory_bytes: 24496
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var MOD = 998244353;
		var sc = new Scanner(System.in);
		var n = sc.nextInt();
		var m = sc.nextInt();
		var k = sc.nextInt();
		sc.close();

		var calc = new Calc(MOD);
		var sum = calc.pow(m, n);
		var m1 = m;
		var c1 = 1;
		for (var i = n - 1; i > k; i--) {
			if(i != n - 1) {
				m1 = calc.multiply(m1, m - 1);
				c1 = calc.divide(calc.multiply(c1, i + 1), n - 1 - i);
			}
			sum = calc.subtract(sum, calc.multiply(m1, c1));
		}
		System.out.println(sum);
	}

	public static class Calc {
		int mod;

		public Calc(int mod) {
			this.mod = mod;
		}

		public int add(int a, int b) {
			return (int) (((long) a + b) % mod);
		}

		public int subtract(int a, int b) {
			return (int) (((long) a - b + mod) % mod);
		}

		public int multiply(int a, int b) {
			return (int) (((long) a * b) % mod);
		}

		public int divide(int a, int b) {
			return multiply(a, pow(b, mod - 2));
		}

		public int pow(int n, int k) {
			if (k == 0) {
				return 1;
			} else if (k % 2 == 0) {
				int p = pow(n, k / 2);
				return multiply(p, p);
			} else {
				int p = pow(n, (k - 1) / 2);
				return multiply(multiply(p, p), n);
			}
		}

		public int combine(int n, int k) {
			int sum1 = 1;
			int sum2 = 1;
			for (int i = 0; i < k; i++) {
				sum1 = multiply(sum1, n - i);
				sum2 = multiply(sum2, i + 1);
			}
			return divide(sum1, sum2);
		}
	}
}

Measured memory_bytes: 36280
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

double* equation2(double para[2][2],double val[2])
{
	double* ans = (double*)malloc(sizeof(double)*2);
	double det = para[0][0]*para[1][1]-para[1][0]*para[0][1];
	ans[0] = val[0]*para[1][1]-val[1]*para[0][1];
	ans[0] /= det;
	ans[1] = val[1]*para[0][0]-val[0]*para[1][0];
	ans[1] /= det;
	return ans;
}

int main()
{
	int n;
	int i;
	double x[3];
	double y[3];
	double* point;
	double radius;
	double para[2][2];
	double val[2];
	scanf("%d",&n);
	for(i = 0;i < n;i++)
	{
		scanf("%lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2]);
		para[0][0] = 2*(x[0]-x[1]);
		para[0][1] = 2*(y[0]-y[1]);
		para[1][0] = 2*(x[0]-x[2]);
		para[1][1] = 2*(y[0]-y[2]);
		val[0] = x[0]*x[0]+y[0]*y[0]-x[1]*x[1]-y[1]*y[1];
		val[1] = x[0]*x[0]+y[0]*y[0]-x[2]*x[2]-y[2]*y[2];
		point = equation2(para,val);
		radius = sqrt((point[0]-x[0])*(point[0]-x[0])+(point[1]-y[0])*(point[1]-y[0]));
		printf("%.3f %.3f %.3f\n",point[0],point[1],radius);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
template<class T> struct rge { T b, e; };
template<class T> rge<T> range(T i, T j) { return rge<T>{i, j}; }
struct debug {
#ifdef LOCAL
	~debug(){cerr<<endl;}
	template<class T> debug& operator<<(T x){cerr<<boolalpha<<x; return *this;}
	template<class B, class C> debug& operator<<(pair<B, C> x){return *this<<"("<<x.first<<", "<<x.second<<")";}
	template<class T> debug& operator<<(rge<T> x){*this<<"[";for(auto it=x.b;it!=x.e;it++){*this<<", "+2*(it==x.b)<<*it;}return *this<<"]";}
	template<class T> debug& operator<<(vector<T> x){ return *this<<range(x.begin(),x.end());}
#else
	template<class T> debug& operator <<(const T&){return *this;}
#endif
};
#define nav(...) << "[ " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " ] "
using ll = long long;
const int MAXN = 200*1000+5;
const int inf = 1e9+5;
vector<int> g[MAXN];
int dp[MAXN], a[MAXN], ans[MAXN];

void dfs(int u, int p) {
    int x = a[u];
    int lo = 0, hi = MAXN;
    while(lo < hi) {
        int mid = lo + (hi - lo + 1)/2;
        if(dp[mid] < x) {
            lo = mid;
        }
        else {
            hi = mid - 1;
        }
    }
    int old = dp[lo+1];
    dp[lo+1] = min(dp[lo+1], x);
    int L = 0, R = MAXN;
    while(L < R) {
        int mid = L + (R - L + 1)/2;
        if(dp[mid] < inf) {
            L = mid;
        }
        else {
            R = mid - 1;
        }
    }
    ans[u] = L;
    for(int v : g[u]) {
        if(v != p) {
            dfs(v, u);
        }
    }
    
    dp[lo+1] = old;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    fill(dp, dp+MAXN, inf);
    dp[0] = 0;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }

    for(int i = 0; i < n-1; i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(0, -1);
    for(int i = 0; i < n; i++) {
        cout << ans[i] << '\n';
    }
}


Measured memory_bytes: 31260
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846;
typedef long long  ll;
int main()
{
string s,t;
cin>>s;
cin>>t;
int c=0;
for(int i=0;i<3;i++)
{
    if(s[i]==t[i])
        c++;
}
cout<<c;
return 0;
}


Measured memory_bytes: 256
fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input);
    let mut vec = Vec::with_capacity(2);
    vec = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<i32>>();
    let mut data = Vec::with_capacity(vec[1] as usize);
    input.clear();
    std::io::stdin().read_line(&mut input);
    data = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<i32>>();
    let mut sum = 0;
    let length = data.len() / 8;
    // let remainder = data.len() % 4;
    for i in 0..7 {
        for i in 0..length {
            sum += data.pop().unwrap();
        }
        if sum >= vec[0] {
            println!("Yes");
            return;
        }
    }
    while !data.is_empty() {
        sum += data.pop().unwrap();
    }
    if sum >= vec[0] {
        println!("Yes");
        return;
    }
    println!("No");
}

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

int main() {
  int n;
  cin >> n;
  int a, b, c, d;
  a = n / 1000;
  b = (n - 1000 * a) / 100;
  c = (n - 1000 * a - 100 * b) / 10;
  d = (n - 1000 * a - 100 * b - 10 * c);
  
  if ((a == b && b == c ) || ( b == c && c == d)) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3576
#
import sys
import math
import numpy as np
import itertools
# いくつか入力
n,x,y = (int(i) for i in input().split())  

a = [0]*(n-1)
x = x - 1
y = y - 1
for i in range(n-1):
    for j in range(i+1,n,1):
        d = min(j-i,abs(i-x)+1+abs(j-y))
        a[d-1]+= 1
#        print(i+1,j+1,d)

for i in range(n-1):
    print(a[i])


Measured memory_bytes: 14436
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define co(i) cout<<(i)<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
#define all(i) i.begin(),i.end()
#define pint pair<int, int>
#define vint vector<int>
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;
//const int MOD=998244353;

ll modpow(ll a,ll b,ll m){
    ll ret=1;
    while(b>0){
        if(b&1)(ret*=a)%=m;
        (a*=a)%=m;
        b>>=1;
    }
    return ret;
}
//kCrをもとめる
ll comb(ll k,ll r){
	ll ans=1;
	FOR(i,0,r){
		(ans*=(k-i))%=MOD;
		(ans*=modpow(i+1,MOD-2,MOD))%=MOD;
	}
	return ans;
}

int main(){
	int n,m; cin>>n>>m;
	int t=0,i=2;
	ll ans=1;
	while(m>1){
		if(m%i==0){
			t++;
			m/=i;
		}else{
			(ans*=comb(t+n-1,t))%=MOD;
			t=0;
			i++;
		}
	}
	if(t>0) (ans*=comb(t+n-1,t))%=MOD;
	co(ans);
}


Measured memory_bytes: 256
#include<stdio.h>

long int inv(long int x){
  long int j[30],y,k;
  j[0]=x%1000000007;
  for(k=1;k<=29;k++){
    j[k]=(j[k-1]*j[k-1])%1000000007;
  }
  y=(j[0]*j[2])%1000000007;
  y=(y*j[9])%1000000007;
  y=(y*j[11])%1000000007;
  y=(y*j[14])%1000000007;
  y=(y*j[15])%1000000007;
  y=(y*j[17])%1000000007;
  y=(y*j[19])%1000000007;
  y=(y*j[20])%1000000007;
  y=(y*j[23])%1000000007;
  y=(y*j[24])%1000000007;
  y=(y*j[25])%1000000007;
  y=(y*j[27])%1000000007;
  y=(y*j[28])%1000000007;
  y=(y*j[29])%1000000007;
  
  if(y<0){
    y=1000000007+y;
  }
  return y;
}

int main(void){
  long int n,k;
  scanf("%ld%ld",&n,&k);
  
  long int x,y,i;
  if(k==1){
    x=n*(n-1)%1000000007;
    printf("%ld",x);
    return 0;
  }
  if(k>=n){
    x=1;
    for(i=1;i<=n-1;i++){
      x=(((x*(2*n-i))%1000000007)*inv(i))%1000000007;
    }
    printf("%ld",x);
    return 0;
  }
  
  long int c[200001];
  x=1;
  c[0]=1;
  for(i=1;i<=k;i++){
    c[i]=(((c[i-1]*(n-i+1))%1000000007)*(n-i))%1000000007;
    c[i]=(((c[i]*inv(i))%1000000007)*inv(i))%1000000007;
    x=(x+c[i])%1000000007;
  }
  printf("%ld",x);
  
  return 0;
}

Measured memory_bytes: 1664
import java.io.*;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static class UnionFindTree{

private static int[] par;
private static int[] rank;

public UnionFindTree(int size){
par=new int[size];
rank=new int[size];
for(int i=0;i<size;i++){
par[i]=i;
rank[i]=0;
}
}

private static int find(int x){
if(par[x]==x) return x;
else return par[x]=find(par[x]);
}

public static void unite(int x,int y){
x=find(x);
y=find(y);
if(x==y) return;
else if(rank[x]>rank[y]) par[y]=x;
else{
par[x]=y;
if(rank[x]==rank[y]) rank[y]++;
}
}

public static boolean same(int x,int y){
return find(x)==find(y);
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
int num=Integer.parseInt(br.readLine().split(" ")[0]);
UnionFindTree tree=new UnionFindTree(num);
while((line=br.readLine())!=null&&!line.isEmpty()){
String[] values=line.split(" ");
int query=Integer.parseInt(values[0]);
int x=Integer.parseInt(values[1]);
int y=Integer.parseInt(values[2]);
if(query==0) tree.unite(x,y);
else out.println(tree.same(x,y)?"1":"0");
}
out.flush();
}
}

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

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

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

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

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

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

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

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


int main(){

    long long X;
    scanf("%lld",&X);

    ll A = 100;
    ll count = 0;

    while(X>A){
        A = A * 1.01;
        count++;
    }

    cout << count << endl;

    return 0;
}


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

long count(std::string str) {
  long res = 0;
  long temp = 0;
  for(int i = 0; i < (int)str.size(); ++i) {
    if( '0' <= str[i] and str[i] <= '9' ) {
      temp = temp * 10 + str[i] - '0';
    }
    if( str[i] == '|' ) {
      res += temp;
      temp = 0;
    }
  }
  res += temp;
  return res;
}  

long solve(std::string str, int i) {
  if( i == (int)str.size() ) {
    return count(str);
  }
  long res = 0;
  if( str[i] == '|' ) {
    res += solve(str, i + 1);
    str[i] = ' ';
    res += solve(str, i + 1);
    str[i] = '|';
  }
  else {
    return solve(str, i + 1);
  }
  return res;
}

std::string conv(std::string str) {
  std::string res;
  res += str[0];
  for(int i = 1; i < (int)str.size(); ++i) {
    res += '|';
    res += str[i];
  }
  return res;
}

int main() {
  std::string str;
  std::cin >> str;
  long res = solve(conv(str), 0);
  std::cout << res << std::endl;
  
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1e18 + 1;

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (auto& e : a) {
    cin >> e;
    e--;
  }

  ll i = 0;
  vector<ll> d(n, INF);
  d[0] = 0;
  while (k > 0) {
    if (d[a[i]] != INF && d[a[i]] <= d[i] && (d[i] + 1) - d[a[i]] < k) {
      k %= (d[i] + 1) - d[a[i]];
    } else {
      if (d[a[i]] == INF) d[a[i]] = d[i] + 1;
      i = a[i];
      k--;
    }
  }
  for (auto e : d) cerr << e << ' ';
  cerr << endl;
  cout << i + 1 << endl;
}


Measured memory_bytes: 7392
N = int(input())
A = list(map(int,input().split()))
a = list(range(1,N+1))
elements = sorted([i-j for (i,j) in zip(A,a)])
if(N%2 == 1):
    b = elements[N//2]
else:
    b = elements[(N//2)-1]
answer = sum([abs(i-j-b) for (i,j) in zip(A,a)])
print(answer)


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

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

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

bool comp(P a, P b){return a.second < b.second;}

void findAllOccurances(vector<size_t>& vec, string& data, string toSearch)
{
    size_t pos = data.find(toSearch);
    while( pos != string::npos)
    {
        vec.push_back(pos);
        pos = data.find(toSearch, pos + toSearch.size());
    }
}

int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
     int a, b; cin >> a >> b;

     int ans = 0;
     if(a > b){
         ans += a;
         --a;
     }
     else{
         ans += b;
         --b;
     }

    if(a > b){
        ans += a;
        --a;
    }
    else{
        ans += b;
        --b;
    }

    cout << ans << endl;

    return 0;
}



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

struct UnionFind{
  vector<int> d;
  UnionFind(int n=0) : d(n,-1) {}
  int find(int x){
    if( d.at(x) < 0 )  return x;
    return d.at(x) = find(d.at(x));
  }
  bool unite(int x,int y){
    x = find(x); y = find(y);
    if( x == y ) return false;
    if( -d.at(x) < -d.at(y) ) swap(x,y);
    d.at(x) += d.at(y);
    d.at(y) = x;
    return true;
  }
  bool same(int x,int y){ return find(x) == find(y); }
  int size(int x){ return -d.at( find(x) ); }
};

int main(){
  vector<int> deg(100005);
  vv to(100005,vector<int>(0));
  int n,m,k;
  cin >> n >> m >> k;
  UnionFind uf(n);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--; b--;
    deg.at(a)++;
    deg.at(b)++;
    uf.unite(a,b);
  }
  rep(i,k){
    int a,b;
    cin >> a >> b;
    a--; b--;
    to.at(a).push_back(b);
    to.at(b).push_back(a);
  }
  rep(i,n){
    int ans = uf.size(i) - 1 - deg.at(i);
    for(int u : to.at(i) ){
      if(uf.same(i,u) ) ans--;
    }
    printf("%d%c",ans, i==n-1?'\n' : ' ');
  }
}


Measured memory_bytes: 6784
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x)) 
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
int main() {
  ll a, b, c, d, e, ans=0;
  cin >> a >> b >> c >> d;
  e = a - 1;
    /* 自然数 a > b を確認・入替 */
  ll A = max(c,d);
  ll B = min(c,d);
  /* ユークリッドの互除法 */
  ll r = A % B;
  ll x = A * B;
  while(r!=0){
    A = B;
    B = r;
    r = A % B;
  }
  ll f = x/B;

  ans += b / c;
  ans += b / d;
  ans -= b / (f);
  ans -= e / c;
  ans -= e / d;
  ans += e / (f);
  ans = (b - a + 1) - ans;
  cout << ans << endl;
}



Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

S=sum(B)
for i in range(N-1):
  if A[i+1]==A[i]+1:
    S += C[A[i]-1]

print(S)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	long long X;
	cin >> X;

	long long count = 0;
	long long ans = 100;;
	for (;;) {
		ans = ans * 1.01;
		count++;
		if (ans >= X) {
			break;
		}
	}

	cout << count << endl;

	return 0;
}

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

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

    int N;
    cin >> N;
    int ans = 1;
    while (ans * 2 <= N) {
        ans *= 2;
    }
    cout << ans << endl;

    return 0;
}

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

int main(){
  int n, k;
  k = 1;
  cin >> n;
  vector<int> b(n);
  for(int i = 0; i < n; i++)
    cin >> b[i];
  sort(b.begin(),b.end());
  for(int i = 0; i < n - 1; i++){
    if(b[i] == b[i + 1])
      k = 0;
  }
  if(k != 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 1024
#ABC_085_B_Kagami_Mochi.py
N = int(input())
a = [int(input()) for i in range(N)]
num = [0]*101  # bucket
for i in range(N):
	num[a[i]] += 1

count = 0  # answer
for i in range(101):
	if num[i] > 0:
		count += 1
print(count)


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
char mp[353][353];

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%s",mp[i]);
  int ans = 0;
  REP(_,n){
    // check
    bool ok = true;
    REP(i,n)REP(j,n)if(mp[i][j] != mp[j][i]){
      ok = false; break;
    }
    if(ok)ans += n;
    // swap
    REP(i,n)FORR(j,0,n-1)swap(mp[i][j], mp[i][j+1]);
  }
  printf("%d\n",ans);
  return 0;
}


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

int main() {
  int N,L;
  cin >> N >> L;
  vector<string> S(N);
  rep(i,N) cin >> S[i];
  sort(S.begin(), S.end());
  for(int i=0; i<N; i++) {
    cout << S[i];
  }
}

Measured memory_bytes: 3632
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H,W;
        while(sc.hasNextLine()){
            String[] str = sc.nextLine().split(" ");
            H = Integer.parseInt(str[0]);
            W = Integer.parseInt(str[1]);
            if(H == 0 && W == 0) break;
            for(int y = 0; y < H; y++){
                for(int x = 0;x < W; x++){
                    if(y == 0 || y == H-1 ||
                       x == 0 || x == W-1) System.out.print("#");
                    else System.out.print(".");
                }
                System.out.println();
            }
            System.out.println();
        }
    }

}


Measured memory_bytes: 36824
#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define N 100005
#define inf 1e18
#define mem(a,b) memset(a,b,sizeof(a))

using namespace std;

ll binomialCoeff(ll n,ll k);
ll power(ll x,ll y);

ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
    int n;
    cin >> n;
    int arr[n][4];
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=3;j++)
            cin >> arr[i][j];
    }
    ll dp[N][4];
    mem(dp,-1);
    dp[1][1] = arr[1][1];dp[1][2] = arr[1][2];dp[1][3] = arr[1][3];
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=3;j++)
        {
            for(int k=1;k<=3;k++)
            {
                if(j==k)
                    continue;
                dp[i][j] = max( dp[i][j] , dp[i-1][k] + arr[i][j] );
            }
        }
    }
    cout << max( { dp[n][1] , dp[n][2] , dp[n][3] } );
}

ll binomialCoeff(ll n,ll k)
{
    ll res = 1;
    if(k >n - k)
        k = n - k;
    for(int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

ll power(ll x,ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return temp*temp;
    else
        return x*temp*temp;
}


Measured memory_bytes: 4992
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string>
#include <sstream>
#define ll long long
#define F first
#define S second
#define pb push_back
#define ld long double
#define pll pair<long long,long long>
#define pld pair<long double,long double>
#define ios     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll mod=1000000000;
ll INF=1e18;
ll gcd (ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll fastexp(ll x ,ll n)
{
    ll result =1;
    while(n>0)
    {
        if(n%2==1)
            result*=x;
        x*=x;
        n=n/2;
    }
    return result;
}

ll modularExp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x)%mod;
        x=((x%mod)*(x%mod))%mod;
        n=n/2;
    }
    return (result)%mod;
}
bool isPrime(ll n)
{
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
            return false;
    return true;
}
bool mycomp(pll &a,pll &b)
{
    if(a.F!=b.F)
        return a.F < b.F;
    else
        return a.S < b.S;
}
vector<ll> par(2005),sz(2005,1);

ll froot(ll x)
{
     if(x==par[x])
          return x;
     return par[x]=froot(par[x]);
}
void solve()
{
     string s;
     cin>>s;
     ll n=s.length();
     if(s[n-1]=='s')
          s+="es";
     else 
          s+="s";
          cout<<s;
     
}

int main()
{
    ios;
    ll t;
     // cin>>t;
     t=1;
     while(t--)
     {
          solve();
     }
}


Measured memory_bytes: 3688
// editorialを読んだ　天才
#include<iostream>
#include<set>
using namespace std;
typedef pair<int,int> pii;

int main(){
    int l;
    cin >> l;
    int dep = 1;
    while(1<<(dep+1) <= l)  dep++;
    set<pii> s[dep+1];
    for(int i = 1; i <= dep; i++)   s[i].insert({i+1, 0}), s[i].insert({i+1, 1<<(i-1)});
    int num = dep*2;
    for(int i = dep; i >= 1; i--){
        // 今表現出来ていないのは S = [2^dep, l)
        // iの左側で表現出来ているのは[0, 2^(i-1))
        // iの左側で表現出来ているものに1つ加える(i->dep+1に辺を張る)事によって
        // Sの一部を覆う事が出来るなら覆う　出来ないなら何もしない
        if(l - (1<<(i-1)) >= 1<<dep){
            s[i].insert({dep+1, l - (1<<(i-1))});
            num++;
            l -= 1<<(i-1);
        }
    }
    cout << dep+1 << " " << num << endl;
    for(int i = 1; i <= dep; i++){
        for(pii p : s[i])   cout << i << " " << p.first << " " << p.second << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b)
#define chmin(a, b) (a)=min(a, b)
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/

ll N, M;
vector<ll> g[MAX];
vector<ll> ps;
ll used[MAX];

void dfs(ll u) {
  used[u]=1;
  ps.push_back(u);
  
  for(auto v:g[u])
    if(!used[v]) {
      dfs(v);
      return;
    }
}


int main(void) {
  ll i, j, k;
  
  cin >> N >> M;
  
  for(i=0; i<M; i++) {
    ll a, b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  
  dfs(0);
  reverse(ps.begin(), ps.end());
  ps.pop_back();
  dfs(0);
  
  pt(ps.size());
  for(i=0; i<ps.size(); i++) pt(ps[i]+1);
  
}





Measured memory_bytes: 10868
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef struct d{ll n,r,l;}d;
const ll INF=100000000000000000;
d T[1000001];
int N,gp=1;

void pre(int n)
{
	if(n==-1)return;
	printf(" %d",T[n].n);
	if(T[n].l!=-1)pre(T[n].l);
	if(T[n].r!=-1)pre(T[n].r);
	return;
}

void ino(int n)
{
	if(n==-1)return;
	if(T[n].l!=-1)ino(T[n].l);
	printf(" %d",T[n].n);
	if(T[n].r!=-1)ino(T[n].r);
	return;
}

void ins(int p,int np=0)
{
	if(T[np].n==INF)T[np].n=p;
	else
	{
		if(T[np].n>p)
		{
			if(T[np].l==-1)
				T[np].l=gp++;
			ins(p,T[np].l);
		}
		else
		{
			if(T[np].r==-1)
				T[np].r=gp++;
			ins(p,T[np].r);
		}
	}
}

void p()
{
	ino(0);puts("");
	pre(0);puts("");
}

int main()
{
	for(int i=0;i<1000001;i++)
	{
		T[i].n=INF;
		T[i].r=T[i].l=-1;
	}
	scanf("%d\n",&N);
	for(int i=0;i<N;i++)
	{
		char s[20];
		int a;
		scanf("%s%d\n",s,&a);
		if(s[0]=='i')
			ins(a);
		else
			p();
	}
}

Measured memory_bytes: 24640
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main(){
    int N,X;
    cin >> N >> X;
    int m[110]={0};
    int minm=1000;
    int sum=0;
    for (int i=0;i<N;i++){
	cin >> m[i];
	minm=min(minm,m[i]);
	sum+=m[i];
    }

    cout << N+(X-sum)/minm << endl;

    return 0;
}

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

int main() {
  vector<int> V(9);
  for (int i = 0; i < 9; i++) cin >> V.at(i);
  int N, b;
  cin >> N;
  while (cin >> b) for (int i = 0; i < 9; i++) if (b == V.at(i)) V.at(i) = 0;

  string ans = "No";
  if (!(V.at(0) + V.at(3) + V.at(6))) ans = "Yes";
  if (!(V.at(1) + V.at(4) + V.at(7))) ans = "Yes";
  if (!(V.at(2) + V.at(5) + V.at(8))) ans = "Yes";
  if (!(V.at(0) + V.at(1) + V.at(2))) ans = "Yes";
  if (!(V.at(3) + V.at(4) + V.at(5))) ans = "Yes";
  if (!(V.at(6) + V.at(7) + V.at(8))) ans = "Yes";
  if (!(V.at(0) + V.at(4) + V.at(8))) ans = "Yes";
  if (!(V.at(2) + V.at(4) + V.at(6))) ans = "Yes";

  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>

int GCD(const int a, const int b)
{
    return (b == 0) ? a : GCD(b, a % b);
}

int main() 
{
    int a, b;
    scanf("%d %d", &a, &b);
    if (a >= b) {
        printf("%d\n", GCD(a, b));
    } else {
        printf("%d\n", GCD(b, a));
    }
}



Measured memory_bytes: 2756
#include <iostream>

int main() {
  // 入力
  int a, b;
  std::cin >> a >> b;

  // 処理
  int ans;
  if (b % a == 0) {
    ans = b + a;
  } else {
    ans = b - a;
  }

  // 出力
  std::cout << ans << std::endl;

  return 0;
}


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

int main() {
    int n,t;
    cin >> n >> t;
    int ans = 10000;
    for(int i=0; i<n; i++){
        int c,time;
        cin >> c >> time;
        if(time > t){
            continue;
        }
        ans = min(ans,c);
    }
    if(ans == 10000) cout << "TLE" << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    static String S;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        S = sc.next();

        System.out.println(solve());
    }

    static String solve() {
        String sub = S.substring(2, S.length()-1);
        int cnt = 0;
        for (int i = 0; i < sub.length(); i++) {
            if( sub.charAt(i) == 'C' ) {
                cnt++;
            }
        }
        int cnt2 = 0;
        for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);
            if( 'A' <= c && c <= 'Z' ) cnt2++;
        }
        if( S.startsWith("A") && cnt == 1 && cnt2 == 2 ) {
            return "AC";
        } else {
            return "WA";
        }
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

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

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

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

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

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

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

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


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

#define MEMO_MAX 100
typedef unsigned long long ULL;

bool Flag_memo_g = true;	//?????¢??????????????????

class Answer
{
public:
	Answer()
	{
		day = 10; year = 365;
		for(int i = 0; i < MEMO_MAX; i++)
		{
			memo[i] = 0;
			Flag_memo[i] = false;
		}
	}
	
	int N;	//??\???
	int day;
	int year;

	ULL memo[MEMO_MAX];
	bool Flag_memo[MEMO_MAX];
	
	ULL count(int cnt);	//??¨??¢?´¢(??±???)
	ULL count_memo(int cnt);	//??¨??¢?´¢(??±???)(?????¢???ver.)
	void set();	//??\???
	void OutPut();	//???????????????
	
	bool empty();	//???????????¶?????????
	bool ans();	//?§£???
};

ULL Answer::count(int cnt)
{
	if( cnt < 0 )
		return 0;
	
	else if( cnt == 0 )
		return 1;
	
	return count(cnt - 1) + count(cnt - 2) + count(cnt - 3);
}


ULL Answer::count_memo(int cnt)
{
	if( cnt < 0 )return 0;
	else if( cnt == 0 )return 1;
	
	if( !(Flag_memo[cnt]) )
	{
		memo[cnt] = count_memo(cnt - 1) + count_memo(cnt - 2) + count_memo(cnt - 3);
		Flag_memo[cnt] = true;
	}
	
	return memo[cnt];
}

void Answer::OutPut()
{
	if( N == 0 )
		return;
	int ans_ = 1;	//??????????????´???
	if( Flag_memo_g )
		ans_ += count_memo( N ) / (day * year);
	
	else if( !Flag_memo_g )
		ans_ += (count( N )) / (day * year);	//??\???
	
	cout << ans_ << endl;
}

void Answer::set()
{
	cin >> N;
}

bool Answer::empty()
{
	if( N == 0 )return false;
	else return true;
}

bool Answer::ans()
{
	set();
	OutPut();
	return empty();
}

int main()
{
	Answer ans;

	while( ans.ans() );
	return 0;
}

Measured memory_bytes: 1160
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    x = int(input())
    if 360 % x == 0:
        res = 360 // x
        print(res)
    else:
        q, r = divmod(360, x)
        print((360 // r) * q)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9172
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;
typedef pair<int, int> P;

double dp[3010][3010], p[3010];
int main()
{
	int N; cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> p[i];
	}
	dp[0][0] = 1.0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= N; j++) {
			if (j > 0) {
				dp[i + 1][j] = dp[i][j - 1] * p[i] + dp[i][j] * (1 - p[i]);
			}
			else {
				dp[i + 1][j] = dp[i][j] * (1 - p[i]);
			}
			//cout << dp[i + 1][j] << " ";
		}
		//cout << endl;
	}
	double ans = 0.0;
	for (int i = N; i > N / 2; i--) {
		ans += dp[N][i];
	}
	printf("%.10f\n", ans);
}


Measured memory_bytes: 70784