akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
#include <string.h>

#define X first
#define Y second
#define MP make_pair
typedef long long ll;
using namespace std;
const int MAX = 101;

template<class T, class U>
void convert(T &t, U &u){
	stringstream ss;
	ss << t;
	ss >> u;
}

int main(){
	int n;
	cin >> n;
	cin.ignore();
	while(n--){
		string s;
		getline(cin, s);
		while(1){
			int res = s.find("Hoshino", 0);
			if(res == -1) break;
			s.replace(res, 7, "Hoshina");
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include <iostream>

#include <bits/stdc++.h>

using namespace std;

int main()

{
	long long h,w;
	cin>>h>>w;
	
	if (h==1 || w==1)
	{
		cout<<1<<endl;
	}
	else
	cout << (h * w + 1) / 2 << endl;
	
	
	
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include <numeric>
using namespace std;

int main()
{	
	long long int N, T, A;
	
	scanf("%lld", &N);
	scanf("%lld %lld", &T, &A);

	long long int H[N];
	for(long long int i=0;i<N;i++){
		scanf("%lld", &H[i]);
	}
	long long int di=abs(1000*T-6*H[0]-1000*A);
	long long int soeji=0;
	for(long long int i=0;i<N;i++){
		if(abs(1000*T-6*H[i]-1000*A)<di)
		{
			di=abs(1000*T-6*H[i]-1000*A);
			soeji=i;
		}
	}
	printf("%lld", soeji+1);
}


Measured memory_bytes: 128
# -*- coding: utf-8 -*-
def main():
    N,K = map(int,input().split())
    ans = []
    for i in range(K):
        tmp = []
        S = int(input())
        tmp = list(map(int, input().split()))
        ans.extend(tmp)
        #print(tmp,ans)
    print(N-(len(set(ans))))

if __name__ == '__main__':
    main()

Measured memory_bytes: 9144
x1 = list(map(int,input().rstrip().split(" ")))
x2 = list(map(int,input().rstrip().split(" ")))

def makey(x1,x2):
  total = 0
  for i in range(x1[0]):
    total += x2[i]
    if total > x1[1]:
      return i
  return i+1
y = makey(x1,x2)
print(y+1)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define For(i,a,b) for(i=(a);i<=(b);++i)
#define Forward(i,a,b) for(i=(a);i>=(b);--i)
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define Repe(i,a,b) for(register int i=(a);i>=(b);--i)
#define Chkmax(a,b) a=a>b?a:b
#define Chkmin(a,b) a=a<b?a:b
using namespace std;
template<typename T>inline void read(T &x)
{
	T s=0,f=1;static char c;
	for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())s=s*10+(c^48);
	x=s*f;
}
const int MAXN=2222;
static int n;
static struct poi
{
	int x,y;
}p[MAXN],q[MAXN];
static int ma[MAXN][MAXN],ans,match[MAXN],vis[MAXN],tt;
bool dfs(int u)
{
	Rep(i,1,n)if(ma[u][i]&&vis[i]!=tt)
	{
		vis[i]=tt;
		if(!match[i]||dfs(match[i]))
		{
			match[i]=u;
			return true;
		}
	}
	return false;
}
int main()
{
	read(n);
	Rep(i,1,n)read(p[i].x),read(p[i].y);
	Rep(i,1,n)read(q[i].x),read(q[i].y);
	Rep(i,1,n)Rep(j,1,n)if(p[i].x<q[j].x&&p[i].y<q[j].y)ma[i][j]=true;
	Rep(i,1,n)
	{
		++tt;
		if(dfs(i))++ans;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>

int main(void) {
	int A, B;
	std::cin >> A >> B;
	if (A < 10 && B < 10) {
		std::cout << A * B;
	}
	else {
		std::cout << -1;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
dp = [[0,0,0]]*n
a,b,c = map(int, input().split())
dp[0]=[a,b,c]
for i in range(1,n):
    abc = list(map(int, input().split()))
    dp0= abc[0]+max(dp[i-1][1], dp[i-1][2])
    dp1= abc[1]+max(dp[i-1][2], dp[i-1][0])
    dp2= abc[2]+max(dp[i-1][0], dp[i-1][1])
    dp[i]=[dp0,dp1,dp2]
ans = dp[-1]
print(max(ans)) 

Measured memory_bytes: 58916
#include <iostream>

using namespace std;

int main(){
  int n;

  while(1){
    int star[31] = { 0 };
    cin >> n;
    if(n == 0) break;
    star[0] = 1;

    for(int i = 1; i <= n; i++){
      if(i > 0) star[i] += star[i-1];
      if(i > 1) star[i] += star[i-2];
      if(i > 2) star[i] += star[i-3];
    }
    
    cout << star[n]/3650+1 << endl;
  }

  return 0;
}

Measured memory_bytes: 1156
#include<stdio.h>
#include<algorithm>
using namespace std;
int t[110];
int now[20];
int p[110];
int q[110];
int r[110];
int main(){
	for(int i=0;i<100;i++){
		p[i]=i*5;
		if(i%5==1)q[i]=5;
		else q[i]=2;
		r[i]=17*(i%2)+3*(i%3)+19;
	}
	int at=0;
	for(int i=0;i<17;i++)now[i]=-1;
	for(int i=0;i<5000;i++){
		for(int j=0;j<at;j++){
			if(i==t[j]+r[j])for(int k=0;k<17;k++)if(now[k]==j)now[k]=-1;
		}
		while(at<=min(99,i/5)){
			int len=0;
			bool ok=false;
			for(int j=0;j<17;j++){
				if(!~now[j])len++;
				else len=0;
				if(len==q[at]){
					for(int k=j-q[at]+1;k<=j;k++)now[k]=at;
					ok=true;break;
				}
			}
			if(ok)t[at++]=i;
			else break;
		}
	}int a;
	while(~scanf("%d",&a)){
		printf("%d\n",t[a]-a*5);
	}
}

Measured memory_bytes: 1008
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
typedef long long ll;
using namespace std;
ll intpow(int n,int m){
    if(m==0)return 1;
    return n*intpow(n,m-1);
}
ll gcd(ll n,ll m){
    n = max(n,m);
    m = min(n,m);
    if(n%m == 0)return m;
    return gcd(m,n%m);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}
int main(){
    int k,n;
    cin >> n >> k;
    vector<int>h,s;
    h.resize(n);
    s.resize(n-k+1);
    for(int i=0;i<n;i++)cin >> h[i];
    sort(h.begin(),h.end());
    for(int i=0;i<n-k+1;i++)s[i] = h[i+k-1]-h[i];
    sort(s.begin(),s.end());
    cout << s[0] <<endl;

}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
		public static void main(String[] args) {
			// ??\???
			Scanner sc = new Scanner(System.in);
			int a, b, c;
			a = sc.nextInt();
			b = sc.nextInt();
			c = sc.nextInt();
			
			// ???????????????
			if(a < b && b < c) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
	}

}

Measured memory_bytes: 26104
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <cstring>
#include <cctype>
#include <ctime>
#include <climits>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <tuple>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <complex>
#include <random>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <functional>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#ifndef M_PI
#define M_PI 3.141592653589793238462643383279
#endif

#define int long long

#define mp make_pair
#define mt make_tuple
#define fr first
#define sc second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(), x.end()
#define get0 get<0>
#define get1 get<1>
#define get2 get<2>
#define get3 get<3>

#define debug(x) cerr << #x << " = " << x << ", line = " << __LINE__ << endl

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef tuple<long long, long long, long long> tlll;
typedef tuple<int, int, int> tiii;
typedef tuple<int, int, int, int> tiiii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MOD = 1e9 + 7;
const int SZ = 2e5 + 1;
int n;
pii a[SZ];

int get(int sx, int sy) {
    int mn = 0, mx = 0;

    for (int i = 1; i < n; ++i) {
        if (a[i].fr * sx + a[i].sc * sy < a[mn].fr * sx + a[mn].sc * sy) {
            mn = i;
        }
        if (a[i].fr * sx + a[i].sc * sy > a[mx].fr * sx + a[mx].sc * sy) {
            mx = i;
        }
    }
    return abs(a[mn].fr - a[mx].fr) + abs(a[mn].sc - a[mx].sc);
}


int32_t main()
{
#ifdef chikibambony
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i].fr >> a[i].sc;
    }
    int ans = get(1, 1);
    ans = max(ans, get(1, -1));
    ans = max(ans, get(-1, 1));
    ans = max(ans, get(-1, -1));

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6772
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  int k, x;
  cin >> k >> x;
  if (500 * k >= x) {
	  cout << "Yes" << endl;
	} else {
	  cout << "No" << endl;
	}
  return 0;
}


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

using namespace std;

int main() {
    int n = 0;
    int m = 0;
    cin >> n >> m;
    int checker[n];
    int sum = 0;
    int counter = 0;

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

    for(int i = 0;i < n;i++){
        if(checker[i] >= 0.25 * sum / m){
            counter ++;
        }
    }
    
    if(counter >= m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
N = int(input())
a = int(N**(1/2))
b = int(N**(1/2))

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = prime_factorize(N)
if c[-1] > 10**6:
    print(c[-1] + N//c[-1] - 2)
    exit()

while 1:
    if a*b < N:
        a += 1
    elif a*b > N:
        b -= 1
    else:
        print(a+b-2)
        exit()

Measured memory_bytes: 9488
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define sz(x) int(x.size())
using ll = long long;
using P = pair<int,int>;
const ll LLINF = numeric_limits<long long>::max();
const int mod = 1000000007;
const int INF = 1001001001;

int main()
{
    ll a,v,b,w,t;
    cin >> a >> v >> b >> w >> t;

    if(w >= v){
        cout << "NO" <<endl;
        return 0;

    }

    ll sa = v-w;
    ll d = abs(b-a);

    double  ti = double(d) / sa;

    if(ti <= t){
        cout << "YES" << endl;
    }
    else {
         cout << "NO" <<endl;
    }



    return 0;
}

Measured memory_bytes: 3644
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

#include <stdio.h>
#include <bits/stdc++.h>
#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
// tree<key, mapped = null_type, cmp = less<key>, rb_tree_tag, tree_order_statistics_node_update> name; order_of_key find_by_order

using namespace std;

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fs first
#define sc second
#define abs(a) ((a) < 0 ? -(a) : (a))
#define sqr(a) ((a) * (a))

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

inline pair<pair<bool, bool>, pair<string, bool> > useinout();

#ifdef SOL
double starttime;
#endif

void initialization() {
#ifdef SOL
	starttime = 1000. * clock() / CLOCKS_PER_SEC;
	if (useinout().fs.fs)
		freopen("input.txt", "r", stdin);
	if (useinout().fs.sc)
		freopen("output.txt", "w", stdout);
#else
	srand(__rdtsc());
	const string file = useinout().sc.fs;
	if (!file.empty()) {
		freopen((file + ".in").c_str(), "r", stdin);
		freopen((file + ".out").c_str(), "w", stdout);
	} else
	if(useinout().sc.sc) {
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
#endif
}

int solution();

void finish(int exitval) {
	fflush(stdout);
#ifdef SOL
	fprintf(stderr, "\n-----------------\nexit value: %d\ntime: %.3lf ms\n-----------------\n", exitval, 1000. * clock() / CLOCKS_PER_SEC - starttime);
#endif
}

int main() {
	initialization();
	finish(solution());
	return (0);
}

const double eps = 1e-9;
const int mod = (int) 1e+9 + 7;
const double pi = acos(-1.);
const int maxn = 200100;

int a[maxn];

int solution() {

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

	ll ans = mod * 1ll * mod;
	for(int i = 0; i < n - 1; i++) {
		s1 -= a[i];
		s2 += a[i];
		ans = min(ans, abs(s1 - s2));
	}
	printf("%lld", ans);




	return (0);
}

inline pair<pair<bool, bool>, pair<string, bool> > useinout() {
	return (mp(mp(0, 0), mp("", 0)));
}

//by Andrey Kim


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define mod 1000000007;
#define my_mod 2019;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    string s,t,u;
    int a,b;
    cin >> s >> t >> a >> b >> u;
    s == u ? cout << a-1 << ' ' << b << endl : cout << a << ' ' << b-1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>
#include <random>
#include <list>
#include <numeric>
#include <chrono>
#include <set>


#define rep(i,p,q) for(ll i = p;i < q;i++)
#define ll long long

using namespace std;


const long long MAX_N = 1 << 17;

long long dat[2 * MAX_N - 1];

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

ll pow(ll a, ll b) {
	vector<ll> d = vector<ll>((ll)(log(b)) + 2);
	d[0] = a;
	rep(i, 1, d.size()) d[i] = d[i - 1] * d[i - 1];
	ll ret = 1;
	rep(i, 0, log(b) + 1) {
		if (b & 1 << i) ret *= d[i];
	}
	return ret;
}

//J
vector<vector<vector<long double>>> dp;
ll n;
ll s1, s2, s3;

long double rec(ll i, ll j, ll k) {
	if (dp[i][j][k] >= 0) return dp[i][j][k];

	if (i == 0 && j == 0 && k == 0) return 0.0;
	

	long double res = 0;
	if (i > 0) res += rec(i - 1, j, k) * i;
	if (j > 0) res += rec(i + 1, j - 1, k) * j;
	if (k > 0) res += rec(i, j + 1, k - 1) * k;
	res += n;
	res *= 1.0 / (long double)(i + j + k);

	return dp[i][j][k] = res;
}

int main(void) {
	 n;
	cin >> n;
	s1 = 0, s2 = 0, s3 = 0;
	rep(i, 0, n) {
		ll sushi;
		cin >> sushi;
		if (sushi == 1)s1++;
		else if (sushi == 2)s2++;
		else s3++;
	}
	dp = vector<vector<vector<long double>>>(310,vector<vector<long double>>(310,vector<long double>(310,-1)));
	cout << setprecision(10) << rec(s1, s2, s3) << endl;
}


Measured memory_bytes: 473088
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// A, Bの入力
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		// 結果の出力
		System.out.println(Math.max(A*B, Math.max(A+B, A-B)));
		
		sc.close();
	}

}


Measured memory_bytes: 21460
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") // wonderful

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


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


    int h, a, x; cin >> h >> a;

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

    if (res >= h) cout << "Yes";
    else cout << "No";

    return 0;
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif

signed main() {
    
    string s;
    cin >> s;
    
    if(s[0]=='9' || s[1]=='9') Yes;
    else No;
    
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_map>
#include<unordered_set>
using namespace std;
typedef long long ll;
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
#define mul(a,b) a=a*b%mod;

int main(){
  string s; cin>>s; ll n=s.size();
  bool ok=(s[0]=='1')&&(s[n-1]=='0');
  for(int i=1;i<n-1;i++){
    ok&=(s[i]==s[n-i-2]);
  }
  if(ok==0){
    cout<<-1<<endl;
    return 0;
  }s[n-1]='1';
  ll bef=1;
  for(int i=0;i<n;i++){
    if(s[i]=='1'){
      for(int j=bef;j<i;j++)cout<<i+1<<" "<<j+1<<endl;
      bef=i;
    }
  }
  
  return 0;
}


Measured memory_bytes: 1664
# N = 2
# a = [[3,1,2],[6,1,1]]
N = input()
N = int(N)
a = [input().split() for _ in range(N)]
b = [[0,0,0]]
b.extend(a)
rtn = 'Yes'
for i in range(N):
    t1 = int(b[i][0])
    x1 = int(b[i][1])
    y1 = int(b[i][2])
    t2 = int(b[i+1][0])
    x2 = int(b[i+1][1])
    y2 = int(b[i+1][2])

    td = t2-t1
    xyd = (x2+y2) - (x1+y1)

    # 偶数
    if((td%2==xyd%2) & (td>=xyd)):
        rtn = rtn
    else:
        rtn = 'No'

print(rtn)



Measured memory_bytes: 32912
#include<iostream>
#include<map>
#include<tuple>
#include<vector>
#include<string>
typedef long long int ll;

using namespace std;

ll f(ll n){
  if( n == 1) return 1;
  else return 2*f(n/2) +1;
}


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

  cout << f(n) << endl;
 }

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var bef = new long[N];
            bef[0] = A[0];
            for (var i = 1; i < N; i++)
                bef[i] = bef[i - 1] + A[i];

            var back = new long[N];
            back[N - 1] = A[N - 1];
            for (var i = N - 2; i >= 0; i--)
                back[i] = back[i + 1] + A[i];

            var min = long.MaxValue;
            for (var i = 0; i < N - 1; i++)
            {
                var diff = Math.Abs(bef[i] - back[i + 1]);
                min = Math.Min(min, diff);
            }

            Console.WriteLine(min);
        }
    }
}


Measured memory_bytes: 39760
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(long i=0;i<n;i++)
#define rn(i,n) for(long i=1;i<=n;i++)

int main(void){
  string s;
  cin>>s;
  if(s=="Sunny")cout<<"Cloudy"<<endl;
  else if(s=="Cloudy")cout<<"Rainy"<<endl;
  else cout<<"Sunny"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
char arr[51][51] = {};
int sum[51][51] = {};
int main() {
    int h,w;
    cin >> h >> w;
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            cin >> arr[i][j];
        }
    }
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            if(arr[i][j] == '#') {
                cout << '#';
            } else {
                if(arr[i-1][j-1]=='#')
                    sum[i][j]++;
                if(arr[i-1][j]=='#')
                    sum[i][j]++;
                if(arr[i-1][j+1]=='#')
                    sum[i][j]++;
                if(arr[i][j-1]=='#')
                    sum[i][j]++;
                if(arr[i][j+1]=='#')
                    sum[i][j]++;
                if(arr[i+1][j-1]=='#')
                    sum[i][j]++;
                if(arr[i+1][j]=='#')
                    sum[i][j]++;
                if(arr[i+1][j+1]=='#')
                    sum[i][j]++;
                cout << sum[i][j];
            }
        }
        cout << endl;
    }
    return 0;
}


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

int main(void){
  int N,A,B;
  scanf("%d",&N);
  scanf("%d",&A);
  scanf("%d",&B);
  if (N*A<=B) {
    printf("%d\n",N*A);
  }else{
    printf("%d\n",B);
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args){
	Scanner scanner = new Scanner(System.in);
    int x1 = scanner.nextInt();
    int y1 = scanner.nextInt();
    int x2 = scanner.nextInt();
    int y2 = scanner.nextInt();
    int y3 = y2 + (x2-x1);
    int x3 = x2 - (y2-y1);
    int y4 = y3 -(y2-y1);
    int x4 = x3 -(x2-x1);

    System.out.println( x3+" " +y3 +" "+  x4 +" "+ y4);
}
}

Measured memory_bytes: 23124
/*May The Force Be With Me*/
#include <bits/stdc++.h>
#include <stdio.h>
#include <ctype.h>
#pragma GCC optimize ("Ofast")
#define ll long long
#define MOD 1000000007
#define endl "\n"
#define vll vector<long long>
#define mll map<long long,long long>
#define pll pair<long long, long long>
#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define pb push_back
#define f first
#define s second
#define inf INT_MAX
#define size_1d 10000000
#define size_2d 1000
#define rep(i,v,n) for(ll i = v; i < n; i++)
//Snippets: delta, sieve, fastexp, dfs, bfs, dijkstra, floodfill

using namespace std;

ll a, b, c, k;

void Input() {
	cin >> a >> b >> c >> k;
}

void Solve() {
	ll x = 0, y = 0;
	while (b <= a)b *= 2, x++;
	while (c <= b)c *= 2, y++;
	if (x + y <= k)cout << "Yes";
	else cout << "No";
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll T = 1;
	//cin >> T;
	//ll t = 1;
	while (T--) {
		Input();
		//cout << "Case " << t << ": ";
		Solve();
		//t++;
	}
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>

 

using namespace std;

 

int main()
{
   int i, h, m, s;
   cin >> i;
   h = i / 3600;
   m = i / 60 - h*60;
   s = i % 60;
   cout << h << ":" << m << ":" << s << endl; 
   return 0;
}


Measured memory_bytes: 3088
using System;

namespace ALDS1_1
{
    class Program
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Array.ConvertAll(Console.ReadLine().Split(), e => int.Parse(e));
            for(int i = 0; i < n; i++)
            {
                int v = a[i], j = i - 1;
                while (j >= 0 && a[j] > v)
                    a[j + 1] = a[j--];
                a[j + 1] = v;
                Console.WriteLine(string.Join(" ", Array.ConvertAll(a, e => e.ToString())));
            }
        }
    }
}

Measured memory_bytes: 9404
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main(void)
{
  int n;

  cin >> n;

  int buff1,buff2;

  vector<int> A;
  vector<int> B;

  for(int i = 0; i < n + 1;i++){
    cin >> buff1;
    A.push_back(buff1);
  }

  for(int i = 0;i< n;i++){
    cin >> buff2;
    B.push_back(buff2);
  }

  long sum = 0;

  for(int i = 0;i < n;i++){
    if(A[i] <= B[i]){
      sum += A[i];
      if(A[i + 1] >= (B[i] - A[i])){
        A[i + 1] -= (B[i] - A[i]);
        sum += (B[i] - A[i]);
      }
      else{
        sum += A[i + 1];
        A[i + 1] = 0;
      }
    }
    else{
      sum += B[i];
    }
  }
  cout << sum << endl;
  return 0;
}


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

using namespace std;

int main(int argc, char const *argv[])
{
	vector<int> A(3);
	for (int i = 0; i < 3; ++i)	cin >> A.at(i);
	sort(A.begin(), A.end());
	cout << A.at(0) + A.at(1) << endl;
	return 0;
}

Measured memory_bytes: 256
x, k, d = map(int,input().split())
x = abs(x)
if x>k*d:
    ans = x-k*d
else:
    cnt = x//d#xに最も近づくための移動回数
    if (k-cnt)%2==0:
        ans = x-cnt*d
    else:
        if x>0:
            ans = abs(x-cnt*d-d)
        else:
            ans = abs(x-cnt*d+d)
print(ans)

Measured memory_bytes: 9196
#関数リスト
import sys
input = sys.stdin.readline

 
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))


n = I()
if n % 1000 != 0:
    print(1000-(n % 1000))
else:
    print(0)

Measured memory_bytes: 61700
use std::collections::VecDeque;

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

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

fn main() {
    let input = read_vec::<usize>();
    let (n, k, c) = (input[0], input[1], input[2]);
    let s = read::<String>().chars().collect::<Vec<_>>();

    let mut skip = 0;
    let mut l: Vec<usize> = vec![];
    let mut r: VecDeque<usize> = VecDeque::new();

    for (i, v) in s.iter().enumerate() {
        if skip > 0 {
            skip -= 1;
            continue;
        }
        if l.len() == k {
            break;
        }
        match *v {
            'o' => {
                l.push(i);
                skip = c;
            },
            'x' => {},
            _ => {
                println!("error");
            }
        }
    }
    skip = 0;
    for (i, v) in s.iter().enumerate().rev() {
        if skip > 0 {
            skip -= 1;
            continue;
        }
        if r.len() == k {
            break;
        }
        match *v {
            'o' => {
                r.push_front(i);
                skip = c;
            },
            'x' => {},
            _ => {
                println!("error");
            }
        }
    }

    let len = std::cmp::min(l.len(), r.len());    

    for i in 0..len {
        if l[i] == r[i] {
            println!("{}", l[i]+1);
        }
    }

}

Measured memory_bytes: 12052
S = str(input())
S += '/'
l = [0]*len(S)

for i in range(len(S)-1):
  if S[i] == '<':
    l[i+1] = l[i] + 1
for i in range(len(S)-2,-1,-1):
  if S[i] == '>':
    l[i] = max(l[i+1]+1,l[i])

print(sum(l))

Measured memory_bytes: 24624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(1e9 + 7)
#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)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

//////////////////////
// const int N = 316330;

char clr[] = {'R', 'G', 'B'};

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);

    int m,d;
    cin >> m >> d;

    int tot = 0;
    repA(i,1,m) repA(j,1,d) {
    	if(j/10 >= 1 and j%10 >= 2 and (j/10)%10 >= 2 and (j%10)*((j/10)%10) == i) tot++;
    }
    cout << tot << '\n';
}


Measured memory_bytes: 256
/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀
⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀
⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀
⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀
⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸⠀
⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂⠀⠀⠀
⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁⠀⠀
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define REP(i,a,n) for(i=a;i<=n;i++)
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,b,a) for(i=b;i>=a;i--)
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const ll mod=1e16;
const ll MAXN=100200;
ll i,j,mask,test;
int main()
{
IOS
/*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
#endif // ONLINE_JUDGE*/
ll x;
cin>>x;
double k=ceil((double)sqrt(1+8*x));
k--;
k=ceil((double)k/2);
cout<<k;
return 0;
}


Measured memory_bytes: 3852
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
bool chmax(ll a, ll &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
int main() {
    int n;
    cin >> n;
    vector<ll> x(n), y(n);
    vector<ll> a(n), b(n), c(n), d(n);
    for(int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        a[i] = x[i] + y[i];
        b[i] = x[i] - y[i];
        c[i] = -x[i] + y[i];
        d[i] = -x[i] - y[i];
    }
    sort(all(a));
    sort(all(b));
    sort(all(c));
    sort(all(d));
    ll M = 0;
    M = max(M, a.back() - a.front());
    M = max(M, b.back() - b.front());
    M = max(M, c.back() - c.front());
    M = max(M, d.back() - d.front());
    cout << M << endl;
}

Measured memory_bytes: 12736
n = int(input())

amts = [1]
tmp = 6
while tmp <= n:
  amts.append(tmp)
  tmp *= 6
  
tmp = 9
while tmp <= n:
  amts.append(tmp)
  tmp *= 9


kaisus = [1e5] * (n+1)
kaisus[0] = 0
for i in range(1, n+1):
  for amt in amts:
    temp = i - amt
    if temp >= 0:
      kaisus[i] = min(kaisus[i], kaisus[temp] + 1)
      
print(kaisus[n])

Measured memory_bytes: 3828
#include <stdio.h>

int keta ( int a , int b ) {
	int sum , result = 0;
	sum = a + b;
	while ( sum > 0 ) {
		sum /= 10;
		result++;
	}
	return result;
}

int main (void) {
	int a , b , ans;
	
	while ( scanf("%d %d",&a,&b) != EOF ) {
		if ( a == 0 && b == 0 ) break;
		
		ans = keta(a,b);
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
#!/usr/bin/env python3
import sys
from itertools import chain
import numpy as np


def solve(X: int):
    if X <= 2:
        return 2
    flags = np.array([True for i in range(3, X + 112, 2)])
    for i in range(len(flags)):
        if flags[i]:
            prime = i * 2 + 3
            flags[i::prime] = False
            if prime >= X:
                return prime




def main():
    X = int(input())  # type: int
    answer = solve(X)
    print(answer)


if __name__ == "__main__":
    main()


Measured memory_bytes: 27432
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int A,B;
  cin>>A>>B;
  string S;
  cin>>S;
  bool flag=1;
  if(S[A]!='-')flag=0;
  FOR(i,0,A)if(S[i]=='-')flag=0;
  FOR(i,A+1,S.size())if(S[i]=='-')flag=0;
  if(flag)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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;
}

vector<vector<int>> g(10005);
vector<int> c;
int ans[10005];
int start;

void dfs(int v, int parent = -1)
{
  if (g[v].size() == 0)
  {
    ans[v] = c[0];
    // cout << v + 1 << ":" << c[0] << endl;
    c.erase(c.begin());
    return;
  }

  if (parent != -1 && ans[parent] != -1)
  {
    ans[v] = c[0];
    // cout << v + 1 << ":" << c[0] << endl;
    c.erase(c.begin());
  }

  for (int i : g[v])
  {
    if (i != parent)
    {
      dfs(i, v);
      if (ans[i] == -1)
      {
        ans[i] = c[0];
        // cout << i + 1 << ":" << c[0] << endl;
        c.erase(c.begin());
      }

      if (ans[v] == -1)
      {
        ans[v] = c[0];
        // cout << v + 1 << ":" << c[0] << endl;
        c.erase(c.begin());
      }
    }
  }

  return;
}

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

  rep(i, n - 1)
  {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  ll sum = 0;
  rep(i, n)
  {
    int x;
    cin >> x;
    c.push_back(x);
    ans[i] = -1;
  }

  sort(c.rbegin(), c.rend());

  rep(i, n)
  {
    if (i != 0)
      sum += c[i];
  }

  start = 0;
  dfs(start);

  cout << sum << endl;
  rep(i, n)
  {
    cout << ans[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 1664
// AGC022A - Diverse Word
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	flags := make([]bool, 26)
	for i := 0; i < len(flags); i++ {
		flags[i] = true
	}

	for _, c := range s {
		flags[c-97] = false
	}
	if len(s) < 26 {
		for i, f := range flags {
			if f {
				fmt.Println(s + string(i+97))
				return
			}
		}
	}
	divide := 0
	for i := len(s) - 1; i >= 1; i-- {
		flags[s[i]-97] = true
		if s[i] > s[i-1] {
			divide = i - 1
			break
		}
	}
	minimumC := "-1"
	for i, f := range flags {
		if f && i+97 > int(s[divide]) {
			minimumC = string(i + 97)
			break
		}
	}
	ans := s[0:divide] + minimumC
	fmt.Println(ans)

}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

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

template<typename T>
void chmax(T &a, T b) {
    a = max(a, b);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> V(N), C(N);
    REP (i, 0, N) {
        cin >> V[i];
    }
    REP (i, 0, N) {
        cin >> C[i];
    }
    int ans = 0;
    REP (i, 0, 1 << N) {
        int v = 0, c = 0;
        REP (j, 0, N) {
            if ((i >> j) & 1) {
                v += V[j];
                c += C[j];
            }
        }
        chmax(ans, v - c);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    [n, m] = list(map(int, input().split()))
    lr = [list(map(int, input().split())) for _ in range(m)]
    max_l = 1
    min_r = n
    for l, r in lr:
        if max_l < l:
            max_l = l
        if min_r > r:
            min_r = r
    print(max(min_r - max_l + 1, 0))


Measured memory_bytes: 27336
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
 
    string n;
    cin>>n;
    

    bool flag=false;
    for(int i=0;i<3;i++){
        if(n.at(i)=='7')
            flag=true;
    }

    if(flag)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    

    return 0;
}  

Measured memory_bytes: 3628
#!/usr/bin/env python3
"""
RWとなってなければおｋ
WRはだめ
"""


def main():
    import sys

    input = sys.stdin.readline

    N = int(input())
    c = input()

    white, red = 0, c.count('R')
    if red == 0:
        print(0)
        return
    ans = N
    for i in range(N):
        if c[i] == 'W':
            white += 1
        else:
            red -= 1
        res = max(white, red)
        ans = min(ans, res)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9380
#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 c = 0;
  for(int i =0; i<n; i++) {
    if((i+1) % 2 == 1 && a.at(i) % 2 == 1) c++;
  }
  cout << c << endl;
}

Measured memory_bytes: 3628
/*  
    Talkin' to myself and feelin' old
    Sometimes I'd like to quit, nothin' ever seems to fit
    Hangin' around, nothin' to do but frown
    Rainy days and Mondays always get me down
    _________________________
    _________________________
    912 Hours of Solitude
    Quarantine_Day : 38
*/

#include<bits/stdc++.h>

using namespace std;

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

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<int>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 50005


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

	string s; cin>>s;
	REP(i, s.size()) if(!(i&1)) cout<<s[i];
	cout<<'\n';

	return 0;
}


Measured memory_bytes: 592
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n =sc.nextInt();
		int k =sc.nextInt();
		
		int []h= new int [n];
		
		int sum = 0;
		
		for(int i = 0 ; i < n ;i++) {
			h[i] = sc.nextInt();
			if(h[i] >= k) {
				sum++;
			}
		}
		System.out.println(sum);
		
		
	}

}


Measured memory_bytes: 47364
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N,K;
    cin >> N >> K;
    ll ans = K;
    rep(i,N - 1){
        ans *= K - 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import collections
N,K=map(int,input().split())
A=list(map(int,input().split()))
c=collections.Counter(A)
C=sorted(list(c.items()),key=lambda x: x[1])
t=len(C)
ans=0
for i in range(len(C)):
  if t>K:
    ans+=C[i][1]
    t-=1
  else:
    break
print(ans)

Measured memory_bytes: 40880
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
 
using namespace std;
 
int s[5050];
 
bool cmp(int a,int b)
{
	return a<b;
}
 
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n,k;
	scanf("%d%d",&n,&k);
	int num=n,temp,ans=1;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&temp);
		if(temp>=k) num--;
		else s[ans++]=temp;
	}
	ans--;
	sort(s+1,s+num+1,cmp);
	temp=0;
	while(num>=2)
	{
		temp+=s[num];
		if(s[num-1]+temp<k)
		{
			num--;
			continue;
		}
		if(s[1]+temp>=k)
		{
			ans=0;
			break;
		}
		int l=1,r=num-2;
		while(l+1<r)
		{
			int mid=(l+r)/2;
			if(temp+s[mid]>=k) r=mid;
			else l=mid;
		}
		ans=ans-(num-r);
		num=r;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sf1(n) scanf("%d",&n)
#define sf2(n,q) scanf("%d %d",&n,&q)
#define f first
#define ss second
#define pb push_back
#define lli long long
#define mem(ar,false) memset(ar,false,sizeof(ar))
#define mpr make_pair
#define endl "\n"
#define mod 1000000007
#define inf 9000000000000000000LL
using namespace std;

int ar[200005];
int n,k;
int dp[100005];
int func(int i)
{

    if(i==n-1)
        return 0;
    if(dp[i]!=-1)
        return dp[i];
    int ret = INT_MAX;

    for(int j=1;j<=k;j++)
    {
        if(i+j<n)
            ret = min(ret,abs(ar[i]-ar[i+j])+func(i+j));
    }
    return dp[i] = ret;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    mem(dp,-1);
    cin >> n >> k;
    for(int i=0; i<n; i++)
        cin >> ar[i];

     int ans = func(0);
  /*  for(int i=1; i<n; i++)
    {
        int ret1 = dp[i-1]+abs(ar[i]-ar[i-1]);
        int ret2 = INT_MAX;
        if(i-2>=0)
            ret2 = dp[i-2]+abs(ar[i]-ar[i-2]);
        dp[i] = min(ret1,ret2);
    }*/

    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 12160
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto x = lread();
    foreach (i; x .. (x + 10 ^^ 6))
    {
        if (func(i))
        {
            writeln(i);
            return;
        }
    }

}

bool func(long x)
{
    foreach (i; 2 .. x)
    {
        if (x % i == 0)
        {
            return false;
        }
    }
    return true;
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


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


int main(){
    int N; cin >> N;
    int d[N];
    for (int i = 0; i < N; i++)
    {
        cin >> d[i];
    }
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i+1; j < N; j++)
        {
            ans += d[i]*d[j];
        }
        
    }
    
    cout << ans << endl;
    return 0;
}

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

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = min(a, n % (a + b));
  ans += n / (a + b) * a;
  cout << ans << endl;
  return 0;
}


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

int check(int i){
    if((i/10000 == i%10) && (i%10000/1000 == i%100/10)){
        return 1;
    }else return 0;
}
int main(){
    int a, b;
    cin >> a >> b;
    int ans = 0;
    for(int i = a; i < b+1; i++){
        ans += check(i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

ans = 0
M = []
for i in range(N):
	if i >= K and M[i-K] == T[i]:
		M.append('x')
		continue
	else:
		if T[i] == 'r':
			ans += P
			M.append('r')
		if T[i] == 's':
			ans += R
			M.append('s')
		if T[i] == 'p':
			ans += S
			M.append('p')
print(ans)


Measured memory_bytes: 48880
N = int(input())
route = [[int(i) for i in input().split()] for j in range(N)]

arrive = True
pre_spot = [0, 0, 0]
for spot in route:
    cost = abs(spot[1] - pre_spot[1]) + abs(spot[2] - pre_spot[2])
    time = spot[0] - pre_spot[0]
    if (time - cost < 0) or ((time - cost) % 2 != 0):
        arrive = False
        break

if arrive:
    print("Yes")
else:
    print("No")

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

using namespace std;
const int INF=1e9+5;
const int MOD=1e9+7;
typedef long long ll;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int n1=a/d;
	int n2=c/b;
	if(a%d!=0)  n1++;
	if(c%b!=0) n2++;
	if(n2>n1)  cout<<"No\n";
	else cout<<"Yes\n";
}


Measured memory_bytes: 3632
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

// Pie Chart is as easy as pie.
public class Main{
	Scanner sc=new Scanner(System.in);

	double r, cx, cy;
	int n;
	double[] ps;

	void run(){
		r=sc.nextInt();
		cx=sc.nextInt();
		cy=sc.nextInt();
		n=sc.nextInt();
		ps=new double[n];
		for(int i=0; i<n; i++){
			ps[i]=sc.nextInt()/100.0*2*PI;
		}
		solve();
	}

	void solve(){
		double[] xs=new double[n], ys=new double[n];
		double sum=0;
		for(int i=0; i<n; i++){
			xs[i]=r*cos(PI/2-sum);
			ys[i]=r*sin(PI/2-sum);
			sum+=ps[i];
		}
		for(int i=0; i<n; i++){
			int j=(i+1)%n;
			double d=hypot(xs[j]-xs[i], ys[j]-ys[i]);
			double A1=r*r*ps[i]/2, A2=A1;
			double s1=heron(d, r, r);
			double s2=heron(d, hypot(xs[i]-cx, ys[i]-cy),
					hypot(xs[j]-cx, ys[j]-cy));
			A2+=s1*ccw(xs[i], ys[i], xs[j], ys[j], 0, 0);
			A2-=s2*ccw(xs[i], ys[i], xs[j], ys[j], cx, cy);
			print((int)(100*A2/A1)+(i==n-1?"\n":" "));
		}
	}

	double heron(double a, double b, double c){
		double s=(a+b+c)/2;
		return sqrt(s*(s-a)*(s-b)*(s-c));
	}

	int ccw(double ax, double ay, double bx, double by, double cx, double cy){
		bx-=ax;
		by-=ay;
		cx-=ax;
		cy-=ay;
		if(det(bx, by, cx, cy)>0){
			return +1;
		}
		if(det(bx, by, cx, cy)<0){
			return -1;
		}
		return 0;
	}

	double det(double x1, double y1, double x2, double y2){
		return x1*y2-y1*x2;
	}

	void print(String s){
		System.out.print(s);
	}

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

Measured memory_bytes: 17396
n = int(input())
l = [input() for i in range(n)]

ac = l.count("AC")
wa = l.count("WA")
tle = l.count("TLE")
re = l.count("RE")

print("AC x", ac)
print("WA x", wa)
print("TLE x", tle)
print("RE x", re)



Measured memory_bytes: 16280