akhauriyash/Code-Regression huggingface dataset:
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int H, W, N;  cin >> H >> W >> N;
    int Sr, Sc; cin >> Sr >> Sc; Sr--; Sc--;
    string S, T; cin >> S >> T;
    
    vector<char> hd(1, ' ');
    REP(i,N) {
        hd.push_back(S[i]);
        hd.push_back(T[i]);
    }

    map<char, int> dr;
    dr['U'] = 0;
    dr['D'] = 1;
    dr['L'] = 2;
    dr['R'] = 3;

    vvi dp(N * 2 + MGN, vi(4, 0));
    // dp[i][u] : upper limit in case of "YES" in i-th hand.
    dp[N * 2][dr['U']] = 0;
    dp[N * 2][dr['D']] = H-1;
    dp[N * 2][dr['L']] = 0;
    dp[N * 2][dr['R']] = W-1;

    for (int i = N * 2; i > 0; i--) {
        for (int j=0; j<4; j++) {
            dp[i - 1][j] = dp[i][j];
        }

        if (i%2 == 0) { // Ao
            switch(hd[i - 1]) { // Tk
            case 'U':
                dp[i - 1][dr['U']]++;
                break;
            case 'D':
                dp[i - 1][dr['D']]--;
                break;
            case 'L':
                dp[i - 1][dr['L']]++;
                break;
            case 'R':
                dp[i - 1][dr['R']]--;
                break;
            default:
                break;
            }
        } else { // Tk
            switch(hd[i - 1]) { // Ao
            case 'U':
                dp[i - 1][dr['D']]++;
                break;
            case 'D':
                dp[i - 1][dr['U']]--;
                break;
            case 'L':
                dp[i - 1][dr['R']]++;
                break;
            case 'R':
                dp[i - 1][dr['L']]--;
                break;
            default:
                break;
            }
        }

        dp[i - 1][dr['U']] = max(dp[i - 1][dr['U']], 0);
        dp[i - 1][dr['D']] = min(dp[i - 1][dr['D']], H-1);
        dp[i - 1][dr['L']] = max(dp[i - 1][dr['L']], 0);
        dp[i - 1][dr['R']] = min(dp[i - 1][dr['R']], W-1);

        if ((dp[i-1][dr['U']] > dp[i-1][dr['D']]) || (dp[i-1][dr['L']] > dp[i-1][dr['R']])) {
            cout << "NO" << endl;
            return 0;
        }
    }

    string ans ="NO";
    if (dp[0][dr['U']] <= Sr && Sr <= dp[0][dr['D']] 
        && dp[0][dr['L']] <= Sc && Sc <= dp[0][dr['R']]) {
        ans = "YES";
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	int tmp;
	tmp = a;
	a = b;
	b = tmp;
	
	tmp = a;
	a = c;
	c = tmp;
	
	printf("%d %d %d",a,b,c);

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
char c[22][22];


struct NODE{
	int x,y,bit,time;
	NODE(int x,int y,int bit,int time) : x(x) , y(y) , bit(bit) , time(time) {}
};

int num[10] , d[10] , s[10] , e[10];
int done[22][22][1<<8][102] = {};

int dx[] = {0,1,0,-1,0};
int dy[] = {1,0,-1,0,0};
int main(){
	int W,H;
	while(cin >> W >> H && W){
		rep(i,22)rep(j,22) c[i][j] = '#';
		queue<NODE> Q;
		for(int i = 0 ; i < H ; i++){
			for(int j = 0 ; j < W ; j++){
				cin >> c[i+1][j+1];
				if( c[i+1][j+1] == 'P'){
					Q.push(NODE(j+1,i+1,0,0));
					c[i+1][j+1] = '.';
				}
			}
		}
		int N;
		cin >> N;
		for(int i = 0 ; i < N ; i++){
			int g;
			cin >> g;
			num[g] = i;
			cin >> d[i] >> s[i] >> e[i];
		}
		int value[1<<10] = {};
		for(int i = 0 ; i < (1<<N) ; i++){
			for(int j = 0 ; j < N ; j++){
				value[i] += (i>>j&1) * d[j];
			}
			//cout << value[i] << " " << i << endl;
		}
		
		memset(done,0,sizeof(done));
		int ans = 0;
		while(Q.size()){
			NODE q = Q.front(); Q.pop();
			if( q.time > 100 ) continue;
			if( c[q.y][q.x] != '.' ) continue;
			for(int i = 0 ; i < 4 ; i++){
				int tx = q.x + dx[i];
				int ty = q.y + dy[i];
				if( c[ty][tx] >= '0' && c[ty][tx] <= '9' ){
					int idx = num[c[ty][tx]-'0'];
					if( s[idx] <= q.time && q.time < e[idx] ) q.bit |= 1<<idx;
					
				}
			}
			if( done[q.x][q.y][q.bit][q.time]++ ) continue;
			ans = max( ans , value[q.bit] );
			for(int i = 0 ; i < 5 ; i++){
				Q.push(NODE(q.x+dx[i],q.y+dy[i],q.bit,q.time+1));
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 55000
N = int(input())
W = list(map(int,input().split()))
S1 = 0
S2 = sum(W)
Min = S2
for i in range(N):
    S1 += W[i]
    S2 -= W[i]
    if abs(S1-S2) < Min:
        Min = abs(S1-S2)
print(Min)

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    unordered_map<string, int64_t> m;
    for (auto _ : irange(0L, n)) {
        string s;
        cin >> s;
        ++m[s];
    }

    for (const auto* key : {"AC", "WA", "TLE", "RE"}) {
        cout << key << " x " << m[key] << endl;
    }
}

Measured memory_bytes: 3636
#include <iostream>
#include <queue>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

    int n, m;
    cin >> n >> m;

    vector<vector<int> > dp(n);
    REP(i, m) {
        int a, b;
        cin >> a >> b;
        dp[a-1].push_back(b-1);
        dp[b-1].push_back(a-1);
    }

    vector<int> dist(n, -1);
    queue<int> q;
    vector<int> pre(n, -1);

    dist[0] = 0;
    q.push(0);

    while(!q.empty()) {
        int v = q.front();
        q.pop();
        for (int i : dp[v]) {
            if (dist[i] != -1) continue ;
            dist[i] = dist[v] + 1;
            q.push(i);
            pre[i] = v;
        }
    }

    cout << "Yes" << '\n';
    REP(i, n) {
        if (i == 0) continue ;
        cout  << pre[i] + 1<< '\n';
    }
    return 0;
}


Measured memory_bytes: 10536
N = input()

if N[-1]=="2" or N[-1]=="4" or N[-1]=="5" or N[-1]=="7" or N[-1]=="9":
    print("hon")
if N[-1]=="0" or N[-1]=="1" or N[-1]=="6" or N[-1]=="8":
    print("pon")
if N[-1]=="3":
    print("bon")

Measured memory_bytes: 61764
parseInt(x) = parse(Int, x)

function main()
	h, w = map(parseInt, split(readline()))
	a = Array{Int}(w, h)
	for i in 1:h
		a[:, i] = map(parseInt, readline()|> split)
	end
	count = 0
	anstr = Array{Array{Int, 1}}(0)
	if w > 1
		for i in 1:w-1
			for j in 1:h
				if a[i,j] %2 == 1
					a[i+1,j] += 1
					count += 1
					push!(anstr, [j, i, j, i+1])
				end
			end
		end
	end
	for j in 1:h-1
		if a[w,j] %2 == 1
			a[w,j+1] += 1
			count += 1
			push!(anstr, [j, w, j+1, w])
		end
	end
	println(count)
	for i in 1:count
		println(anstr[i][1], " ", anstr[i][2], " ", anstr[i][3], " ", anstr[i][4])
	end
end

main()

Measured memory_bytes: 177816
n = int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]

same = 0

for i in range(n):
  if x[i] == y[i]:
    same += 1
  else:
    same = 0
  if same >= 3:
    print("Yes")
    exit()
    
print("No")

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

int digitnum;
vector<string> S;

int dn(int num, int cnt){
    int d = num / 10;
    cnt++;
    if(d > 0) return dn(d, cnt);
    else return cnt;
}

void dfs(string t, int s){
    S.push_back(t + '3');
    S.push_back(t + '5');
    S.push_back(t + '7');
    if(s + 1 == digitnum) return;
    else{
        dfs(t + '3', s + 1);
        dfs(t + '5', s + 1);
        dfs(t + '7', s + 1);
    }
}

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

    int n;
    cin >> n;
    
    digitnum = dn(n, 0);
    dfs("", 0);

    vector<int> T;
    for(auto x : S){
        bool d = false, e = false, f = false;
        for(int i = 0; i < x.size(); i++){
            if(x[i] == '3') d = true;
            if(x[i] == '5') e = true;
            if(x[i] == '7') f = true;
        }
        if(d and e and f) T.push_back(stoi(x));
    }

    sort(T.begin(), T.end());

    int ans = upper_bound(T.begin(), T.end(), n) - T.begin();
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2428
#include "bits/stdc++.h"
using namespace std;

int main() {
	string S;
	int N, K;
	char C;
	cin >> N >> S >> K;
	C = S[K - 1];
	for (int i = 0; i < N; i++) {
		if (S[i] == C) cout << C;
		else cout << '*';
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
const double PI  =3.141592653589793238463;
using namespace std;
using ll = long long;
const ll INF = +10010010000;
typedef pair<ll,ll> P;
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

ll ppow(int n){
    if(n==0)return 1;
    else return 2*ppow(n-1)%mod;
}

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n)cin >> a[i];
    ll ans = 0;
    rep(i,60){
        ll x=0;
        rep(j,n)if((a[j]>>i)&1)++x;
        ll e = n-x;
        ans += ((x*e%mod) * ppow(i));
        // ans += x*e % mod * pow(2,i)%mod;
    }
    cout << ans%mod << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>

int main() {
	int W,H,x,y,r;

	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

	if (x-r<0|| y-r<0)  printf("No\n");
	else if (x+r>W || y+r>H) printf("No\n");
	else printf("Yes\n");

	return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

const int mod = 1000000007;

int main(){
    int n, k; cin >> n >> k;
    ll ans = 0;
    for(ll i = k; i <= n+1; i++){
        ll small = i * (i-1) / 2;
        ll large = (2*n - i + 1) * i / 2;
        ll res = large - small + 1;
        ans = (ans + res) % mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//vector<pair<ll,ll>> pc;
//int ABS(int a){return max(a,-a);}
int main(){
    double t,x;
    cin>>t>>x;
    printf("%.10f",t/x);
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())
T0 = list(map(int, input().split()))
V = list(map(int, input().split()))

INF = 1000
def main():
    Tmax = 0
    T = [0]
    for t in T0:
        Tmax += t
        T.append(Tmax)

    preh = 0
    ans = 0
    for t0 in range(2*Tmax+1):
        t = t0/2
        height = INF
        for n in range(-1, N+1):
            if n == -1:
                t1, t2, v = -1, 0, 0
            elif n == N:
                t1, t2, v = Tmax, Tmax+1, 0
            else:
                t1, t2, v = T[n], T[n+1], V[n]
            
            if t < t1:
                y = v + t1 - t
            elif t1 <= t <= t2:
                y = v
            else:
                y = v + t - t2
            height = min(height, y)
        
        ans += (preh + height)*0.5/2
        preh = height
    print(ans)

if __name__ == "__main__":
    main()

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

const ll INF = 1LL << 60;

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

int main() {
	
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i, n) cin >> h.at(i);
	
	vector<ll> dp(n, INF);
	
	dp.at(0) = 0;
	for(int i=1; i<n; i++){
		chmin(dp.at(i), dp.at(i-1) + abs(h.at(i) - h.at(i-1)));
		if(i > 1) chmin(dp.at(i), dp.at(i-2) + abs(h.at(i) - h.at(i-2)));
	}
	cout << dp.at(n-1) << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll  long long int
#define endl '\n'

ll vis[105];
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	
	//ll t; cin>>t; while(t--)
	{
		ll x,n;
		cin>>x>>n;
		
		ll ar[n];
		for(int i=1;i<=n;i++)
		cin>>ar[i],vis[ar[i]]=true;

		ll res=INT_MAX;
		ll ans=0;
		for(int i=0;i<=101;i++)
		{
			if(!vis[i])
			{
				if(abs(i-x)<res)
				{
					res=abs(i-x);
					ans=i;
				}
			}
		}
		cout<<ans;
	}
	
   
	
}

Measured memory_bytes: 3680
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] rank = new int[9];
        for (int i = 0; i < n; i++) {
            int tmp = sc.nextInt();
            if (tmp >= 3200) {
                tmp = 3200;
            }
            rank[tmp/400]++;
        }

        int colors = 0;
        for (int i = 0; i < rank.length - 1; i++) {
            if (rank[i] != 0) {
                colors++;
            }
        }
        int color_min = (colors == 0)? 1: colors;
        int color_max = colors + rank[8];
        System.out.println(color_min + " " + color_max);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  ll res = 0;
  for(int i = 0;i <= n - 1;i++){
    ll num = 0;
    cin >> num;
    while(1){
      if(num % 2 == 1)break;
      num /= 2;
      res++;
    }
  }
  cout << res << endl;
  return 0;
}

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

int main() {
    int n;
    int a[3][3];
    int i, j, k;
    for(i = 0; i < 3; i++) {
        for(j = 0; j < 3; j++) {
            cin >> a[i][j];
        }
    }

    cin >> n;
    vector<int> b(n);

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

    for(i = 0; i < 3; i++) {
        for(j = 0; j < 3; j++) {
            for(k = 0; k < n; k++) {
                if(a[i][j] == b[k]) {
                    a[i][j] = 0;
                }
            }
        }
    }

    int cnt_x;
    int cnt_y;
    string ret = "No";
    for(i = 0; i < 3; i++) {
        cnt_x = 0;
        cnt_y = 0;
        for(j = 0; j < 3; j++) {
            cnt_x += a[i][j];
            cnt_y += a[j][i];
        }
        if(cnt_x == 0 || cnt_y == 0) {
            ret = "Yes";
            break;
        }
    }

    int cross_left = 0;
    int cross_right = 0;
    for(i = 0; i < 3; i++) {
        cross_left += a[i][i];
        cross_right += a[2 - i][i];
    }
    if(cross_left == 0 || cross_right == 0) {
        ret = "Yes";
    }

    cout << ret << endl;
 }

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while(0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

typedef std::pair<bool,ll> PBL;
ll N;
vector<PBL> v[16]; // {isHonest,  person id}

signed main() {
  cin >> N;
  rep(i,N) {
    ll A;
    cin >> A;
    rep(j,A){
      ll x,y;
      cin>>x>>y;
      x--;
      v[i].emplace_back(y, x); 
    }
  }
  ll ans = -1;
  for (ull bit=0; bit < ((ull)1 << N); bit++) {
    //printf("0x%02x\n", bit);
    bool ok = true;
    ll nHonest = 0;
    rep(i, N) {
      bool iIsHonest = (bit >> i) & 1;
      if (!iIsHonest)
        continue;
      nHonest++;
      rep(j,  v[i].size()) {
        bool tIsHonest = v[i][j].first;
        if (tIsHonest != ((bit >> v[i][j].second) & 1)) {
          ok = false;
        }
      }
    }
    if (ok) {
      //cout << "ans: ";
      //rep(i, N) {
      //  if ((bit >> i) & 1) {
      //    cout << i << " ";
      //  }
      //}
      //cout << endl;
      ans = max(ans, nHonest);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n,k=map(int, input().split())
S = []
for i in range(k):
    d1 = int(input())
    
    S.append(list(map(int, input().split())))

ans = [0]*n

for i,s in enumerate(S):
    for d in s:
        ans[int(d)-1]+=1


cnt = 0
for i in ans:
    if i == 0:
        cnt+=1
print(cnt)

Measured memory_bytes: 9196
import sys, re
from math import ceil, floor, sqrt, pi, factorial#, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    n = i_input()
    if n == 3 or n == 5 or n == 7:
        YES()
    else:
        NO()

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  map<ll,ll> mp;
  for(int i = 0;i < n;i++)cin >> a[i],mp[a[i]]++;
  sort(a.rbegin(),a.rend());
  ll res = 0;
  for(int i = 0;i < n;i++){
    if(mp[a[i]] == 0)continue;
    mp[a[i]]--;
    ll now = 2;
    while(1){
      if(now > a[i])break;
      now *= 2;
    }
    ll pan = now - a[i];
    if(mp[pan] >= 1)res++,mp[pan]--;
  }
  cout << res << endl;
}

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

using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)


bool k_flip(string s, int k)
{
    int n = s.length();

    int status = 0;
    deque<int> endindex;

    rep(i, n - k + 1)
    {
        if (endindex.size() % 2 == 0 && s[i] == '1')
        {
            s[i] = '0';
            endindex.push_back(i + k - 1);
        }
        else if (endindex.size() % 2 == 1 && s[i] == '1')
        {
            s[i] = '0';
        }
        else if (endindex.size() % 2 == 1 && s[i] == '0')
        {
            endindex.push_back(i + k - 1);
        }

        if (endindex.front() == i)
            endindex.pop_front();
    }

    rep2(i, n - k + 1, n)
    {
        if (endindex.size() % 2 == 1)
        {
            if (s[i] == '0')
                s[i] = '1';
            else
                s[i] = '0';
        }

        if (endindex.front() == i)
            endindex.pop_front();
    }

    rep(i, k)
        if (s[i] == '1')
            status++;

    if (!status)
        return 1;
    else
        return 0;
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    string s;
    cin >> s;
    int ok, ng, mid;

    if (k_flip(s, s.length()))
        cout << s.length() << endl;
    else
    {
        ok = 0, ng = s.length();
        while (ng - ok> 1)
        {
            mid = (ok + ng) / 2;
            if (k_flip(s, mid))
                ok = mid;
            else
                ng = mid;
            
        }
        cout << ok << endl;
    }

    return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

bool isGdPrime(int n)
{
    if (n == 1)
    {
        return false;
    }
    if (n % 7 == 1 || n % 7 == 6)
    {
        for (int i = 2; i * i <= n; i++)
        {
            if (!(i % 7 == 1 || i % 7 == 6))
            {
                continue;
            }
            if (n % i == 0)
            {
                return false;
            }
        }
        return true;
    }
    else
    {
        return false;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true)
    {
        int N;
        cin >> N;
        if (N == 1)
        {
            break;
        }
        vector<int> v;

        for (int i = 1; i * i <= N; i++)
        {
            if (N % i == 0)
            {
                v.push_back(i);
                v.push_back(N / i);
            }
        }
        sort(ALL(v));
        v.erase(unique(ALL(v)), v.end());

        cout << N << ":";
        for (int i = 0; i < (int)v.size(); i++)
        {
            if (isGdPrime(v[i]))
                cout << " " << v[i];
        }
        cout << endl;
    }
}


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

int main(void){
    int A,B,C,X,Y;
    cin>>A>>B>>C>>X>>Y;
    
    int sum=1000000000;
    for(int i=0;i<=max(X,Y);i++){
        sum=min(sum,i*2*C+A*max(0,X-i)+B*max(0,Y-i));
    }
    
    cout<<sum<<endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(),x.end()
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9+7;
const ll INF = 1e18;
const int MAX = 1e6;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

// struct edge {int to, cost;}; // 辺
// vector<edge> graph[MAX]; // 隣接リスト
// bool visited[MAX]; // 訪問状況


int main() {
    // input
    int h, w;
    cin >> h >> w;
    char a[h][w];
    rep(i, h) {
        rep(j, w) {
            cin >> a[i][j];
        }
    }
    // solve
    bool skip_i[h];
    bool skip_j[w];
    memset(skip_i, 1, sizeof(skip_i));
    memset(skip_j, 1, sizeof(skip_j));
    rep(i, h) {
        rep(j, w) {
            if (a[i][j] == '#') {
                skip_i[i] = false;
                skip_j[j] = false;
            }
        }
    }
    // output
    rep(i, h) {
        if (skip_i[i]) continue;
        rep(j, w) {
            if (skip_j[j]) continue;
            cout << a[i][j];
        }
        printf("\n");
    }
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;//typo用
using uintl = unsigned long long;
using itn = int;//typo用
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a) - 1; i >= (intl)(b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl//1次元配列の出力
#define rrdebug(i, j, x) rep(i, alength(x))rep(j, alength(x[i]))cout << #x << "[" << i << "][" << j << "]:" << x[i][j] << endl//二次元配列の出力
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = acos(-1);
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
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; }
intl gcd(intl a, intl b){ if(!b)return a; return gcd(b, a % b); }
intl lcm(intl a,intl b){ return a / gcd(a, b) * b; }
intl kai(intl k){//k!を求める関数,
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl digit10(intl a){//aを10進数で表したときの桁数を求める関数
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}

//--------------入力受け取る場所----------------------------------------------------
char c;
void input_var(){
    cin >> c;

}
//-------------------------------------------------------------------------------


signed main(){
    cout << fixed << setprecision(10);
    input_var();
    fp(c >= 'a',"a","A");
    return 0;
}


Measured memory_bytes: 3628
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        int n = sc.nextInt();
        long a[] = new long[3 * n];
        for (int i = 0; i < 3 * n; i++) {
            a[i] = sc.nextLong();
        }

        long sumr[] = new long[n + 1];
        long sumb[] = new long[n + 1];
        Queue<Long> rq = new PriorityQueue<>((o1, o2) -> Long.compare(o1, o2));
        Queue<Long> bq = new PriorityQueue<>((o1, o2) -> Long.compare(o2, o1));
        for (int i = 0; i < n; i++) {
            rq.add(a[i]);
            sumr[0] += a[i];
            bq.add(a[2 * n + i]);
            sumb[n] += a[2 * n + i];
        }

        for (int i = n; i < 2 * n; i++) {
            sumr[i - n + 1] = sumr[i - n] + a[i];
            rq.add(a[i]);
            sumr[i - n + 1] -= rq.poll();
            sumb[2 * n - i - 1] = sumb[2 * n - i] + a[3 * n - i - 1];
            bq.add(a[3 * n - i - 1]);
            sumb[2 * n - i - 1] -= bq.poll();
        }

        long ans = sumr[n] - sumb[n];
        for (int i = 0; i < n; i++) {
            ans = Math.max(ans, sumr[i] - sumb[i]);
        }
        System.out.println(ans);
    }

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


Measured memory_bytes: 106900
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <numeric>
#include <map>
#include <cstring>
using namespace std;

int main()
{
    long long N, Q;
    cin >> N;
    cin >> Q;

    std::map<long long, std::vector<long long>> C;
    for (long long i = 0; i < N - 1; i++) {
        long long a, b;
        cin >> a;
        cin >> b;
        if (a > b) {
            std::swap(a, b);
        }
        if (C.count(a) == 0) {
            std::vector<long long> r;
            C[a] = r;
        }
        C[a].push_back(b);
    }

    long long S[200001];
    memset(S, 0, sizeof(S));
    for (long long i = 0; i < Q; i++) {
        long long p, x;
        cin >> p;
        cin >> x;
        S[p - 1] += x;
    }

    for (long long i = 1; i < N; ++i) {
        if (C.count(i) == 0) {
            continue;
        }
        auto r = C[i];
        auto s = S[i - 1];
        for (auto j : r) {
            S[j - 1] += s;
        }
    }

    for (long long i = 0; i < N; ++i) {
        std::cout << S[i] << " ";
    }
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 25856
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int X, Y; cin >> X >> Y;
    for (int i = 0; i <= X; ++i) {
        int j = X - i;
        if (i * 2 + j * 4 == Y) {
            printf("%s\n", "Yes");
            return 0;
        }
    }
    printf("%s\n", "No");
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int mod = 1e9 + 7;

int gcd(int a, int b)
{
	if (a % b == 0)
	{
		return (b);
	}
	else
	{
		return (gcd(b, a % b));
	}
}
int main(void)
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n;i++){
        cin >> a[i];
    }
    int ans = a[0];

    for (int i = 0; i < n;i++){
        ans = gcd(a[i], ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
N = int(input())
H = list(map(int, input().split()))

dp = [10**9]*N
dp[0] = 0
for i in range(N):
    if i+1 <= N-1:
        dp[i+1] = min(dp[i+1], dp[i]+abs(H[i+1]-H[i]))
    if i+2 <= N-1:
        dp[i+2] = min(dp[i+2], dp[i]+abs(H[i+2]-H[i]))
print(dp[N-1])


Measured memory_bytes: 52208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main(){
    int n,x,t;
    cin >> n >> x >> t;
    int ans;
    if(n%x==0) cout << n/x*t;
    else cout << (n/x+1)*t;
}

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

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    for(int i=0; i<N; i++){
        cin >> h.at(i);
    }

    sort (h.begin(), h.end());
    //h 1 1 2 4 5 8
    //R

    int m;
    m = pow (10, 9);
    for(int i=0; i+K-1 < N; i++){
        m = min(m, h.at(i+K-1)-h.at(i));
    }

    cout << m << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f


int main()
{
    char s[10];
    scanf("%s",s);
    if(s[2]==s[3]&&s[4]==s[5])
        printf("Yes\n");
    else
        printf("No\n");
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

typedef long long ll;	//偷个懒 
	
ll a,b,c;

int main()
{
	cin>>a>>b>>c;
	if(c-a-b<0)
	{
		cout<<"No"<<endl;
		return 0;
	}
	ll cnt=4*a*b;
	ll ans=(c-a-b)*(c-a-b);
	if(cnt<ans)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
L = input().split()
A = int(L[0])
B = int(L[1])
if A % 2 == 0:
    Amin = A / 0.08
    Aout = (A + 1) / 0.08
else:
    Amin = A / 0.08 + 0.5
    Aout = (A + 1) / 0.08
Bmin = 10*B
Bout = 10*(B + 1)
if Amin < Bout and Bmin < Aout:
    if Amin <= Bmin:
        print(int(Bmin))
    else:
        print(int(Amin))
else:
    print(-1)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3005;
ll a[maxn], dp[maxn][maxn];
int main()
{
    ll n;
    cin >> n;
    for(ll i=0;i<n;i++)cin >> a[i];
    for(ll l=n-1;l>=0;l--){
        for(ll r=l;r<n;r++){
            if(r == l)dp[l][r]=a[l];
            else dp[l][r] = max(a[l]-dp[l+1][r],a[r]-dp[l][r-1]);
        }
    }
    cout << dp[0][n-1] << endl;
    return 0;
}


Measured memory_bytes: 70016
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const long long MAXN=1005,fx[4][2]={{-1,0},{1,0},{0,-1},{0,1}},INF=0x7f7f7f7f7f7f7f7fll;
char s[4]={'L','R','D','U'};
long long n;
struct node
{
	long long x,y;
	node(){}
	node(long long xx,long long yy)
	{
		x=xx,y=yy;
	}
}a[MAXN];
long long b[MAXN];
long long Abs(long long x)
{
	return x>0?x:-x;
}
long long jl(long long x,long long y,long long X,long long Y)
{
	return Abs(x-X)+Abs(y-Y);
}
int main()
{
	scanf("%lld",&n);
	long long key=0;
	for(long long i=1;i<=n;i++)
	{
		scanf("%lld %lld",&a[i].x,&a[i].y);
		if(i!=1&&((a[i].x+a[i].y)%2+2)%2!=((a[i-1].x+a[i-1].y)%2+2)%2)
		{
			key=1;
		}
	}
	if(key)
	{
		printf("-1\n");
		return 0;
	}
	long long z=(a[1].x+a[1].y)%2,m=39;
	if(z==0)
		m++;
	printf("%lld\n",m);
	long long ee=1;
	for(long long i=38;i>=0;i--)
	{
		printf("%lld ",1ll<<i);
		b[ee]=1ll<<i;
		ee++;
	}
	if(m==40)
	{
		printf("1 ");
		b[40]=1ll;
	}
	printf("\n");
	for(long long i=1;i<=n;i++)
	{
		long long X=a[i].x,Y=a[i].y;
		long long nx=0,ny=0;
		for(long long j=1;j<=m;j++)
		{
			long long zy[2]={0ll,INF};
			for(long long o=0;o<4;o++)
			{
				long long x=nx+fx[o][0]*b[j];
				long long y=ny+fx[o][1]*b[j];
				if(jl(x,y,X,Y)<zy[1])
				{
					zy[0]=o;
					zy[1]=jl(x,y,X,Y);
				}
			}
			printf("%c",s[zy[0]]);
			nx=nx+fx[zy[0]][0]*b[j];
			ny=ny+fx[zy[0]][1]*b[j];
		}
		printf("\n");
	}
}

Measured memory_bytes: 256
n = int(input())
dam = list(map(int, input().split()))
mt = [0] * n
SUM = sum(dam)
mt0 = 0
for i in range(0,n,2):
  mt0 += dam[i]
mt[0] = mt0 * 2 - SUM
for i in range(1,n):
  mt[i] = dam[i-1] * 2 - mt[i-1]
print(*mt)

Measured memory_bytes: 14156
import math

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    nf = rf = 1
    for i in range(r):
        nf = nf * (n-i) % mod
        rf = rf * (i+1) % mod
    return nf * pow(rf, mod-2, mod) % mod

if __name__ == "__main__":
    X, Y = map(int, input().split())

    #initial: (X,Y) = (0,0)

    num = 10**9 + 7
    sum = 0
    #print(num)
    for i in range(X+1):# i は1step回数。２stepを行う回数は(X-i)//2(余りあったらbreak)
        if (X-i)% 2 == 0:
            j = (X-i)//2
            #print("i and j is ", i, j)
            if i * 2 + j  == Y:
                #conbination_num1 = (math.factorial(i + j) / math.factorial(i)) % num
                sum += combination(i+j, i, num)  

    print(int(sum))




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

//解説放送視聴後に書いたコード。　すぬけさんありがとう
int main() {

int n;
int sum=0;

cin >> n;
vector<int> vec(n);
rep(i,n)
{cin >> vec[i];
 sum^=vec[i];
}
rep(i,n)
{
  cout<<int(vec[i]^sum)<<" ";
}
cout<<endl;
return 0;
}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

Measured memory_bytes: 3948
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){
	int A,B;
	cin>>A>>B;
	
	if(A>8 || B>8){
		cout<<":("<<endl;
	}else{
		cout<<"Yay!"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,a,t,sum=0;
  for(i=1; i<=5; i++)
  {
      cin>>a;
      if(a==0)
      {
          t=sum+i;
      }
  }
  cout<<t;
}


Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <tuple>
using ll = long long;
using namespace std;

int main(void)
{
    int D;
    cin >> D;
    if (D == 25)
        cout << "Christmas" << endl;
    else if (D == 24)
        cout << "Christmas Eve" << endl;
    else if (D == 23)
        cout << "Christmas Eve Eve" << endl;
    else
        cout << "Christmas Eve Eve Eve" << endl;
    return 0;
}

Measured memory_bytes: 256
#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++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef pair<int, int> p;
typedef priority_queue<p> pq;
typedef priority_queue<p, vector<p>, greater<p>> gpq;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vs s(n);
    REP(i, n)
    {
        cin >> s[i];
    }

    set<string> words;
    string ans = "Yes";
    char shiri = 'a';
    REP(i, n)
    {
        words.insert(s[i]);
        if(i > 0 and shiri != s[i][0])
        {
            ans = "No";
        }
        shiri = s[i][s[i].size() - 1];
    }

    if(words.size() < n)
    {
        ans = "No";
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
#ifndef CLion
//#pragma GCC optimize ("O3")
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>

#define F first
#define S second
#define pb push_back
#define ll long long
#define all(x) x.begin() , x.end()
#define mod(x,m) ((x%m + m)%m)
#define rep(i,s,e) for (int i = s; i < e; ++i)
#define mem(a,v) memset(a , v , sizeof a)
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
        tree_order_statistics_node_update>;

const int N = 2e5 + 9 , base = 26;
ll n, d , df;

string res = "";
void go(ll d , ll rem){
    if ( d <= 0 ){
        if (rem == 0){
            cout << res; exit(0);
        }
        return;
    }

    for ( char i = 'z'; i >= 'a'; --i ){
        ll cur = powl(26 , d - 1) * (i - 'a');
        if ( cur <= rem ){
            res += i; go(d - 1 , rem - cur);
            res.pop_back();
        }
    }
}

void Main(int cse , bool last){
    cin >> n;

    ll l = 1 , r = 26 , m = 26; d = 1;
    do{
        if ( n >= l && n <= r ){
            df = n - l; go(d , df); exit(0);
        }
        m *= 26;
        l = r+1 , r += m , d++;
    }
    while (true);

}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef CLion
    freopen( "in.txt" , "r" , stdin  );
    //freopen( "out.txt", "w" , stdout );
#endif

    int t = 1;
    //cin >> t;
    for ( int cse = 1; cse <= t; ++cse ) Main(cse, cse == t);
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

int main() {
    vector<string> s(3);
    rep(i,3) cin>>s[i];
    vec id(3, 0);
    int turn = 0;
    while(id[turn] < s[turn].size()){
        turn = s[turn][id[turn]++] - 'a';
        //cout<<char('A' + turn)<<endl;
    }
    cout<<char('A' + turn)<<endl;
}

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

#define DRACARYS ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define PI 3.14159265
const long long int MAXN = 2e5+10;
const long long int MINN = 1e5+10;
const long long int inf = 1e18+7;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi; 
typedef stack<int> st;

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    DRACARYS
    int n,c1=0,c2=0;
    string s;
    cin>>n>>s;
    for(int i=0;i<n;++i){
        if(s[i]=='R') ++c1;
        else ++c2;
    }
    if(c1>c2) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, int> P;
#define MOD (1000000007ll)

ll sq(ll x){
	return x*x;
}

int main(void){
	int i,n=3;
	string s[3];
	for(i=0; i<n; i++){
		cin >> s[i];
		cout << s[i][0];
	}
	cout << endl;
	return 0;
}

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

int n;
long long ans;
long long num[25][25];
int main()
{
	int i,j;
	scanf("%d",&n);
	while(n--)
	{
		double t;
		scanf("%lf",&t);
		long long a=t*1e9+0.5;
		int n2=1,n5=1;
		while(a%2==0)
		{
			a/=2;
			n2++;
		}
		while(a%5==0)
		{
			a/=5;
			n5++;
		}
		n2=min(19,n2);
		n5=min(19,n5);
		for(i=20-n2;i<=19;i++)
			for(j=20-n5;j<=19;j++)
				ans+=num[i][j];
		num[n2][n5]++;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
int main() {
  
  int N;
  cin >> N;
  vector<int> vecX(N);
  vector<int> vec(N);
  for(int i = 0 ; i < N ; i++){
    cin >> vecX.at(i);
  }
  
  for(int i = 0 ; i < N ; i++){
    vec.at(i) = vecX.at(i);
  }
  
  sort(vec.begin() , vec.end());
  reverse(vec.begin() , vec.end()); 
  
  int sumA,sumB;
  
  for(int i = 0 ; i < N ; i += 2){
    sumA += vec.at(i);
  }
  
  for(int i = 1 ; i < N ; i += 2){
    sumB += vec.at(i);
  }
  
  cout << sumA - sumB <<endl;
}

Measured memory_bytes: 256
let () =
    let main () =
        let n, k = Scanf.sscanf (read_line ()) "%d %d" (fun n k -> n, k) in
        let ab = Array.init (n - 1) (fun _ -> Scanf.sscanf (read_line ()) "%d %d" (fun a b -> a - 1, b - 1)) in
        let hist = Array.make n [] in
        Array.iter (fun (a, b) -> hist.(a) <- b :: hist.(a); hist.(b) <- a :: hist.(b)) ab;
        let ( *@) a b = (a * b) mod 1000000007 in
        let rec color from cur =
            let cl = if from = -1 then k - 1 else k - 2 in
            if List.length hist.(cur) > k then 0 else (
                let (c, _) = List.fold_left (fun (acc, cl) next ->
                    if next = from then (acc, cl) else acc *@ cl, cl - 1) (1, cl) hist.(cur)
                in
                List.fold_left (fun acc next ->
                    if next = from then acc else acc *@ color cur next) c hist.(cur)
            )
        in
        Printf.printf "%d\n" (k *@ color (-1) 0)
    in
    main ()

Measured memory_bytes: 19712
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define vsort(v) sort(all(v))
#define mod 1000000007
using data=pair<ll,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}


int main(){
  ll i,j,N,M,x;
  cin>>N;
  vec v(N+1,0);
  v[1]=1;
  for(i=2;i*i<=N;i++){
    x=i*i;
    while(x<=N){
      v[x]=1;
      x*=i;
    }
  }
  for(i=N;;i--){
    if(v[i]){cout<<i<<endl;return 0;}
  }
  return 0;
}

Measured memory_bytes: 256
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	ll x;
	cin >> x;
	ll a = 100;
	ll cnt = 0;
	while(a < x){
		cnt++;
		a *= 1.01;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
using namespace std;
  
int main(){
  int n, k; cin >> n >> k;
  vector< int > v(n);
  bool pos = false;
  bool neg = false;
  int id = (int)1e9;
  ll ans = (ll)id;
  for(int i = 0; i < n; ++i){
    cin >> v[i];
    if(v[i] < 0)neg = true;
    if(v[i] > 0){
     pos = true;
     id = min(id,i);
    }
    if(v[i] == 0);
  }
  if(!pos) ans = abs(v[n - k]);
  else if(!neg) ans = abs(v[k - 1]);
  else{
    
      for(int i = 0; i < n && i + k - 1 < n;++i){
         ll temp = (ll)abs(v[i]) + (ll)(2*abs(v[i + k -1]));
         ans = min(ans,temp);
      }
      for(int i = n - 1; i >= 0 && i - k + 1 > -1; --i){
          ll temp = (ll)abs(v[i]) + (ll)(2*abs(v[i - k + 1]));
          ans = min(ans,temp);
      }
  }
  cout << ans << '\n';
}

Measured memory_bytes: 3744
def main():
    n = int(input())

    l = [1] * n

    for i in range(2,n+1):
        for j in range(i,n+1,i):
            l[j-1] += 1

    for i in range(n):
        l[i] *= (i+1) 
    print(sum(l))

if __name__ == "__main__":
    main()

Measured memory_bytes: 151660