akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _20180307_AOJ
{
    class ALDS1_6D
    {
        static void Main(string[] args)
        {
            for (;;)
            {
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line))
                {
                    break;
                }

                int n = int.Parse(line);
                int[] arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                int[] sorted = new int[n];
                arr.CopyTo(sorted, 0);
                Array.Sort(sorted);
                Dictionary<int, int> dict = new Dictionary<int, int>();
                for(int i=0;i<n;i++)
                {
                    dict.Add(sorted[i], arr[i]);
                }

                List<List<int>> cyclics = new List<List<int>>();
                while(dict.Count>0)
                {
                    List<int> list = new List<int>();
                    var kvp = dict.FirstOrDefault();
                    while(dict.ContainsKey(kvp.Key))
                    {
                        list.Add(kvp.Key);
                        dict.Remove(kvp.Key);
                        kvp = dict.FirstOrDefault(x=>x.Key == kvp.Value);
                    }

                    cyclics.Add(list);
                }

                int min = arr.Min();
                long sum = 0;
                foreach(var v in cyclics)
                {
                    long sum1 = SingleSum(v);
                    long sum2 = SumWithX(v, min);
                    sum += Math.Min(sum1, sum2);
                }

                Console.WriteLine(sum);
            }
        }

        static long SingleSum(List<int> list)
        {
            int min = list.Min();
            int len = list.Count;
            long sum = (len - 2) * min + list.Sum();
            return sum;
        }

        static long SumWithX(List<int> list, int x)
        {
            int len = list.Count;
            long sum = (len + 1) * x + list.Sum() + list.Min();
            return sum;
        }
    }
}



Measured memory_bytes: 10616
using System;
using System.Linq;
using System.Collections;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            MyInputStream cin = new MyInputStream();
            WriteLine(cin.ReadInt() < 1200 ? "ABC" : "ARC");
        }
    }

    public class MyInputStream
    {
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(char separator = ' ')
        {
            this.separator = separator;
            inputStream = new Queue<string>();
        }

        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = Console.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; i++)
            {
                inputStream.Enqueue(tmp[i]);
            }
            return inputStream.Dequeue();
        }
        public string ReadLine() => Console.ReadLine();
        public int ReadInt() => int.Parse(Read());
        public long ReadLong() => long.Parse(Read());
        public double ReadDouble() => double.Parse(Read());
    }

    public class Pair<T1, T2>
    {
        public T1 First;
        public T2 Second;
        public Pair() { First = default(T1); Second = default(T2); }
        public Pair(T1 f, T2 s) { First = f; Second = s; }
        public override string ToString() { return "(" + First + ", " + Second + ")"; }
        public override int GetHashCode() { return First.GetHashCode() ^ Second.GetHashCode(); }
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj)) return true;
            else if (obj == null) return false;
            var tmp = obj as Pair<T1, T2>;
            return (object)tmp != null && First.Equals(tmp.First) && Second.Equals(tmp.Second);
        }
    }

    #region HashMap
    public class HashMap<K, V> : Dictionary<K, V>
    {
        public HashMap() : base() { }
        public HashMap(int cap) : base(cap) { }
        public HashMap(IDictionary<K, V> dictionary) : base(dictionary) { }
        new public V this[K i]
        {
            get
            {
                V v;
                return TryGetValue(i, out v) ? v : base[i] = default(V);
            }
            set { base[i] = value; }
        }
    }
    #endregion
}


Measured memory_bytes: 11220
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

def solve(L):
    n = 0
    sets = set()
    for y in range(12):
        for x in range(12):
            if not L[y][x]:
                continue
            elif y and L[y-1][x]:
                L[y][x] = L[y-1][x]
            elif x and L[y][x-1]:
                L[y][x] = L[y][x-1]
            else:
                n += 1
                sets.add(n)
                L[y][x] = n
        for x in range(10, -1, -1):
            if L[y][x] and L[y][x+1] and L[y][x] != L[y][x+1]:
                sets.discard(L[y][x])
                L[y][x] = L[y][x+1]
    return len(sets)

s = '\n'
sep = '\n'
while s:
    L = []
    for i in range(12):
        L.append([int(s) for s in stdin.readline().rstrip()])
    print(solve(L))
    s = stdin.readline()

Measured memory_bytes: 4288
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[N][N];
int color[N],d[N],f[N],tt;

void visit(int);
void dfs(void);

int main(){
  int u,v,k,i,j;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++)M[i][j]=0;
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }

  dfs();

  return 0;
}

void visit(int u){
  int v;
  color[u]=GRAY;
  d[u]=++tt;
  for(v=0;v<n;v++){
    if(M[u][v]==0)continue;
    if(color[v]==WHITE){
      visit(v);
    }
  }
  color[u]=BLACK;
  f[u]=++tt;
}

void dfs(){
  int u;
  for(u=0;u<n;u++)color[u]=WHITE;
  tt=0;
  for(u=0;u<n;u++){
    if(color[u]==WHITE)visit(u);
  }
  for(u=0;u<n;u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
}

Measured memory_bytes: 1064
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define     bit_1(a)       __builtin_popcount(a)
#define     ull            unsigned long long
#define     ll             long long
#define     u              unsigned
#define     pb             push_back
#define     pf             push_front
#define     mpr            make_pair
#define     ins            insert
#define     ff             first
#define     ss             second
#define     vi             vector<int>
#define     vl             vector<ll>
#define     vstr           vector<string>
#define     si             set<int>
#define     sl             set<ll>
#define     li             list<int>
#define     pii            pair<int,int>
#define     pll            pair<ll,ll>
#define     mii            map<int,int>
#define     mll            map<ll,ll>
#define     ma             INT_MAX
#define     mi             INT_MIN
#define     mod            1000000007
#define     pi             3.14159265359
#define     e              2.71828182846
#define     inf            1000000000000000LL
#define     all(x)         x.begin(), x.end()
#define     lb(a,b,c)      lower_bound(a,a+b,c)-a
#define     ub(a,b,c)      upper_bound(a,a+b,c)-a
#define     lbv(a,c)       lower_bound(all(a),c)-a.begin()
#define     ubv(a,c)       upper_bound(all(a),c)-a.begin()
#define     srt1(a,b)      sort(a,a+b)
#define     srt2(a,b)      sort(a,a+b,greater<int>())
#define     gcd(a,b)       __gcd(a,b)
#define     lcm(a,b)       (a*(b/gcd(a,b)))
#define     harmonic(n)    0.57721566490153286l+log(n)
#define     mem(a, b)      memset(a, b, sizeof(a))
#define     orderset1      tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define     orderset2      tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>

///s.lower_bound(a),s.upper_bound(a), for set
///nCr(x, y) = nCr(x-1, y-1) + nCr(x-1, y)
///factorial digit   ((n * log10(n / e) +log10(2 * pi * n) /2.0));
/// lcm(a,b)=a/gcd(a,b)*b (handle overflow)

bool sortinrev1(const pair<int,int>&a,const pair<int,int>&b)
{
    //return (a.first > b.first);
    if(a.first==b.first)return (a.second>b.second);
    else return (a.first > b.first);
}
bool sortinrev2(const pair<int,int>&a,const pair<int,int>&b)
{
    //return (a.first > b.first);
    if(a.first==b.first)return (a.second<b.second);
    else return (a.first > b.first);
}

int func(int x,int y,int z)
{
    return (x*x)+(y*y)+(z*z)+(x*y)+(y*z)+(z*x);
}

int main()
{
    /*int l,r,d;
    cin>>l>>r>>d;
    int ans=(r/d)-(l/d);
    if(r%d==0 && l%d==0)ans++;
    cout<<ans<<endl;*/
    /*int n,a,cnt=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a;
        if(i&1 && a&1)cnt++;
    }
    cout<<cnt<<endl;*/
    int n;
    cin>>n;
    mii mp;
    for(int i=1;i<=sqrt(n);i++){
        for(int j=1;j<=sqrt(n);j++){
            for(int k=1;k<=sqrt(n);k++)
                mp[func(i,j,k)]++;
        }
    }
    for(int i=1;i<=n;i++)
        cout<<mp[i]<<endl;

}



Measured memory_bytes: 5384
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define deb(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define memo(a,val) memset(a,val,sizeof(a))
#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(a) a.begin(),a.end()
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define dloop(i,n) for(int i=n-1;i>=0;i--)
#define iii tuple<int,int,int>
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define int long long
#define ld long double
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007
#define inf (int)1e18

bool cmp(string a, string b){
	return a+b<b+a;
}

int32_t main(){
	NINJA;
		
	int n,l; cin >> n >> l;
	vector<string> a(n);
	fo(i,n) cin >> a[i];

	sort(a.begin(), a.end(),cmp);

	fo(i,n) cout << a[i];

	return 0;
}

Measured memory_bytes: 3608
package main

import (
	"fmt"
	"sort"
	"unicode/utf8"
)

func main() {
	var N int
	fmt.Scan(&N)

	inputs := scanNums(N)

	sort.Sort(sort.IntSlice(inputs))
	// fmt.Println(inputs)
	a := inputs[N/2-1]
	b := inputs[N/2]
	// fmt.Println(a, b)

	if b == a {
		fmt.Println(0)
	} else {

		fmt.Println(b - a)
	}

}

func scanStrings(len int) (strings []string) {
	var str string
	for i := 0; i < len; i++ {
		fmt.Scanf("%s", &str)
		strings = append(strings, str)
	}
	return
}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func spritString(input string) (res []string) {
	for i := 0; i < utf8.RuneCountInString(input); i++ {
		res = append(res, input[i:i+1])
	}
	return
}


Measured memory_bytes: 7552
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N)
    cin >> A[i];

  int cur = 1;  
  rep(i, N) {
    if (A[i] == cur) {
      cur++;
    }
  }

  if (cur == 1) {
    cout << -1 << endl;
  } else {
    cout << N - cur + 1 << endl;

  }

  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string.h>
#include<stack>
#include<queue>
using namespace std;
 
int main(){
	int a, b, c, d;
	int A, B;
	cin >> a >> b >> c >> d;
	A = max(a, c);
	B = min(b, d);
	if (B - A > 0)cout << B - A << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        int k = in.nextInt();
        int result = 0;
        while (n > 0) {
            n /= k;
            result += 1;
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 21844
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

a = ns()
b = ns()
cor = 0
for i in range(3):
    if a[i] == b[i]:
        cor += 1
print(cor)


Measured memory_bytes: 3064
#include <array>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;

typedef vector<vector<int>> graph;

enum { A, B, C, N };

inline bool ng(int current_a, int next_a, int current_b, int next_b) {
	return next_a == next_b || (current_a == next_b && next_a == current_b);
}

inline int bfs(const array<int, N> &start, const array<int, N> &goal, const graph &G) {
	const int V = G.size();

	vector<vector<vector<int>>> dist(V, vector<vector<int>>(V, vector<int>(V, -1)));
	queue<tuple<int, int, int>> que;

	dist[start[A]][start[B]][start[C]] = 0;
	que.push(make_tuple(start[A], start[B], start[C]));

	while(!que.empty()) {
		int a, b, c;
		tie(a, b, c) = que.front();
		que.pop();

		const int d = dist[a][b][c];

		for(const auto &to_a : G[a]) {

			for(const auto &to_b : G[b]) {
				if(ng(a, to_a, b, to_b)) continue;

				for(const auto &to_c : G[c]) {
					if(ng(a, to_a, c, to_c) || ng(b, to_b, c, to_c)) continue;

					if(dist[to_a][to_b][to_c] == -1) {
						if(to_a == goal[A] && to_b == goal[B] && to_c == goal[C]) return d + 1;
						dist[to_a][to_b][to_c] = d + 1;
						que.push(make_tuple(to_a, to_b, to_c));
					}
				}
			}
		}
	}
	assert(false);
}

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

	for(int w, h, n; cin >> w >> h >> n && w;) {
		cin.ignore();

		vector<string> field(h);
		for(auto &e : field) getline(cin, e);

		int num = 0;
		array<int, N> start, goal;
		vector<vector<int>> label(h, vector<int>(w, -1));

		for(int i = 1; i < h - 1; ++i) {
			for(int j = 1; j < w - 1; ++j) {
				if(field[i][j] != '#') {
					if(islower(field[i][j])) {
						start[field[i][j] - 'a'] = num;
					}
					else if(isupper(field[i][j])) {
						goal[field[i][j] - 'A'] = num;
					}
					label[i][j] = num++;
				}
			}
		}

		for(int i = n; i < N; ++i) {
			start[i] = goal[i] = num++;
		}

		graph G(num);
		for(int v = 0; v < num; ++v) G[v].emplace_back(v);

		for(int i = 1; i < h - 1; ++i) {
			for(int j = 1; j < w - 1; ++j) {
				if(label[i][j] == -1) continue;
				const int v = label[i][j];

				if(label[i - 1][j] != -1) {
					const int u = label[i - 1][j];
					G[v].emplace_back(u);
					G[u].emplace_back(v);
				}
				if(label[i][j - 1] != -1) {
					const int u = label[i][j - 1];
					G[v].emplace_back(u);
					G[u].emplace_back(v);
				}
			}
		}

		cout << bfs(start, goal, G) << endl;
	}
	return EXIT_SUCCESS;
}

Measured memory_bytes: 9544
s = gets.chomp
step_r = ['R', 'U', 'D']
step_l = ['L', 'U', 'D']
success = true
s.chars.each_with_index do |step, i|
  next if i % 2 == 0  && step_r.include?(step)
  next if i % 2 == 1  && step_l.include?(step)
  success = false
  break
end

puts success ? 'Yes' : 'No'

Measured memory_bytes: 1788
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include<math.h>
typedef long long int ll;
ll ckck(ll n)
{
    if(n==1)
        return 0;
    if(n==2||n==3)
        return 1;
    if(n%2==0||n%3==0)
        return 0;
    for(ll i=5;i*i<=n;i++)
    {
        if(n%i==0)
            return 0;
    }
    return 1;
}
int main()
{
  ll A,B;
  cin>>A>>B;
  ll d=__gcd(A,B);
  vector<ll> vec;
  ll i;
  for(i=1;i*i<=d;i++)
  {
      if(d%i==0)
      {
          vec.push_back(i);
          if(i*i!=d)
          {
              vec.push_back(d/i);
          }
      }
  }
  ll ans=1;
  for(i=0;i<vec.size();i++)
  {
      ans+=ckck(vec[i]);
  }
  cout<<ans;


}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, t;
    double a;
    cin >> n;
    cin >> t >> a;
    double h[n];
    for (double &i : h)
    {
        int tmp;
        cin >> tmp;
        i = t - tmp * 0.006;
    }
    double min = abs(h[0] - a), ans(1);
    for (int i = 1; i < n; ++i)
    {
        if (abs(h[i] - a) < min)
        {
            min = abs(h[i] - a);
            ans = i + 1;
        }
    }
    cout << ans << endl;
}

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

namespace ConsoleApplication37
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int[] b = new int[a];
            for (int c = 0; c < a*(a-1)/2; c++)
            {
                int[] score = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (score[2] > score[3])
                    b[score[0] - 1] += 3;
                if (score[2] < score[3])
                    b[score[1] - 1] += 3;
                if (score[2] == score[3])
                {
                    b[score[0] - 1] += 1;
                    b[score[1] - 1] += 1;
                }
            }
            int[] op = new int[a];
            for (int g = 0; g < a; g++)
            {
                op[g] = b[g];
            }
            for (int u = 0; u < a;u++)
                for (int j = 0; j < a; j++)
                {
                    Array.Sort(b);
                    Array.Reverse(b);
                    if (op[u] == b[j])
                    {
                        Console.WriteLine(j + 1);
                        break;
                    }
                    Array.Reverse(b);
                }
            }
           
        }
    }

Measured memory_bytes: 9780
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed 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")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}

use std::cmp::{max, min};

fn main() {
    let n: i64 = read();
    let a: String = read();
    let b: String = read();
    let a_vec: Vec<char> = a.chars().collect();
    let b_vec: Vec<char> = b.chars().collect();
    let mut ans = "".to_string();
    for i in 0..n as usize {
        ans.push(a_vec[i]);
        ans.push(b_vec[i]);
    }

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


Measured memory_bytes: 4352
// Frog 2 https://atcoder.jp/contests/dp/tasks/dp_b
#include <bits/stdc++.h>
using namespace std;

const int INF = 1e9 + 5;

int n, k;
vector<int> h;
vector<int> memo;

// rec(x) is best score to get to position x

int rec(int pos) {
	if(pos == 0) {
		return 0;
	}
	if(memo[pos] != -1) {
		return memo[pos];
	}
	int best = INF;
	for(int jump = 1; jump <= k && pos - jump >= 0; ++jump) {
		best = min(best, rec(pos - jump) + abs(h[pos] - h[pos-jump]));
	}
	return memo[pos] = best;
}

int solve1() {
	return rec(n-1);
}

int main() {
	cin >> n >> k;
	h.resize(n);
	memo.resize(n, -1);
	for(int& x : h) {
		cin >> x;
	}
	cout << solve1();
}


Measured memory_bytes: 5760
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define mp make_pair
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll inf = 1e18;
constexpr ll mod = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int b[112];
    bool f = true;
    for (int i = 0; i < n;i++){
        cin >> b[i];
        if(b[i]>i+1)
            f = false;
    }
    if(f==false)
        cout << -1 << endl;
        else{
            vector<int> a(0);
            for (int i = 0; i < n;i++){
                a.insert(a.begin() + b[i] - 1, b[i]);
            }
            for (int i = 0; i < n;i++){
                cout << a[i] << endl;
            }
        }
}

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()

int main() {
   int n;
   cin >> n;
   long long l[100];
   l[0]=2;l[1]=1;
   for(int i=2;i<=n;i++)
   l[i]=l[i-1]+l[i-2];
   cout << l[n] << endl;
}

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

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

int main() {
  int h, w;
  cin >> h >> w;
  char s[51][51];
  rep(y, h) {
    rep(x, w) {
      cin >> s[x][y];
    }
  }
  rep(y, h) {
    rep(x, w) {
      if (s[x][y] == '#') {
        bool frag = true;
        rep(i, 4) {
          int sx = x + dx[i];
          int sy = y + dy[i];
          if (sx < 0 || sx >= w) continue;
          if (sy < 0 || sy >= h) continue;
          if (s[sx][sy] == '#') frag = false;
        }
        if (frag) {
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include<vector>
#include<iostream>
using namespace std;
#define df 0
void push(int i,int j,vector<int>* r,vector<int>* l,int* p){
  if(p[i]<p[j])l[i].push_back(j);
  else{
    r[j].push_back(i);
    push(i,l[j].at(0),r,l,p);
  }
}

int second(int i,int j,vector<int>* r,int* p,int k,int n){
  if(df)printf("find(%d):\n",i);
  if(r[i].at(0)==n+1)return n;
  if(r[i].at(0)==0)return 1;
  if(df)printf(" %d",j);
  while(k>=0){
    if(p[r[j].at(k)]<p[i]){
      j=r[j].at(k);
      if(df)printf(" ->%d(+%d)",j,k);
    }
    k--;
  }
  if(df)printf("\n");
  return j;
}
  
int main(){
  if(df) printf("*debug mode*\n");
  int n; cin >>n;
  int p[n+2];
  p[0]=p[n+1]=n+1;
  for(int i=1;i<=n;i++){
    cin >>p[i];
  }
  vector<int> r[n+2],l[n+2];
  r[0].push_back(n+1);
  l[0].push_back(0);
  r[n+1].push_back(n+1);
  l[n+1].push_back(0);
  for(int i=1;i<n+1;i++){
    push(i,i-1,r,l,p);
  }
  for(int i=1;i<n+1;i++){
    if(r[i].size()==0) r[i].push_back(n+1);
  }
  int flag=1,k=0;
  while(flag){
    flag=0;
    for(int i=0;i<n+2;i++){
      r[i].push_back(r[r[i].at(k)].at(k));
      l[i].push_back(l[l[i].at(k)].at(k));
      if(r[i].at(k+1)!=n+1 || l[i].at(k+1)!=0)flag=1;
    }
    k++;
  }
  if(df){
    printf("r:\n");
    for(int i=1;i<=n;i++){
      printf("%d:",i);
      for(int x: r[i]){
	printf("%d ",x);
      }
      printf("\n");
    }
    printf("l:\n");
    for(int i=1;i<=n;i++){
      printf("%d:",i);
      for(int x: l[i]){
	printf("%d ",x);
      }
      printf("\n");
    }
  }
  int r2[n+2],l2[n+2];
  for(int i=0;i<n+2;i++){
    int x=second(i,r[i].at(0)+1,r,p,k,n);
    r2[i]=(p[x]>p[i])?x:r[x].at(0);
    x=second(i,l[i].at(0)-1,l,p,k,n);
    l2[i]=(p[x]>p[i])?x:l[x].at(0);
  }
  l2[0]=l2[n+1]=0;
  r2[0]=r2[n+1]=n+1;
  if(df){
    printf("r2:\n");
    for(int x: r2){
      printf("%d ",x);
    }
    printf("\nl2:\n");
    for(int x: l2){
      printf("%d ",x);
    }
    printf("\n");
  }
  long int s=0;
  for(int i=1;i<=n;i++){
    s+=((long)l[i].at(0)-l2[i])*(r[i].at(0)-i)*p[i];
    if(df)printf("%ld ",((long)l[i].at(0)-l2[i])*(r[i].at(0)-i)*p[i]);
    s+=((long)r2[i]-r[i].at(0))*(i-l[i].at(0))*p[i];
    if(df)printf("%ld ",((long)r2[i]-r[i].at(0))*(i-l[i].at(0))*p[i]);
  }
  cout << s;
}

/// confirm df==0 ///


Measured memory_bytes: 33536
#include<bits/stdc++.h>
#define inf 1000000000
using namespace std;
struct node
{
    int x,y;
}a[1009];
int main()
{
    int x,n,dp[30009],ans=inf;
    scanf("%d%d",&x,&n);
    for(int i=1;i<=x;i++)
        dp[i]=inf;
    dp[0]=0;
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i].x,&a[i].y);
    for(int i=1;i<=n;i++)
        for(int j=0;j<=x;j++)
        dp[j]=min(dp[j],dp[max(j-a[i].x,0)]+a[i].y);
    for(int i=x;i<=x;i++)
        ans=min(ans,dp[i]);
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 5010;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll dp[101010];

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

ll find(ll x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

char c[2010][2010];
bool flag[2010][2010];
ll cnt[2010][2010];

//long longしか使わない
//素数は1より大きい
int main() {
	ll h, w;
	cin >> h >> w;
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j];
		}
	}
	rep(i, h) {
		vector<ll>done(w);
		rep(j, w) {
			if (c[i][j] == '#')continue;
			if (done[j])continue;
			ll l = 0;
			while (j + l < w) {
				if (c[i][j + l] == '#')break;
				++l;
			}
			rep(k, l) {
				cnt[i][j + k] += l;
				done[j + k] = l;
			}
		}
	}
	rep(j, w) {
		vector<ll>done(h);
		rep(i, h) {
			if (c[i][j] == '#')continue;
			if (done[i])continue;
			ll l = 0;
			while (i + l < h) {
				if (c[i+l][j] == '#')break;
				++l;
			}
			rep(k, l) {
				cnt[i+k][j] += l;
				done[i + k] = l;
			}
		}
	}
	ll ans = 0;
	rep(i, h) {
		rep(j, w) {
			ans = max(ans, cnt[i][j] - 1);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 39168
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define sz(a)       (ll)(a.size())
#define cr(P)       cout<<P<<"\n";return;
#define mem(a,val)  memset(a, val, sizeof(a))
#define fr(i,x,n)   for(ll i=x; i<n; i++)
#define frr(i,x,n)  for(ll i=n-1; i>=x; i--)
using namespace std;


const ll N   =  500005;
const ll mod = 1e9 + 7;



void solve(){

 ll x=0, y=0, c = 0, ans = 0;
 ll n, m, k;

 cin >> n >> m >> x >> k;
 while(m <=n){
 	if(k==0)
 		break;
 	m*=2;
 	k--;
 }
 while(k--){
 	x*=2;
 }
 if(x > m and m > n){
 	cr("Yes");
 }
 c("No");
    
 
}

signed main(){
     
 ios_base::sync_with_stdio(false);   
 cin.tie(NULL);
 //int T;cin >> T;while (T--)
 solve();
 return 0;
}



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

int main() {
	int n, x;
	int min = 1000001;
	int max = -1000001;
	long sum = 0;
	cin >> n;

	for (int i = 1; i <= n; i++)
	{
		cin >> x;
		if (x > max)
			max = x;
		if (x < min)
			min = x;
		sum += x;
	}

	cout << min << " " << max << " " << sum << endl;
}

Measured memory_bytes: 3072
#include <iostream>
using namespace std;
int main(){
    int n,k,q,b,i;
    cin >> n >> k >> q;
    int a[n+1]={0};
    for (i=0;i<q;i++){
        cin >> b;
        a[b]++;
    }
    for (i=1;i<=n;i++){
        if (a[i]+k-q>0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder {
    public class Program {
        public static void Main() {
            int N = int.Parse(Console.ReadLine());
            long[] Ls = new long[N+1];
            Ls[0] = 2;
            Ls[1] = 1;
            for (int i = 2; i <= N; i++) {
                Ls[i] = Ls[i - 1] + Ls[i - 2];
            }
            Console.WriteLine(Ls[N]);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef long double ld;
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define rep(i, a, b) for (ll i = a; i < (b); ++i)
#define reb(i, a, b) for (ll i = a; i >= (b); --i)
#define trav(a, x) for (auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
int main()
{
// #ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
// #endif
   ll n;
   ld p_head;
   cin >> n;
   vector<ld> dp(n + 1);
   dp[0] = 1.0;
   rep(i,0,n)
   {
      cin >> p_head;
      reb(j,i+1,0)
      {
         dp[j] = (j==0?0:dp[j - 1] * p_head) + dp[j] * (1 - p_head);
      }
   }
   double ans = 0.0;
   rep(i,1,n+1)
   {
      ll ch = n - i;
      if(i>ch)
         ans += dp[i];
   }
   cout <<setprecision(10)<< ans << endl;
}

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



int main()
{
	 #ifndef ONLINE_JUDGE
     freopen("input1.txt","r",stdin);
     freopen("output1.txt","w",stdout);
   #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	
	int t,n;
	// cin>>t;
	// while(t--)
	// {


	// }
	cin>>n;
	int sum=0;
	sum=n+pow(n,2)+pow(n,3);
	cout<<sum;
	
	return 0;
}


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

#define ll long long
#define all(it) it.begin(), it.end()
#define FOR(i, n) for(int i = 0; i < n; i++)
#define FORU(i, a, b, s) for(int i = a; i < b; i += s)
#define FORD(i, a, b, s) for(int i = a; i > b; i -= s)
#define endl "\n"

ll INF = 2e18;
ll MOD = 1e9 + 7;
int i, j, k, t;

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

    if(X == 7 || X == 5 || X == 3) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3636
n = int(input())
a = list(map(int,input().split()))

lst = []
for i in a:
    if i%2 == 0:
        lst.append(i)

def half(x):
    cnt = 0
    for i in range(x):
        if x%2 == 0:
            x = x//2
            cnt += 1
        else:
            break
    return cnt

ans = 0
for i in lst:
    ans += half(i)
    
print(ans)

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

int main(void) {
    int h, w;
    cin >> h >> w;
    vector<vector<int> > mat(h, vector<int>(w, 0));
    vector<int> vec(w, 0);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> mat.at(i).at(j);
        }
    }
    for (int i = 0; i < w; i++) {
        cin >> vec.at(i);
    }

    for (int i = 0; i < h; i++) {
        int c = 0;
        for (int j = 0; j < w; j++) {
            c += mat.at(i).at(j) * vec.at(j
            );
        }
        cout << c << endl;
    }
}



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

using namespace std;

void Main() {
    int N;
    cin >> N;
    vector<int> p(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> p[i];
    }

    int highest = *max_element(p.begin(), p.end());
    int pay = accumulate(p.begin(), p.end(), 0);
    pay -= highest / 2;

    cout << pay << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=2e5+100;
int main()
{
    FASTINOUT;
    int x,k;
    cin>>x>>k;
    int y[x];
    for (int i=0;i<x;i++)
        cin>>y[i];
    sort(y,y+x);
    int ans=1e9;
    for (int i=k-1;i<x;i++){
        ans=min(ans,y[i]-y[i-k+1]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <map>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    map<int64_t,int> mp;
    for(int i=0; i<N; i++) {
        int64_t A;
        cin >> A;
        mp[A]++;
    }

    int64_t ans = 0;
    for(auto itr=mp.rbegin(); itr!=mp.rend(); itr++) {
        if(ans) {
            if(itr->second >= 2) {
                cout << (ans * itr->first) << endl;
                return 0;
            }
        } else if(itr->second >= 4) {
            cout << (itr->first * itr->first) << endl;
            return 0;
        } else if(itr->second >= 2) {
            ans = itr->first;
        }
    }

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


Measured memory_bytes: 6528
def cin
  gets.split.map(&:to_i)
end

a, b, c, x, y = cin
ans1, ans2, ans3 = 0
min, max = [x, y].minmax

ans1 = c * max * 2
ans2 = if x >= y
         c * min * 2 + a * (x - y)
       else
         c * min * 2 + b * (y - x)
       end

ans3 = a * x + b * y
puts [ans1, ans2, ans3].min


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
//n文字目までのそれぞれの文字数の累積和をとればよさそう
//O(N^2logN)ぐらいまでなら行ける

int main() {
	int N;
	cin >> N;
	string s;
	cin >> s;
	vector<vector<int>>rgb(3,vector<int>(N)),rgbs(3,vector<int>(N+1));
	for (size_t i = 0; i < N; i++)
	{
		if (s.at(i) == 'R')rgb.at(0).at(i)=1;
		else if (s.at(i) == 'G')rgb.at(1).at(i)=1;
		else rgb.at(2).at(i)=1;
	}
	for (size_t i = 1; i < N+1; i++)
	{
		for (size_t j = 0; j < 3; j++)
		{
			rgbs.at(j).at(i) = rgb.at(j).at(i - 1) + rgbs.at(j).at(i - 1);
		}
	}
	long long ans = 0;
	//i個目
	for (size_t i = 0; i < N; i++)
	{
		for (size_t j = 0; j < i; j++)
		{
			if (s.at(i) != s.at(j)) {
				//Bを探す
				if ((s.at(i) == 'R' && s.at(j) == 'G') || (s.at(i) == 'G' && s.at(j) == 'R')) {
					
					ans += rgbs.at(2).at(j);
					if (2 * (i-j) <= i)ans -= rgb.at(2).at(i - 2 * (i - j));
				}
				//Gを探す
				else if ((s.at(i) == 'R' && s.at(j) == 'B') || (s.at(i) == 'B' && s.at(j) == 'R')) {
					ans += rgbs.at(1).at(j);
					if (2 * (i-j) <= i)ans -= rgb.at(1).at(i - 2 * (i - j));
				}
				//Rを探す
				else if ((s.at(i) == 'B' && s.at(j) == 'G') || (s.at(i) == 'G' && s.at(j) == 'B')) {
					
					ans += rgbs.at(0).at(j);
					if (2 * (i - j) <= i)ans -= rgb.at(0).at(i - 2 * (i - j));
				}
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 3700
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line
}

fn main() {
    let v: Vec<i32> = get_line().trim()
        .split_whitespace()
        .map(|e| e.parse().unwrap())
        .collect();
    let (a, b): (i32, i32) = (v[0], v[1]);

    println!("{} {} {}", a / b, a % b, (a as f64) / (b as f64));
}



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

using namespace std;
int main(void){
    int n;
    
    while(1){
        cin >> n;
        
        if(n==0) break;
        
        int s[n];
        
        double ave=0;
        for(int i=0;i<n;i++){
            cin >> s[i];
            ave += s[i];
        }
        ave = ave/n;
        double var=0;
        for(int i=0;i<n;i++){
            var += pow(ave-s[i],2);
        }
        var=var/n;
        
        cout << fixed << sqrt(var) << endl;
    }
}



Measured memory_bytes: 3272
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	int N;
	cin >> N;

	vector<int> a_list(N + 2, 0);

	long long all_sum = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> a_list[i + 1];
	}

	vector<int> diff_list;
	for (int i = 0; i < a_list.size() - 1; i++)
	{
		diff_list.push_back(a_list[i + 1] - a_list[i]);
		all_sum += abs(diff_list.back());
	}

	for (int i = 0; i < N; i++)
	{
		int sub_value = abs(diff_list[i]) + abs(diff_list[i + 1]);
		long long result = all_sum - sub_value + abs(diff_list[i + 1] + diff_list[i]);
		cout << result << "\n";
	}

	return 0;
}


Measured memory_bytes: 2168
N = int(input())

def prime_factorize(n):
    if n == 1:
        return []
    ans = []
    tmp = n
    i = 2
    while pow(i, 2) <= n:
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp /= i
            ans.append([i, cnt])
        i += 1
    if tmp != 1:
        ans.append([tmp, 1])
    if ans == []:
        ans.append([n, 1])
    return ans

pl = prime_factorize(N)
ans = 0
for p, n in pl:
    tmp = n
    i = 1
    while tmp-i >= 0:
        tmp -= i
        i += 1
        ans += 1
print(ans)

Measured memory_bytes: 9292
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> A(M);
	for (int i = 0; i < M; i++)
	{
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	vector<int> B;
	for (int i = 0; i < A.size() - 1; i++)
	{
		B.push_back(A[i + 1] - A[i]);
	}
	sort(B.begin(), B.end(), greater<int>());
	int ans = 0;
	for (int i = N-1; i < B.size(); i++)
	{
		ans += B[i];
	}
	cout << ans << endl;
}

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

using namespace std;
typedef long long ll;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll d = c - a - b;
    bool ans = 1;
    if (d <= 0) ans = 0;
    ll l = 4 * a * b;
    if (l >= d * d) ans = 0;
    if (ans) puts("Yes");
    else puts("No");
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        int[] l = new int[N];
        for(int i = 0;i < N;i++)    l[i] = sc.nextInt()-i-1;
        Arrays.sort(l);
        int b = l[N/2+N%2-1];
        long ans = 0;
        for(int i = 0;i < N;i++)    ans += Math.abs(l[i]-b);
        System.out.println(ans);
    }
}

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

int main(){
    int a, b, c;
    string s;
    cin >> a >> b >> c;
    
    if(a < b){
        if(b < c){
            s = "Yes";
        }else{
            s = "No";
        }
    }else{
        s = "No";
    }
    
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3212
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
    #from itertools import 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

    h = int(input())
    res = 0
    turn = 1
    while h>0:
        res += turn
        turn *= 2
        h = h//2
    print(res)


if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include "iostream"
#include "string"
#define REP(i, n) for (int i = 0; i < n; ++i)

typedef long long ll;
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s, t;
    cin >> s;
    cin >> t;
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] != t[i])
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
    #include<vector>
    #include<string>
    #include<algorithm>
    #include<cmath>
    
    #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define int long long int
    #define mod 1000000007
    
    using namespace std;

    signed main()
    {
        fast;
        int n,k;
        cin>>n>>k;

        vector<int> a(n);

        for ( int i = 0 ; i < a.size() ; i++ )
        {
            cin>>a[i];
        }

        long double ans = 0;

        for ( int i = 0 ; i < k ; i++ )
        {
            ans += (a[i]+1)/(double)2;
        }
        int j = k;
        long double x = 0;
        x = max(x,ans);
        while( j != a.size() )
        {
            ans += (-(a[j-k]+1)/(double)2) + ((a[j]+1)/(double)2);
            x = max(x,ans);
            j++;
        }
        cout<<fixed<<setprecision(20)<<x<<endl;
        return 0;
    }

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

#define min(a, b) ((a)<(b)? (a):(b))
#define max(a, b) ((a)>(b)? (a):(b))
#define rep(i, n) REP(i, 0, (n))
#define REP(i, a, n) for(typeof(n) i=(a); i<(n); i++)

int H, W;
char t[30][30];
bool visited[30][30];

int dfs(int i, int j, int cnt) {
    if(i < 0 || j < 0 || i >= H || j >= W) return 0;
    if(visited[i][j]) return 0;
    if(t[i][j] == '#') return 0;
    
    visited[i][j] = true;
    
    return 1 + dfs(i+1, j, cnt) + dfs(i-1, j, cnt) + dfs(i, j+1, cnt) + dfs(i, j-1, cnt);
}

int main() {
	while(true) {
        cin >> W >> H;
        if(W == 0 && H == 0) break;
        
        int p, q;
        rep(i, H) {
            rep(j, W) {
                cin >> t[i][j];
                visited[i][j] = false;
                if(t[i][j] == '@') {p = i; q = j;}
            }
        }
        cout << dfs(p, q, 0) << endl;
	}
}



Measured memory_bytes: 3000
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  if((a + b) % 2 == 0){
  cout << (a + b) / 2 << endl;
  }
  else{
  cout << (a + b) / 2 + 1 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
int main(){
	ll n;
	cin >> n;
	string s = "";
	while(n){
		n--;
		//cout << n << endl;
		char c = n % 26 + 'a';
		//cout << n << " % 26 = " << c << endl;
		s = c + s;
		n/=26;
	}
	cout << s << endl;
	return 0;
}

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

fn dfs(s: String, mc: char, n: usize) {
    if s.len() == n {
        println!("{}", s);
    } else {
        let mcp = (mc as u8 + 1) as char;
        for cc in ('a' as u8) ..(mcp as u8) {
            let c = cc as char;
            let mut st = s.clone();
            st.push(c);
            if c == mc {
                dfs(st, mcp, n);
            } else {
                dfs(st, mc, n);
            }
        }
    }
}

fn main() {
    let n = read::<usize>();

    let s = String::new();
    dfs(s, 'a', n);

}

Measured memory_bytes: 5500
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    public static void Main()
    {
        int a = NextInt();
        int b = NextInt();
        string ans = "x";
        if (a + b == 15) ans = "+";
        if (a * b == 15) ans = "*";
        Console.WriteLine(ans);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 11220
N,H = map(int,input().split())
B = []
max_attack = 0
for i in range(N):
    a,b = map(int,input().split())
    max_attack = max(a,max_attack)
    B.append(b)

B.sort(reverse=True)
ans = 0

for b in B:
    if max_attack <= b:
        H -= b
        ans += 1
        if H <= 0:
            break
    else:
        break

if 0 < H:
    if H%max_attack == 0:
        ans += H//max_attack
    else:
        ans += 1+H//max_attack
print(ans)


Measured memory_bytes: 81436