akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#ifdef TEST
#define getchar_unlocked _getchar_nolock
#endif
#define int long long
#define ins insert
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define pp pop
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define g0(a) get<0>(a)
#define g1(a) get<1>(a)
#define g2(a) get<2>(a)
#define g3(a) get<3>(a)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef double db;
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef tree<pair<int, int>, null_type, less<pair<int, int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int X;
vector<pair<int, int> > v;

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> X;
	for (int i = -5000; i <= 5000; i++) {
		int tmp = 1;
		for (int j = 1; j <= 5; j++) tmp *= i;
		v.eb(tmp, i);
	}
	for (auto i : v) {
		auto it = lower_bound(v.begin(), v.end(), mp(i.first - X, -300000ll));
		if (it != v.end() && it->first ==i.first - X) {
			cout << i.second << ' ' << it->second << '\n';
			return 0;
		}
	}
}


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

int main(void){
    int n,i,b;
    int *a;
    
    scanf("%d",&n);
    
    if(n<0||100<n){
        printf("error\n");
        return 0;
    }
    
    a=(int*)calloc(n,sizeof(int));
    
    for(i=0;i<n;i++){
        scanf("%d",&b);
        if(b<0||1000<=b){
            printf("error\n");
            return 0;
        }
        a[i]=b;
    }
    printf("%d",a[n-1]);
    for(i=n-2;i>=0;i--){
        printf(" %d",a[i]);
    }
    putchar('\n');
    return 0;
}


Measured memory_bytes: 2032
function main(input) {
    const args = input.split('\n');
    const A = parseInt(args[0], 10),
          B = parseInt(args[1], 10),
          C = parseInt(args[2], 10),
          X = parseInt(args[3], 10);

    var count = 0;

    for (var a = 0; a <= A; ++a) {
        for (var b = 0; b <= B; ++b) {
            for (var c = 0; c <= C; ++c) {
                var sum = (a * 500) + (b * 100) + (c * 50);
                if (sum === X) ++count;
            }
        }
    }
    console.log(count);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21192
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod = 1e9 + 7;
const int MAXN = 10007;
inline int add(int x, int y) {int res = x + y; if (res >= mod) res -= mod; return res;}
inline int mul(int x, int y) {ll res = (ll)x * y; res -= res / mod * mod; return res;}
int dp[MAXN][100];
char s[MAXN];
inline void upd(int &x, int y) {x = add(x, y);}
int main()
{
    scanf(" %s", s + 1); int n = strlen(s + 1);
    int D; scanf("%d", &D);
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) 
        for (int d = 0; d < 10; d++)
            for (int j = 0; j < D; j++)
                upd(dp[i + 1][(j + d) % D], dp[i][j]);

    int ans = 0, r = 0;
    for (int i = 1; i <= n; i++)
    {
        int d = s[i] - '0';
        for (int j = 0; j < d; j++) upd(ans, dp[n - i][(D - (j + r) % D + D) % D]);
        r = (r + d) % D;
    }
    if (!r) upd(ans, 1);
    printf("%d\n", add(ans, mod - 1));
    return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <string.h>
using namespace std;
const int MAXN=1005;
int n,m;
int a[MAXN],c[MAXN];
int dp[MAXN][1<<12+5];
int main()

{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	
	for (int i=1;i<=m;i++){
		int num;
		cin>>c[i]>>num;
		for (int j=1;j<=num;j++){
			int x;
			cin>>x;
			a[i]|=(1<<x-1);
		}
	}
	
	memset(dp,0x3f3f3f3f,sizeof(dp));
	dp[0][0]=0;

	for (int i=0;i<=m;i++){
		for (int j=0;j<(1<<n);j++){
			int goal=j|a[i+1];
			/*
			cout<<"qwq:"<<i<<endl;
			print(a[i+1]);
			print(j);
			print(goal);
			cout<<dp[i][j]<<" "<<c[i+1]<<" "<<dp[i+1][goal]<<endl;
			*/
			dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
			dp[i+1][goal]=min(dp[i+1][goal],dp[i][j]+c[i+1]);
			//cout<<dp[i+1][goal]<<endl;
		}
	}

	if (dp[m][(1<<n)-1]!=0x3f3f3f3f)
		cout<<dp[m][(1<<n)-1]<<endl;
	else
		cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 514944
S = input()
N = len(S)
if list(reversed(S)) == list(S) and list(reversed(S[:(N-1)//2])) == list(S[:(N-1)//2]) and list(reversed(S[((N+3)//2)-1:])) == list(S[((N+3)//2)-1:]):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<stdio.h>
int prime[2000];
int c,count;
int isPrime(int n){
	int i;
	if(n==2)return 1;
	if(n==1)return 0;
	if(!(n%2))return 0;
	for(i=1;i<c;i++){
		if(n==prime[i])return 1;
		if(!(n%prime[i]))return 0;
	}
	for(i=prime[c-1];i<n/2;i+=2)if(!(n%i))return 0;
	return 1;
}
void search(int n,int i,int sum){
	int j;
	if(sum+prime[i]==n){count++;return;}
	if(sum+prime[i]>n)return;
	sum+=prime[i];
	search(n,i+1,sum);
}
int main(){
	int i,n;
	prime[0]=2;prime[1]=3;prime[2]=5;prime[3]=7;prime[4]=11;
	c=5;
	for(i=13;i<10000;i+=2){
		if(isPrime(i)){
			prime[c]=i;
			c++;
		}
	}
	for(;scanf("%d",&n)&&n;){
		count=0;
		for(i=0;i<c&&prime[i]<=n;i++)search(n,i,0);
		printf("%d\n",count);
	}
	return 0;
}

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

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x;
  cin >> x;
  for (int i = 1; i <= 1000; i++) {
    if (100 * i <= x && x <= 105 * i) {
      cout << 1 << endl;
      return 0;
    } else if (x < 100 * i) {
      break;
    }
  }
  cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> x(n);
  int64_t sb=0;
  for(int i=0;i<n;i++){
    cin>>a.at(i)>>b.at(i);
    x.at(i)=a.at(i)+b.at(i);
    sb+=b.at(i);
  }
  sort(x.begin(),x.end(),greater<int>());
  int64_t sx=0;
  for(int i=0;i<n;i+=2)
    sx+=x.at(i);
  cout<<sx-sb<<endl;
}

Measured memory_bytes: 4580
import java.util.*;
import java.io.*;
public class Main
{
	static final int mod=(int)1e9+7;
	static final int inf=(int)1e9;
	static final long INF=(long)1e18;
	public static void main(String[] args)
	{
		FastScanner fs=new FastScanner();
		int n=fs.nextInt();
		int x=fs.nextInt();
		int t=fs.nextInt();
		if(n%x==0)
		{
			System.out.println((n/x)*t);
		}
		else
		{
			System.out.println(((n/x)+1)*t);
		}
		
	}
}
class FastScanner 
{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		public String next() 
		{
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
			
		}
		ArrayList<Integer> sieve(int n)
		{
			ArrayList<Integer> primes = new ArrayList<Integer>();
			boolean arr[]=new boolean[n+1];
			Arrays.fill(arr,true);
			arr[0]=arr[1]=false;
			for(int i=2;i*i<=n;i++)
			{
				if(arr[i]==true)
				{
					for(int j=i*i;j<arr.length;j+=i)
					{
						arr[j]=false;
					}
				}
			}
			for(int i=0;i<arr.length;i++)
			{
				if(arr[i]==true)primes.add(i);
			}
			return primes;
		}
		long pow(long x,long n)
		{
			long res=1;
			while(n>0)
			{
			   	if(n%2!=0)
			   	{
			   		res=(res*x);n--;
			   	}
			   	else
			   	{
			   		x=(x*x);n/=2;
			   	}
			}
			return res;
		}
		int gcd(int a,int b)
		{
			if(b==0)
			{
				return a;
			}
			return gcd(b,a%b);
		}
		long longgcd(long a,long b)
		{
			if(b==0)
			{
				return a;
			}
			return longgcd(b,a%b);
		}
		int[] sort(int arr[])
		{
			ArrayList<Integer> list = new ArrayList<Integer>();
			for(int i:arr)list.add(i);
			Collections.sort(list);
			for(int i=0;i<arr.length;i++)
			{
				arr[i]=list.get(i);
			}
			return arr;
		}
		char[] charsort(char arr[])
	        {
	    	ArrayList<Character> list = new ArrayList<>();
	    	for(char c:arr)list.add(c);
	    	Collections.sort(list);
	    	for(int i=0;i<list.size();i++)
	    	{
	    		arr[i]=list.get(i);
	    	}
	    	return arr;
	        }
		long[] longsort(long arr[])
		{
			ArrayList<Long> list = new ArrayList<Long>();
			for(long i:arr)list.add(i);
			Collections.sort(list);
			for(int i=0;i<arr.length;i++)
			{
				arr[i]=list.get(i);
			}
			return arr;
		}
		public int nextInt() 
		{
			return Integer.parseInt(next());
		}
		public int[] readArray(int n)
		{
			int[] arr=new int[n];
			for (int i=0; i<n; i++) arr[i]=nextInt();
			return arr;
		}	
		public long nextLong()
		{
			return Long.parseLong(next());
		}
		public long[] longreadArray(int n) 
		{
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
}

Measured memory_bytes: 32792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

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

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll modpow(ll a, ll n, ll mod_) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod_;
        a = a * a % mod_;
        n >>= 1;
    }
    return res;
}

const ll MAX_SIZE = 200005;
array<ll, MAX_SIZE> fac, inv, finv;
void finit() {
    // combination init
    fac[0] = 1;
    for (ll i = 1; i < MAX_SIZE; i++) fac[i] = fac[i - 1] * i % MOD;
    finv[MAX_SIZE - 1] = modpow(fac[MAX_SIZE - 1], MOD - 2, MOD);
    for(ll i = MAX_SIZE - 1; i > 0; i--) finv[i - 1] = finv[i] * i % MOD;
    
    //inv init
    repe(i, 1, MAX_SIZE) inv[i] = modpow(i, MOD - 2, MOD);
}

ll perm(ll a, ll b) { return fac[a] * finv[a - b] % MOD; }

ll comb(ll a, ll b) { return fac[a] * finv[b] % MOD * finv[a - b] % MOD; }

int main() {
    init();
    finit();
    ll N, K;
    cin >> N >> K;
    
    if(N>K){
        cout << 0 << endl;
        return 0;
    }

    cout << perm(K, N) << endl;
}


Measured memory_bytes: 7856
from collections import deque


S=input()

lenS=len(S)
T=deque()
for i in range(lenS):
    T.append(S[i])

#print(T)

A=len(T)

while A>7:
    if T[A-1]== "m" and T[A-2] =="a" and T[A-3] =="e" and T[A-4] =="r" and T[A-5] =="d":
        for i in range(5):
            T.pop()
    elif T[A-1]== "e" and T[A-2] =="s" and T[A-3] =="a" and T[A-4] =="r" and T[A-5] =="e":
        for i in range(5):
            T.pop()
            
    elif T[A-1]== "r" and T[A-2] =="e" and T[A-3] =="s" and T[A-4] =="a" and T[A-5] =="r" and T[A-6] =="e":
        for i in range(6):
            T.pop()
            
    elif T[A-1]== "r" and T[A-2] =="e" and T[A-3] =="m" and T[A-4] =="a" and T[A-5] =="e" and T[A-6] =="r" and T[A-7] =="d":
        for i in range(7):
            T.pop()
    else:
        print("NO")
        exit()
    
    A=len(T)

if A<=4:
    print("NO")
elif A==5 and T[A-1]== "m" and T[A-2] =="a" and T[A-3] =="e" and T[A-4] =="r" and T[A-5] =="d":
    print("YES")
elif A==5 and T[A-1]== "e" and T[A-2] =="s" and T[A-3] =="a" and T[A-4] =="r" and T[A-5] =="e":
    print("YES")
elif A==6 and  T[A-1]== "r" and T[A-2] =="e" and T[A-3] =="s" and T[A-4] =="a" and T[A-5] =="r" and T[A-6] =="e":
    print("YES")
elif A==7 and T[A-1]== "r" and T[A-2] =="e" and T[A-3] =="m" and T[A-4] =="a" and T[A-5] =="e" and T[A-6] =="r" and T[A-7] =="d":
    print("YES")
else:
    print("NO")




Measured memory_bytes: 10336
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
typedef long long ll;
typedef vector<int> vi;

int n;
int a[62];

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%d",a+i);
  ll minval = 1, maxval = 1;
  vi minarr, maxarr;
  REP(i,n){
    ll aa = a[i];
    ll nmin = minval*aa, nmax = maxval*aa;
    vi nminar = minarr, nmaxar = maxarr;
    nminar.push_back(i+1); nmaxar.push_back(i+1);
    if(nmin > maxval){
      maxval = nmin;
      maxarr = nminar;
    }
    if(nmax > maxval){
      maxval = nmax;
      maxarr = nmaxar;
    }
    if(nmin < minval){
      minval = nmin;
      minarr = nminar;
    }
    if(nmax < minval){
      minval = nmax;
      minarr = nmaxar;
    }
  }
  printf("%d\n",(int)maxarr.size());
  for(int x : maxarr){
    printf("%d\n",x);
  }
  return 0;
}


Measured memory_bytes: 3276
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

///
enum EPS = 1e-10;

///
double add(double a, double b) {
    if (abs(a + b) < EPS * (abs(a) + abs(b))) return 0;
    return a + b;
}

///
struct P {
    double x, y;

    this(double x, double y) {
        this.x = x;
        this.y = y;
    }

    P opBinary(string op)(P p) {
        static if (op == "+") return P(add(x, p.x), add(y, p.y));
        else static if (op == "-") return P(add(x, -p.x), add(y, -p.y));
        else static assert(0, "Operator '"~op~"' not implemented");
    }

    P opBinary(string op)(double d) {
        static if (op == "*") return P(x * d, y * d);
        else static if (op == "/") return P(x / d, y / d);
        else static assert(0, "Operator '"~op~"' not implemented");
    }

    // dot product
    double dot(P p) {
        return add(x * p.x, y * p.y);
    }

    // cross product
    double det(P p) {
        return add(x * p.y, -y * p.x);
    }

    double dist(P p) {
        return sqrt((x - p.x)^^2 + (y - p.y)^^2);
    }

    P middle(P p) {
        return P((x + p.x)/2, (y + p.y)/2);
    }

    P rotate(double th) {
        return P(add(x * cos(th), -y * sin(th)), add(x * sin(th), y * cos(th)));
    }

    P rotate(P p, double th) {
        auto q = P(x - p.x, y - p.y).rotate(th);
        return P(q.x + p.x, q.y + p.y);
    }
}

void main()
{
    auto N = readln.chomp.to!int;
    auto ps = [P(0, 0), P(100, 0)];
    foreach (_; 0..N) {
        P[] nps;
        foreach (i; 0..ps.length-1) {
            auto x = ps[i];
            auto y = ps[i+1];
            nps ~= x;
            nps ~= P((x.x*2+y.x)/3, (x.y*2+y.y)/3);
            auto d = x.dist(y);
            auto th = atan2(y.y-x.y, y.x-x.x);
            nps ~= P(x.x+d/2, x.y+d/6.0*sqrt(3.0)).rotate(x, th);
            nps ~= P((x.x+y.x*2)/3, (x.y+y.y*2)/3);
        }
        ps = nps ~ ps[$-1];
    }
    foreach (p; ps) writefln("%.10f %.10f", p.x, p.y);
}


Measured memory_bytes: 2572
N, S = map(int, input().split())
A = list(map(int, input().split()))
MOD = 998244353

dp = [0] * (S + 1)

ans = 0
for a in A:
    dp[0] += 1
    for s in range(S + 1)[::-1]:
        if s + a <= S:
            dp[s + a] = (dp[s + a] + dp[s]) % MOD
    ans += dp[S]
    ans %= MOD

print(ans)


Measured memory_bytes: 42348
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    int n, c;
    ll k;
    cin >> n >> c >> k;
    vector<int> t(n);
    in_arr(int, t, n);
    sort(t.begin(), t.end());
    int ride = 0, start = t[0], ans = 1;
    rep(i, n){
        if(ride >= c || start + k < t[i]){
            ++ans;
            ride = 1;
            start = t[i];
            continue;
        }
        ++ride;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  string s;
  cin>>s;
  
  int A;//最初にAが出てきた時の番号
  int Z;//最後にZが出てきた時の番号
  
  A=s.find_first_of('A');
  Z=s.find_last_of('Z');
  
  cout<<Z-A+1<<endl;
  return 0;
}

Measured memory_bytes: 3720
from math import ceil
n = int(input())
a = list(map(int, input().split()))

ans = 10**10

m1 = a[int(n/2)]
m2 = int(sum(a) / n)
m3 = ceil(sum(a) / n)

for v in [m1, m2, m3]:
    cost = 0
    for i in range(n):
        cost += (a[i] - v) ** 2
    ans = min(cost, ans)
print(ans)

Measured memory_bytes: 38384
import collections
import heapq
import bisect
import sys
input = sys.stdin.readline

N, M, Q = map(int, input().split())
LR = [tuple(map(int, input().split())) for i in range(M)]
LR.sort(key=lambda x: x[1])
table = collections.defaultdict(list)
for l, r in LR:
    table[l].append(r)

ss = [[0]*(N+1) for i in range(N+1)]
s = [[0]*(N+1) for i in range(N+1)]
for i in range(1, N+1):
    for x in table[i]:
        ss[i][x] += 1
    for j in range(i, N+1):
        s[i][j] = s[i][j-1] + ss[i][j]


for i in range(Q):
    p, q = map(int, input().split())
    ret = 0
    for j in range(p, q+1):
        ret += s[j][q]
    print(ret)


Measured memory_bytes: 96988
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i) 
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int R = 1000000000;
	int L = 0;
	int a, b;
	int n;
	int m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		L = max(L, a);
		R = min(R, b);
    }
	ll ans = max(R - L + 1,0);
	cout << ((ans > n) ? n : ans) << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

#define INF 1e9
#define st string
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define fopen freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define test(x) int t; cin >> t; while(t--) x();

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

void solve(){
    int a, b; cin >> a >> b;
    if(a == b) {
        cout << "Draw";
        return;
    }
    if(a == 1) {
        cout << "Alice";
        return;
    }
    if(b == 1) {
        cout << "Bob";
        return;
    }
    if(a < b) {
        cout << "Bob";
        return;
    }
    if(a > b) cout << "Alice";
}

int main(){
    fastio
    solve();
    return 0;
}



Measured memory_bytes: 3620
//k
#include<stdio.h>
typedef long long ll;

ll x, y, z;
int main()
{
	int ans=0;
	scanf("%lld%lld", &x, &y);
	z=y/x;
	while(z>1)
	{
		ans++;
		z>>=1;
	}
	printf("%d\n", ans+1);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ll n,k,c=1,d;
	cin>>n>>k;
	for(int i=0;i<n-1;i++)
	{
		c=c*(k-1);
	}
	cout<<c*k;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define INF 1000000000
typedef long long int ll;
ll dp[1001][1001];
int main(){
	ll n,m;
	ll dis[1001],we[1001];
	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> dis[i];
	}
	for(int i=0;i<m;i++){
		cin >> we[i];
	}
	for(int i=0;i<=m;i++){
		for(int j=0;j<=n;j++){
			dp[i][j] = INF;
		}
	}
	dp[0][0] = 0;
	for(int i=1;i<=m;i++){
		dp[i][0] = 0;
		for(int j=0;j<=n;j++){
			if(dp[i-1][j] == INF) continue;
			dp[i][j+1] = min(dp[i-1][j+1],dp[i-1][j]+dis[j]*we[i-1]);
		}
	}
	cout << dp[m][n] << endl;
}

Measured memory_bytes: 8996
#![allow(non_snake_case)]
use proconio::input;
use std::collections::HashSet;
use std::cmp::max;

fn main() {
    input! {
        H: usize,
        W: usize,
        M: i64,
        tmpHWs: [(usize, usize); M],
    }

    let mut HWs: Vec<(usize, usize)> = Vec::new();
    let mut set: HashSet<(usize, usize)> = HashSet::new();
    for &(h, w) in tmpHWs.iter() {
        let p: (usize, usize) = (h - 1, w - 1);
        HWs.push(p);
        set.insert(p);
    }

    // どの行に何個あるか
    let mut h_cnt: Vec<i64> = vec![0i64; H];

    // どの列に何個あるか
    let mut w_cnt: Vec<i64> = vec![0i64; W];

    for &(h, w) in HWs.iter() {
        h_cnt[h] += 1;
        w_cnt[w] += 1;
    }

    let mut h_cnt_max = 0;
    let mut ans_h_cands: Vec<usize> = Vec::new();

    for (h, &cnt) in h_cnt.iter().enumerate() {
        if cnt > h_cnt_max {
            ans_h_cands = Vec::new();
            ans_h_cands.push(h);

            h_cnt_max = cnt;
        } else if cnt == h_cnt_max {
            ans_h_cands.push(h);
        }
    }

    let mut w_cnt_max = 0;
    let mut ans_w_cands: Vec<usize> = Vec::new();


    for (w, &cnt) in w_cnt.iter().enumerate() {
        if cnt > w_cnt_max {
            ans_w_cands = Vec::new();
            ans_w_cands.push(w);

            w_cnt_max = cnt;
        } else if cnt == w_cnt_max {
            ans_w_cands.push(w);
        }
    }

    // dbg!(h_cnt_max);
    // dbg!(w_cnt_max);

    // for &(h, w) in set.iter() {
    //     eprintln!("({}, {})", h, w);
    // }

    let mut ans = 0i64;
    for &h in ans_h_cands.iter() {
        for &w in ans_w_cands.iter() {
            // eprintln!("({}, {}) as cand", h, w);

            if set.contains(&(h, w)) {
                let cand = h_cnt_max + w_cnt_max - 1;
                ans = max(ans, cand);
            } else {
                let cand = h_cnt_max + w_cnt_max;
                println!("{}", cand);
                return;
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 33448
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define maxn 105
#define ll long long 
using namespace std;

int n,m,c,mo,i,j,k;
ll f[2][maxn][maxn];
ll mul[maxn][maxn*maxn],C[maxn][maxn];

ll ksm(ll x,ll y){
	ll s=1;
	for(;y;y/=2,x=x*x%mo) if (y&1)
		s=s*x%mo;
	return s;
}

int main(){
	scanf("%d%d%d%d",&n,&m,&c,&mo);
	for(mul[0][0]=1,i=1;i<=c;i++){
		mul[i][0]=1;
		for(j=1;j<=n*m;j++) mul[i][j]=mul[i][j-1]*i%mo;
	}
	for(C[0][0]=1,i=1;i<=max(n,m);i++) for(C[i][0]=1,j=1;j<=i;j++)
		C[i][j]=(C[i-1][j]+C[i-1][j-1])%mo;
	int p=0,q=1;
	for(int x=1;x<=c;x++){
		p^=1,q^=1; memset(f[p],0,sizeof(f[p]));
		for(i=0;i<=max(n,m);i++) f[q][0][i]=f[q][i][0]=0; f[q][0][0]=1;
		for(i=n;i>=0;i--) for(j=m;j>=0;j--) if (f[q][i][j]) for(k=0;k<=n-i;k++)
			(f[p][i+k][j]+=f[q][i][j]*mul[x][(m-j)*k]%mo*mul[c-x+1][j*k]%mo*C[i+k][k])%=mo;
		p^=1,q^=1; memset(f[p],0,sizeof(f[p]));
		for(i=n;i>=0;i--) for(j=m;j>=0;j--) if (f[q][i][j]) for(k=0;k<=m-j;k++)
			(f[p][i][j+k]+=f[q][i][j]*mul[x][(n-i)*k]%mo*mul[c-x+1][i*k]%mo*C[j+k][k])%=mo;
		p^=1,q^=1; memset(f[p],0,sizeof(f[p]));
		for(i=n;i>=0;i--) for(j=m;j>=0;j--) if (f[q][i][j]) for(k=0;k<=n-i;k++)
			(f[p][i+k][j]+=f[q][i][j]*mul[x][(m-j)*k]%mo*mul[c-x][j*k]%mo*C[i+k][k]*((k&1)?-1:1))%=mo;
		p^=1,q^=1; memset(f[p],0,sizeof(f[p]));
		for(i=n;i>=0;i--) for(j=m;j>=0;j--) if (f[q][i][j]) for(k=0;k<=m-j;k++)
			(f[p][i][j+k]+=f[q][i][j]*mul[x][(n-i)*k]%mo*mul[c-x][i*k]%mo*C[j+k][k]*((k&1)?-1:1))%=mo;
	}
	printf("%lld\n",(f[p][n][m]%mo+mo)%mo);
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A.at(i);
    }
    int max_height = A.at(0);
    int ans = 1;
    int current;
    for (int i = 1; i < N; ++i) {
        current = A.at(i);
        if (current >= max_height) {
            ans++;
            max_height = current;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n,m,l=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
b=[list(map(int,input().split())) for i in range(m)]
c=[[0]*l for i in range(n)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j]+=a[i][k]*b[k][j]
    print(*c[i])


Measured memory_bytes: 7032
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
double a[105];
int main() {
	int n;
	double sum=0.0;
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>a[i];
		sum+=1/a[i];
	}
	cout<<1/sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S; cin >> S;
  int N = S.size();
  ll ans = 0, cnt = 0;
  REP(i, N){
    if(S[i] == 'B') cnt++;
    if(S[i] == 'W') ans += cnt;
  }
  cout << ans << endl;
}

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

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

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}




void _main() {
        ll now = 100, x; cin >> x;
        int steps = 0;
        while (now < x) {
                now += now / 100;
                steps++;
        }

        cout << steps;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int A[2010];
    rep(i, N) cin >> A[i];
    int ans = 0;
    rep(i, N) {
        int cnt = 0;
        int cnt1 = 0;
        int d = 0;
        rep(j, N) {
            if (i + j < N) {
                if (A[i] > A[(i +j) % N]) cnt++;
            }
            else {
                if (A[i] > A[(i + j) % N]) cnt1++;
            }
        }
        ans = (ans + ((K * (K + 1) / 2) % mod) * cnt)  % mod;
        ans = (ans + ((K * (K - 1) / 2) % mod) * cnt1)  % mod;
        //cout << ans << " " << cnt << " " << cnt1 << endl;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
int func(int a)
{
	int i=0;
	for(i=0;i<=a;i++)
	{
		if(i*i==a)
			return i;
	}
	return 0;
}
int func_2(int a)
{
	int n=1;
	while(a)
	{
		a/=10;
		n*=10;
	}
	return n;
}
int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	a=a*func_2(b)+b;
	if(func(a))
		printf("Yes");
	else
		printf("No");
}

Measured memory_bytes: 256
from collections import deque
n, q = map(int, input().split())
deq = deque()
for i in range(n):
    name, time = input().split(); time = int(time)
    deq.append((time, name))
ans = []
cur = 0
while deq:
    time, name = deq.popleft()
    if time <= q:
        cur += time
        ans.append("%s %d" % (name, cur))
    else:
        cur += q
        deq.append((time-q, name))
print(*ans, sep="\n")



Measured memory_bytes: 13380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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;
    vector<ll> v(n), p(n), q(n);
    rep(i,n) cin>>p[i];
    rep(i,n) cin>>q[i];
    rep(i,n) v[i]=i+1;
    ll a,b;
    ll cnt=0;
    do{
        bool ifp=true, ifq=true;
        rep(i,n){
            if(v[i]!=p[i]) ifp=false;
            if(v[i]!=q[i]) ifq=false;
        }
        if(ifp) a=cnt;
        if(ifq) b=cnt;
        cnt++;
    }while(next_permutation(v.begin(), v.end()));
    cout<<abs(a-b)<<endl;
    return 0;
}

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

int H, W, N, sr, sc;
string S, T;

bool solve() {
    int rr, cc;
    // L
    cc = sc;
    for (int i=0; i<N; ++i) {
        if (S[i] == 'L') cc--;
        if (cc < 1) return false;
        if (T[i] == 'R' && cc+1<=W) cc++;
    }

    // R
    cc = sc;
    for (int i=0; i<N; ++i) {
        if (S[i] == 'R') cc++;
        if (W < cc) return false;
        if (T[i] == 'L' && cc-1>0) cc--;
    }

    // U
    rr = sr;
    for (int i=0; i<N; ++i) {
        if (S[i] == 'U') rr--;
        if (rr < 1) return false;
        if (T[i] == 'D' && rr+1<=H) rr++;
    }

    // D  
    rr = sr;
    for (int i=0; i<N; ++i) {
        if (S[i] == 'D') rr++;
        if (H < rr) return false;
        if (T[i] == 'U' && rr-1>0) rr--;
    }

    return true;
}

int main(){
    cin >> H >> W >> N >> sr >> sc;
    cin >> S >> T;
    cout << (solve() ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 776
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

int main()
{
    int n;
    cin >> n;
    auto a = vector<int>(n);
    for (auto& a_i : a) {
        cin >> a_i;
    }

    auto factors = vector<vector<int>>(1'000'005);
    for (int a_i = 1; a_i <= 1'000'000; ++a_i) {
        auto x = a_i;
        factors[a_i].push_back(1);

        if (x % 2 == 0) {
            do { x /= 2; } while (x % 2 == 0);
            factors[a_i].push_back(2);
        }
        if (x % 3 == 0) {
            do { x /= 3; } while (x % 3 == 0);
            factors[a_i].push_back(3);
        }

        for (int d = 5; d * d <= x;) {
            if (x % d == 0) {
                do { x /= d; } while (x % d == 0);
                factors[a_i].push_back(d);
            }
            d += 2;
            if (x % d == 0) {
                do { x /= d; } while (x % d == 0);
                factors[a_i].push_back(d);
            }
            d += 4;
        }

        if (x > 1) {
            factors[a_i].push_back(x);
        }
    }

    auto factor_count = vector<int>(1'000'005);
    for (auto a_i : a) {
        for (auto f : factors[a_i]) {
            factor_count[f]++;
        }
    }

    auto sharing = 0;
    for (auto f = 1; f <= 1'000'000; ++f) {
        if (f == 1) continue;
        sharing = max(sharing, factor_count[f]);
    }
    if (sharing <= 1) {
        cout << "pairwise coprime" << endl;
        return 0;
    }
    if (sharing < n) {
        cout << "setwise coprime" << endl;
        return 0;
    }

    cout << "not coprime" << endl;
    return 0;
}


Measured memory_bytes: 69756
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
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;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll n, k; cin >> n >> k;
    vector<long long> vec(n);
    for(long long i = 0; i < n; i ++){
        cin >> vec[i];
    }

    ll cnt = 0;
    for(ll i = 0; i < n; i++){
        if(i >= k){
            if(vec[i] > vec[cnt]){
                cout << "Yes" << endl;
            }else{
                cout << "No" << endl;
            }
            cnt++;
        }
    }

}

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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

class LazySegmentTree {
private:
	int size_;
	vector<long long> v, lazy;
	void update(int a, int b, long long x, int k, int l, int r) {
		push(k, l, r);
		if (r <= a || b <= l) return;
		if (a <= l && r <= b) {
			lazy[k] = x;
			push(k, l, r);
		}
		else {
			update(a, b, x, k * 2, l, (l + r) >> 1);
			update(a, b, x, k * 2 + 1, (l + r) >> 1, r);
			v[k] = merge(v[k * 2], v[k * 2 + 1]);
		}
	}
	long long query(int a, int b, int k, int l, int r) {
		push(k, l, r);
		if (r <= a || b <= l) return 0;
		if (a <= l && r <= b) return v[k];
		long long lc = query(a, b, k * 2, l, (l + r) >> 1);
		long long rc = query(a, b, k * 2 + 1, (l + r) >> 1, r);
		return merge(lc, rc);
	}
 
public:
	LazySegmentTree() : v(vector<long long>()), lazy(vector<long long>()) {};
	LazySegmentTree(int n) {
		for (size_ = 1; size_ < n;) size_ <<= 1;
		v.resize(size_ * 2);
		lazy.resize(size_ * 2);
	}
	inline void push(int k, int l, int r) {
		if (lazy[k] != 0) {
			v[k] = lazy[k] * (r - l);
			if (r - l > 1) {
				lazy[k * 2] = lazy[k];
				lazy[k * 2 + 1] = lazy[k];
			}
			lazy[k] = 0;
		}
	}
	inline long long merge(long long x, long long y) {
		return x + y;
	}
	inline void update(int l, int r, long long x) {
		update(l, r, x, 1, 0, size_);
	}
	inline long long query(int l, int r) {
		return query(l, r, 1, 0, size_);
	}
};

LazySegmentTree seg;
int n,q;


int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>n>>q;
	seg = LazySegmentTree(n);
	while(q--)
	{
		ll pos, v;
		cin>>pos>>v;
		pos--;
		ll lo = 0; ll hi = pos;
		ll ans = -1;
		while(lo<=hi)
		{
			ll mid = (lo+hi)>>1;
			ll val = seg.query(mid,mid+1)*(pos-mid+1) - seg.query(mid,pos+1);
			if(val<=v)
			{
				ans=mid;
				hi=mid-1;
			}
			else
			{
				lo=mid+1;
			}
		}
		ll cur = seg.query(ans,ans+1);
		ll val = cur*(pos-ans+1) - seg.query(ans,pos+1);
		v-=val;
		cur+=v/(pos-ans+1);
		v%=(pos-ans+1);
		seg.update(ans,ans+v,cur+1);
		seg.update(ans+v,pos+1,cur);
	}
	for(int i = 0; i < n; i++)
	{
		cout<<seg.query(i,i+1)<<'\n';
	}
}


Measured memory_bytes: 5760
#-swank
(unless (member :child-sbcl *features*)
  (quit
	:unix-status
	(process-exit-code
	  (run-program *runtime-pathname*
				   `("--control-stack-size" "128MB"
					 "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
					 "--eval" "(push :child-sbcl *features*)"
					 "--script" ,(namestring *load-pathname*))
				   :output t :error t :input t))))

(let ((a (read))
	  (b (read))
	  (c (read))
	  (d (read)))
  (princ (max 0
			  (- (min b d) (max a c)))))


Measured memory_bytes: 8504
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        long a = fs.nextInt();
        long b = fs.nextInt();
        long c = fs.nextInt();
        if(c>a+b){
            long left = 4*a*b;
            long right = (c-a-b)*(c-a-b);
            if(left < right){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }else{
            System.out.println("No");
        }
    }
    static class FastScanner {
            private final InputStream in = System.in;
            private final byte[] buffer = new byte[1024];
            private int ptr = 0;
            private int buflen = 0;
            private boolean hasNextByte() {
                if (ptr < buflen) {
                    return true;
                }else{
                    ptr = 0;
                    try {
                        buflen = in.read(buffer);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    if (buflen <= 0) {
                        return false;
                    }
                }
                return true;
            }
            private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
            private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
            public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
            public String next() {
                if (!hasNext()) throw new NoSuchElementException();
                StringBuilder sb = new StringBuilder();
                int b = readByte();
                while(isPrintableChar(b)) {
                    sb.appendCodePoint(b);
                    b = readByte();
                }
                return sb.toString();
            }
            public long nextLong() {
                if (!hasNext()) throw new NoSuchElementException();
                long n = 0;
                boolean minus = false;
                int b = readByte();
                if (b == '-') {
                    minus = true;
                    b = readByte();
                }
                if (b < '0' || '9' < b) {
                    throw new NumberFormatException();
                }
                while(true){
                    if ('0' <= b && b <= '9') {
                        n *= 10;
                        n += b - '0';
                    }else if(b == -1 || !isPrintableChar(b)){
                        return minus ? -n : n;
                    }else{
                        throw new NumberFormatException();
                    }
                    b = readByte();
                }
            }
            public int nextInt() {
                long nl = nextLong();
                if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
                return (int) nl;
            }
            public double nextDouble() { return Double.parseDouble(next());}
        }
}


Measured memory_bytes: 32412
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  for(int i=1; i<=n; i++){
    //int i =17;
    int total = 0;
    //bool skip = false;
    bool skipX = false;
    for(int x=1; x<=i; x++){
      if(skipX)break;
      bool skipY = false;
      for(int y=x; y<=i; y++){
        if(skipY)break;
        bool skipZ = false;
        for(int z=y; z<=i; z++){
          if(skipZ)break;
          //cout << x << y << z << endl;
          //cout << (x*x + y*y + z*z + x*y + y*z + z*x) << endl;
          if(x*x + y*y + z*z + x*y + y*z + z*x == i){
            if(x == y && y == z){
              total++;
            }else if(x==y || y==z || z==x){
              total = total + 3;
            }else{
              total = total + 6;
            }
            skipZ = true;
          }else if(x*x + y+y + z*z + x*y + y*z + z*x > i){
            skipZ = true;
          }
          
          if(skipZ && z == y)skipY = true;
          if(skipZ && skipY && y == x)skipX = true;
        }
   	  }
    }
    cout << total << endl;
  }
  
  return 0; 
}

Measured memory_bytes: 3508
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int n,m;cin>>n>>m;){
		vi a(n*2);
		rep(i,a.size()) a[i]=i+1;
		rep(i,m){
			int k; cin>>k;
			if(k==0){
				vi b(n*2);
				rep(j,n){
					b[j*2]=a[j];
					b[j*2+1]=a[n+j];
				}
				a=b;
			}
			else
				rotate(a.begin(),a.begin()+k,a.end());
		}
		rep(i,a.size())
			cout<<a[i]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    ll h,w,ans=1e9,a,b,c;
    cin>>h>>w;
    rep(i,h/2){
        a=w*(i+1);
        if((h-i-1)%2==0||w%2==0) b=w*(h-i-1)/2,c=b;
        else b=(max(w,h-i-1)-1)*min(w,h-i-1)/2,c=w*(h-i-1)-b;
        ans=min(ans,max({a,b,c})-min({a,b,c}));
    }
    rep(i,w/2){
        a=h*(i+1);
        if((w-i-1)%2==0||h%2==0) b=h*(w-i-1)/2,c=b;
        else b=(max(h,w-i-1)-1)*min(h,w-i-1)/2,c=h*(w-i-1)-b;
        ans=min(ans,max({a,b,c})-min({a,b,c}));
    }
    cout<<ans;
}

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

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

     string s;
    cin>>s;

     if(n%2==1)
        cout<<"No"<<endl;

     else{
        int z=n/2;
        int e=0;
        for(int i=0;i<z;i++){
            if(s[i]!=s[i+z])
              {
                  e=1;
                  cout<<"No"<<endl;
                  break;
              }


        }

        if(e==0)
            cout<<"Yes"<<endl;
     }
     
     return 0;



}


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

using namespace std;
typedef long long ll;
#define rep(i, n, s) for (int i = s; i < (int)(n); i++)

ll calcNumOfCombination(ll n, ll r) {
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}

int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }

int findSumDigits(int s) {
    int num = 0;
    int temp = 0;
    while (s) {
        temp = s % 10;
        num += temp;
        s = s / 10;
    }
    return num;
}

int main() {
    string s;
    cin >> s;
    int ans = 0;
    int count = 0;

    for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
            count++;
        } else {
            if (count > ans) {
                ans = count;
            }
            count = 0;
        }
    }

    if (count > ans) {
        ans = count;
    }

    cout << ans << endl;


    return 0;
}

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

#define debug(x) cout <<"DEBUG"<<" "<<#x<<":"<<x<<'\n'

//↓0-indexか1-indexでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-index昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-index昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-index降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-index降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

/* 円周率は M_PI を使おうね */
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;

/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    //cin.tie(nullptr);
    //ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(15);

    int n;
    while(cin >> n) {
        vi a(n); rep(i,n) cin >> a[i];
        int cnt = 0;
        sort(all(a));
        rep1(i,n-1) {
            a[i] = a[i-1] + a[i];
        }
        rep(i,n) {
            cnt += a[i];
        }
        cout << cnt << '\n';
    }
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N;

int main()
{
    cin >> N;
    vector<int> p(N);
    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
    }
    int ans = 0;
    for (int i = 0; i + 2 < N; i++)
    {
        if (p[i] < p[i + 1] && p[i + 1] < p[i + 2])
            ans++;
        if (p[i] > p[i + 1] && p[i + 1] > p[i + 2])
            ans++;
    }
    cout << ans << endl;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    string ans = "Yay!";
    if (a > 8 || b > 8)
    {
        ans = ":(";
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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 X,Y; cin>>X>>Y;
  ll ans=1;
  while(true){
    X*=2;
    if(X>Y) break;
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}


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

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

int main(){
    int x;
    cin >> x;
    string ans = "Yes";
    if(x < 30){
        ans = "No";
    }
    cout << ans << endl;
}


Measured memory_bytes: 3588
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextStr() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRuneAt(s string, i int) rune {
	rs := []rune(s)
	return rs[i]
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	str := nextStr()

	var count = 0
	for index := 0; index < n; index++ {
		if getRuneAt(str, index) == rune('R') {
			count++
		}
	}
	if count > n-count {
		fmt.Print("Yes")
		return
	}
	fmt.Print("No")
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=(n);i++)
#define Endl endl
int main(){
	string s,t;
	int count=0;
	cin>>s>>t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end());
	int minst=min(s.size(),t.size());
	for(int i=0;i<minst;i++){
		if(s[i]==t[i]){
			count++;
		}
	}
	if(s.size()<t.size() && count==minst){
		cout<<"Yes"<<Endl;
		return 0;
	}
	for(int i=0;i<t.size();i++){
		if(t[i]>s[0]){
			cout<<"Yes"<<Endl;
			return 0;
		}
	}
	cout<<"No"<<Endl;
	return 0;
}

Measured memory_bytes: 256