akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll A, B, C, X, Y;
    cin>>A>>B>>C>>X>>Y;
    ll Minim=A*X+B*Y+C*X*2+C*Y*2;
    rep(Cn, max(X, Y)*2+1){
        ll An=max(X-Cn/2, (ll)0);
        ll Bn=max(Y-Cn/2, (ll)0);
        ll cost=An*A+Bn*B+Cn*C;
        //cout<<cost<<sp<<An<<sp<<Bn<<sp<<Cn<<endl;
        Minim=min(Minim, cost);
    }
    cout<<Minim<<endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
ll mod = 998244353;
#define EPS 1e-1
#define PI 3.14159265

#define iofile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define fastio ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
using namespace std;

ll fastpow(ll base, ll pow)
{
    if (!base)
        return 0;
    if (!pow)
        return 1;
    if (pow == 1)
        return base;
    ll x = fastpow(base, pow / 2) % mod;
    x *= x;
    x %= mod;
    if (pow % 2)
        x *= base;
    return x % mod;
}

ll inverse(ll x)
{
    return fastpow(x, mod - 2) % mod;
}

ll fact[(int)1e6 + 5], inv[(int)1e6 + 5];
void init()
{
    fact[0] = inv[0] = 1;
    for (int i = 1; i <= 1e6; i++)
    {
        fact[i] = (i * fact[i - 1]) % mod;
        inv[i] = inverse(fact[i]);
    }
}

void factorize(ll x, map<int, int> &ss)
{
    while (x % 2 == 0)
        ss[2]++, x /= 2;
    for (int i = 3; i <= sqrt(x); i += 2)
        while (x % i == 0)
            ss[i]++, x/= i;
    if (x > 2)
        ss[x]++;
}

ll ncr(ll n, ll r)
{
    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}

ll npr(ll n, ll r)
{
    return (fact[n] * inv[n - r]) % mod;
}

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

int n;
ll arr[(int)1e5 + 5];
ll dp[(int)1e5 + 5];

ll solve(int idx)
{
    if (idx == n)
        return 0;
    if (dp[idx] != -1)
        return dp[idx];
    ll res = 1e9;
    if (idx + 1 < n)
        res = min(res, abs(arr[idx] - arr[idx + 1]) + solve(idx + 1));
    else if (idx + 1 == n)
        res = min(res, solve(idx + 1));
    if (idx + 2 < n)
        res = min(res, abs(arr[idx] - arr[idx + 2]) + solve(idx + 2));
    else if (idx == n)
        res = min(res, solve(idx + 2));
    return dp[idx] = res;
}

int main()
{
    fastio
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    dp[0] = 0;
    dp[1] = abs(arr[0] - arr[1]);
    for (int i = 2; i < n; i++)
    {
        int c1 = dp[i - 1] + abs(arr[i] - arr[i - 1]);
        int c2 = dp[i - 2] + abs(arr[i] - arr[i - 2]);
        dp[i] = min(c1, c2);
    }
    cout << dp[n - 1];
    return 0;
}


Measured memory_bytes: 1792
#!/usr/bin/env python3
#
# Author: Tetsuya Ishikawa <tiskw111@gmail.com>
# Date  : June 30, 2020
##################################################### SOURCE START #####################################################

A = int(input().strip())
B = int(input().strip())
C = int(input().strip())
X = int(input().strip())

count = 0

if X % 50 != 0:
    print(0)

else:

    Y = X // 50

    for a in range(A + 1):
        for b in range(B + 1):
            c = Y - 10 * a - 2 * b
            if 0 <= c <= C:
                count += 1

    print(count)

##################################################### SOURCE FINISH ####################################################
# vim: expandtab tabstop=4 shiftwidth=4 fdm=marker


Measured memory_bytes: 9084
#include<stdio.h>
int main()
{
	int n,count=0;
	scanf("%d",&n);
	char s[n+1];
	scanf("%s",s);
	for(int i=0;i<n;i++)
	{
		if(i+1<n && i+2<n)
		{
			if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
				count++;
		}
	}
	printf("%d\n",count);
}



Measured memory_bytes: 128
// AOJ 0642 Sugoroku
// 2018.3.28 bal4u

#include <stdio.h>

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

int one, s;
int main()
{
	int n;

	n = in(); while (n--) {
		if (in()) s++;
		else {
			if (s > one) one = s;
			s = 0;
		}
	}
	if (s > one) one = s;
	printf("%d\n", one+1);
	return 0;
}


Measured memory_bytes: 2104
#include<stdio.h>
int main(){
  int n,i,j,k,s=0,M=1e9+7;
  int d[10][60]={};
  char s1[100],s2[100];
  scanf("%d",&n);
  scanf("%s %s",s1,s2);
  for(i=0;i<9;i++){
    if(s1[0]==s2[0]&&i/3==i%3)d[i][0]=1;
    if(s1[0]!=s2[0]&&i/3!=i%3)d[i][1]=1;
  }
  for(i=s1[0]==s2[0]?0:1;i<n;i++){//printf("%d:",i);
    //for(j=0;j<9;j++)printf("%d ",d[j][i]);printf("\n");
    for(j=0;j<9;j++){
      for(k=0;k<9;k++){
	if(s1[i]==s2[i]){
	  if(j/3-j%3)continue;
	  if(s1[i+1]==s2[i+1]){
	    if(k/3-k%3)continue;
	    if(j/3==k/3)continue;
	    d[k][i+1]=(d[k][i+1]+d[j][i])%M;
	  }
	  else{
	    if(k/3==k%3)continue;
	    if(j/3==k/3||j%3==k%3)continue;
	    d[k][i+2]=(d[k][i+2]+d[j][i])%M;
	  }	  
	}
	else{
	  if(j/3==j%3)continue;
	  if(s1[i+1]==s2[i+1]){
	    if(k/3-k%3)continue;
	    if(j/3==k/3||j%3==k%3)continue;
	    d[k][i+1]=(d[k][i+1]+d[j][i])%M;
	  }
	  else{
	    if(k/3==k%3)continue;
	    if(j/3==k/3||j%3==k%3)continue;
	    d[k][i+2]=(d[k][i+2]+d[j][i])%M;
	  }
	}
      }
    }
    if(s1[i+1]-s2[i+1])i++;
  }
  for(i=0;i<9;i++)s=(s+d[i][n-1])%M;
  printf("%d\n",s);
  return 0;
}


Measured memory_bytes: 128
s = input()
if len(s) == 1:
    print('0')
else:
    if len(s) % 2 == 0:
        sa = s[:len(s)//2]
        sb = s[len(s)//2:]
        sbr = sb[::-1]
    else:
        sa = s[:(len(s)-1)//2]
        sb = s[(len(s)-1)//2:]
        sbr = s[::-1]
    n = 0
    for i in range(len(sa)):
        if sa[i] != sbr[i]:
            n += 1
    print(n)

Measured memory_bytes: 38256
#![allow(unused_imports)]

//input
use proconio::input;
use proconio::marker::{Bytes, Chars};
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;
//use std::collections::BinaryHeap;

//use std::cmp::*;

fn main() {
    input! {
        s : Chars,
    }
    for x in s.iter() {
        print!("{}", x);
    }
    if s[s.len() - 1] == 's' {
        println!("es");
    } else {
        println!("s");
    }
}


Measured memory_bytes: 2152
#include <iostream>

using namespace std;
int main()
{
    int a,b,c,n;
    cin>>n;
    if((n>=10)&&(n<=99))
    {for(int i=0;i<1;i++)
        a=n/10;
        b=n%10;
        c=a%10;



    }
    if((b==9)||(c==9))
        cout<<"Yes";
    else
        cout<<"No";
	
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static long[] V;
    static long[] dp;

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        V = new long[n + 1];
        dp = new long[n + 1];
        for (int i = 0; i <= n; i++) {
            dp[i] = -1;
        }
        for (int i = 1; i <= n; i++) {
            V[i] = sc.nextLong();
        }
        long ans = solve(n);
        System.out.println(ans);
    }

    private static long solve(int n) {
        if (dp[n] != -1){
            return dp[n];
        }

        if (n == 1){
            return 0;
        }
        if (n == 2){
            return dp[n] = Math.abs(V[2] - V[1]);
        }
        long option1 = Math.abs((V[n] - V[n - 1])) + solve(n - 1);
        long option2 = Math.abs((V[n] - V[n - 2])) + solve(n - 2);
        return dp[n] = Math.min(option1, option2);
    }
}


Measured memory_bytes: 76156
n = int(input())
a = list(map(int, input().split()))
money = 1000
stock = 0

d = []
for i in range(1, n):
  diff = a[i] - a[i-1]
  if diff > 0:
    d.append('up')
  elif diff < 0:
    d.append('down')
  else:
    d.append('stay')

def buy_all(money, stock, price):
  num = money // price
  money -= price * num
  stock += num
  return money, stock

def sell_all(money, stock, price):
  money += price * stock
  stock = 0
  return money, stock

flag = 0
for i in range(n-1):
  if flag == 0 and d[i] == 'up':
    money, stock = buy_all(money, stock, a[i])
    flag = 1
  if flag == 1 and d[i] == 'down':
    money, stock = sell_all(money, stock, a[i])
  if flag == 1 and d[i] == 'up':
    money, stock = buy_all(money, stock, a[i])
if stock > 0:
  money, stock = sell_all(money, stock, a[n-1])
print(money)
    



Measured memory_bytes: 9192
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N, A, B;
    N = sc.nextInt();
    A = sc.nextInt();
    B = sc.nextInt();

    if(A*N < B) {
      System.out.println(A*N);
    } else {
      System.out.println(B);
    }
  }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

const double bit = 380000.0;

int main(){
    int n;
    cin >> n;
    vector<double> x(n);
    vector<string> u(n);

    double ans = 0;

    rep(i,n){
        double x; cin >> x;
        string u; cin >> u;
        if(u == "JPY") ans+=x;
        else{
            ans += x * bit;
        }
    }
    cout << Double(ans) << endl;
}


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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;



int main() {

	map<string, int> m;

	string s;
	cin >> s;

	string t = "";
	string u = "";


	int ans = 0;
	REP(i, s.size()) {
		t += s[i];
		if (t == u) {
			continue;
		}
		else {
			ans++;
			u = t;
			t = "";
		}
	}

	cout << ans << endl;



	return 0;
}


Measured memory_bytes: 1152
import java.util.*;

public class Main{
  
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int L = sc.nextInt();
    int R = sc.nextInt();
    int d = sc.nextInt();
    int count = 0;
    
    if(L>=1 && L<=100 && R>=1 && R<=100 && d>=1 && d<=100){
      for(int i = L; i <= R ; i++){
        if(i % d == 0){
          count++;
        }
      }
      System.out.println(count);
      
    }else{
      System.out.println("入力条件に違反しています");
    }
    
  }
  
}

Measured memory_bytes: 35792
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::io::{stdin, stdout, BufWriter, Write};

#[derive(Default)]
struct Scanner {
    buffer: Vec<String>,
}

impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scan = Scanner::default();
    let out = &mut BufWriter::new(stdout());

    let s = scan.next::<i32>();
    let m = s /60 % 60;
    let h = s / 3600;

    writeln!(out, "{}:{}:{}", h, m, s%60).ok();
}



Measured memory_bytes: 5036
#include <bits/stdc++.h>
using namespace std;
int p[11], c[11];
int main(){
	int d, g;
	scanf("%d%d", &d, &g);
	for(int i=0;i<d;i++){
		scanf("%d%d", &p[i], &c[i]);
	}
	int ans = 1e9;
	for(int i=0;i<(1<<d);i++){
		int score = 0, res = 0;
		for(int j=0;j<d;j++){
			if((i>>j)&1){
				res += p[j];
				score += 100*(j+1)*p[j] + c[j];
			}
		}
		for(int j=d-1;j>=0;j--){
			if((i>>j)&1) continue;
			if(score >= g) break;
			int mx = 100*(j+1)*p[j];
			int used = (g-score+100*(j+1)-1)/(100*(j+1));
			if(used <= p[j]){
				res += used;
				score += 100*(j+1)*used;
			}
			else{
				res += p[j];
				score += 100*(j+1)*p[j];
			}
		}
		if(score >= g){
			ans = min(ans, res);
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// atoi : atoi(str.c_str())
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  int n,m;
  cin >> n >> m;
  vector<pair<int,int>> a(m);
  rep(i,m){
    cin >> a.at(i).first >> a.at(i).second; 
  }
  sort(a.begin(),a.end());
  int x = a.at(0).first;
  int y = a.at(0).second;
  int nextx,nexty;
  int answer = 0;
  for(int i=1;i<m;i++){
    nextx = a.at(i).first;
    nexty = a.at(i).second;
    if(y <= nextx){
      answer++;
      x = nextx;
      y = nexty;
      continue;
    }
    x = max(x,nextx);
    y = min(y,nexty);
  }
  answer++;
  cout << answer << endl;
}

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

int main(){
	int N=0;
	int x[366];
	int y[366];
	int b[366];
	int p[366];
	
	int minA[366];

	cin>>N;
	for(int i=0;i<N;i++){
		cin>>x[i];
		cin>>y[i];
		cin>>b[i];
		cin>>p[i];
	}
	for(int i=0;i<N;i++){
		int A=0;
		int B=1000000;
		int C=1000000;
		int D=1000000;
		int E=1000000;

		A=x[i]*b[i]+y[i]*p[i];

		if((b[i]>=5)&&(p[i]>=2)){
			B=(x[i]*b[i]+y[i]*p[i])*0.8;
		}
		
		if((b[i]<5)&&(p[i]<2)){
			C=(x[i]*5+y[i]*2)*0.8;
		}
		if((b[i]<5)&&(p[i]>=2)){
			D=(x[i]*5+y[i]*p[i])*0.8;
		}
		if((b[i]>=5)&&(p[i]<2)){
			E=(x[i]*b[i]+y[i]*2)*0.8;
		}
		minA[i]=min(A,B);
		minA[i]=min(minA[i],C);
		minA[i]=min(minA[i],D);
		minA[i]=min(minA[i],E);
	}
	for(int i=0;i<N;i++){
		cout<<minA[i]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1168
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		switch (x.substring(x.length() - 1)) {
		case "3":
			System.out.println("bon");
			break;
		case "0":
		case "1":
		case "6":
		case "8":
			System.out.println("pon");
			break;
		default:
			System.out.println("hon");
			break;
		}
	}
}

Measured memory_bytes: 35708
#include <stdio.h>

int main(void)
{

  int i, j, N, v, k;
  int A[100];

  scanf ("%d\n", &N);

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

  for (i = 1; i < N+1; i++) {
   v = A[i];
   j = i - 1;

    for (k = 0; k < N; k++) {
        printf("%d", A[k]);
        if (k < N-1) printf(" ");
        else printf("\n");
    }

    while (j >= 0 && A[j] > v) {
     A[j+1] = A[j];
     j--;
     A[j+1] = v;
   }

  
   } 
return 0;
}

Measured memory_bytes: 2688
#include <stdio.h>

int main()
{
  int n;
  int A[100];
  int i, j, k;
  int key;
  
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", &A[i]);
  }
  // printf("--------------\n");
  for(i=0; i<n; i++){
      if(i == n - 1) printf("%d", A[i]);
      else printf("%d ", A[i]);
  }
  printf("\n");
  
  for(i=1; i<n; i++){
    key = A[i];
    //printf("key=%d\n", key);
    /* insert A[i] into the sorted sequence A[0,...,j-1] */
    j = i-1;
    
    while(j>=0 && A[j]>key){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=key;
    
    for(k=0; k<n; k++){
      if(k == n - 1) printf("%d", A[k]);
      else printf("%d ", A[k]);
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2140
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i < n; i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
int main()
{
    string n;
    cin >> n;
    int m = n.size();
    int tmp = 0;
    rep(i, m) tmp += (int) n[i]-'0', tmp %= 9;
    if (tmp==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3740
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    H = int(input())

    # 1オリジンにするために、0番目にNoneを入れておく
    A = [None] + list(map(int, input().split()))

    def max_heapify(i):
        l = 2*i
        r = 2*i+1
        # 左の子、自分、右の子で値が最大のノードを選ぶ
        if l <= H and A[l] > A[i]:
            largest = l
        else:
            largest = i
        if r <= H and A[r] > A[largest]:
            largest = r

        if largest != i: # 子の方が値が大きい場合
            A[i], A[largest] = A[largest], A[i] # pythonはこれで要素の入れ替えが可能
            max_heapify(largest)

    for i in range(H//2, 0, -1):
        max_heapify(i)

    # Aが1オリジンなので、0番目は出力しないように
    print(' ' + ' '.join(map(str, A[1:])))



Measured memory_bytes: 64244
import math
xyzk = list(map(int,input().split()))
abc = [list(map(int,input().split())) for a in range(3)]
ab=[]
for a in abc[0]:
    for b in abc[1]:
        ab.append(a+b)
ab.sort()
ab.reverse()
abc[2].sort()
abc[2].reverse()
abc2=[]
for c in range(len(abc[2])):
    for a in range(min([math.ceil(xyzk[3]/(c+1)),len(ab)])):
        abc2.append(abc[2][c]+ab[a])
abc2.sort()
abc2.reverse()
for a in range(xyzk[3]):
    print(abc2[a])

Measured memory_bytes: 55384
#include<stdio.h>
int main(){
	double f;
	int a,b,d,r;
	scanf("%d %d",&a,&b);
	d=a/b;
	r=a%b;
	f=1.0*a/b;
	printf("%d %d %lf\n",d,r,f);
return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
//一括include
using namespace std;
int main()
{
    string s;
    cin >> s;
    string ans = {};
    int n = s.size();
    for (int i = 0; i < n; i += 2)
    {
        ans += s[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
string_data = list(input())

N = len(string_data)
match_word_lits = ['A', 'C', 'G', 'T']
count = 0
max_word = 0
for i in range(N):
    if string_data[i] in match_word_lits:
        count += 1
        if max_word < count:
            max_word = count
    else:
        count = 0

print(max_word)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
void sunday(int n,string s)
{
    int l = s.length();
    for(int i = 0;i<l;i++)
    {
        if(int(s[i])+n<=90)
            s[i] = int(s[i])+n;
        else
            s[i] = int(s[i])+n-26;
    }
    //cout<<int(s[0])+2;
    cout<<s;
}
int main()
{
    string s;
    int n;
    cin>>n;
    cin>>s;
    sunday(n,s);
    return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int sum = 0;
    rep(i, n) sum += a[i];
    int ans = 0;
    rep(i, n) if (a[i] * 4 * m >= sum)++ ans;
    if (ans < m)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_N=1e6;
const ll MOD=1e9+7;
ll n;
ll dp[MAX_N+1];
int main(){
	cin>>n;
	dp[0]=1;
	dp[1]=n;
	dp[2]=n*n%MOD;
	ll sm=(1+n+n*n)%MOD;
	FOR(i,3,n+1){
		ll v=(sm-dp[i-2]+MOD)%MOD;
		v+=n-i+1;
		v%=MOD;
		v+=(n-1)*(n-1)%MOD;
		v%=MOD;
		dp[i]=v;
		sm+=v;
		sm%=MOD;
	}
	cout<<dp[n]<<endl;
	return 0;
}

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

using namespace std;

int main(){
    int n;
    long long int ans = 0;
    cin >> n;
    vector<int>step(n);

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

    int max_step = step[0];
    for(int i = 0; i < n; i++){
        if(max_step > step[i]){
            ans += max_step-step[i];
        }
        max_step = max(max_step,step[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4004
//file_name:ABC88_A.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}

const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n;
    scanf("%d",&n);
    int a;
    scanf("%d",&a);

    if(n%500<=a)yn;

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int search(int A[], int n, int key){
  int i = 0;
  A[n] = key;
  while(A[i] != key) i++;
  return i != n;
}


int main(){
  int i, n,x,key, sum = 0;
  int A[10000];
   scanf("%d", &n);
   for(i = 0; i < n; i++)scanf("%d", &A[i]);

   scanf("%d", &x);
   for(i = 0; i < x; i++){
     scanf("%d", &key);
     if(search(A, n,key))
       sum = sum +1;
   }
   printf("%d\n", sum);
   return 0;
}



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

int gcd(int a,int b){
  if (a==0){return b;}
  int c,ans;
  for(int i=0;i<900;i++){
    c=a%b;
    if (c==0){
      ans=b;
      break;
    }
    a=b;
    b=c;
  }
  return ans;
}




int main(){
  int N;
  cin>>N;
  
  int newN=1;
  int beki=0;
  for(;N>newN;newN*=2){
    beki++;
  }
  
  vector<int> x(newN,0);
  for(int i=0;i<N;i++){
    cin>>x[i];
  }
  
  
  for(int i=N;i<newN;i++){
    x[i]=x[N-1];
  }
  
  
  vector<int> y(newN*2,0);
  for(int i=0;i<newN;i++){
    y[i+newN]=x[i];
  }
  
  
  for(int j=newN/2;j>0;j/=2){
    for(int i=0;i<j;i++){
      y[i+j]=gcd(y[j*2+i*2],y[j*2+i*2+1]);
    }
  }
  
  
  //ここからは
  int gcdmax=0;
  for(int i=0;i<N;i++){
    //i番目を除外したときの全gcd値
    int j=i;
    int g=0;
    for(int k=0;k<beki;k++){
      int t=1-(j/(1<<k))%2;
      g=gcd(g,y[(1<<(beki-k))+((j/(1<<k))^1)]);
    }
    gcdmax=max(gcdmax,g);
  }
  
  cout<<gcdmax<<endl;
  return 0;
}

Measured memory_bytes: 1792
from itertools import groupby

# RUN LENGTH ENCODING str -> tuple
def run_length_encode(S: str):
    """
    'AAAABBBCCDAABBB' -> [('A', 4), ('B', 3), ('C', 2), ('D', 1), ('A', 2), ('B', 3)]
    """
    grouped = groupby(S)
    res = []
    for k, v in grouped:
        res.append((k, len(list(v))))
    return res


S = input()
K = int(input())

if len(set(list(S))) == 1:
    print((len(S) * K) // 2)
else:
    rle = run_length_encode(S)
    cnt = 0
    for w, length in rle:
        if length > 1:
            cnt += length // 2

    ans = cnt * K
    if S[0] == S[-1]:
        a = rle[0][1]
        b = rle[-1][1]
        ans -= (a // 2 + b // 2 - (a + b) // 2) * (K - 1)
    print(ans)




Measured memory_bytes: 9156
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        // long startTime = System.currentTimeMillis();

        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        Long[] X = new Long[N];
        for (int i = 0; i < N; i++) {
            X[i] = scanner.nextLong();
        }
        scanner.close();

        Arrays.sort(X);

        Long n = X[N - 1];
        Double m = n / 2.0;
        Double d = Double.MAX_VALUE;
        // System.out.println(m);
        Long r = X[N - 1];
        for (int i = 0; i < N - 1; i++) {
            Double s = Math.abs(X[i] - m);
            if (d > s) {
                d = s;
                r = X[i];
            }
        }
        System.out.println(n + " " + r);
        // System.out.println(System.currentTimeMillis() - startTime);
    }
}

Measured memory_bytes: 62856
a, b=map(int, input().split())
def fn(n, m):
  k = 0
  for i in range (m):
    k = k + n * 10 ** i
  return k
if a > b:
  print(fn(b, a))
elif a < b:
  print(fn(a, b))
else:
  print(fn(a, b))

Measured memory_bytes: 3060
#include<cstdio>
#define Min(a, b) ((a)<(b))?(a):(b)
const int inf = 0x3f3f3f;
using namespace std;
int main()
{
    int n;
    while(scanf("%d", &n)!=EOF)
    {
        int i, a, b, c, d, e, m, l;
        int minx = inf;
        if(n < 10)
            printf("%d\n", n);
        else if(n == 10)
            printf("10\n");
        else if(n<20)
        {
            for(i=10; i<=n; i++)
            {
                a = i%10;
                l = a+1;
                m = n-i;
                l += m;
                minx = Min(l, minx);
            }
            printf("%d\n", l);
        }
        else if(n>=20)
        {
            for(i=n-1; i>=n/2; i--)
            {
                m = n-i;
                a = m % 10;
                b = (m-a)/10%10;
                c = (m-b*10-a)/100%10;
                d = (m-c*100-b*10-a)/1000%10;
                e = m/10000;
                l = a+b+c+d+e;
                a = i % 10;
                b = (i-a)/10%10;
                c = (i-b*10-a)/100%10;
                d = (i-c*100-b*10-a)/1000%10;
                e = i/10000;
                l += a+b+c+d+e;
                minx = Min(minx, l);
            }
            printf("%d\n", minx);
        }
    }
}


Measured memory_bytes: 888
#include <iostream>
#include <stdlib.h>
using namespace std;

int H;
int Cx;
int Cy;

int N;
int x[110];
int y[110];
int h[110];

inline int height(int x, int y) {
  int h = H - abs(x - Cx) - abs(y - Cy);
  return (h > 0) ? h : 0;
}

void solve() {
  int i_nz; // non-zero index
  for(int i = 0; i < N; i++) {
    if(h[i] > 0)  i_nz = i;
  }

  // 中心座標を(cx, cy)として全探索
  for(Cx = 0; Cx <= 100; Cx++) {
    for(Cy = 0; Cy <= 100; Cy++) {

      H = h[i_nz] + abs(x[i_nz] - Cx) + abs(y[i_nz] - Cy);

      bool flag = true;
      for(int i = 0; i < N; i++) {
        if(height(x[i], y[i]) != h[i]) {
          flag = false;
          break;
        }
      }

      if(flag)  return;

    }
  }
}

int main() {
  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> x[i] >> y[i] >> h[i];
  }

  solve();
  cout << Cx << " " << Cy << " " << H << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int n, W;
Int dp[110][110000];
Int w[110], v[110];

int main(){
    cin >> n >> W;
    for(int i = 1;i <= n;i++)cin >> w[i] >> v[i];
    for(int j = 1;j < 110000;j++){
        dp[0][j] = LINF;
    }
    for(int i = 1;i <= n;i++){
        for(int j = 0;j < 110000;j++){
            dp[i][j] = dp[i-1][j];
            if(j-v[i] >= 0){
                dp[i][j] = min(dp[i][j], dp[i-1][j-v[i]] + w[i]);
            }
        }
    }
    int ans = 0;
    for(int v = 0;v < 110000;v++){
        if(dp[n][v] <= W){
            ans = max(ans, v);
        }
    }
    cout << ans << endl;
    
    return 0;
}

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

#define int long long

struct Combination {
  int mod; // e.g. 1000000007
  vector<int> fact; // factorial
  vector<int> invf; // inverse factorial
  vector<vector<int> > part; // partition number

  /*
    constructor : O(sz+log(mod))   
    make factorial table (fact) and inverse factorial table (invf)
  */
  Combination(int sz, int mod) : fact(sz+1), invf(sz+1), mod(mod) {
    fact[0] = 1;
    for ( int i = 1; i < (int)fact.size(); i++ ) {
      fact[i] = fact[i-1]*i%mod;
    }
    invf[sz] = inv(fact[sz]);
    for ( int i = sz-1; i >= 0; i-- ) {
      invf[i] = invf[i+1]*(i+1)%mod;
    }
  }

  int pow(int x, int n) const {
    int ret = 1;
    while ( n > 0 ) {
      if ( n & 1 ) (ret *= x) %= mod;
      (x *= x) %= mod;
      n >>= 1;
    }
    return ret;
  }

  int inv(int x) const {
    return pow(x, mod - 2);
  }

  /*
    permutation
  */
  int P(int n, int r) const {
    if ( r < 0 || n < r ) return (0);
    return fact[n]*invf[n-r]%mod;    
  }

  /*
    combination
  */
  int C(int n, int r) const {
    if ( r < 0 || n < r ) return (0);    
    return fact[n]*invf[r]%mod*invf[n-r]%mod;    
  }  

  /*
    combination with repetition
  */
  int H(int n, int r) const {
    if ( n < 0 || r < 0 ) return 0;
    if ( n == 0 && r == 0 ) return 1;
    return C(n+r-1, n);    
  }

  /*
    stirling number
  */
  int S(int n, int r) const {
    int ret = 0;
    for ( int i = 1; i <= r; i++ ) {
      int add = C(r, i)*pow(i, n)%mod;      
      if ( (r-i)&1 ) ret += mod-add;
      else ret += add;
      ret %= mod;      
    }
    (ret *= invf[r]) %= mod;
    return ret;
  }

  /*
    bell number
  */
  int B(int n, int r) const {
    int ret = 0;
    for ( int i = 1; i <= r; i++ ) {
      (ret += S(n, i)) %= mod;      
    }
    return ret;
  }

  /*
    calc partition number
    return and make partition number table (part)
  */
  vector<vector<int> > built_part(int n, int r) {
    part = vector<vector<int> >(n+1, vector<int>(r+1, 0));
    part[0][0] = 1;
    for ( int i = 0; i <= n; i++ ) {
      for ( int j = 1; j <= r; j++ ) {
	if ( i-j >= 0 ) {
	  (part[i][j] = part[i][j-1]+part[i-j][j]) %= mod;	  
	} else {
	  part[i][j] = part[i][j-1];
	}
      }
    }
    return part;    
  }

  /*
    TODO 
    make built_part() that make only part[i][i]
    https://twitter.com/kirika_comp/status/953482654787149824
    http://d.hatena.ne.jp/DEGwer/20170829
    http://mathworld.wolfram.com/BellNumber.html
  }    
  */
};


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

  const int MOD = 998244353;
  Combination comb(100001, MOD);  

  int ans = 1;
  int N;
  cin >> N;

  vector<int> cnt(N, 0);
  int ma = 0;
  bool f = true;
  for ( int i = 0; i < N; i++ ) {
    int a;
    cin >> a;
    if ( i == 0 && a != 0 ) f = false;
    if ( i != 0 && a == 0 ) f = false;    
    else cnt[a]++;
    ma = max(ma, a);    
  }

  if ( !f ) {
    cout << 0 << endl;
    return 0;
  }

  for ( int i = 1; i < ma; i++ ) {
    ans *= comb.pow(cnt[i], cnt[i+1]);    
    ans %= MOD;    
  }

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 2560
#include<iostream>
using namespace std;
long long gcd(long long a, long long b) {
	long long c;
	if (a < b)a += b, b = a - b, a -= b;
	while (b != 0) c = a % b, a = b, b = c;
	return a;
}
int main() {
	long long t, a, b, c, d;
	cin >> t;
	for (int i = 0; i < t; i++) {
		cin >> a >> b >> c >> d;
		int x = 0;
		long long z = (a - c) % gcd(b, d);
		z += gcd(b, d);
		z = z % gcd(b, d);
		if (z == 0) z = gcd(b, d);
		if (b - c <= z) x = 1;
		if (a < b || d < b) x = 0;
		if (x == 0) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef pair<pi,pi> ppi;

const int N=205,P=998244353;

map<ppi,int>D;
int n,x[N],y[N],p2[N],m,t;

inline int gcd(int x,int y){return y?gcd(y,x%y):x;}
inline pi mk(pi x){
	ll g=gcd(x.fi,x.se);
	if(g)x.fi/=g,x.se/=g;
	if(x.fi<0)x.fi=-x.fi,x.se=-x.se;
	else if(x.fi==0&&x.se<0)x.se=-x.se;
	return x;
}
inline ppi mp(ll u1,ll v1,ll u2,ll v2){
	pi l=mk({u2-u1,v2-v1}),s;
	if(l.fi)s=mk({v1*l.fi-u1*l.se,l.fi});else s={u1,0};
	return {l,s};
}
inline int get(int s){return (1+sqrt(1+8*s+0.5))/2;}

int main(){
	scanf("%d",&n);
	p2[0]=1;
	for(int i=1;i<=n;i++)p2[i]=(p2[i-1]<<1)%P,scanf("%d%d",&x[i],&y[i]);
	for(int i=1;i<=n;i++)for(int j=1;j<i;j++)D[mp(x[i],y[i],x[j],y[j])]++;
	m=p2[n];
	for(auto&i:D)t=get(i.se),m=(m-p2[t]+t+1+P)%P;
	m=(m-n-1+P)%P;
	printf("%d\n",m);
	return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	vector<vector<vector<int>>> T(4,vector<vector<int>>(3,vector<int>(10,0)));
	int N=in();
	REP(i,N){
		int u=in()-1,v=in()-1,w=in()-1;
		T[u][v][w] += in();
	}
	
	REP(i,4){
		REP(j,3){
			REP(k,10){
				cout << ' ' << T[i][j][k];
			}
			cout << endl;
		}
		if(i<3){
			REP(k,20) cout << '#';
			cout << endl;
		}
	}
	//cout << endl;

	return 0;
}



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

int main(){
    while(1){
        int m, f, r;
        cin >> m >> f >> r;
        if(m==-1 && f==-1 && r==-1) break;

        if(m==-1 || f==-1) cout << "F";
        else if(m + f >= 80) cout << "A";
        else if(m + f >= 65) cout << "B";
        else if(m + f >= 50) cout << "C";
        else if(m + f >= 30){
            if(r >= 50) cout << "C";
            else cout << "D";
        }
        else cout << "F";

        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3088
#include <iostream>

using namespace std;

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


	for (int i = 0; i < N; i++) {
		char S;
		cin >> S;
		if (S == 'Y') {
			cout << "Four" << endl;
				return 0; 
		}
		
	}
	cout << "Three" << endl;
	return 0;

}


Measured memory_bytes: 3112
n = int(input())
b = [int(i) for i in input().split()]
#print(b)

a = [1]
a[0] = b[0]
for i in range(1,n-1):
    #print(i)
    a.append(min(b[i-1], b[i]))
a.append(b[n-2])
print(sum(a))

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

typedef long long ll;
int main(){
    int n, m;
    map<ll, int> shop;
    int key;
    long long value;

    cin >> n >> m;
    for(int i = 0; i < n; i++){
        cin >> key >> value;
        if(shop.count(key) == 0){
            shop[key] = value;
        }else{
            shop[key] += value;
        }
    }

    int count = 0;
    ll price = 0;
    for(auto x : shop){
        if(count + x.second < m){
            count += x.second;
            price += x.first * x.second;
        }else{
            while(count < m){
                count++;
                price += x.first;
            }
        }
        if(count >= m){
            break;
        }
    }
    cout << price << endl;
}


Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
using namespace std;

int main(){
    char find[10];
    cin >> find;
    int counter = 0;
    while(1){
        char word[1000];
        cin >> word;
        if (strcmp(word, "END_OF_TEXT") ==0) break;
        for(int i=0; word[i]; i++){
            word[i] = tolower(word[i]);
        }
        if (strcmp(word, find) ==0) counter += 1;
    }   
    cout << counter << endl;
    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int
#define double long double
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
int solve(int h)
{
    if (h == 1)
        return 1;
    return 1 + 2 * solve(h / 2);
}
signed main()
{
    int h;
    cin >> h;
    int ans = solve(h);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int solve(vector<int> bam,int a, int b, int c, int A, int B,int C){
  if(bam.size() == 0){
    return ((min({a,b,c}) > 0) ? abs(A-a)+abs(B-b)+abs(C-c)-30 : MOD);
  }
  int len = bam[0];
  vector<int> buf;
  rep(i,bam.size()-1) buf.push_back(bam[i+1]);
  //rep(i,bam.size()) cout<<bam[i]<<"  ";
  //cout<<endl;
  int buf1 = solve(buf,a+len,b,c,A,B,C) + 10;
  int buf2 = solve(buf,a,b+len,c,A,B,C) + 10;
  int buf3 = solve(buf,a,b,c+len,A,B,C) + 10;
  int buf4 = solve(buf,a,b,c,A,B,C);
  return min({buf1,buf2,buf3,buf4});
}


int main(){
  int n,a,b,c;
  cin >> n >> a >> b >> c;
  vector<int> bamboo(n);
  rep(i,n) cin >> bamboo[i];
  cout << solve(bamboo,0,0,0,a,b,c) << endl;
}



Measured memory_bytes: 256
s = input()


def count(a):
    global s
    cnt = 0
    for i in range(len(s)):
        if (i % 2 == 0 and s[i] == a[0]) or (i % 2 == 1 and s[i] == a[1]):
            cnt += 1
    return cnt


print(min(count("10"), count("01")))


Measured memory_bytes: 3316
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
const int INF = 1001001001;
const ll MOD = 1e9+7;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

ll dp[3005][3005];

signed main(){
	int n; cin>>n;
	string s; cin>>s;

	int m = s.size();

	rep(i,m){
		s[i] = s[i]+n;
		if(s[i]>'Z') s[i] -= 26;
	}
	cout << s << endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <iomanip>
#include <functional>
//#pragma optimize GCC("O3")
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n, d;
	cin >> n >> d;
	vector<pair<ll, ll> > v(n);
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> v[i].first >> v[i].second;
		if (d*d >= v[i].first*v[i].first + v[i].second*v[i].second)
			ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }

const int mod=1000000007;
const int INF=1001001001;


int main() {
  int N;
  cin>>N;
  vector<int>A(N),B(N);
  for(int i=0;i<N;i++){
      cin>>A[i];
      B[i]=A[i]-(i+1);
  }
  sort(B.begin(),B.end());
  int b=B[N/2];
  int64_t sum=0;
  for(int i=0;i<N;i++){
      sum+=abs(A[i]-(b+i+1));
  }
  cout<<sum<<endl;
  return 0;  
}

Measured memory_bytes: 4788
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, ma, mb;
  cin >> N >> ma >> mb;
  ll fn = (N + 1) / 2, bn = N - fn;
  vector<vector<ll>> front;
  vector<vector<ll>> back;
  vector<vector<ll>> fvec(401, vector<ll>(401, INF));
  vector<vector<ll>> bvec(401, vector<ll>(401, INF));
  for (ll i = 0; i < N; ++i) {
    ll a, b, c;
    cin >> a >> b >> c;
    if (i < fn) {
      front.push_back({a, b, c});
    }
    else {
      back.push_back({a, b, c});
    }
  }
  for (ll i = 0; i < (1 << fn); ++i) {
    ll a = 0, b = 0, c = 0;
    for (ll j = 0; j < fn; ++j) {
      if ((i & (1 << j)) != 0) {
        vector<ll> temp = front.at(j);
        a += temp.at(0);
        b += temp.at(1);
        c += temp.at(2);
      }
    }
    fvec.at(a).at(b) = min(fvec.at(a).at(b), c);
  }
  for (ll i = 0; i < (1 << bn); ++i) {
    ll a = 0, b = 0, c = 0;
    for (ll j = 0; j < bn; ++j) {
      if ((i & (1 << j)) != 0) {
        vector<ll> temp = back.at(j);
        a += temp.at(0);
        b += temp.at(1);
        c += temp.at(2);
      }
    }
    bvec.at(a).at(b) = min(bvec.at(a).at(b), c);
  }
  ll ans = INF;
  for (ll i = 1; i < 401; ++i) {
    for (ll j = 1; j < 401; ++j) {
      if (fvec.at(i).at(j) != INF) {
        ll c = fvec.at(i).at(j);
        ll cnt = max((i + ma - 1) / ma, (j + mb - 1) / mb);
        while ((cnt * ma <= 400) && (cnt * mb <= 400)) {
          ans = min(ans, c + bvec.at(cnt * ma - i).at(cnt * mb - j));
          cnt += 1;
        }
      }
    }
  }
  for (ll i = 1; i < 401; ++i) {
    for (ll j = 1; j < 401; ++j) {
      if (bvec.at(i).at(j) != INF) {
        ll c = bvec.at(i).at(j);
        ll cnt = max((i + ma - 1) / ma, (j + mb - 1) / mb);
        while ((cnt * ma <= 400) && (cnt * mb <= 400)) {
          ans = min(ans, c + fvec.at(cnt * ma - i).at(cnt * mb - j));
          cnt += 1;
        }
      }
    }
  }
  if (ans == INF) {
    cout << -1 << "\n";
  }
  else {
    cout << ans << "\n";
  }
}


Measured memory_bytes: 6140
#-*- coding:utf-8 -*-
"""
整数N,Kが与えられます。
N以下の正の整数の組(a,b,c)であって、a+b,b+c,c+aがすべてKの倍数であるようなものの個数を求めてください。
ただし、a,b,cの順番を入れ替えただけの組も異なるものとして数えます。
また、a,b,cの中に同じものがあっても構いません。
"""


def main(str):
    num = str.split()
    N = int(num[0])
    K = int(num[1])
    if(K%2 != 0):
        cnt = 0
        for a in range(1, N+1):
            if(a%K == 0):
                cnt += 1
        cnt = cnt ** 3

    else:
        cnt1 = 0
        cnt2 = 0
        for a in range(1, N+1):
            if(a%K == 0):
                cnt1 += 1
        for a in range(1, N+1):

            if(a%K == K/2):
                cnt2 += 1

        cnt = cnt1 ** 3 + cnt2 ** 3

    print(cnt)


if __name__ == "__main__":
    main(input())

Measured memory_bytes: 3064
n = int(raw_input())

ans = []
for i in range(0, n):
    s, p = raw_input().split(" ")
    p = int(p)

    ans.append((s, p * -1, i + 1))

sort = sorted(ans)

for i in range(0, len(sort)):
    city, point, index = sort[i]
    print(index)


Measured memory_bytes: 2568
#include <iostream>
#include <vector>
#include <string>

using namespace std;

vector<int> tree;
int n, q, cmd;
string str;

void build(int v, int l, int r)
{
    if (l == r - 1)
    {
        tree[v] = (1 << int(str[l] - 'a'));
        return;
    }

    int m = (l + r) / 2;

    build(2 * v + 1, l, m);
    build(2 * v + 2, m, r);

    tree[v] = tree[2 * v + 1] | tree[2 * v + 2];
}

void change(int v, int l, int r, int pos, int num)
{
    if (l == r - 1)
    {
        tree[v] = (1 << num);
        return ;
    }

    int m = (l + r) / 2;

    if (pos < m)
        change(2 * v + 1, l, m, pos, num);
    else
        change(2 * v + 2, m, r, pos, num);

    tree[v] = tree[2 * v + 1] | tree[2 * v + 2];
}

int get(int v, int l, int r, int askl, int askr)
{
    if (askl >= r || l >= askr)
        return 0;

    if (l >= askl && r <= askr)
        return tree[v];

    int m = (l + r) / 2;

    return get(2 * v + 1, l, m, askl, askr) | get(2 * v + 2, m, r, askl, askr);
}

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

    cin >> n >> str >> q;

    tree.resize(4 * n);
    build(0, 0, n);

    while (q--)
    {
        cin >> cmd;

        if (cmd == 1)
        {
            int pos;
            char ch;

            cin >> pos >> ch;

            change(0, 0, n, pos - 1, ch - 'a');
        }
        else
        {
            int l, r, cnt = 0;
            cin >> l >> r;

            int res = get(0, 0, n, l - 1, r);

            for (int i = 0; i < 27; i++)
                if ((res >> i) & 1)
                    cnt++;

            cout << cnt << "\n";
        }
    }

    return 0;
}


Measured memory_bytes: 8732