akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;
#define ll long long
ll p = 998244353;


int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin>>n;
    int i = 1;
    while (i<1000&&i*(i-1)!=2*n) i++;
    if (i>=1000) {cout<<"No"; return 0;}
    vector<vector<int>> a;
    for (int j = 0; j<i; j++)
    {
        vector<int> temp; 
        a.push_back(temp);
    }
    
    int idx = 1;
    for (int x = 0; x<i; x++)
    for (int y = x+1; y<i; y++)
    {
        a[x].push_back(idx);
        a[y].push_back(idx);
        idx++;
    }
    cout<<"Yes"<<endl;
    cout<<i<<endl;
    for (int j = 0; j<i; j++)
    {
        cout<<a[j].size()<<' ';
        for (int k = 0; k<a[j].size(); k++) cout<<a[j][k]<<' ';
        cout<<endl;
    }
}

Measured memory_bytes: 2304
def solve():
    K, N = list(map(int, input().split()))
    A = list(map(int, input().split()))
    A.sort()

    max_dist = 0
    for i in range(1, N):
        dist_tmp = A[i] - A[i-1]
        if(dist_tmp > max_dist):
            max_dist = dist_tmp
    dist_over_zero = K - (A[N-1] - A[0])
    if(dist_over_zero > max_dist):
        ans = K - dist_over_zero
    else:
        ans = K - max_dist
    print(ans)


if __name__ == "__main__":
    solve()

Measured memory_bytes: 100600
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef complex<ld> Point;
const ll mod = 1000000007;
const ld INF = 1e+30;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

vector<ld> p;
struct graph {
private:
	int n;
	vector<vector<int>> G, rG;
	vector<bool> used;
	vector<int> vs;

	int mk;
	vector<vector<int>> fG;
	vector<vector<int>> ori;
	vector<int> trans;
public:
	graph(int sz) {
		n = sz;
		G.resize(n);
		rG.resize(n);
		used.resize(n);

		fG.resize(n);
		trans.resize(n,-1);
		ori.resize(n);
	}
	void add_edge(int a, int b) {
		G[a].push_back(b);
		rG[b].push_back(a);
	}
	void dfs(int v) {
		used[v] = true;
		rep(i, G[v].size()) {
			if (!used[G[v][i]])dfs(G[v][i]);
		}
		vs.push_back(v);
	}
	void rdfs(int v,int k) {
		used[v] = true;
		queue<int> q; q.push(v);
		vector<int> c;
		while (!q.empty()) {
			int id = q.front(); q.pop();
			ori[k].push_back(id);
			rep(j, rG[id].size()) {
				int to = rG[id][j];
				if (used[to]) {
					if (trans[to] >= 0)c.push_back(trans[to]);
					continue;
				}
				used[to] = true; q.push(to);
			}
		}
		sort(c.begin(), c.end());
		int len = unique(c.begin(), c.end()) - c.begin();
		rep(i, len) {
			fG[c[i]].push_back(k);
		}
		rep(i, ori[k].size()) {
			trans[ori[k][i]] = k;
		}
	}
	void scc() {
		fill(used.begin(), used.end(), false);
		rep(i, n) {
			if (!used[i])dfs(i);
		}
		fill(used.begin(), used.end(), false);
		int k = 0;
		per(i, (int)vs.size()) {
			if (!used[vs[i]]) {
				rdfs(vs[i], k); k++;
			}
		}
		mk = k;
	}
	ld query() {
		scc();
		vector<int> num(mk,0);
		rep(i, mk) {
			rep(j, fG[i].size()) {
				num[fG[i][j]]++;
			}
		}
		ld ret = 1;
		rep(i, mk) {
			if (num[i])continue;
			ld pro = 1;
			rep(j, ori[i].size()) {
				int id = ori[i][j];
				pro *= p[id];
			}
			pro = 1 - pro;
			ret *= pro;
		}
		return ret;
	}
};
void solve() {
	cout << fixed << setprecision(6);
	int n;
	while (cin >> n, n) {
		graph g(n);
		p.clear(); p.resize(n);
		rep(i, n) {
			cin >> p[i];
			int m; cin >> m;
			rep(j, m) {
				int a; cin >> a; a--;
				g.add_edge(i, a);
			}
		}
		ld ans = g.query();
		cout << ans << endl;
	}
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 3412
N = int(input())
A = list(map(int,input().split()))
B = []
for i in range(N):
    a = A[i]
    B.append([i+1,a])
B = sorted(B, key = lambda a: a[1])
ans = []
for i in range(N):
    b = B[i][0]
    ans.append(b)
print(*ans)

Measured memory_bytes: 74988
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007


signed main(){
    int N;
    cin>>N;
    string S;
    cin>>S;

    int ans=0;
    for(int i=0;i<=999;i++){
        int a=i/100%10;
        int b=i/10%10;
        int c=i/1%10;
        for(int j=0;j<S.size();j++){
            if(a!=-1){
                if(S[j]-'0'==a) a=-1;
            }
            else if(b!=-1){
                if(S[j]-'0'==b) b=-1;
            }
            else if(c!=-1){
                if(S[j]-'0'==c) c=-1;
            }
        }
        if(c==-1) ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3232
#include <iostream>
#include <algorithm>
using namespace std;
#define int long long

signed main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ans = 0;
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i]) {
      count += a[i];
    } else {
      ans += count / 2;
      count = 0;
    }
  }
  ans += count / 2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

const int MAX_N = 505;

char purple [MAX_N][MAX_N];
char red [MAX_N][MAX_N];
char blue [MAX_N][MAX_N];

int main () {
  int h, w;
  cin >> h >> w;

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> purple[i][j];
    }
  }

  for (int j = 0; j < w; j++) {
    red[0][j] = '#';
    blue[0][j] = '.';
  }
  
  for (int i = 1; i < h - 1; i++) {
    for (int j = 0; j < w; j++) {
      if (j % 2 == 0) {
        red[i][j] = '#';
        blue[i][j] = '.';
      } else {
        red[i][j] = '.';
        blue[i][j] = '#';
      }
    }
  }

  for (int j = 0; j < w; j++) {
    red[h - 1][j] = '.';
    blue[h - 1][j] = '#';
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (purple[i][j] == '#') {
        red[i][j] = '#';
        blue[i][j] = '#';
      }
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cout << red[i][j];
    }
    cout << '\n';
  }
  cout << '\n';
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cout << blue[i][j];
    }
    cout << '\n';
  }
  cout << '\n';
}


Measured memory_bytes: 4384
#include <bits/stdc++.h>
 size_t strlen(const char *s);
#define rep(i,n) for(long long int i=0;i<n;i++)
#define sz(x) ((int)(x).size())

using namespace std;
std::vector<int> graph[10050];//graph頂点数のsize
const int N=200010;
//const ll P=1000000007;
const long long P=998244353;
using ll = long long;
vector<ll> prime;

//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
//小さい方
long long int min(long long int a,long long int b){
	if(a>b){
		return b;
	}else{
		return a;
	}
}
//大きい方
long long int max(long long int a,long long int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ

/*
	memset(b, '\0', sizeof(b));
初期化*/


/*
	string s;
	s.size()
*/

/*
	char s[N];
	strlen(s)
*/
/*
	if(  <  )puts("Yes");
	else puts("No");
*/

/*文字列比較
if(strcmp(name[i],s)==0)
*/

/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/


int main(){
  ll n;
  long double s; 
  cin>>n>>s;
  ll ss=(s+0.005)*100;
  ll ans=ss*n/100;
  cout<<ans<<endl;
          
}



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

int main (){
    string S ;
    cin >> S ;
    int N = S.size() ;
    if(N == 1){
        cout << 0 << endl;
        return 0 ;
    }
    int count = 0 ;
        rep(i,N/2){
            if(S.at(i) != S.at(N-1-i) ) count ++;
        }
        cout << count <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    ll ans = 0;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            if(i * j >= n) break;
            if(i * j < n) ans++;
        }
    }
    cout << ans << endl;    
}


Measured memory_bytes: 3632
n = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(n):
    for j in reversed(range(i, n - 1)):
        if A[j + 1] < A[j]:
            A[j + 1], A[j] = A[j], A[j + 1]
            count += 1
print(*A)
print(count)



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


int main() {
    string S;
    cin >> S;
    int x=S.size();
    string A="";
    for(int i=0;i<x;i++){
        char IP =S.at(i);
        if(IP=='0'){
            A = A+"0";
        }
        else if(IP=='1'){
            A+="1";
        }
        else if(IP=='B' && A!=""){
            A.pop_back();
        }
    }
    cout << A << endl;
}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        long z = in.nl(), w = in.nl();
        long[][] dp = new long[n+1][n+1];
        long[] a = in.nl(n);
        dp[n][0] = Math.abs(a[n-1]-w);
        dp[0][n] = Math.abs(a[n-1]-z);
        for (int i = 1; i <= n; i++) {
            dp[n][i] = Math.abs(a[n-1]-a[i-1]);
            dp[i][n] = Math.abs(a[n-1]-a[i-1]);
        }
        for (int i = n-1; i > 0; i--) {
            //y
            dp[i][i-1] = dp[i][n];
            for (int j = n-1; j > i; j--) {
                dp[i][i-1] = Math.min(dp[i][i-1], dp[i][j]);
            }
            for (int j = i-2; j >= 0; j--) {
                dp[i][j] = dp[i][i-1];
            }
            //x
            dp[i-1][i] = dp[n][i];
            for (int j = n-1; j > i; j--) {
                dp[i-1][i] = Math.max(dp[i-1][i], dp[j][i]);
            }
            for (int j = i-2; j >= 0; j--) {
                dp[j][i] = dp[i-1][i];
            }
        }
        for (int i = 1; i <= n; i++) {
            dp[0][0] = Math.max(dp[0][0], dp[i][0]);
        }
        out.println(dp[0][0]);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 81204
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
#include<iomanip>
using namespace std;

int N, X;

int main() {
    cin >> X;
    int left = (X + 104) / 105, right = X / 100;
    cout << (left > right? 0 : 1) << endl;
}


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

using namespace std;

typedef long long ll;
ll a[100005];

int main(){
    ll n,x,ans,memo;
    

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

    ans = 0;
    for (int i=0; i<n; i++){
        if (a[i]+a[i+1] > x){
            memo = a[i]+a[i+1]-x;
            a[i+1] -= memo;
            ans += memo;
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 1024
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN = 5000;
typedef struct R { int lim, cnt; } R;
bool operator<(const R &a, const R &b) { return a.lim + a.cnt < b.lim + b.cnt; }

int n;
R r[MAXN];

int dp[MAXN + 1];

void run() {
	scanf("%d", &n); REP(i, n) scanf("%d%d", &r[i].lim, &r[i].cnt);

	sort(r, r + n);
	dp[0] = 0; FORE(i, 1, n) dp[i] = INT_MAX;
	REP(i, n) {
		for (int j = i; j >= 0; --j) if (dp[j] <= r[i].lim) dp[j + 1] = min(dp[j + 1], dp[j] + r[i].cnt);
	}
	int ret = 0; FORE(i, 1, n) if (dp[i] != INT_MAX) ret = max(ret, i); printf("%d\n", ret);
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;int main(){size_t n,a,b;cin>>n>>a>>b;size_t ave=(a+b)/2;if(ave * 2 == a + b)cout <<  ave - a << endl;else cout<<min(a-1,n-b)+1+(b-a-1)/2<<endl;}

Measured memory_bytes: 3636
#include<iostream>
#include<math.h>
#include<iomanip>
#include<string>
#include<fstream>
using namespace std;

int main(){
  //ifstream in("input.txt");
  //cin.rdbuf(in.rdbuf());
  int n,m,x,y,num;
  int di=0;
  string order;
  while(1){
    cin>>n>>m;
    x=1;y=1;di=0;
    if(n==0 && m==0)break;
    while(1){
      cin>>order;
      if(order=="FORWARD"){
	cin>>num;
	if(di==0){
	  y=min(y+num,m);
	}else if(di==1){
	  x=min(x+num,n);
	}else if(di==2){
	  y=max(y-num,1);
	}else if(di==3){
	  x=max(x-num,1);
	}
      
      }else if(order=="BACKWARD"){
	cin>>num;
	if(di==2){
	  y=min(y+num,m);
	}else if(di==3){
	  x=min(x+num,n);
	}else if(di==0){
	  y=max(y-num,1);
	}else if(di==1){
	  x=max(x-num,1);
	}
      }else if(order=="RIGHT"){
	di=(di+5)%4;
      }else if(order=="LEFT"){
	di=(di+3)%4;
      }else if(order=="STOP"){
	cout << x <<" "<<y<<endl;
	break;
      }else{
	cout << "ERROR "<<order<<endl;
	return 0;
      }
    }
  }
}

Measured memory_bytes: 2996
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(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 INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

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

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}
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;
}

signed main() {
    INIT;
    cin >> N >> A >> B;
    vi a(N), b(N), c(N);
    REP(i, N)
    cin >> a[i] >> b[i] >> c[i];
    auto dp = make_vec<int>(41, 501, 501);
    dp[0][0][0] = 0;
    REP(i, N) {
        REP(j, 401)
        REP(k, 401) {
            if (dp[i][j][k] == INF)
                continue;
            chmin(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
            chmin(dp[i + 1][j][k], dp[i][j][k]);
        }
    }
    ans = INF;
    REP(j, 401)
    REP(k, 401) {
        if (j == 0 || k == 0)
            continue;
        int tmp = j / A;
        if (A * tmp == j && B * tmp == k) {
            chmin(ans, (ll)dp[N][j][k]);
        }
    }
    if (ans == INF)
        ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 45148
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut tasks = vec![];
    for i in 0..n {
        let v = read_vec::<i64>();
        let (x, l) = (v[0], v[1]);
        tasks.push((x + l, x - l));
    }
    tasks.sort();
    // debug!(tasks);
    let mut cur = -std::i64::MAX;
    let mut ans = 0;
    for (end, start) in tasks {
        if cur <= start {
            cur = end;
            ans += 1;
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    bool f[1010] = {};
    f[1] = true;
    rep(i, 2, n + 1){
        int now = i;
        while(now <= n){
            now *= i;
            if(now <= n){
                f[now] = true;
            }
        }
    }
    int ans = 1;
    repb(i, n, 1){
        if(f[i]){
            ans = i; 
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
long long L[210000];
long long R[210000];
long long p[210000];
int lp[210000];
int rp[210000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%lld",p+i);
	for(int i=0;i<a-1;i++){
		long long tmp=p[i+1];
		while(tmp<p[i]){
			rp[i]++;
			tmp*=4;
		}
		while(p[i]*4<=tmp){
			tmp/=4;
			rp[i]--;
		}
		tmp=p[i];
		while(tmp<p[i+1]){
			lp[i]++;
			tmp*=4;
		}
		while(p[i+1]*4<=tmp){
			lp[i]--;
			tmp/=4;
		}
	}
	for(int i=0;i<a-1;i++){
	//	printf("%d %d\n",lp[i],rp[i]);
	}
	stack<pair<int,int> >S;
	long long cur=0;
	S.push(make_pair(mod,a-1));
	for(int i=a-2;i>=0;i--){
		if(rp[i]>0){
			int req=rp[i];
			while(req>0){
				pair<int,int>tmp=S.top();
				S.pop();
				int C=min(tmp.first,req);
				cur+=min(tmp.first,req)*(tmp.second-i);

				req-=min(tmp.first,req);
				tmp.first-=C;
				if(tmp.first){
					S.push(tmp);
				}
			}
		}else if(rp[i]<0){
			S.push(make_pair(-rp[i],i));
		}
		R[i]=cur;
	}

	while(S.size())S.pop();
	cur=0;
	S.push(make_pair(mod,0));
	for(int i=1;i<a;i++){
		if(lp[i-1]>0){
			int req=lp[i-1];
			while(req>0){
				pair<int,int>tmp=S.top();
				S.pop();
		//		printf(" %d %d\n",tmp.first,tmp.second);
				int C=min(tmp.first,req);
				cur+=min(tmp.first,req)*(i-tmp.second);
				req-=min(tmp.first,req);

				tmp.first-=C;
				if(tmp.first){
					S.push(tmp);
				}
			}
		}else if(lp[i-1]<0){
			S.push(make_pair(-lp[i-1],i));
		}
		L[i]=cur;
	}

	//for(int i=0;i<a;i++)printf("%lld %lld\n",L[i],R[i]);
	long long ret=inf;
	for(int i=0;i<=a;i++){
		long long tmp=0;
		if(i)tmp+=L[i-1]*2+i;
		if(i<a)tmp+=R[i]*2;
		ret=min(ret,tmp);
	}printf("%lld\n",ret);
}



Measured memory_bytes: 6656
n = int(input())
ls = [[] for _ in range(n)]
di = []
for p in range(n):
    a = int(input())
    ls[p] = [list(map(int,input().split())) for _ in range(a)]
for i in range(2**n):
    new = []
    for j in range(n):
        if (i>>j)&1:
            new.append(j)
    di.append(new)
flag = True
mx = 0
for l in di:
    flag = True
    for k in l:
        for s in ls[k]:
            a,b = s[0],s[1]
            if ((a-1 not in l)and (b == 1)) or ((a-1 in l) and (b == 0)):
                flag = False
                break
        if flag == False:
            break
    if flag == True:
        if len(l) > mx:
            mx = len(l)     
print(mx) 

Measured memory_bytes: 13856
import java.util.BitSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	Scanner sc;

	Main() {
		sc = new Scanner(System.in);
	}

	class st implements Comparable<st> {
		int cost;
		int pos;
		int omit;

		st(int cost, int pos, int omit) {
			this.cost = cost;
			this.pos = pos;
			this.omit = omit;
		}

		public int compareTo(st tar) {
			if(cost == tar.cost){
				return omit-tar.omit;
			}
			return cost - tar.cost;
		}
	}

	@SuppressWarnings("unchecked")
	void run() {
		for (;;) {
			int n = sc.nextInt();

			if (n == 0) {
				break;
			}
			n++;
			int s = sc.nextInt();
			int t = sc.nextInt();
			int m = sc.nextInt();

			LinkedList<Integer>[] dir = new LinkedList[n];
			LinkedList<Integer>[] rev = new LinkedList[n];
			for (int i = 0; i < n; i++) {
				dir[i] = new LinkedList<Integer>();
				rev[i] = new LinkedList<Integer>();
			}

			for (int i = 0; i < m; i++) {
				int a = sc.nextInt();
				int b = sc.nextInt();
				dir[a].add(b);
				rev[b].add(a + (i + 1) * n);
			}

			BitSet u = new BitSet(n * (m + 1));
			PriorityQueue<st> q = new PriorityQueue<st>();
			q.add(new st(0, s, 0));
			for (;;) {
				if (q.isEmpty()) {
					throw new OutOfMemoryError();
				}

				st now = q.poll();
				int v = now.pos + now.omit * n;
				if (u.get(v)) {
					continue;
				}
				if (now.pos == t) {
					System.out.println(now.cost + " " + now.omit);
					break;
				}
				u.set(v);

				for (int next : dir[now.pos]) {
					if (!u.get(next + now.omit * n)) {
						q.add(new st(now.cost + 1, next, now.omit));
					}
				}
				if (now.omit == 0) {
					for (int next : rev[now.pos]) {
						int a = next % n;
						int b = next / n;
						if (!u.get(a + b * n)) {
							q.add(new st(now.cost + 1, a, b));
						}
					}
				}
			}

		}
	}

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

}

Measured memory_bytes: 0
n=int(input())
s=[]
for i in range(n):
    s.append(input())

m=int(input())
t=[]
for i in range(m):
    t.append(input())

w=list(set(s))
a=[0]
for i in range(len(w)):
    a.append(s.count(w[i])-t.count(w[i]))

print(max(a))


Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

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; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int a, b, k;
  cin >> a >> b >> k;
  RF0(i, 101) {
    if (a % i == 0 && b % i == 0) {
      if (!--k) {
        cout << i;
        return 0;
      }
    }
  }
}
#endif


Measured memory_bytes: 3644
#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int sum = 0;
    int num;
    char o;
    while(cin >> sum){
        while(cin >> o, o != '='){
            cin >> num;
            if(o == '+')
                sum+=num;
            else if(o == '-')
                sum-=num;
            else if(o == '*')
                sum*=num;
            else if(o == '/')
                sum/=num;
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 1160
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    intmax_t H, N, A[(int)1e5];

    scanf("%jd%jd", &H, &N);
    for (size_t i = 0; i < N; i++) {
        scanf("%jd", &A[i]);
    }

    intmax_t sum = 0;
    for (size_t i = 0; i < N; i++) {
        sum += A[i];
    }

    if (sum >= H) {
        puts("Yes");
    } else {
        puts("No");
    }

    return 0;
}


Measured memory_bytes: 896
#include<iostream>
using namespace std;
int main()
{
	int n, m; cin >> n >> m; char a[108][106];
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			cin >> a[i][j];
		}
	}
	for (int i = 0; i <= m+1; ++i)
	{
		cout << '#';
	}
	cout << endl;
	for (int i = 0; i < n; ++i)
	{
		cout << '#';
		for (int j = 0; j < m; ++j)
		{
			cout << a[i][j];
		}
		cout << "#"<<endl;
	}
	for (int i = 0; i <= m+1; ++i)
	{
		cout << '#';
	}
}

Measured memory_bytes: 3112
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flag = true;
		for(int i = 0; i < n; i++){
			int x = sc.nextInt();
			if(x % 2 == 0){
				if(x % 3 != 0 && x % 5 != 0){
					flag = false;
				}
			}
		}
		System.out.println(flag ? "APPROVED" : "DENIED");
	}
}


Measured memory_bytes: 23252
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<string>
using namespace std;

char a[10];
int main()
{
	scanf("%s",a);
	bool flag = false;
	if((a[0] == a[1] && a[1] == a[2] )|| (a[1] == a[2] && a[2] == a[3]))
		puts("Yes\n");
	else	puts("No\n");
	return 0;
}

Measured memory_bytes: 256
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	vector<int> a(n+2);
	for (int i = 1; i < n+1; i++)cin >> a[i];
	a[0] = a[n + 1] = 0;
	int ans = 0;
	rep(i,n+1){
		ans += abs(a[i] - a[i + 1]);
	}
	for (int i = 1; i < n + 1; i++) {
		cout << ans - (abs(a[i + 1] - a[i]) + abs(a[i] - a[i - 1])) + abs(a[i + 1] - a[i - 1]);
		if (i < n) cout << " ";
		else cout << endl;
	}
}

Measured memory_bytes: 2048
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

typedef pair<int, int> P;

int h, w;
string field[51];

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

char bfs(int y, int x){
  if(field[y][x] != '.') return '.';
  queue<P> que;
  set<P> check;
  que.push(P(y, x));
  bool isW, isB;
  isW = isB = false;
  while(!que.empty()){
    if(isW && isB) return '.';
    P pos = que.front();
    que.pop();
    if(check.find(pos) != check.end()) continue;
    check.insert(pos);
    for(int i = 0 ; i < 4 ; i++){
      if(pos.first+dy[i] < 0 || pos.first+dy[i] >= h) continue;
      if(pos.second+dx[i] < 0 || pos.second+dx[i] >= w) continue;
      
      if(field[pos.first+dy[i]][pos.second+dx[i]] == 'W'){
	isW = true;
	continue;
      }
      else if(field[pos.first+dy[i]][pos.second+dx[i]] == 'B'){
	isB = true;
	continue;
      }
      else{
	que.push(P(pos.first+dy[i], pos.second+dx[i]));
      }
    }
  }
  
  if(isW && !isB) return 'W';
  else if(!isW && isB) return 'B';
  else return '.';
}

int main(){
  while(cin >> w >> h){
    if(h == 0 && w == 0) break;
    for(int i = 0 ; i < h ; i++){
      cin >> field[i];
    }
    
    int W, B;
    W = B = 0;

    for(int i = 0 ; i < h ; i++){
      for(int j = 0 ; j < w ; j++){
	char c = bfs(i, j);
	if(c == 'W') W++;
	else if(c == 'B') B++;
      }
    }
    cout << B << ' ' << W << endl;
  }
  return 0;
}

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

void dfs(int node, vector<int> adj[], int dp[], bool vis[]) 
{ 
	vis[node] = true; 

	for (int i = 0; i < adj[node].size(); i++) 
    {
		if (!vis[adj[node][i]]) 
			dfs(adj[node][i], adj, dp, vis); 

		dp[node] = max(dp[node], 1 + dp[adj[node][i]]); 
	} 
} 

void addEdge(vector<int> adj[], int u, int v) 
{ 
	adj[u].push_back(v); 
} 

int findLongestPath(vector<int> adj[], int n) 
{ 
	int dp[n + 1]; 
	memset(dp, 0, sizeof dp); 

	bool vis[n + 1]; 
	memset(vis, false, sizeof vis); 

	for (int i = 1; i <= n; i++) 
    { 
		if (!vis[i]) 
			dfs(i, adj, dp, vis); 
	} 

	int ans = 0; 

	for (int i = 1; i <= n; i++) { 
		ans = max(ans, dp[i]); 
	} 
	return ans; 
} 

int main() 
{ 
	int n,m;
    cin>>n>>m; 
	
    vector<int> adj[n + 1]; 

	for(int i=0; i<m; i++)
    {
        int u,v;
        cin>>u>>v;

        addEdge(adj,u,v);
    }

	cout << findLongestPath(adj, n); 
    
	return 0; 
} 


Measured memory_bytes: 12864
#include <stdio.h>

int main(){
	int a,b,c,d,e,f,g,h,rea,reb;
	
	scanf("%d %d %d %d",&a,&b,&c,&d);
	scanf("%d %d %d %d",&e,&f,&g,&h);
	rea = a + b + c + d;
	reb = e + f + g + h;
	if(rea > reb) printf("%d\n",rea);
	else printf("%d\n", reb);
	
	return 0;
}


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

int main()
{
    int n,m,X,Y;
    cin>> n>>m>>X>>Y;
    vector<int>x(n);
    vector<int>y(m);
    int xmax=X,ymin=Y;
    for(int i=0;i<n;++i){
        cin >> x[i];
        xmax=max(x[i],xmax);
    }
    for (int i=0;i<m;++i){
        cin>> y[i];
        ymin=min(ymin,y[i]);
    }
    if(xmax<ymin){
        cout << "No War"<< endl;
    }
    else cout << "War"<< endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>

using namespace std;
using Int = long long;

constexpr double EPS = 1e-10;
constexpr long long MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    double L; cin >> L;
    printf("%.12f\n", L/3 * (L/3) * (L/3));
}

Measured memory_bytes: 1016
from sys import stdin
def main():
    n = int(stdin.readline())
    e = [[] for _ in xrange(n)]
    for line in stdin:
        x, y = map(int, line.split())
        x -= 1
        y -= 1
        e[x].append(y)
        e[y].append(x)
    d = [None] * n
    st = []
    pu = st.append
    po = st.pop
    pu(0)
    d[0] = 0
    while st:
        x = po()
        for y in e[x]:
            if d[y] is None:
                d[y] = d[x] + 1
                pu(y)
    y = -1
    for i, x in enumerate(d):
        if y < x:
            y = x
            j = i
    d = [None] * n
    pu(j)
    d[j] = 0
    while st:
        x = po()
        for y in e[x]:
            if d[y] is None:
                d[y] = d[x] + 1
                pu(y)
    x = max(d)
    print 'Second' if x % 3 == 1 else 'First'
main()


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

using ll = long long;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define pb push_back
#define mp make_pair
#define fill(x, y) memset(x, y, sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int) (lower_bound(s, t, x) - s)
#define UB(s, t, x) (int) (upper_bound(s, t, x) - s)

ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1) ans = 1ll * ans * a % mo; a = 1ll * a * a % mo; } while (b >>= 1); return ans; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx8[] = { 1, -1, 0, 0, 1, 1, -1, -1 }, dy8[] = { 0, 0, -1, 1, -1, 1, -1, 1 };

template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) { return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...)); }
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }
// auto dp = make_v<int>(4, h, w);
// fill_v(dp, 0);

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

template <class T>
bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T>
bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

inline tuple<ll, ll> rotate45(tuple<ll, ll> point) { ll x = get<0>(point), y = get<1>(point); return tuple<ll, ll>(x + y, x - y); }
inline bool rangeCheck2D(int nx, int ny, int Width, int Height) { return nx >= 0 and nx < Width and ny >= 0 and ny < Height; }
void out_sequence(vector<ll> &out) { REP(i, out.size()) { cout << out[i]; if (i == out.size() - 1) cout << endl; else cout << " "; } }



int main(void)
{
	cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20);

	ll N; cin >> N;
	vector<ll> a(N); REP(i, N) cin >> a[i];
	REP(i, N) {
		a[i] -= (i+1);
	}
	sort(all(a));
	ll n = a.size() / 2;
	ll v = (even(a.size()) ? (a[n] + a[n - 1]) / 2 : a[n]);
	ll ans = 0;
	REP(i, N) {
		ans += abs(a[i] - v);
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
    int n, k;
    int i, count;

    scanf("%d %d", &n, &k);

    int a[n];

    for (i=0; i<n; i++)
    {
        scanf("%d", &a[i]);
    }

    count = (n-2)/(k-1)+1;

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

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using std::cout;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  int n;
  cin>> n ;
  string s[n];
  int p[n];
  int ans1[1111];
  
  for(int i=0;i<n;i++){
    cin>> s[i]>>p[i];
  }
  int a =0;
  for(int i=0 ;i<n;i++){
    for(int j=0; j<n ;j++){
      if(j==i){
        continue;
      }
      else{
        if(s[i] >s[j]){
          a++;
        }
        else if(s[i] ==s[j]){
          if(p[i]<p[j]){
            a++;
          }
        }
      }
    }
    ans1[a]=i+1;
    
    a=0;
  }
  for(int i=0;i<n;i++){
    cout <<ans1[i]<<endl;
  }
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <random>
#include <bitset>
#include <time.h>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
//#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define sp system("pause")
#define queuel queue<long long>
#define all(x) (x).begin(),(x).end()
#define matrix vector<vector<ll>>
#define pin(p) cin >> p.first >> p.second;
#define rev(v) reverse(v.begin(),v.end());
#define mx(v) max_element(v.begin(), v.end());
#define mn(v) min_element(v.begin(), v.end());
#define sout(s, c) for(auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for(ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vout(v, c) for(int i = 0; i < v.size(); ++i) cout << v[i] << c;
#define pushi(v, a) for(int i = 0; i < a.size(); ++i) v.push_back(a[i]);
#define sin(s, n) for(int i = 0; i < n; ++i){int a; cin >> a; s.insert(a);}
#define fastio() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ll INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000 * 1000 * 1000;
const ld PI = acos(-1.0);
const ll mod1 = inf + 7;
const ll mod2 = inf + 9;
const int MAXN = 500001;
const ld EPS = 1e-9;
int hp = 179;

signed main()
{
	fastio();
	int a, b;
	cin >> a >> b;
	if (a % 2 == 0 || b % 2 == 0)
	{
		cout << "No";
	}
	else
	{
		cout << "Yes";
	}
	system("pause");
}

Measured memory_bytes: 504
#include <stdio.h>
#include <stdlib.h>
 
#define M 500000
#define P 10
 
struct node{
 int right;
 int left;
 int parent;
 int key;
};
typedef struct node Node;
 
Node root[30];
 
void inorder(Node);
void preorder(Node);
void postorder(Node);
int find(int);
 
int n;
 
int main() {
 
  int k,i,l,p;
 
  scanf("%d",&n);
 
  for (i=0 ; i<n ; i++){
    scanf("%d",&l);
    if(i==0)p=l;
    root[l].key=l;
    scanf("%d %d",&root[l].left,&root[l].right);
    }
 
    if(root[p].left==-1 && root[p].right==-1){
      p=find(root[p].key);
      }
 
    printf("Preorder\n");
    preorder(root[p]);
    printf("\n");
    printf("Inorder\n");
    inorder(root[p]);
    printf("\n");
    printf("Postorder\n");
    postorder(root[p]);
    printf("\n");
 
  return 0;
}
 
 
void inorder(Node r){
 
    if(r.left!=-1) inorder(root[r.left]);
    printf(" %d",r.key);
    if(r.right!=-1)inorder(root[r.right]);
 
}
 
 
void preorder(Node r){
 
      printf(" %d",r.key);
      if(r.left!=-1) preorder(root[r.left]);
      if(r.right!=-1)preorder(root[r.right]);
 
}
 
void postorder(Node r){
 
  if(r.left!=-1) postorder(root[r.left]);
  if(r.right!=-1)postorder(root[r.right]);
  printf(" %d",r.key);
 
}
 
int find(int x){
 
int i,a,c=0;
 
for(i=0 ; i<n ; i++){
    if(root[i].left==x) {
    a=find(root[i].key);
    c++;
  }
    if(root[i].right==x) {
      a=find(root[i].key);
      c++;
    }
}
 
  if(c!=0)  return a;
  else return x;
}  
  


Measured memory_bytes: 2100
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;

using namespace std;


signed main() {
  int L;

  cin >> L;

  int N = 0;
  while (pow(2, N + 1) <= L) N++;

  int r = pow(2, N);

  vector<pair<int, int>> vec;
  for (int i = N - 1; i >= 0; i--) {
    if (L - pow(2, i) >= r) {
      vec.push_back(make_pair(i, L-pow(2, i)));
      L -= pow(2, i);
    }
  }

  cout << N+1 << " " << 2 * N + vec.size() << endl;
  for (int i = 1; i <= N; i++) {
    cout << i << " " << i + 1 << " " << 0 << endl;
    cout << i << " " << i + 1 << " " << pow(2, i-1) << endl;
  }
  for (pair<int, int> p: vec) {
    cout << p.first+1 << " " << N+1 << " " << p.second << endl;
  }

  return 0;
}

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


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

  vector<int64_t> lucas (n+1,0);
    lucas[0]=2;
  	lucas[1]=1;
  if(n==0)	cout << lucas[0];
  else if(n==1) cout << lucas[1];
  else if(n==2) cout <<lucas[0] +lucas[1];
  else{
    for(int i=2;i<=n;i++){
    lucas[i]=lucas[i-1]+lucas[i-2];
    }
  cout << lucas[n] <<endl;
  }
}


Measured memory_bytes: 3596