akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
 
fn main(){
    let n: usize = read();
    let mut c: Vec<u64> = (0..5).map(|_| 0).collect();
 
    for _ in 0..n {
        let tmp: Vec<char> = read::<String>().chars().collect();
        let s = tmp[0];
        match s{
            'M' => { c[0] += 1; },
            'A' => { c[1] += 1; },
            'R' => { c[2] += 1; },
            'C' => { c[3] += 1; },
            'H' => { c[4] += 1; },
            _ => (),
        }
    }
 
    let mut ret = 0;
    for i in 0..5 {
        for j in 0..i {
            for k in 0..j {
                ret += c[i] * c[j] * c[k];
            }
        }
    }
    println!("{}", ret);
}

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

int main(){
    const int INF = 100100100;
    int n; cin >> n;
    vector<int> seq(n);
    for(int i = 0; i < n; i++){
        cin >> seq.at(i);
    }
    int min = INF , max = -1*INF;
    long long sum = 0;
    for(int i = 0; i < n; i++){
        sum += seq.at(i);
        if(min >= seq.at(i)){
            min = seq.at(i);
        }
        if(max <= seq.at(i)){
            max = seq.at(i);
        }
    }
    cout << min << " " << max << " " << sum << "\n"; 
}


Measured memory_bytes: 3116
N=int(input())
A=[((i+1),int(input())) for i in range(N)]
count = 0
b=1
for i in range(N+1):
  b = A[b-1][1]
  count+= 1
  if b==2:
    print(count)
    break
if count == N+1:
  print(-1)
    

Measured memory_bytes: 16556
#include <bits/stdc++.h>
using namespace std;
const int MAXN=10010;
int n,m;
char c[MAXN];
int main () {
	scanf("%d%s",&n,c+1);
	m=strlen(c+1);
	for (int i=1;i<=m;i++) {
		printf("%c",((c[i]-'A'+n)%26)+'A');
	}
	return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math

    #inf = 10**17
    #mod = 10**9 + 7

    n,k = map(int, input().split())
    a = list(map(int, input().split()))
    f =list(map(int, input().split()))
    a.sort()
    f.sort(reverse=True)

    def check(mid, k):
        for i in range(n):
            if a[i]*f[i] <= mid:
                continue
            k -= a[i] - mid // f[i]
            if k < 0:
                return False
        return True

    ng = -1
    ok = 10**12
    while ok - ng > 1:
        mid = (ok + ng) // 2
        if check(mid, k):
            ok = mid
        else:
            ng = mid
    print(ok)

if __name__ == '__main__':
    main()

Measured memory_bytes: 106956
#include <bits/stdc++.h>
using namespace std;
const int maxn=100005;
const int inf=1000*1000*1000;
int n,a[maxn],t[maxn*2];
void add(int x){
  for(;x<maxn*2;x+=x&-x)t[x]++;
}
int ask(int x){
  int y=0;
  for(;x>0;x-=x&-x)y+=t[x];
  return y;
}
long long chk(int v){
  int sum=maxn;
  long long res=0;
  memset(t,0,sizeof(t));
  add(sum);
  for(int i=1;i<=n;i++){
    sum+=(a[i]<=v)?1:-1;
    res+=ask(sum-1);
    //printf("i %d %d %d\n",i,sum,res);
    add(sum);
  }
  return res;
}
int main(){
  //freopen("aa.in","r",stdin);
  scanf("%d",&n);
  for(int i=1;i<=n;i++){
    scanf("%d",a+i);
  }
  int l=1,r=inf;
  long long all=1LL*n*(n+1)/2;
  for(;l<r;){
    int mid=(l+r)/2;
    if(chk(mid)<=all/2)l=mid+1;
    else r=mid;
  }
  printf("%d\n",l);
  return 0;
}

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

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

    map<string, int> mp;
    string S;

    for(int i = 0; i < N; ++i) {
        cin >> S;
        mp[S]++; 
    }

    cin >> N;

    for(int i = 0; i < N; ++i) {
        cin >> S;
        mp[S]--; 
    }
    int ans = 0;
    for(auto itr = mp.begin(); itr!= mp.end(); ++itr) {
        int val = itr->second;
        ans = max(ans, val);
    }
    cout << ans << endl;


}

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

public class Main {
    public static void main (String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] n;
        n = new int[3];
        String str;

        str = scan.next();
        n[0] = Integer.parseInt(str);
        str = scan.next();
        n[1] = Integer.parseInt(str);
        str = scan.next();
        n[2] = Integer.parseInt(str);
        scan.close();

        Arrays.sort(n);

        System.out.println(n[0]+" "+n[1]+" "+n[2]);
    }
}


Measured memory_bytes: 26140
#include<bits/stdc++.h>
using namespace std;
using lint = long long ;
using ulint = unsigned long long ;
using ldouble = long double;

void err(istream_iterator<string> _it) {}
template<typename T,typename... Args>
void err(istream_iterator<string> _it, T a,Args... args) {cerr<<"\n"<<*_it<<" is "<<a<<endl;err(++_it,args...);}

//#define __debug true; // c++17
const bool _debug = true;
#define cerr if(_debug)cerr
#define eb emplace_back
#define error(args...) if(_debug){string _s = #args; replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s); istream_iterator<string> _itt(_ss);err(_itt,args);} 

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ulint ans = 0;
    int n; cin >> n;
    int last = 0;
    int temp;
    for (int i = 0; i < n; ++i){
        cin >> temp;
        int cha = temp - last;
        if (cha < 0) ans += -cha;
        else last = temp;
    }
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <cstdlib> // abs(x-y)
#include <iomanip> // 出力の桁数指定
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  
  if (k >= n)
    cout << 0 << endl;
  else {
  vector<long> h(n);
  rep (i, 0, n) {
    cin >> h.at(i);
  }
    sort (h.begin(), h.end());
    long ans = 0;
    rep (i, 0, n-k)
      ans += h.at(i);
    cout << ans << endl;
  }
}


Measured memory_bytes: 1792
import numpy as np
N = int(input())
S = "d"+input()+"d"

#index=0,N+1は初期化に必要
leftwest = np.array([0]*(N+2))
righteast = np.array([0]*(N+2))

for i in range(1,N+1):
    if S[i] == "W":
        leftwest[i+1] = leftwest[i] + 1
    else:
        leftwest[i+1] = leftwest[i]
        
    if S[-(i+1)] == "E":
        righteast[-(i+2)] = righteast[-(i+1)] + 1
    else:
        righteast[-(i+2)] = righteast[-(i+1)]

#print("left",leftwest)
#print('right',righteast)


print(min(leftwest[1:N+1]+righteast[1:N+1]))

Measured memory_bytes: 34212
a, b = map(int, input().split())
A = format(a, "045b")
B = format(b, "045b")
s = ""
A1 = [(a-1) // (2 ** (i+1)) * 2 ** i + max((a-1) % 2**(i+1) - 2 ** i + 1, 0) for i in range(44, -1, -1)]
B1 = [b // (2 ** (i+1)) * 2 ** i  + max(b % 2 ** (i+1) - 2 ** i + 1, 0) for i in range(44, -1, -1)]  
for i in range(45):
  s += str(int(A1[i]%2 != B1[i]%2))
#print(A1, B1, s)
print(int(s, 2))

Measured memory_bytes: 3064
#include<cmath>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<set>
#define N 10005
#define mod 1000000007
typedef long long ll;
using namespace std;

int main()
{
    int a,b,k;
    cin>>a>>b>>k;
    if(a>b)swap(a,b);
    int flag=0;
    for(int i=a;i>=1;i--)
    {
        if(a%i==0&&b%i==0)
        {
            flag++;
            if(flag==k)
            {
                cout<<i<<endl;
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
using namespace std;

typedef pair<int, int> P;

int ans[110];
P seat[20];
queue<int> waiting;
int Cnt = 0;

void outputSeat(){
  for(int i = 0 ; i < 17 ; i++){
    printf("%3d ", seat[i].first);
  }
  cout << endl;
  
  for(int i = 0 ; i < 17 ; i++){
    printf("%3d ", seat[i].second);
  }
  cout << endl << endl;
}

bool come(int n, int t){
  int group = n % 5 == 1 ? 5 : 2;
  int cnt = 0, s = 0;
  bool f = false;
  for(int i = 0 ; i < 17 ; i++){
    if(seat[i].first == -1 && !f){
      s = i;
      f = true;
    }
    
    if(seat[i].first == -1){
      cnt++;
    }
    
    else cnt = 0, s = i+1, f = false;
  
    if(cnt == group){
      //cout << "OK"<<endl;
      for(int j = s ; j < s+group ; j++){
	seat[j].first = n;
	seat[j].second = 17*(n%2) + 3*(n%3) + 19 + t;
      }
      return true;
    }
  }
  return false;
}
  
void off(int n){
  for(int i = 0 ; i < 17 ; i++){
    if(seat[i].first == n) seat[i].first = -1, seat[i].second = -1;
  }
}

void solve(){
  for(int t = 0 ; t <= 610 ; t++){
    //outputSeat();
    //cout << "time = " << t << endl;
    for(int i = 0 ; i < 17 ; i++){
      if(seat[i].second == t){
	off(seat[i].first);
	if(waiting.size() > 0){
	  int num = waiting.front();
	  while(1){
	    bool f = come(num, t);
	    if(f){
	      ans[num] = t - ans[num];
	      waiting.pop();
	      num = waiting.front();
	      if(num == 0) break;
	    }
	    else break;
	  }
	}
      }
    }
    
    //cout << "front = " << waiting.front() << endl;
    
    if(t % 5 == 0 && Cnt < 100){
      Cnt++;
      int number = t / 5;
      if(waiting.size() > 0){
	ans[number] = t;
	waiting.push(number);
	continue;
      }
      bool f = come(number, t);
      if(f) ans[number] = 0;
      else{
	waiting.push(number);
	ans[number] = t;
      }
    }    
    
  }
  
}

void init(){
  memset(seat, -1 , sizeof(seat));  
  memset(ans, 0, sizeof(ans));
}

int main(){
  init();
  solve();
  int n;

  while(cin >> n) cout << ans[n] << endl;
  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF (int)1e9
#define MOD 0
//#define int ll
using namespace std;
typedef vector<long long> vl;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  double m,element,sep,sum = 0,check =0;
  vector<double> a;
  cin >> n >> m;
  rep(i,n) {
    cin >> element;
    a.push_back(element);
    sum += element;
  }
  sep = sum/(4*m);
  rep(i,n) {
    if(a[i] >= sep) {
      check++;
    }
  }
  if(check >= m) puts("Yes");
  else puts("No");

  return 0;
}



Measured memory_bytes: 256
let conv s =
  let rec loop prev cnt r i =
    if i = String.length s then
      r^(string_of_int cnt)^prev
    else
      begin
        let c = String.make 1 s.[i] in
        if prev = c then
          loop prev (cnt+1) r (i+1)
        else
          loop c 1 (r^(string_of_int cnt)^prev) (i+1)
      end
  in loop (String.make 1 s.[0]) 1 "" 1
;;

let () =
  let rec read () =
    let n = read_int () in
    if n = 0 then ()
    else
      begin
        let init = read_line () in
        let rec loop r = function
            0 -> r
          | i -> loop (conv r) (i-1)
        in
        Printf.printf "%s\n" (loop init n);
        read ()
      end
  in read ()
;;

Measured memory_bytes: 10676
n,k=map(int,input().split())
A=list(map(int,input().split()))
a=len(A)
b=0
for i in range(a-1):
  for j in range(i+1,a):
    if A[i]>A[j]:
      b=b+1
c=0
for i in range(a):
  for j in range(a):
    if A[i]>A[j]:
      c=c+1
print((b*k+c*k*(k-1)//2)%(10**9+7))

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

int main() {
  int N, H, H_tmp, max, n;
  max = n = 0;
  
  cin >> N;
  cin >> H_tmp;
  for(int i=1; i<N; i++) {
    cin >> H;
    if(H_tmp >= H) {
      n++;
    } else {
      if(n>=max) {
        max = n;
      }
      n = 0;
    }
    H_tmp = H;
  }
  
  if(n>=max) {
    max = n;
  }
  
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=200010;
int n,a[maxn];
map<int,int> mp;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		mp[i]=a[i];
	}
	sort(a,a+n);
	map<int,int>::iterator it;
	for(it=mp.begin();it!=mp.end();it++)
	{
		if(it->second<=a[n-2])
			cout<<a[n-1]<<endl;
		else
			cout<<a[n-2]<<endl;
	}
	return 0;
}

Measured memory_bytes: 11776
a=[]

while True:
    tmp99=[]
    tmp0=input()
    if tmp0=="-":
        break
    tmp99.append(list(tmp0))
    tmp1=int(input())
    tmp99.append(tmp1)
    for i in range(tmp1):
        tmp99.append(int(input()))
    a.append(tmp99)
for i in a:
    for j in i[2:]:
        i[0]=i[0][j:]+i[0][:j]
for i in a:
    print("".join(i[0]))


Measured memory_bytes: 5596
MOD = 10**9 + 7


def main():
    N = int(input())
    G = [[] for _ in range(N)]
    for _ in range(N-1):
        a, b = (int(i) for i in input().split())
        G[a-1].append(b-1)
        G[b-1].append(a-1)

    dp_w = [0]*N
    dp_b = [0]*N

    def dfs(s):
        seen = [False]*N
        par = [-1]*N
        stack = [s]
        seen[s] = True
        while stack:
            v = stack.pop()
            if v >= 0:
                stack.append(~v)
                for u in G[v]:
                    if seen[u]:
                        continue
                    stack.append(u)
                    seen[u] = True
                    par[u] = v
            else:
                # 帰りがけ順
                # ~v = -v-1
                v = ~v
                w = 1
                b = 1
                for u in G[v]:
                    if u == par[v]:
                        continue
                    w *= dp_w[u] + dp_b[u]
                    b *= dp_w[u]
                    w %= MOD
                    b %= MOD
                dp_w[v] += w
                dp_b[v] += b
                dp_w[v] %= MOD
                dp_b[v] %= MOD

    dfs(0)
    print((dp_w[0] + dp_b[0]) % MOD)


if __name__ == '__main__':
    main()


Measured memory_bytes: 101424
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

void b_card_game_easy(void) {
	string a, b, c;
	cin >> a >> b >> c;
	int ptr_a = 0, ptr_b = 0, ptr_c = 0;
	char turn = 'a';

	string winner;
	while (true) {
		if (turn == 'a') {
			if (ptr_a == a.size()) {
				winner = 'A';
				break;
			}
			turn = a[ptr_a++];
		}
		else if (turn == 'b') {
			if (ptr_b == b.size()) {
				winner = 'B';
				break;
			}
			turn = b[ptr_b++];
		}
		else {
			if (ptr_c == c.size()) {
				winner = 'C';
				break;
			}
			turn = c[ptr_c++];
		}
	}
	cout << winner << endl;
}

int main()
{
	b_card_game_easy();
    return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main(int argc, char const *argv[])
{
    long long N,K;
    long long sum = 0;
    long long max, min;
    cin >> N >> K;
    for (long long i = K; i < N+2; i++)
    {
        max = (2*N-i+1)*i/2;
        min = i*(i-1)/2;
        sum += max-min+1;
    }
    cout << sum%(1000000007);
    return 0;
}


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

int main() {
    int n,a,b,c;
    cin >> n >> a >> b >> c;
    vector<int> l(n);
    for (int i = 0; i < n; i++) {
        cin >> l.at(i);
    }
    int quat;
    int minMp = 10000;

    for (int i = 0; i < pow(4, n); i++) {
        
        vector<int> matu(4);
        int sum = 0;

        for (int j = 0; j < n; j++) {
            quat = 0;
            if (i & (1<<(j * 2))) {
                quat++;
            }
            if (i & (1<<((j * 2) + 1))) {
                quat += 2;
            }

            if ((matu.at(quat) != 0) && (quat != 3)) {
                sum += 10;
            }
            matu.at(quat) += l.at(j);
        }
        if ((matu.at(0) == 0) || (matu.at(1) == 0) || (matu.at(2) == 0)) {
            continue;
        }
        sum += abs(a - matu.at(0)) + abs(b - matu.at(1)) + abs(c - matu.at(2));
        
        if (minMp > sum) {
            minMp = sum;
        }
    }

    cout << minMp << endl;
}

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

int main(){
    int r,c;
    cin >> r >> c;
    vector<vector<int> > t(r+1, vector<int>(c+1,0));
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            cin >> t[i][j];
            t[r][j] += t[i][j];
            t[i][c] += t[i][j];
            t[r][c] += t[i][j];
        }
    }

    for(int i=0; i<=r; i++){
        for(int j=0; j<c; j++){
            cout << t[i][j] << " ";
        }
        cout << t[i][c] << endl;
    }
    return 0;
}


Measured memory_bytes: 3156
# coding: utf-8
# Your code here!

N = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x : x-1, A))
B = list(map(int, input().split()))
C = list(map(int, input().split()))


point = 0

for i in range(N) : 
    point += B[A[i]]
    if i == N-1 : continue
    if A[i]+1 == A[i+1] : 
        point += C[A[i]]

print(point)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int[] N=cin.ArrayInt(2,0);
        Console.WriteLine(N[0]+N[1]/2);
        
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public static void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }//Answer.IntArrayAns(x);
    public static void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}



Measured memory_bytes: 11092
fn main() {
    let mut buf = String::new();
    let handle = std::io::stdin();
    handle.read_line(&mut buf).unwrap();
    let mut s: String = buf.trim().to_string();
    let k: String = "keyence".to_string();
    let mut k_index: Vec<usize> = vec![];
    
    let mut left = 0;
    let mut right = s.len() - k.len();
    let mut find = false;
    loop {
        let mut target = s[0..left].to_string();
        target.push_str(&s[right..]);
        if target == k {
            find = true;
            break;
        }
        if right == s.len() {
            break;
        }
        left += 1;
        right += 1;
    }
    if find {
        println!("{}", "YES");
    } else {
        println!("{}", "NO");
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;
int main()
{

  string a,b;
  cin>>a>>b;


  if(a.length()>b.length()){
    cout<<"GREATER"<<endl;
  }else if(a.length()<b.length()){
    cout<<"LESS"<<endl;
  }else{
    rep(i,a.length()){
      if(a[i]>b[i]){
        cout<<"GREATER"<<endl;
        return 0;
      }else if(a[i]<b[i]){
        cout<<"LESS"<<endl;
        return 0;
      }
    }
    cout<<"EQUAL"<<endl;
  }


  return 0;
}


Measured memory_bytes: 3624
def index(rate):
    if rate <= 3199:
        idx = rate // 400
    else:
        idx = 'free'
    return idx


def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    color_lst = [0] * 8

    free = 0
    for i in range(n):
        rate = a_lst[i]
        idx = index(rate)
        if idx == 'free':
            free += 1
        else:
            color_lst[idx] = 1

    types = 0
    for i in range(8):
        if color_lst[i] == 1:
            types += 1

    if types > 0:
        minimum = types
    else:
        minimum = 1

    maximum = types
    max_add = free
    maximum += max_add

    print(minimum, maximum)


if __name__ == '__main__':
    main()

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

int main(){
  string s;
  cin >> s;
  int n=s.size();
  ll su=0;
  for(int i=0;i<n;++i){
    ll cal=(s[i]-'0');
    su+=cal;
  }
  if(su%9==0) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3748
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		//System.out.print("???????????°????????\??????");
		Scanner scan = new Scanner(System.in);
		
		String str = scan.next();
		int a = Integer.parseInt(str);
		
		str = scan.next();
		int b = Integer.parseInt(str);
		
		int area = a * b;
		int perimeter = 2 * (a + b);
		
		System.out.println(area + " " + perimeter);
	}
}

Measured memory_bytes: 25676
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;

int main(){

    ll n,m;
    cin >> n >> m;

    vector<pll> shop(n);
    for(int i = 0; i < n; i++){
        cin >> shop.at(i).first >> shop.at(i).second;
    }

    sort(shop.begin(),shop.end());
    
    ll cost = 0;
    for(int i = 0; i< n; i++){
        if(m>shop.at(i).second){
            m -= shop.at(i).second;
            cost += shop.at(i).first*shop.at(i).second;
        }else{
            cost+= m*shop.at(i).first;
            break;
        }
    }

    cout << cost << endl;



}


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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int ans = a + b + c;
	if (ans == 17) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

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

const string YES = "YES";
const string NO = "NO";

void solve(std::string S){
    vector<string> vecs;
    vecs.push_back("KIHBR");
    vecs.push_back("KIHBRA");
    vecs.push_back("KIHBAR");
    vecs.push_back("KIHABR");
    vecs.push_back("AKIHBR");
    vecs.push_back("KIHBARA");
    vecs.push_back("KIHABRA");
    vecs.push_back("KIHABAR");
    vecs.push_back("AKIHBRA");
    vecs.push_back("AKIHBAR");
    vecs.push_back("AKIHABR");
    vecs.push_back("KIHABARA");
    vecs.push_back("AKIHBARA");
    vecs.push_back("AKIHABRA");
    vecs.push_back("AKIHABAR");
    vecs.push_back("AKIHABARA");
    for(auto s: vecs){
        if(s == S){
            cout << YES << endl;
            return;
        }
    }
    cout << NO << endl;
    return;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3588
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long ll;
 
const int maxn = 110;
int n, p, x, a, b;
int main(){
	scanf("%d%d", &n, &p);
	for(int i = 1;i <= n;++i){
		scanf("%d", &x);
		if(x & 1)a++;
		else b++;
	}
	if(a == 0){
		if(p == 0)printf("%lld\n", 1LL << n);
		else puts("0");
	}
	else printf("%lld\n", 1LL << (n - 1));
	return 0;
}


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

typedef  long long ll;
typedef long double ld;
using namespace std;
const int N=1e5+5;

#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define point complex<double>
ll mod=1e9+7;
ll inf=2e18;
double eps=1e-10;
double pi=acos(-1);
double dot(point a, point b)
{
    return (conj(a)*b).real();
}
double cross(point a, point b)
{
    return (conj(a)*b).imag();
}
ll add(ll x, ll y)
{
    return (x%mod+y%mod)%mod;
}
point takepoint()
{
    int x, y;
    cin>>x>>y;
    point p(x,y);
    return p;
}
point rotatearound(point v, point o, double deg)
{
    v-=o;
    v*=polar((double)1,pi/2);
    v+=o;
    return v;
}
int main()
{

   point a=takepoint();
   point b=takepoint();
   point c=rotatearound(b,a,90);
   point d=c+b-a;
   cout<<fixed<<setprecision(0)<<d.real()<<" "<<d.imag()<<" "<<c.real()<<" "<<c.imag();



    return 0;
}


Measured memory_bytes: 4128
#include<bits/stdc++.h>
using namespace std;
#define int long long 

signed main(){
    ios::sync_with_stdio(0);cin.tie(0);
    
    int n;
    string s;
    cin>>n>>s;

    int ans=1,prev=s[0];
    for(int i=1;i<n;i++){
        if(s[i]==prev){
            continue;
        }
        ans++;
        prev=s[i];
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (10007)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

 
int main(void){
    int n;
    while(true){
        cin>>n;
        if(n==0)break;
        map<char,int>mp;
        bool flag =false;
        int num = 0;
        char ans1 = 'a',ans2 = 'a';
        int max1=0,max2=0;
        int index = 0;
        for(int i=0;i<n;i++){
            char x;
            cin>>x;
            num++;
            mp[x]++;
            for(char a='A';a<='Z';a++){
                if(mp[a]>max1){
                    max1 = mp[a];
                    ans1 = a;
                }
            }
            for(char a='A';a<='Z';a++){
                if(max1>=mp[a]){
                    if(mp[a]>max2){
                        if(a != ans1){
                            max2 = mp[a];
                            ans2 = a;
                        }
                    }
                }
            }
            if(!flag && max1>max2+(n-num)){
                index = i+1;
                flag = true;
            }
        }
        if(max1==max2)cout<<"TIE"<<endl;
        else cout<<ans1<<" "<<index<<endl;
    }
	return 0; 
}


Measured memory_bytes: 3096
//#include "bits\stdc++.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long LL;

int main()
{
    int n;

    LL a, p = 1;

    cin >> n;

    a = pow(10, 9) + 7;

    for (int i = 0; i < n; ++i)
    {
        p *= (i + 1);
        p %= a;
    }


    cout << p << endl;

    return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip()
    res = 0
    a = 'CODEFESTIVAL2016'
    for i in range(16):
        if s[i] != a[i]:
            res += 1
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
from sys import stdin
N = int(stdin.readline().rstrip())
ans = float('inf')
for i in range(1, N):
    x = sum(int(c) for c in str(i))
    y = sum(int(c) for c in str(N-i))
    tmp = x + y
    ans = min(ans, tmp)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include<math.h>

using namespace std;

int main() {
	double X;
	int year = 0;
	double money = 100;
	cin >> X;
	while (true) {
		if (money >= X) {
			break;
		}
		++year;
		money += floor(money/100);
		money = floor(money);
	}
	cout << year;
	return 0;
}

Measured memory_bytes: 3720
import sys
from collections import defaultdict, deque

readline = sys.stdin.readline
n, m, k = map(int, readline().split())
# ab = [list(map(int, readline().split())) for i in range(m)]
# cd = [list(map(int, readline().split())) for i in range(k)]

friend = [set() for i in range(n)]
not_friend = [set() for i in range(n)]

suggest_friends = [-1] * n
for i in range(m):
    a, b = map(int, readline().split())
    a -= 1
    b -= 1
    friend[a].add(b)
    friend[b].add(a)
    # friend[b].append(a)
for i in range(k):
    c, d = map(int, readline().split())
    c -= 1
    d -= 1
    not_friend[c].add(d)
    not_friend[d].add(c)
    # not_friend[d].append(c)
for i in range(n):
    if suggest_friends[i] != -1:
        continue
    q = deque(friend[i])
    friend_group = set(friend[i])
    while q:
        p = q.popleft()
        for f in friend[p]:
            if not(f in friend_group):
                q.append(f)
                friend_group.add(f)
    num = len(friend_group)
    for f in friend_group:
        suggest_friends[f] = num - 1 - len(friend[f] | not_friend[f] & friend_group)

for i in range(n):
    if suggest_friends[i] == -1:
        suggest_friends[i] = 0
print(*suggest_friends)


Measured memory_bytes: 107432
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)      for(int i = 0; i < (n); ++i)
#define all(c)         begin(c), end(c)
#define rall(c)        rbegin(c), rend(c)
#define SZ(a)          ((ll) a.size())

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

int main() {
	int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  int tmp=10;
  int sum=0;
  rep(i,5){
    if(a[i]%10==0){
      sum+=a[i];
    }
    else{
      sum+=(a[i]/10+1)*10;
      tmp=min(a[i]%10,tmp);
    }
  }

  cout << (sum-10+tmp);
  return 0;
}


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

#define NL '\n'
#define C char
#define D double
#define F float
#define S string
#define sz(x) x.size()
#define INF LONG_LONG_MAX
#define PI (2.0*acos(0.0))
#define sfi(x) scanf("%d",&x)
#define sfi2(x,y) scanf("%d %d",&x,&y)
#define sfi3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sfl(x) scanf("%lld",&x)
#define sfl2(x,y) scanf("%lld %lld",&x,&y)
#define sfl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define sfd(x) scanf("%lf",&x);
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max(max3(a,b,c),d)
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min(a,min3(b,c,d))
#define mem(ara,val) memset(ara,val,sizeof(ara))
#define READ freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;

/*LL gcd(LL a,LL b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
LL lcm(LL a,LL b)
{
    return a/gcd(a,b)*b;
}*/

/*bool pal (S s)
{
    bool flag = true;
    for(int i=0; i<sz(s); i++)
    {
        if(s[i]!=s[sz(s)-i-1])
        {
            flag = false;
            break;
        }
    }
    if(flag) return true;
    else return false;
}*/

int main()
{
    int a,b;
    sfi2(a,b);
    if(a<10)
    {
        int x = 100 * (10 - a);
        cout<<b+x;
    }
    else
        cout<<b;
}


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

int main() {
  int N,M;
  cin>>N>>M;
  vector<int>t(M);
  int a=0;
  for(int i=0; i<M;i++){
    cin>>t.at(i);
    a=a+t.at(i);
  }
  if(N<a){
    cout<<"-1"<< endl;
  }
  else{
    cout<<N-a<< endl;
  }
  
  
    
}


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

int main() {

  int n = 1, x = 1 ;
  int i, j, k;
  int cnt = 0;

  cin >> n >> x;

  while ( n > 0 || x > 0 ) {
    
    for ( i = 1; i <= n-2; ++i ) {
      for ( j = i + 1; j <= n-1; ++j) {
        if ( x - i - j  > j && x - i - j <= n ) cnt++;
      }
    }
    cout << cnt << endl;
    cnt = 0;
    cin >> n >> x;
  }
  return 0;
}


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

typedef long long s64;
#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=1e5+5;
int px[N],p[N],d0[N],d1[N];

bool vis[N];
int c[N],len;
void pow_p(int n,s64 k)
{
	rep(x,1,n)
	if(!vis[x])
	{
		len=0;
		for(int y=x;!vis[y];y=p[y])vis[c[len++]=y]=1;
		int now=k%len;
		rep(i,0,len-1)d1[c[i]]=d0[c[(i+now)%len]]; 	
	}
}

int main()
{
	//freopen("1.in","r",stdin);
	int n;
	cin>>n;
	rep(i,1,n)scanf("%d",px+i);
	rep(i,1,n-1)d0[i]=px[i+1]-px[i];
	int m;s64 k;
	cin>>m>>k;
	rep(i,1,n-1)p[i]=i;
	while(m--)
	{
		int a;
		scanf("%d",&a);
		swap(p[a-1],p[a]);
	}
	pow_p(n-1,k);
	s64 ans=px[1];
	printf("%lld\n",ans);
	rep(i,1,n-1)
	{
		ans+=d1[i];
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 3328
import functools
 
 
@functools.lru_cache(maxsize=None)
def rec(l, r):
    # [l, r)
    if l+1 == r:
        return 0
    ret = INF
    for mid in range(l+1, r):
        ret = min(ret, rec(l, mid) + rec(mid, r) + R[l] * R[mid] * C[r-1])
    return ret
 
INF = 10**9
N = int(input())
R, C = [], []
for i in range(N):
    r, c = map(int, input().split())
    R.append(r), C.append(c)
print(rec(0, N))


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

using namespace std;

int main()
{
    int n,k,arr[1005],price=0;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);

    for(int i=0;i<k;i++)
    {
        price+=arr[i];
    }
    cout<<price<<endl;
    return 0;
}


Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
  class Program
  {
    static void Main(string[] args)
    {
      int a = int.Parse(Console.ReadLine());
      int b = int.Parse(Console.ReadLine());
      int c = int.Parse(Console.ReadLine());
      int x = int.Parse(Console.ReadLine());
      
      int result = CheckMoney(a, b, c, 0, x);
      
      Console.WriteLine(result);
    }
    
    static int CheckMoney(int remA, int remB, int remC, int total, int x)
    {
      int patternCount = 0;
      
      if(total < x)
      {
        if(0 < remA)
        {
          patternCount += CheckMoney(remA -1, remB, remC, total + 500, x);
        }
        if(0 < remB)
        {
          patternCount += CheckMoney(0, remB -1, remC, total + 100, x);
        }
        if(0 < remC)
        {
          patternCount += CheckMoney(0, 0, remC -1, total + 50, x);
        }
      }
      else if(total == x)
      {
        patternCount = 1; 
      }
      else
      {
        patternCount = 0;  
      }
      
      return patternCount;
    }
  }
}



Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {
static int ans,N;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
       int n=sc.nextInt();
       if(n%2==0)System.out.println(n/2*n/2);
       else System.out.println(n/2*(n-n/2));
        }
    }

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

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

int calc(int n, int c, int d){
    int cc = n / c;
    int dd = n / d;
    int LCM = c / gcd(c, d) * d;
    int cd = n / LCM;
    int res = cc + dd - cd;
    return n - res;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << calc(b, c, d) - calc(a - 1, c, d) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int k,x;
	int ans=0;
	cin >>k>>x;
	for (int i =x-k+1; i <= k+x-1; i++) {
		cout << i;
		if (i != k + x - 1) {
			cout <<" ";
		}
		
	}
	cout << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,j,n) for(int i = (int)(j); i < (int)(n); i++)
#define mrep(i,n) for (int i = (int)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20)
ll INF = 1LL << 60;
ll mod = 1e9 + 7;
ll modn = 998244353;

int main() {
	int n; cin >> n;
	int ans=0;
	rep(i,n) {
		int a; cin >> a;
		if(i%2==0) {
			if(a%2==1) ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=100003,INF=1<<30;

int main(){
    
    int N;
    ll L,T;cin>>N>>L>>T;
    ll G;
    vector<ll> X(N),W(N),goal(N);
    for(int i=0;i<N;i++){
        cin>>X[i]>>W[i];
        if(W[i]==1){
            goal[i]=(X[i]+T)%L;
        }else{
            goal[i]=(L+X[i]-T%L)%L;
        }
        
        if(i==0) G=goal[i];
    }
    sort(all(goal));
    
    ll cnt1=0;
    for(int i=0;i<N;i++){
        if(W[i]==W[0]) continue;
        ll dis=2*T;
        if(W[0]==1){
            if(dis<X[i]-X[0]) continue;
            dis-=(X[i]-X[0]);
        }else{
            if(dis<L+X[0]-X[i]) continue;
            dis-=(L+X[0]-X[i]);
        }
        cnt1++;
        
        cnt1+=(dis/L);
        
        cnt1%=N;
    }
    
    int app=0;
    
    for(int i=0;i<N;i++){
        if(goal[i]==G) app++;
    }
    
    if(app==1){
        for(int i=0;i<N;i++){
            if(goal[i]==G){
                int j;
                if(W[0]==2){
                    j=(i+cnt1)%N;
                }else{
                    j=(N+i-cnt1)%N;
                }
                
                //cout<<i<<" "<<j<<endl;
                
                for(int k=0;k<N;k++){
                    cout<<goal[(j+k)%N]<<endl;
                }
                
                return 0;
            }
        }
    }else{
        if(W[0]==1){
            for(int i=1;i<N;i++){
                if(goal[i]==G&&goal[i-1]==G){
                    int j;
                    if(W[0]==2){
                        j=(i+cnt1)%N;
                    }else{
                        j=(N+i-cnt1)%N;
                    }
                    
                    //cout<<i<<" "<<j<<endl;
                    
                    for(int k=0;k<N;k++){
                        cout<<goal[(j+k)%N]<<endl;
                    }
                    
                    return 0;
                }
            }
        }else{
            for(int i=0;i<N;i++){
                if(goal[i]==G){
                    int j;
                    if(W[0]==2){
                        j=(i+cnt1)%N;
                    }else{
                        j=(N+i-cnt1)%N;
                    }
                    
                    //cout<<i<<" "<<j<<endl;
                    
                    for(int k=0;k<N;k++){
                        cout<<goal[(j+k)%N]<<endl;
                    }
                    
                    return 0;
                }
            }
        }
    }
    
    
}



Measured memory_bytes: 3584
#include<stdio.h>
#include<stdlib.h>
int sort(int *a,int *b){
  return *a-*b;
}
int main(void){
  int n;
  scanf("%d",&n);
  int a[n];
  for(int i=0;i<n;i++){
scanf("%d",&a[i]);
  }
  qsort(a,n,sizeof(a[0]),sort);
  if(a[n/2-1]==a[n/2])printf("0");
  else printf("%d",a[n/2]-a[n/2-1]);
  
  return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
// #define int long long
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;

signed main() {
    int n , m;
    cin >> n >> m;
    vector<pair<ll, ll>> store(n);
    rep(i, n){
        ll price, cnt;
        cin >> price >> cnt;
        store[i] = make_pair(price, cnt);
    }

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

    ll now = 0;
    ll now_money = 0;

    for(ll i = 0; now < m; i++){
        for(ll j = store[i].second; j > 0; j--){
            if(now < m){
                now++;
                now_money += store[i].first;
            }
        }
    }

    cout << now_money << endl;

}

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

namespace lineAralgebra
{
	class Program
	{
		public static void Main(String[] args)
		{
			var input = long.Parse(Console.ReadLine());

			long ans = 1;
			var height = Math.Log(input, 2);
			for (double i = 0; i <= height; i++)
			{
				ans *= 2;
			}

			System.Console.WriteLine(ans - 1);
		}
	}
}



Measured memory_bytes: 13140
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,P> PP;
#define F first
#define S second
#define INF (LLONG_MAX)
#define ALL(a) (a).begin(),(a).end()
int W,H,N;
vector<P> ps[2];
int dx[4];
int dy[4];
inline ll ab(ll a){ return a>0?a:-a; }
ll calc(ll x,ll y){
  //  printf("%lld %lld\n",x,y);
  ll ret = 0;
  ll tmax = 0;
  for(int i=0;i<N;i++){
    ll tmp = (ab((ll)ps[0][i].F-x)+ab((ll)ps[0][i].S-y));
    tmax = max(tmp,tmax);
    ret += tmp*2;
  }
  //    printf("%lld\n",ret-tmax);
  return ret-tmax;
}
void make_p(){
  int h = N/2;
  for(int i=0;i<4;i++){
    if(i%2)
      dx[i] = ps[0][h].F;
    else
      dx[i] = ps[0][h-1].F;
    if(i<2)
      dy[i] = ps[1][h].F;
    else
      dy[i] = ps[1][h-1].F;
  }
}
PP solve(int id){
  int h = N/2;
  if(id==0)
    return min(PP(calc(id,h+1),P(ps[id][h+1].F,ps[id][h+1].S)),
	       PP(calc(id,h),P(ps[id][h].F,ps[id][h].S)));
  else
    return min(PP(calc(id,h+1),P(ps[id][h+1].S,ps[id][h+1].F)),
	       PP(calc(id,h),P(ps[id][h].S,ps[id][h].F)));
			    
}
int main(){
  scanf("%d %d",&W,&H);
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    int x,y;
    scanf("%d %d",&x,&y);
    ps[0].push_back( P(x,y) );
    ps[1].push_back( P(y,x) );
  }
  if(N==1){
    puts("0");
    printf("%d %d\n",ps[0][0].F,ps[0][0].S);
    return 0;
  }
  sort(ALL(ps[0]));
  sort(ALL(ps[1]));
  make_p();
  PP res = PP(INF,P(0,0));
  for(int i=0;i<4;i++){
      int nx = dx[i], ny = dy[i];
      res = min(res,PP(calc((ll)nx,(ll)ny),P(nx,ny)));
  }
  printf("%lld\n%d %d\n",res.F,res.S.F,res.S.S);
}

Measured memory_bytes: 2904
#include <stdio.h>

#define N 100

int main(){
  
  int i,j;
  int n=0,u=0,k=0;
  int Adj[N];
  int G[N][N];
  
  
  scanf("%d",&n);
  
  if(n < 0 || N < n) return 0;
  
  for(i=0;i < n;i++) {
    for(j=0;j < n;j++){
      G[i][j] = 0;
    }
  }
  
  for(i=0;i < n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j < k;j++){
      scanf("%d",&Adj[j]);
      G[u-1][Adj[j]-1] = 1;
    }
  }
  
  for(i=0;i < n;i++) {
    for(j=0;j < n;j++){
      if(j == n-1) printf("%d",G[i][j]);
      else  printf("%d ",G[i][j]);
    }
    printf("\n");
  }
  
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    rep(i, 0, n){
        cin >> A.at(i);
    }
    int cnt = 0;
    set<int> color;
    for (auto ai: A){
        int thr = 399;
        bool add = 0;
        rep(i, 0, 8){
            if (ai <= thr){
                add = 1;
                color.insert(thr);
            }
            thr += 400;
            if (add == 1) break;
        }
        if (add == 0) cnt ++;
    }
    int size = color.size();
    int mi = max(1, size);
    int mx = color.size() + cnt;
    printf("%d %d\n", mi, mx);
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define INF (1<<30)
#define LLINF (1ll<<60)
typedef long long ll;

int main(void){
	ll a,amx=-1,b[100100],h,ans=0;
	int n,i;
	cin >> n >> h;
	for(i=0; i<n; i++){
		cin >> a >> b[i];
		amx = max(a,amx);
	}
	sort(b,b+n);
	for(i=(n-1); i>=0; i--){
		if(b[i] > amx){
			ans++;
			h -= b[i];
		}else{
			break;
		}
		if(h <= 0){
			break;
		}
	}
	if(h >0 && h%amx == 0){
		ans--;
	}
	if(h > 0){
		ans += h/amx;
		ans ++;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    constexpr int kMod = 998244353;

    unordered_map<string, int> dp;

    auto And = [&](const string &a, const string &b) {
        assert(a.size() == b.size());
        string res(a.size(), '0');
        for (int i = 0; i < a.size(); ++i) {
            if (a[i] == '1' && b[i] == '1') res[i] = '1';
            else res[i] = '0';
        }
        return res;
    };

    function<int(string s)> Dfs = [&](string s) {
        if (s.empty()) return 1;
        if (dp.find(s) != dp.end()) return dp[s];
        int res = (1 + s[0] - '0') * Dfs(s.substr(1)) % kMod;
        for (int k = 1; k + k <= s.size(); ++k) {
            string t = s.substr(0, k);
            for (int i = 2; i * k <= s.size(); ++i) {
                t = And(t, s.substr((i - 1) * k, k));
                res += 1LL * Dfs(t) * Dfs(s.substr(i * k)) % kMod;
                if (res >= kMod) res -= kMod;
            }
        }
        dp[s] = res;
        return res;
    };

    cout << Dfs(s) << "\n";
}


Measured memory_bytes: 5388