akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for (i=a;i<b;i++)
#define rep2(i,a,b) for (i=a;i>=b;i--)
#define mod 1000000007
#define mod2 998244353
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF  1e9+5
#define f first
#define s second
#define endl '\n'
#define ll long long
#define ii pair <int,int>
#define pll pair <ll,ll>
#define vi vector <int>
#define vl vector <ll>
#define vvi vector < vi >
#define vii vector < ii >
#define vpl vector < pll >
#define vvii vector < vii >
#define vll vector < ll >
#define vb  vector <bool>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define pg priority_queue<ll, vector<ll>, greater<ll>>
#define pq priority_queue<ll>
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define cset(a) __builtin_popcountll(a)
#define FILL(a, b, T) fill_n((T *)a, sizeof(a) / sizeof(T), b)
#define debug(x) cerr << #x << " is " << x << endl;
#define st pair<ll,pll>
using namespace std;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// unordered_map<long long, int, custom_hash> safe_map;
// FOR VIEWERS, CODE STARTS HERE

int main()
{
    // #ifndef ONLINE_JUDGE
    //  freopen("input.txt","r",stdin);
    //  freopen("output.txt","w",stdout);
    // #endif
    FIO;
    ll t, q, n, m, prev, maxx,  i, j, k1, k2, k3, k, x, y, flag, sum, cnt, ans;
    cin>>n>>m;
    k = n*m;
    k/=__gcd(n,m);
    cout<<k<<endl;
    return 0;    
}

Measured memory_bytes: 256
/*Author
   SaJiB */

#include<bits/stdc++.h>
using namespace std;


#define pb   push_back
#define fi   first
#define se   second
#define all(x)    x.begin(),x.end()

#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

typedef long long int ll;
typedef unsigned long long int ull;
const double pi = 2.0*acos(0.0);

ll big_mod(ll BASE, ll POWER, ll MOD){

    if(POWER == 0) return 1;
    else if(POWER %2 ==0){
        ll RESULT = big_mod(BASE,POWER/2,MOD);
        return ((RESULT % MOD)*(RESULT % MOD))% MOD;
    }
    else return ((BASE % MOD)*(big_mod(BASE,POWER-1,MOD)% MOD))% MOD;

}

int main(){

char c;
cin>>c;

int d = int(c);

if(d>=65 && d<=90) cout<<"A"<<endl;
else cout<<"a"<<endl;

}



Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// 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 MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

  if(N == 0){
    cout << 0 << "\n";
    return 0;
  }

  vector<int> v(62, 0);
  int p = 1;
  int plus = 1;
  REP(i, 62){
    p *= 2;
    if(N%p){
      v[i]++;
      N -= plus;
    }
    plus *= -2;
  }

  string ans;
  bool flag = false;
  RREP(i, 63){
    if(v[i]%2 == 1){
      flag = true;
    }
    if(flag) ans += to_string(v[i]%2);
  }

  cout << ans << "\n";

  return 0;
}

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

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
        string S;
        cin >> S;
        int ans = 1000;
        rep(i, 3)
        {
                if (S[i] == 'x')
                        ans-=100;
        }
        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    String s = sc.next();

    String a = s.substring(0, (n / 2));
    String ans = "No";
    if (s.equals(a + a)) ans = "Yes";
    
    System.out.println(ans);
  }
}


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

//We only care about lines with both endpoints on the edges.
int R, C;
int N;
const int maxn = 1e5+5;

int gettime(int x, int y) {
    if (x == 0) {
        return y;
    }
    else if (y == R) {
        return R + x;
    }
    else if (x == C) {
        return R + C + (R - y);
    }
    else {
        return R + C + R + (C - x);
    }
}

bool isBorder(int x, int y) {
    return x == 0 || x == C || y == 0 || y == R;
}

struct Event
{
    bool start;
    int t, id;
};

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> R >> C >> N;
    vector<Event> events;
    for (int i = 0; i < N; i++) {
        int x1, y1, x2, y2; cin >> y1 >> x1 >> y2 >> x2;
        if (isBorder(x1,y1) && isBorder(x2,y2)) {
            int t1 = gettime(x1,y1);
            int t2 = gettime(x2,y2);
            if (t1 > t2) swap(t1,t2);
            events.push_back({true,t1,i});    
            events.push_back({false,t2,i});    
        }
    }
    sort(events.begin(),events.end(),[](auto a, auto b) {
            return a.t < b.t;
            });
    stack<int> st;
    bool poss = true;
    for (Event e: events) {
        if (e.start) {
            st.push(e.id);
        }
        else {
            if (st.top() != e.id) {
                //not possible
                cout << "NO\n";
                return 0;
            }
            else {
                st.pop();
            }
        }
    }
    cout << "YES\n";
}



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

struct Dinic{
  const int INF=1<<28;
  
  struct edge {
    int to,cap,rev;
    edge(){}
    edge(int to,int cap,int rev):to(to),cap(cap),rev(rev){}
  };

  int n;
  vector<vector<edge> > G;
  vector<map<int,int> > M;
  vector<int> level,iter;

  Dinic(){}
  Dinic(int sz):n(sz),G(n),M(n),level(n),iter(n){}
  
  void add_edge(int from,int to,int cap){
    M[from][to]=G[from].size();
    M[to][from]=G[to].size();
    G[from].push_back(edge(to,cap,G[to].size()));
    // undirected
    //G[to].push_back(edge(from,cap,G[from].size()-1));
    // directed
    G[to].push_back(edge(from,0,G[from].size()-1));
  }
  
  void bfs(int s){
    fill(level.begin(),level.end(),-1);
    queue<int> que;
    level[s]=0;
    que.push(s);
    while(!que.empty()){
      int v=que.front();que.pop();
      for(int i=0;i<(int)G[v].size();i++){
        edge &e = G[v][i];
        if(e.cap>0&&level[e.to]<0){
          level[e.to]=level[v]+1;
          que.push(e.to);
        }
      }
    }
  }
  
  int dfs(int v,int t,int f){
    if(v==t) return f;
    for(int &i=iter[v];i<(int)G[v].size();i++){
      edge &e=G[v][i];
      if(e.cap>0&&level[v]<level[e.to]){
        int d = dfs(e.to,t,min(f,e.cap));
       if(d>0){
         e.cap-=d;
         G[e.to][e.rev].cap+=d;
         return d;
       }
      }
    }
    return 0;
  }
  
  int flow(int s,int t,int lim){
    int fl=0;
    for(;;){
      bfs(s);
      if(level[t]<0||lim==0) return fl;
      fill(iter.begin(),iter.end(),0);
      int f;
      while((f=dfs(s,t,lim))>0){
       fl+=f;
       lim-=f;
      }
    }
  }

  int flow(int s,int t){
    return flow(s,t,INF);
  }

  //cap==1 only
  bool back_edge(int s,int t,int from, int to){
    for(int i=0;i<(int)G[from].size();i++) {
      edge& e=G[from][i];
      if(e.to==to) {
        if(e.cap==0&&flow(from,to,1)==0) {
          flow(from,s,1);
          flow(t,to,1);
          return 1;
        }
      }
    }
    return 0;
  }
};

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

main(){
  int test;
  cin>>test;
  r(o,test){
    int h,w,sum=0;
    cin>>w>>h;
    int a[h][w];
    r(i,h)r(j,w)cin>>a[i][j],sum+=a[i][j];
    Dinic D(h*w+2);
    int SRC=h*w;
    int SINK=h*w+1;
    r(i,h){
      r(j,w){
        if((i+j)%2){
          D.add_edge(SRC,i*w+j,a[i][j]);
          r(k,4){
            int y=i+dy[k];
            int x=j+dx[k];
            if(y<0||x<0||y>=h||x>=w)continue;
            D.add_edge(i*w+j,y*w+x,1e8);
          }
        }
        else D.add_edge(i*w+j,SINK,a[i][j]);
      }
    }
    cout<<"Case "<<o+1<<": "<<sum-D.flow(SRC,SINK,1e8)<<endl;
  }
}


Measured memory_bytes: 3252
h,w,n=map(int,input().split())
si,sj=map(int,input().split())
ss=input()
tt=input()
l=1
u=1
r=w
d=h
for t,s in zip(tt[::-1],ss[::-1]):
    if t=='U' and d<h:
        d+=1
    elif t=='D' and u>1:
        u-=1
    elif t=='L' and r<w:
        r+=1
    elif t=='R' and l>1:
        l-=1
    if s=='U':
        u+=1
    elif s=='D':
        d-=1
    elif s=='L':
        l+=1
    else:
        r-=1
    if u>d or l>r:
        print('NO')
        exit()
if u<=si<=d and l<=sj<=r:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 48940
#include<stdio.h>
#define MAX 1000

int main()
{
  int i, j, k, N, v;
  int F[MAX];

  scanf("%d",&N);
 
  F[0] = 1;
  F[1] = 1;

  if(N==0||N==1)
    {
      printf("%d\n",1);
    }
  else
    {
      for(i=2;i<=N;i++)
	{
	  F[i] = F[i-1] + F[i-2];
	}
      printf("%d\n",F[N]);
    }
  return(0);
}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		
		String s = stdIn.next();
		
		char c1 = s.charAt(0);
		char c2 = s.charAt(1);
		
		if((c1 == s.charAt(1) && c1 == s.charAt(2)) || (c2 == s.charAt(2) && c2 == s.charAt(3)))
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 35672
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

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

int main() {
	init();

	int H, W; cin >> H >> W;
	vector<string>maze(H);
	rep(i, 0, H) {
		cin >> maze[i];
	}
	Graph G_cost(H, vector<int>(W, INF));
	G_cost[0][0] = 0;
	if (maze[0][0] == '#') {
		G_cost[0][0]++;
	}
	rep(i, 0, H) {
		rep(j, 0, W) {
			rep(k, 0, 2) {
				int x = j + dx[k], y = i + dy[k];
				if (out(y, x, H, W))continue;
				int cost = G_cost[i][j];
				if (maze[i][j]=='.' && maze[y][x] == '#')cost++;
				G_cost[y][x] = min(G_cost[y][x], cost);
			}
		}
	}
	cout << G_cost[H - 1][W - 1] << "\n";

	return 0;
}


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

int main() {
	int N;
	double A[100], B[100], flame, out, count = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		count += A[i];
	}
	flame = count / N;
	for (int i = 0; i < N; i++) {
		B[i] = flame - A[i];
		if (B[i] < 0) B[i] = -B[i];
	}
	sort(B, B + N);
	for (int i = 0; i < N; i++) {
		if (A[i] == flame + B[0] || A[i] == flame - B[0]) {
			out = i;
			break;
		}
	}
	cout << out << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int l, r, t = 0;
  scanf("%d", &l);
  for(r = 0; (1<<r) <= l; r++); r--;
  for(int i = l; i; i -= i&-i, t++); t--;
  printf("%d %d\n", r+1, 2*r+t);
  for(int i = 0; i < r; i++){
    printf("%d %d %d\n", i+1, i+2, 1<<i);
    printf("%d %d %d\n", i+1, i+2, 0);
    if(l&(1<<i)) printf("%d %d %d\n", i+1, r+1, l-=l&-l);
  }
}

Measured memory_bytes: 256
a, b, c, x, y = gets.strip.split.map(&:to_i)

if 2 * c < a + b then
  # 組み替えたほうがお得
  # どっちかがあふれるまではとにかく組み替えたほうがよい
  m = [x, y].min
  total = 2 * m * c
  # 残り
  if x > y then
    # A ピザをのこり x - y 枚
    if 2 * c < a then
      # A ピザ一枚作るのにもセットを2枚買ったほうがお得
      total += (x - y) * 2 * c
    else
      # A ピザ一枚買うほうがセット2枚買うよりお得
      total += (x - y) * a
    end
  elsif x < y
    # B ピザを残り y - x 枚
    if 2 * c < b then
      # B ピザ一枚作るのにもセットを2枚買ったほうがお得
      total += (y - x) * 2 * c
    else
      # B ピザ一枚買うほうがセット2枚買うのよりお得
      total += (y - x) * b
    end
  end
  puts total
else
  # 単品でOK
    puts a * x + b * y
end

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] t = new int[n+1];
		int[] x = new int[n+1];
		int[] y = new int[n+1];
		t[0]=0; x[0]=0; y[0]=0;
		for (int i = 1; i <= n; i++) {
			t[i] = sc.nextInt();
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		for(int i = 1; i <= n; i++) {
			int tsa = t[i] - t[i-1];
			int kyori = Math.abs(x[i]-x[i-1])+Math.abs(y[i]-y[i-1]);
			int hikaku = tsa - kyori;
			if(hikaku >= 0 && hikaku % 2 == 0) {
			} else {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}

Measured memory_bytes: 89640
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
//#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ppi pair<int, pii>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const int N = 5e5 + 5, mod = 1e9 + 7;
const int inf = 1e9;
int popc(int a){
    int ans = 0;
    while(a != 0){
        if(a % 2 == 1) ans++;
        a = a / 2;
    }
    return ans;
}
void fun(int a){
    int ans = 1;
    while(a != 0){
        int c = popc(a);
        a = a % c;
        ans++;
    }
    cout << ans << endl;
}
void solve(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int c = 0;
    for(char i : s){
        if(i == '1') c++;
    }
    vi p1(n), p2(n);
    p1[n - 1] = 1;
    for(int i = n - 2; i >= 0; --i){
        p1[i] = (p1[i + 1] * 2) % (c + 1);
    }
    if(c > 1){
        p2[n - 1] = 1;
        for(int i = n - 2; i >= 0; --i){
            p2[i] = (p2[i + 1] * 2) % (c - 1);
        }
    }
    int num1 = 0, num2 = 0;
    for(int i = n - 1; i >= 0; i--){
        if(s[i] == '1'){
            num1 = (num1 + p1[i]) % (c + 1);
            if(c > 1){
                num2 = (num2 + p2[i]) % (c - 1);
            }
        }
    }
    //cout << num1 << " " << num2 << endl;
    //cout << "Manish" << endl;
    for(int i = 0; i < n; i++){
        if(s[i] == '1' && c > 1){
            int newnum = (c - 1 + num2 - p2[i]) % (c - 1);
            //cout << newnum << "low" << endl;
            fun(newnum);
        }
        else if(s[i] == '1' && c == 1){
            cout << 0 << endl;
        }
        else{
            int newnum = (num1 + p1[i]) % (c + 1);
            //cout << newnum << "high" << endl;
            fun(newnum);
        }
    }
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);//cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll t,p;
    t=1;
    //cin>>t;
    for(p=1;p<=t;p++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 5148
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
const ll inf = 1LL << 50;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
///////////////////////////////////////
int N;
vector<vector<pii>>G;
int ans[100100];
void dfs(int n,int c) {
	ans[n] = c % 2;
	for (auto i : G[n]) {
		if (ans[i.first] == -1) {
			dfs(i.first,c+(i.second)%2);
		}
	}
	return;
}
int main() {
	cin >> N;
	G.resize(N);
	for (int i = 0; i < N; ++i)ans[i] = -1;
	for (int i = 0; i < N - 1; ++i) {
		int u, v, w;
		cin >> u >> v >> w;
		--u, --v;
		G[u].push_back({ v,w });
		G[v].push_back({ u,w });
	}
	dfs(0,0);
	for (int i = 0; i < N; ++i) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 7424
#include <iostream>

int main()
{
	int data_num;
	std::cin >> data_num;
	while (data_num >= 1) {
		int x1, x2, x3;
		std::cin >> x1 >> x2 >> x3;
		if (x1 * x1 == x2 * x2 + x3 * x3) {
			std::cout << "YES" << std::endl;
		} else if (x2 * x2 == x3 * x3 + x1 * x1) {
			std::cout << "YES" << std::endl;
		} else if (x3 * x3 == x1 * x1 + x2 * x2) {
			std::cout << "YES" << std::endl;
		} else {
			std::cout << "NO" << std::endl;
		}
		data_num--;
	}
	return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){

  int n;
  cin >> n;
  ll res = 1;
  for(int i = 0;res*2 <= n;i++){
    res *= 2;
  }
  cout << res << endl;





  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  string s, t;
  cin >> s >> t;
  
  string ans = s == t.substr(0, t.length() - 1) ? "Yes" : "No";
  cout << ans << "\n";
  
  return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#define llint long long
#define inf 1e18

using namespace std;
typedef pair<double, double> P;

llint n;
llint x[1005], y[1005];
llint u[1005], v[1005];

void get(llint u, llint U[])
{
	u = (1LL<<39)-1 - u;
	for(int i = 0; i < 39; i++){
		if(u&(1LL<<(i+1))) U[i] = -1;
		else U[i] = 1;
	}
}

string calc(llint u, llint v)
{
	llint U[45], V[45];
	get(u, U), get(v, V);
	
	string ret;
	for(int i = 0; i < 39; i++){
		if(U[i] > 0){
			if(V[i] > 0) ret += "R";
			else ret += "U";
		}
		else{
			if(V[i] > 0) ret += "D";
			else ret += "L";
		}
	}
	return ret;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> x[i] >> y[i];
	
	llint p = abs(x[1]+y[1]) % 2;
	for(int i = 1; i <= n; i++){
		if(abs(x[i]+y[i]) % 2 != p){
			cout << -1 << endl;
			return 0;
		}
	}
	for(int i = 1; i <= n; i++) u[i] = x[i]+y[i], v[i] = x[i]-y[i];
	
	bool odd = (abs(u[1])%2);
	if(odd) cout << 39 << endl;
	else cout << 40 << endl;
	
	for(int i = 0; i < 39; i++) cout << (1LL<<i) << " ";
	if(!odd) cout << 1 << endl;
	cout << endl;
	
	for(int i = 1; i <= n; i++){
		if(!odd) u[i]--, v[i]--;
		string ans = calc(u[i], v[i]);
		if(!odd) ans += "R";
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 384
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    answer = 0
    for i in range(1, n - 1):
        for j in range(i + 1, n):
            for k in range(j + 1, n + 1):
                if i + j + k == x:
                    answer += 1
    print(answer)



Measured memory_bytes: 5596
#include <iostream>
#include <iomanip>
#include <queue>
#include <deque>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <bitset>

#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x, y) memset(x, y, sizeof(x))
#define pb push_back
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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

using namespace std;
using ll = long long;

const int kInf = 2e9;
const ll kLInf = 2e18;

int gcd (int a, int b) {
   return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
   cout << fixed << setprecision(10);
   int N;
   cin >> N;
   double sum = 0;
   REP(i, N) {
      int A;
      cin >> A;
      double rev = 1./A;
      sum += rev;
   }
   cout << 1/sum << endl;
   return 0;
}



Measured memory_bytes: 256
import java.util.*;class Main{public static void main(String[]g){Scanner S=new Scanner(System.in);double o=1e4,a,b,c,n[]=new double[6],l[];for(int i,m=S.nextInt();m-->0;System.out.printf("%.3f %.3f %.3f\n",n[3]/o,n[4]/o,n[5]/o)){l=n.clone();for(i=0;i<6;)n[i++]=S.nextDouble();for(i=0;(i+=2)<5;l[i+1]=2*(n[i+1]-n[1]))l[i]=2*(n[i]-n[0]);l[0]=n[0]*n[0]+n[1]*n[1]-n[2]*n[2]-n[3]*n[3];l[1]=n[0]*n[0]+n[1]*n[1]-n[4]*n[4]-n[5]*n[5];n[3]=(l[3]*l[1]-l[5]*l[0])/(l[2]*l[5]-l[4]*l[3])*o;n[4]=(l[0]*l[4]-l[1]*l[2])/(l[2]*l[5]-l[4]*l[3])*o;n[5]=Math.hypot(n[3]/o-n[0],n[4]/o-n[1])*o;}}}


Measured memory_bytes: 28592
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+18;

int main() {
    ios::sync_with_stdio(false);   
    Int n;
    cin >> n;
    vector<Int> a(n), b(n);
    vector<bool> conf(n, false);
    Int ma = -1;
    for (Int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] > ma) {
            conf[i] = true;
            ma = a[i];
        }
    }
    for (Int i = 0; i < n; i++) cin >> b[i];
    Int res = 1;
    ma = -1;
    for (Int i = n - 1; i >= 0; i--) {
        if (b[i] > ma) {
            ma = b[i];
            if ((conf[i] && b[i] != a[i]) || (!conf[i] && a[i] < b[i])) {
                dump(0);
                return 0;
            }
        }
        else {
            if (!conf[i]) {
                res *= min(a[i], b[i]);
                res %= mod;
            }
        }
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 1792
N = int(input())
H = list(map(int, input().split()))
H[-1] += 1
for i in range(N - 2, 0, -1):
    if H[i] == H[i + 1]:
        continue
    elif H[i] < H[i + 1]:
        H[i] += 1
    else:
        print("No")
        break
else:
    print("Yes")


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

using namespace std;

#define all(v) (v).begin(), (v).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, f, n) for(int i = (int)(f); i < (int)(n); i++)

typedef pair<int, int> P;

const int inf = 1 << 25;

struct edge
{
  int to, cost;
  edge(){}
  edge(int to, int cost):to(to), cost(cost){}
};

vector< vector<edge> > graph;
vector< vector<int> > mincost;

int dijkstra(int s)
{
  priority_queue<P, vector<P>, greater<P> > que;
  que.push(P(0, s));
  mincost[s][s] = 0;
  while(!que.empty()) {
    int cost, now;
    tie(cost, now) = que.top(); que.pop();
    if(mincost[s][now] < cost) continue;
    for(edge& e : graph[now]) {
      if(e.cost + cost < mincost[s][e.to]) {
	mincost[s][e.to] = e.cost + cost;
	que.push(P(mincost[s][e.to], e.to));
      }
    }
  }
  return *max_element(all(mincost[s]));
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, R;
  cin >> N >> R;
  graph.resize(N);
  rep(i, R) {
    int s, t, d;
    cin >> s >> t >> d; s--, t--;
    graph[s].emplace_back(t, d);
    graph[t].emplace_back(s, d);
  }

  mincost.resize(N, vector<int>(N, inf));
  int maxdist = 0;
  rep(i, N) maxdist = max(maxdist, dijkstra(i));
  //rep(i, N) dijkstra(i);
  //rep(i, N) reps(j, i+1, N) maxdist = max(maxdist, mincost[i][j]);

  vector<P> ep;
  //vector<int> S, T;
  rep(i, N) reps(j, i+1, N) {
    if(mincost[i][j] == maxdist) {
      ep.emplace_back(i, j);      
      //S.push_back(i), T.push_back(j);
    }
  }

  vector<int> ans;
  rep(i, N) {
    bool flag = true;
    for(auto& p : ep) {
      //rep(j, S.size()) {
      int s, t; tie(s, t) = p;
      if(mincost[s][i] + mincost[i][t] == maxdist) {      
      //if(mincost[S[j]][i] + mincost[i][T[j]] == maxdist) {
	flag = false;
	break;
      }
    }
    if(flag) ans.push_back(i+1);
  }
  
  cout << ans.size() << endl;
  rep(i, ans.size()) cout << ans[i] << endl;
  
  return 0;
}

Measured memory_bytes: 28220
#include <bits/stdc++.h>
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define P pair<ll, int>

struct UnionFind {
  vector<ll> par; 
  vector<ll> siz; 

    
  UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
    for (ll i = 0; i < sz_; ++i) par[i] = i; 
  }
  void init(ll sz_) {
    par.resize(sz_);
    siz.resize(sz_, 1);
    for (ll i = 0; i < sz_; ++i) par[i] = i;
  }

  ll root(ll x) { 
    while (par[x] != x) {
      x = par[x] = par[par[x]];
    }
    return x;
  }

  bool merge(ll x, ll y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }

  bool issame(ll x, ll y) {
    return root(x) == root(y);
  }

  ll size(ll x) {
    return siz[root(x)];
  }
};

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

  int n, m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  UnionFind uf(n);
  rep(i, m) {
    int x, y;
    cin >> x >> y;
    uf.merge(x, y);
  }

  if (n - 1 == m) {
    cout << 0 << '\n';
    return 0;
  }
  int cnt = 0;
  vector<int> s(n, -1);
  rep(i, n) {
    int j = uf.root(i);
    if (s[j] == -1) {
      s[j] = cnt++;
    }
    s[i] = s[j];
  }
  ll ans = 0;
  vector<bool> used(cnt, false);
  int res = 0, res2 = cnt - 2;
  priority_queue<P, vector<P>, greater<P>> pq;
  rep(i, n) {
    pq.push({a[i], s[i]});
  }
  while (res < cnt || res2 > 0) {
    if (pq.empty()) {
      cout << "Impossible" << '\n';
      return 0;
    }
    P p = pq.top();
    pq.pop();
    if (!used[p.second]) {
      ans += p.first;
      used[p.second] = true;
      res++;
    }
    else {
      if (res2 == 0) continue;
      ans += p.first;
      res2--;
    }
  }
  cout << ans << '\n';
  








  
  return 0;
}

Measured memory_bytes: 5236
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n;cin >> n;
    bool check=false;
    rep(i,3){
        if(n%10==7)check=true;
        n/=10;
    }
    if(check)cout << "Yes" <<endl;
    else cout << "No" <<endl;
}


Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int t=0,r=0;
    char a=s[0],b;
    for(int i=0;i<4;i++){
        if(a==s[i]){
            t++;
        }
        else{
            b=s[i];
        }
    }
    if(t!=2){
        cout<<"No";
        return 0;
    }
    for(int i=0;i<4;i++){
        if(b==s[i]){
            r++;
        }
    }
    if(r==2){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        int[] a = new int[n];
        
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        
        long sumOfHalfOfPosDiffBA = 0; // b[i] - a[i] が正の時、その半分を集計
        long sumOfNegaDiffBA = 0; // b[i] - a[i] が負の時、それを集計
        for (int i = 0; i < n; i++) {
            int bi = sc.nextInt();
            int diffBA = bi - a[i];
            
            if (diffBA >= 0) {
                sumOfHalfOfPosDiffBA += diffBA / 2;
            } else {
                sumOfNegaDiffBA += diffBA;
            }
        }
        
        if (sumOfHalfOfPosDiffBA + sumOfNegaDiffBA >= 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");            
        }
    }
}

Measured memory_bytes: 42376
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::HashMap;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_variables)]
        #[allow(unused_mut)]
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("parse error")
    };
}

fn main() {
    input!{
        a: i64,
        b: i64,
        n: i64,
    }
    let n = cmp::min(b-1, n);
    let ans = (a*n/b) - (n/b*a);
    println!("{}", ans);
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

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

    long long total = abs(A[0]);
    for(int i = 0; i < N-1; ++i)
        total += abs(A[i] - A[i+1]);
    total += abs(A[N-1]);

    int fans = total;
    fans -= abs(A[0]);
    fans -= abs(A[0] - A[1]);
    fans += abs(A[1]);
    cout << fans << endl;
    for(int i = 0; i < N-2; ++i){
        int ans = total;
        ans -= abs(A[i] - A[i+1]);
        ans -= abs(A[i+1] - A[i+2]);
        ans += abs(A[i] - A[i+2]);
        cout << ans << endl;
    }
    int lans = total;
    lans -= abs(A[N-1]);
    lans -= abs(A[N-2] - A[N-1]);
    lans += abs(A[N-2]);
    cout << lans << endl;
    return 0;
}

Measured memory_bytes: 1664
n,k=map(int,input().split())
p=[0]+list(map(int,input().split()))
c=[0]+list(map(int,input().split()))
ans=-10**18
for i in range(1,n+1):
  vis=set()
  now=i
  a=[0]
  m=k
  while m:
    vis.add(now)
    now=p[now]
    a+=[c[now]+a[-1]]
    m-=1
    if now in vis:break
  if m==0 or a[-1]<=0:
    cnt=max(a[1:])
  else:
    cnt=(k//(k-m))*a[-1]
    if k%(k-m):cnt+=max(a[1:k%(k-m)+1])
    elif max(a[1:])>a[-1]:
      cnt=cnt=(k//(k-m)-1)*a[-1]+max(a[1:])
  ans=max(ans,cnt)
print(ans) 

Measured memory_bytes: 168868
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
#include <list>
//#include <bits/stdc++.h>


using namespace std;

#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
typedef long long ll;

int main(){
    int n;
    cin >> n;
    int a;
    int vote[n];
    FOR(i,0,n){
        vote[i]=0;
    }
    FOR(i,0,n-1){
        cin >> a;
        vote[a-1]++;
    }
    FOR(i,0,n){
    cout << vote[i] << endl;

    }
    return 0;
}

Measured memory_bytes: 4420
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <string> vs;
#define mod 1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    vi a(n);
    for(ll i=0;i<n;i++)
        cin>>a[i];
    vi b(n+1);
    for(ll i=0;i<n;i++)
    {
        b[a[i]]=i;
    }
    set <ll> s;
    s.insert(-1);
    s.insert(n);
    ll ans=0;
    for(ll i=n;i>0;i--)
    {
        s.insert(b[i]);
        auto c=s.find(b[i]);
        auto p=c;
        auto ne=c;
        p--;
        ne++;
        if(*p!=-1)
        {
            auto pp=p;
            pp--;
            ans+=i*(*p-*pp)*(*ne-*c);
        }
        if(*ne!=n)
        {
            auto nen=ne;
            nen++;
            ans+=i*(*nen-*ne)*(*c-*p);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6528
#include <iostream>
using namespace std;
int main(void){
    int h,w,i;
    char line1[301], line2[301];
    while(1){
        cin >> h >> w;
        if(!(h+w)) break;
        for(i=1;i<w-1;i++){
            line2[i]='.';
        }
        line2[0]='#', line2[i]='#';
        for(i=0;i<w;i++){
            line1[i]='#';
        }
        line1[i]=0;//end of C string
        line2[i]=0;
        cout << line1 << endl;
        for(i=1;i<h-1;i++){
            cout << line2 << endl;
        }
        cout << line1 << endl;
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3068
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input {(source=$s:expr,$($r:tt)*) => {let mut iter=$s.split_whitespace(); let mut next=||{iter.next().unwrap()}; input_inner! {next,$($r)*}};($($r:tt)*) => {let stdin=std::io::stdin();let mut bytes=std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next=move||->String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()}; input_inner! {next,$($r)*}};}
#[allow(unused_macros)]
macro_rules! input_inner {($next:expr) => {}; ($next:expr,) => {}; ($next:expr,$var:ident:$t:tt$($r:tt)*) => {let $var=read_value!($next,$t); input_inner! {$next$($r)*}};}
#[allow(unused_macros)]
macro_rules! read_value {($next:expr,($($t:tt),*)) => {($(read_value! ($next,$t)),*)}; ($next:expr, [$t:tt; $len:expr]) => {(0..$len).map(|_|read_value! ($next,$t)).collect::<Vec<_>>()}; ($next:expr,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX: usize = 100006;
#[allow(dead_code)]
const INF_U32: u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32: i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64: u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64: i64 = 1 << 62;
#[allow(dead_code)]
const MOD: i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(unused_imports)]
use std::f64;

fn binary_search(x:i64) -> i64 {
    let mut left = 0;
    let mut right = 1e9 as i64;
    while (left-right).abs() > 1 {
        let mid = (left+right)/2;
        if mid*(mid+1)/2 >= x { right = mid; }
        else { left = mid; }
    }
    right
}

fn main() {
    input!{x:i64};

    println!("{}", binary_search(x));

}

Measured memory_bytes: 4476
#include<bits/stdc++.h>
#define me(a,x) memset(a,x,sizeof(a))
#define sc scanf
#define itn int
using namespace std;
const int N=1e6;
const long long mod=1e9+7;
const int oo=0x7fffffff;
const int sup=0x80000000;
typedef long long ll;
typedef unsigned long long ull;
template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}
template <typename it>
string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}
template <typename it>int o(it a){cout<<a<<endl;return 0;}
ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}
ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}
int n;
int a[N],b[N]={0};
int main(){
	//freopen("in.txt","r",stdin);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
  for (int i = n; i >= 1; --i) {
    b[i] = a[i];
    for (int j = i * 2; j <= n; j += i)
      b[i] ^= b[j];
  }
  int cnt = 0;
  for (int i = 1; i <= n; ++i) if (b[i] == 1) cnt++;
  printf("%d\n", cnt);
  for (int i = 1; i <= n; ++i)
    if (b[i] == 1) printf("%d ", i);
}


Measured memory_bytes: 5888
using System;
using System.Collections;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        int a, b, c,k;
        string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
        a = int.Parse(str[0]);  //数値で受け取りたい場合は変換する
        b = int.Parse(str[1]);
        c = int.Parse(str[2]);

        int[] n = { a, b, c };
        k = int.Parse(Console.ReadLine());

        var n_li = n.ToList();

        n_li.Sort();

        for (int i = 0; i < k; i++)
        {
            var aa = n_li.Last();
            aa *= 2;
            n_li.RemoveAt(2);
            n_li.Add(aa);
        }

        Console.WriteLine(n_li[0] + n_li[1] + n_li[2]);
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll,ll>
#define pint pair<int,int>
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define mod 1000000007
#define MAX 500010
#define endl '\n'
#define mp make_pair
#define INF INT_MAX
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ff first
#define ss second
#define ps(x,y) fixed<<setprecision(y)<<x
#define setbits(x) __builtin_popcountll(x)            //counts no of ones in binary representation
#define w(t)     int t; cin>>t; while(t--)
#define pi 3.141592653589793238
#define sortt(v)  sort(v.begin(),v.end())
#define lb(v,x) std::lower_bound(v.begin(),v.end(),x)
#define ub(v,x) std::upper_bound(v.begin(),v.end(),x)

using namespace std;

bool isprime(ll n){			//to check whteher no is prime or not
	if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
}

int main(){
	fast;
	ll x;
	cin>>x;
	if(x>=30){
		cout<<"Yes";
	}
	else	cout<<"No";
	//cout<<"Case #"<<x<<": "<<y<<endl;
}

/*for(int i=2;i<=n;i++){
			if(v[i].size()==0)	break;
			for(int j=0;j<v[i].size();j++){
				cout<<v[i-1][0]<<' '<<v[i][j]<<endl;
			}
		}*/

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 32);
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll>> vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

#define Endl endl

/*--------------------template--------------------*/


int main() {
    cin >> n;
    vi va(n);
    ll suma = 0, sumb = 0;
    REP(i,n) {
        cin >> va[i];
        suma += va[i];
    }
    vi vb(n);
    REP(i, n)
    {
        cin >> vb[i];
        sumb += vb[i];
    }
    if(suma>sumb){
        cout << "No" << endl;
        return 0;
    }
    REP(i,n) {
        if(va[i]<vb[i]){
            ll diff = vb[i] - va[i];
            ans += (diff + 1) / 2;
        }
    }
    if(ans<=sumb-suma){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 384
s = input()
if s == 'RRR':
    print(3)
elif s == 'RRS' or s == 'SRR':
    print(2)
elif s == 'SRS' or s == 'RSR' or s == 'SSR' or s == 'RSS':
    print(1)
else:
    print(0)

Measured memory_bytes: 61800
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		int n=fs.nextInt();
		int[] a=new int[4];
		for (int i=0; i<n; i++) {
			String next=fs.next();
			if (next.equalsIgnoreCase("AC")) a[0]++;
			else if (next.equalsIgnoreCase("WA")) a[1]++;
			else if (next.equalsIgnoreCase("TLE")) a[2]++;
			else  a[3]++;
		}
		System.out.println("AC x "+a[0]);
		System.out.println("WA x "+a[1]);
		System.out.println("TLE x "+a[2]);
		System.out.println("RE x "+a[3]);
	}

	static void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

	
}


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

int main() {
    int N;
    string S;
    cin >> N >> S;
    for (long long i=0; i<S.size(); i++) {
        char s = S.at(i);
        for (int j=0; j<N; j++) {
            if (s=='Z') {
                s = 'A';
            }
            else s++;
        }
        cout << s;
    }
}

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

bool same(char *top, char *bottom) {
	int length = ((string) top).length();
	for(int i = 0; i < length; i++) {
		if (top[i] != bottom[length - i - 1]) return false;
	}
	
	return true;
}

int main() {
	char top[5], bottom[5];
	scanf("%s\n%s", top, bottom);
	printf("%s", same(top, bottom) ? "YES" : "NO");
	return 0;
}

Measured memory_bytes: 256