akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main()
{
    string S,T;
    cin >> S;
    cin >> T;

    size_t Ssize = S.length();
    size_t Tsize = T.length();

    if(Ssize+1 == Tsize && T.find(S)==0)
    {
        cout << "Yes" <<endl;
    }     
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();

        int N;
        cin >> N;

        vector<ll> A(N), B(N);

        rep(i, 0, N) cin >> A[i];
        rep(i, 0, N) cin >> B[i];

        ll asum = accumulate(all(A), 0ll);
        ll bsum = accumulate(all(B), 0ll);
        if (asum < bsum) {
            cout << -1 << endl;
            return;
        }

        vector<ll> diff(N);
        rep(i, 0, N) {
            diff[i] = A[i] - B[i];
        }

        sort(all(diff));
        ll fusum = 0ll;
        ll cnt = 0;
        for (int i = 0; i < N && diff[i] < 0; ++i) {
            fusum += diff[i];
            cnt++;
        }

        ll rest = -fusum;
        for (int i = N - 1; i >= 0; --i) {
            if (rest > 0) {
                rest -= diff[i];
                cnt++;
            } else {
                break;
            }
        }

        cout << cnt << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 3064
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0

for i in range(a+1):
  for j in range(b+1):
    if i==0 and j==0:
      for k in range(c):
        if (x/50)-(10*i+2*j+(k+1))==0:
          ans += 1
    else:
      for k in range(c+1):
        if (x/50)-(10*i+2*j+k)==0:
          ans += 1

print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;

signed main(){
    
    int n,x;
    cin >> n >> x;
    int ans = 0;
    int d = 0;
    if(d <= x)ans++;
    rep(i,n){
        int l;
        cin >> l;
        d += l;
        if(d <= x)ans++;
    }
    cout << ans << endl;

    

    
    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc130.contest.atcoder.jp/tasks/abc130_b

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
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; }
//template end



int main(){
    int n; scanf("%d",&n);
    vector<ll> a(n),sum(n+1,0);
    rep(i,0,n)scanf("%lld",&a[i]);
    rep(i,0,n)sum[i+1]=sum[i]+a[i];
    ll ans=INF;
    rep(i,1,n)chmin(ans,abs(sum[i]-(sum[n]-sum[i])));
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <unordered_map>

using namespace std;

int main()
{
  int N, K;
  cin >> N >> K;
  unordered_map<int, int> counts;
  for (int n = 0; n < N; ++n) {
    int a;
    cin >> a;
    ++counts[a];
  }
  vector<int> numbers;
  numbers.reserve(counts.size());
  for (const auto& c: counts) {
    numbers.push_back(c.first);
  }
  sort(numbers.begin(), numbers.end(), [&counts](int a, int b) {
      return counts[a] < counts[b];
  });

  if (K >= counts.size()) {
    cout << 0 << endl;
  } else {
    int ans = 0;
    for (int i = 0; i < numbers.size() - K; ++i) {
      ans += counts[numbers[i]];
    }
    cout << ans << endl;
  }
  return 0;
}   


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

int main(){
  int a,b,k;
  cin >> a >> b >> k;
  if(b-a+1<2*k){
    for(int i=a;i<=b;i++){
      cout << i << endl;
    }
  }
  else{
    for(int i=a;i<a+k;i++){
      cout << i << endl;
    }
    for(int i=b-k+1;i<=b;i++){
      cout << i << endl;
    }
  }
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
        n: usize,
        s: chars,
    );
    let alphabet: Vec<char> = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars().collect();
    for c in s {
        let index = alphabet.iter().position(|&x| x == c).unwrap();
        print!("{}", alphabet[(index + n) % 26]);
    }
}


Measured memory_bytes: 4352
N, H = map(int, input().split())
A = []
B = []

for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

ma = max(A)
B.sort(reverse=True)

flag = False
damage = 0
count = 0
for d in B:
    if ma < d:
        damage += d
        count += 1
        if damage >= H:
            flag = True
            break

if flag:
    print(count)
else:
    ans = -((damage - H) // ma) + count
    print(ans)

Measured memory_bytes: 11340
a,b,k=map(int,input().split())
i = 0
while i < k:
  if i%2 == 0:
    if a%2 == 1:
      a += -1
    b += a//2
    a += -a//2
  if i%2 == 1:
    if b%2 == 1:
      b += -1
    a += b//2
    b += -b//2
  i += 1
print(a,b)

Measured memory_bytes: 3060
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

res = []
for a in A:
    for b in B:
        res.append(a + b)

res.sort(reverse=True)

res2 = []
for v in res[:K]:
    for c in C:
        res2.append(v + c)

res2.sort(reverse=True)
for i in range(K):
    print(res2[i])


Measured memory_bytes: 217756
a, b, c = map(int, input().split())
p = c // (a*7 + b)
q = c % (a*7 + b)
r = q // a
s = q % a
if a*7 < q < a*7+b:
    print(p*7 + 7)
elif s == 0:
    print(p*7 + r)
else:
    print(p*7 + r + 1)

    
    




Measured memory_bytes: 5596
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Dynamic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int N = intArray[0];
            int K = intArray[1];
            int[] arr = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int j = 0;
            Array.Sort(arr);
            for (int i = 0; i < K; i++)
            {
                j += arr[i];
            }
            Console.WriteLine(j);
        }
    }
}



//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 28588
package main

import (
        "bufio"
        "fmt"
        "os"
        "strconv"
        "strings"
)

////////////////////////////////////////
///        templates                 ///
////////////////////////////////////////

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
        sc.Scan()
        return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
        buf := make([]byte, 0, 1000000)
        for {
                l, p, e := rdr.ReadLine()
                if e != nil {
                        panic(e)
                }
                buf = append(buf, l...)
                if !p {
                        break
                }
        }
        return string(buf)
}

func strSprit(str string) []string {
        cols := strings.Split(str, " ")
        return cols
}

func parseInt(str string) int {
        n, _ := strconv.Atoi(str)
        return n
}

func intSprit(str string) []int {
        strs := strSprit(str)
        cols := make([]int, len(strs))
        for i, v := range strs {
                cols[i] = parseInt(v)
        }
        return cols
}

type SortSlice []int

func (s SortSlice) Len() int {
        return len(s)
}

func (s SortSlice) Swap(i, j int) {
        s[i], s[j] = s[j], s[i]
}

func (s SortSlice) Less(i, j int) bool {
        return s[i] < s[j]
}

func reverseString(str string) string {
        buf := []rune(str)
        for i, j := 0, len(buf)-1; i < j; i, j = i+1, j-1 {
                buf[i], buf[j] = buf[j], buf[i]
        }
        return string(buf)
}

////////////////////////////////////////
///        end templates             ///
////////////////////////////////////////

func main() {
        line := readBigLine()

        line = readBigLine()
        spl := strSprit(line)

        //nums := make([]int, N)
        r := 0
        for _, s := range spl {
                r += parseInt(s) - 1
        }

        fmt.Println(r)

}


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

using namespace std;

/* {{{ */
/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define rall(i) (i).begin(),(i).end(),greater<int>()
#define PB push_back
#define pb push_back
#define mp make_pair
#define FI first
#define SE second

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/
/* }}} */

int main(void)
{
  int n;
  int a[210][3];
  int point[210] = {};

  cin >> n;
  rep(i, n){
    cin >> a[i][0] >> a[i][1] >> a[i][2];
  }

  rep(i, 3){
    rep(j, n){
      bool flag = false;
      rep(k, n){
        if (a[j][i] == a[k][i] && k != j){
          flag = true;
          break;
        }
      }
      if (!flag) point[j] += a[j][i];
    }
  }

  rep(i, n) cout << point[i] << endl;

  return (0);
}

Measured memory_bytes: 3100
# E - Active Infants

n = int(input())
a = list(map(int, input().split()))
assert len(a) == n

# 添字のリスト
p = list(range(n))
p.sort(key=lambda i: a[i])

# dp[j] = 位置jから幅iの区間に小さい方からi個を配置したときの最大うれしさ
dp = [0] * (n + 1)

for i in range(n):
    for j in range(n - i):
        dp[j] = max(dp[j]     + a[p[i]] * abs(p[i] - (j + i)),
                    dp[j + 1] + a[p[i]] * abs(p[i] - j))

print(dp[0])


Measured memory_bytes: 68612
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <queue>
#include <functional>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define MOD (int)(1e9+7)
#define rep(i,n) for(int i=0;i<n;i++)

map<int, int>A;

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

	int N; cin >> N;
	vector<int>D(N);
	for (int i = 0; i < N; i++) {
		cin >> D[i];
		A[D[i]]++;
	}



	bool flag = true;
	int M; cin >> M;
	vector<int>T(M);
	for (int i = 0; i < M; i++) {
		cin >> T[i];
		A[T[i]]--;
		if (A[T[i]] < 0)flag = false;
	}

	cout << (flag ? "YES" : "NO") << endl;

    return 0;
}



Measured memory_bytes: 11264
import java.io.PrintWriter

@JvmField val _writer = PrintWriter(System.out, false)
fun main(args: Array<String>) { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val (s, p, r) = readLine()!!.split(' ').map { it.toInt() }
    val t = readLine()!!
    val l = Math.ceil(n.toDouble()/k.toDouble()).toInt()
    val arr = Array(k) {CharArray(l)}
    var ans = 0L
    repeat(k) {i ->
        var prev = '0'
        repeat(l) { j ->
            if (i + j*k < n) {
                val now = t[i + j * k]
                arr[i][j] = now
                if (now != prev) {
                    when (now) {
                        'r' -> ans += r
                        's' -> ans += s
                        'p' -> ans += p
                    }
                    prev = now
                } else {
                    prev = '0'
                }
            }
        }
    }
    println(ans)
}


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

#define ll long long

using namespace std;

char b;
int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>b;
    
    if (b=='A') cout <<'T';
    else if (b=='C') cout<<'G';
    else if (b=='G') cout<<'C';
    else cout<<'A';
    return 0;
}

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>

auto& in = std::cin;
auto& out = std::cout;

constexpr int32_t N = 200;//頂点数
std::vector<int32_t> graph[N];//木
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	int32_t t; in >> t;
	std::string s(N,'0');
	int32_t count = 0;
	for (int32_t i = 0; i < N; ++i)
	{
		s[i] = '1';
		for (int32_t j = i+1; j < N; ++j)
		{
			s[j] = '1';

			out << "? " << s<<endl;
			in >> t;
			if (t == 1) {
				graph[i].push_back(j);
				++count;
				if (count >= N-1) {
					goto res_out;
				}
			}

			s[j] = '0';
		}
		s[i] = '0';
	}
res_out:
	out << '!';
	for (int32_t i = 0; i < N; ++i)
	{
		for (auto& j : graph[i]) {
			out << " (" << i << ',' << j << ')';
		}
	}

	return 0;
}
#endif

Measured memory_bytes: 852
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
    int A,B,C;
    cin>>A>>B>>C;

    if((A<=C&&B>=C)||(B<=C&&A>=C)){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
 
template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr long long inf = 3e18;

struct UnionFind{
	vector<int>par,size;
	int find(int x){
		return (par[x]==x?x:par[x]=find(par[x]));
	}
	bool merge(int x,int y){
		x=find(x);y=find(y);
		if(x==y)return false;
		if(size[x]>size[y])swap(x,y);
		par[x]=y;
		size[y]+=size[x];
		return true;
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	UnionFind(int x):size(x,1),par(x){
		iota(all(par),0);
	}
};
signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int N,Q;cin>>N>>Q;
	UnionFind uf(N);
	while(Q--){
		int t,u,v;cin>>t>>u>>v;
		if(!t)uf.merge(u,v);
		else cout<<uf.same(u,v)<<"\n";
	}
}

Measured memory_bytes: 6348
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, m, tmp, dp[100009];
bool brk[100009];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> tmp;
		brk[tmp] = true;
	}
	dp[1] = 1;
	dp[2] = 1;
	for (int i = 3; i <= n + 1; i++) {
		dp[i] = dp[i - 2] + dp[i - 1];
		dp[i] = dp[i] % MOD;
	}
	long long ans = 1, cnt = 1;
	for (int i = 1; i <= n; i++) {
		if (brk[i]) {
			ans = ans * dp[cnt];
			ans = ans % MOD;
			cnt = 0;
		}
		else {
			cnt++;
		}
	}
	ans = ans * dp[cnt];
	ans = ans % MOD;
	cout << ans << "\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 768
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
const double PI = 3.14159265358979323846;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

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

	int a2 = (4 * X - Y);
	if (a2 % 2 == 0 && 0 <= a2 / 2 && a2 / 2 <= X) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3628
import java.lang.Math.abs

fun main(args: Array<String>) = p16()

fun p16() {
    val n = readLine()!!.toInt()
    val pList = readLine()!!.split(' ').map { it.toLong() }
    val qList = readLine()!!.split(' ').map { it.toLong() }

    val array = LongArray(n) { it + 1L }
    var pi = -1
    var qi = -1
    var i = 0

    do {
        val list = array.toList()
        if (list == pList) pi = i
        if (list == qList) qi = i
        i++
    } while (nextPermutation(array))

    val answer = abs(pi - qi)

    println(answer)
}

private fun nextPermutation(array: LongArray): Boolean {
    var i = array.size - 1
    while (i > 0 && array[i - 1] >= array[i]) i--
    if (i <= 0) return false
    var j = array.size - 1
    while (array[j] <= array[i - 1]) j--
    var temp = array[i - 1]
    array[i - 1] = array[j]
    array[j] = temp
    j = array.size - 1
    while (i < j) {
        temp = array[i]
        array[i] = array[j]
        array[j] = temp
        i++
        j--
    }
    return true
}


Measured memory_bytes: 41368
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

const int N = 303;
int n;
ll a[N][N];
ll ans = 0;

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++) {
			scanf("%lld", &a[i][j]);
		}
	for (int i = 0; i < n; i++)
		for (int j = 0; j < i; j++) {
			ll w = a[i][j] + 1;
			for (int k = 0; k < n; k++) {
				if (i == k || j == k) continue;
				w = min(w, a[i][k] + a[k][j]);
			}
			if (w < a[i][j]) {
				printf("-1\n");
				return 0;
			}
			if (w > a[i][j]) ans += a[i][j];
		}
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPll(i, n) for(ll i = 0; i < (ll)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool>    vecbool;
typedef vector<int>     vecint;
typedef vector<ll>      vecll;
typedef vector<string>  vecstr;
typedef vector<vecint>  vec2int;
typedef vector<vecbool> vec2bool;
int dx[4] {-1,+1, 0, 0};
int dy[4] { 0, 0,-1,+1};
int gcd(int a, int b){
  if(b == 0){
    return a;
  }
  if(a < b)return gcd(b, a);
  return gcd(b, a%b);
}

int main()
{
  int n, k; cin >> n >> k;
  vecint a(n,0);REP(i,n) cin >> a[i];
  sort(all(a));
  if(a[n - 1] < k){
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  int x = gcd(a[0],a[1]);
  REP(i,n){
    x = gcd(x, a[i]);
    if(x == 1){break;}
  }
  // cout << x << endl;
  if(k%x == 0){
    cout << "POSSIBLE" << endl;
  }else{
    cout << "IMPOSSIBLE" << endl;
  }
}


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

def bfs(s):
    if int(s)>n:
        return 0
    if all(s.count(c) > 0 for c in '753'):
        ret=1
    else:
        ret=0
    for c in '753':
        ret+=bfs(s+c)
    return ret

print(bfs('0'))

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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var sp = new List<Tuple<int, string, int>>();
            for (int i = 0; i < n; i++)
            {
                var input = Console.ReadLine().Split().ToArray();
                sp.Add(new Tuple<int, string, int>(i + 1, input[0], int.Parse(input[1])));
            }

            sp = sp.OrderByDescending(x => x.Item3).OrderBy(x => x.Item2).ToList();

            foreach(var x in sp)
            {
                Console.WriteLine(x.Item1);
            }
        }
    }
}


Measured memory_bytes: 13664
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;
// << fixed << setprecision(0) <<
// sort(ALL(),greater<int>());

int main() {

char s[100001];
cin >> s;
int n = strlen(s);
vector<int> r_ans,l_ans,re;
re.push_back(0);
REP(i,n-1) {
  if(s[i]=='R'&&s[i+1]=='L') {
    r_ans.push_back(i);
    l_ans.push_back(i+1);
  }
  if(s[i]=='L'&&s[i+1]=='R') {
    re.push_back(i+1);
  }
}
re.push_back(n);
int ans[n]={0};
int temp;
REP(i,r_ans.size()) {
  temp=re[i+1]-re[i];
  if(temp%2==0) {
    ans[r_ans[i]]=temp/2;
    ans[l_ans[i]]=temp/2;
  } else {
    ans[r_ans[i]]=temp/2+(r_ans[i]-re[i]+1)%2;
    ans[l_ans[i]]=temp/2+(l_ans[i]-re[i]+1)%2;
  }
}
REP(i,n) cout << ans[i] << " ";
cout << endl;
return 0;
}


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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;

template <class T> vector<T> make_v(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto make_v(size_t N,T... t){return vector<decltype(make_v(t...))>(N,make_v(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    int N,M; cin >> N >> M;
    priority_queue<ll> pq;
    for(int i = 0; i < N; ++i) {
        ll A; cin >> A;
        pq.push(A);
    }
    for(int i = 0; i < M; ++i) {
        ll c = pq.top();
        pq.pop();
        pq.push(c/2);
    }
    ll ans = 0;
    while(pq.size()) {
        ans += pq.top();
        pq.pop();
    }
    cout << ans << endl;



    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
const int MaxN = 200003,MaxM = 200003;
int n,m;
bool f1[MaxN],f2[MaxN];

int main() {
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;++i) {
		int u,v;
		scanf("%d%d",&u,&v);
		if (u>v) swap(u,v);
		if (u==1) f1[v]=true;
		if (v==n) f2[u]=true;
	}
	for (int i=1;i<=n;++i)
		if (f1[i] && f2[i]) {
			puts("POSSIBLE");
			return 0;
		}
	puts("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 640
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	m := make(map[uint8]byte, 3)
	for c := range s {
		if _, ok := m[s[c]]; ok {
			fmt.Println("No")
			return
		}
		m[s[c]] = s[c]
	}
	fmt.Println("Yes")
}

Measured memory_bytes: 512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

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

typedef long long int64;

class DLunlunNumber {
 public:
  void solve(std::istream &in, std::ostream &out) {

      int k;
      in >> k;
      queue<int64> q;
      for (int i = 1; i < 10; ++i)
          q.push(i);
      vector<int64> ans;
      while (ans.size() < k) {
          int64 cur = q.front();
          q.pop();

          //out << cur << " ee" << '\n';
          int last = cur % 10;

          //if (func(cur))
          ans.push_back(cur);

          for (int i = max(0, last - 1); i <= min(9, last + 1); ++i) {
              int64 next = (cur * 10) + i;
              q.push(next);
          }
      }
      out << ans.back() << '\n';
  }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    DLunlunNumber solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 2548
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;

int main()
{
    int n,m;
    int map_[100][100];
    while (cin>>n>>m)
    {
        memset(map_,0,sizeof(map_));
        for (int i=0;i<m;i++)
        {
            int a,b;
            cin>>a>>b;
            map_[a][b]++;
            map_[b][a]++;
        }
//        for (int i=1;i<=n;i++)
//        {
//            for (int j=1;j<=n;j++)
//            {
//                cout<<map_[i][j]<<" ";
//            }cout<<endl;
//        }cout<<endl;
        for (int i=1;i<=n;i++)
        {
            int sum=0;
            for (int j=1;j<=n;j++)
            {
                if (map_[i][j]!=0) sum+=map_[i][j];
            }
            cout<<sum<<endl;
        }
    }
}


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

int main () {
    int a, b, c;
    cin >> a >> b >> c;

    if (a > b) {
        swap(a, b);
    }
    
    if (b > c) {
        swap(b, c);
    }
    
    if (a > b) {
        swap(a, b);
    }
    
    cout << a << " " << b << " " << c << endl;
    return 0;
} 


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

using namespace std;

int main() {
    string s;
    cin >> s;
    
    int x = (s[0] - '0') * 10 + (s[1] - '0');
    int y = (s[2] - '0') * 10 + (s[3] - '0');
    
    bool yyxx = false;
    bool xxyy = false;
    
    if(x > 0 && x <= 12) {
        if(y > 0 && y <= 12) {
            yyxx = true;
            xxyy = true;
        }
        else {
            xxyy = true;
        }
    }
    else {
        if(y > 0 && y <= 12) {
            yyxx = true;
        }
    }
    
    if(yyxx && xxyy) {
        cout << "AMBIGUOUS" << endl;
    }
    else if(yyxx) {
        cout << "YYMM" << endl;
    }
    else if(xxyy) {
        cout << "MMYY" << endl;
    }
    else {
        cout << "NA" << endl;
    }
    
    return 0;
}



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

typedef long long ll;

const int MOD = 998244353;
const int N = 3005;
int n, s;
int A[N];
int dp[N][N];

ll f(int i, int sum) {
    if (i == n) {
        if (sum == 0)
            return 1;
        return 0;
    }
    if (dp[i][sum] != -1) return dp[i][sum];
    int v = A[i];
    ll res = 0;
    if (sum >= v)
        res = (res + f(i + 1, sum - v)) % MOD;
    res = (res + f(i + 1, sum) * 2 % MOD) % MOD;
    return dp[i][sum] = res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> s;
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }

    memset(dp, 255, sizeof dp);
    ll res = f(0, s);
    cout << res << endl;


    return 0;
}



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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n, t; cin >> n >> t;
  vector<P> v(n);
  for(int i=0;i<n;++i) {
    cin >> v[i].first >> v[i].second;
  }
  sort(v.begin(), v.end());

  vvll dp(n+1, vll(t, -1));
  dp[0][0] = 0;
  for(int i=0;i<n;++i) {
    for(int j=0;j<t;++j) {
      if(dp[i][j] == -1) continue;
      dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
      if(j + v[i].first < t) dp[i+1][j+v[i].first] = max(dp[i+1][j+v[i].first], dp[i][j] + v[i].second);
    }
  }

  ll ans = 0;
  for(int i=0;i<n;++i) {
    ll ma = 0;
    for(int j=0;j<t;++j) {
      if(dp[i][j] != -1) ma = max(ma, dp[i][j] + v[i].second);
    }
    ans = max(ans, ma);
  }
  for(int i=0;i<t;++i) {
    if(dp[n][i] != -1) ans = max(ans, dp[n][i]);
  }

  cout << ans << endl;
}


Measured memory_bytes: 70784
// Try AtCoder
// author: Leonardone

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!(usize);
    let s = get().as_bytes();
    let t = get().as_bytes();
    for i in 0..n {
        print!("{}{}", s[i] as char, t[i] as char);
    }
    println!();
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    long long l[90];
    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;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
#define int long long

int GCD(int m,int n){
	if(n == 0) return m;
	else return GCD(n,m % n);
}

int LCM(int m,int n){
	int g = GCD(m,n);
	return m / g * n;
}

signed main(){
	int n,m;
	cin >> n >> m;
	string s,t;
	cin >> s >> t;
	int g = GCD(n,m);
	int l = LCM(n,m);
	char mem[100100];
	int j = 0;
	for(int i = 0; i < n; i += (l / m)){
		mem[j] = s[i];
		j++;
	}
	j = 0;
	for(int i = 0; i < m; i += (l / n)){
		if(t[i] != mem[j]){
			cout << -1 << endl;
			return 0;
		}
		j++;
	}
	cout << l << endl;
}

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

using namespace std;

void hawawa()
{
	int n, p, k;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		int num;
		cin >> num;
		if (num == 1) p = i;
	}
	int num = 1, ans = 0;
	while (num < n) {
		ans++;
		num += k - 1;
	}
	cout << ans << "\n";
}

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


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
using namespace std;
int main(){
	int ans=0,n;
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		while(x%2==0){
			ans++;
			x/=2;
		}
	}
	cout<<ans<<endl;
}

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

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

template<class T>struct dijkstra{//T=int or ll
  struct Node{
    vector<T> edges_to;
    vector<T> edges_cost;
    bool done;
    T cost=-1;
  };
  vector<Node> graph;
  void init(T N){
    graph.resize(N);
  }
  void add(T from, T to, T cost){
    graph[from].edges_to.push_back(to);
    graph[from].edges_cost.push_back(cost);
  }
  void shortest(T start){
    priority_queue<pair<T,T>,vector<pair<T,T>>,greater<pair<T,T>>> d;
    d.push(make_pair(0,start));
    while(!d.empty()){
      pair<T,T> p = d.top();
      d.pop();
      Node &point = graph[p.second];
      if(point.done) continue;
      point.done = true;
      point.cost = p.first;
      for(T i = 0; i < (T)point.edges_to.size(); i++){
        if(graph[point.edges_to[i]].done)continue;
        d.push(make_pair(point.cost+point.edges_cost[i],point.edges_to[i]));
      }
    }
  }
};

int main() {
  ll N;
  cin>>N;
  dijkstra<ll> D;
  D.init(N);
  for(ll i = 0; i < N-1; i++) {
    ll x,y,z;
    cin>>x>>y>>z;
    D.add(x-1,y-1,z);
    D.add(y-1,x-1,z);
  }
  ll Q,K;
  cin>>Q>>K;
  D.shortest(K-1);
  for(ll i = 0; i < Q; i++){
    ll x,y;
    cin>>x>>y;
    cout<<D.graph[x-1].cost+D.graph[y-1].cost<<endl;
  }
}

Measured memory_bytes: 16512
import java.util.*;
import java.io.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader(System.in);
		int x = in.readInt();
		int t = in.readInt();
		if(x>t) System.out.println(x-t); 
		else System.out.println(0); 
	}
}
class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

Measured memory_bytes: 19668
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>

using namespace std;

#ifdef DEBUG
#define dprintf      printf
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(1){}else
#define drep(i,n)    if(1){}else
#define dstop()      if(1){}else
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define all(x)      (x.begin(),x.end())
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__);
#define array(T,id,n) T id[n]; rep(i,n)cin>>id[i];

//#define int long long;
#ifndef int
#define INF (0x7fffffff)
#else
#define INF (0x7fffffffffffffff)
#endif

typedef  long long           ll;
typedef  unsigned            ui;
typedef  unsigned long long  ull;
typedef  pair<int,int>       i_i;
typedef  pair<ll,int>        ll_i;
typedef  pair<ll,ll>         ll_ll;
typedef  pair<double,int>    d_i;
typedef  pair<double,double> d_d;

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

signed main(void)
{
  in(int,n);
  int i;
  int k=1;
  for(i=0;n;i++)
    n/=2,k*=2;
  
  cout<<k/2<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;
void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

template<typename T>
void print(T &arr){
    ll sz = sizeof(arr)/sizeof(arr[0]);
    for(int i = 0;i < sz-1;i++){cout << arr[i] << ' ';}
    cout << arr[sz-1] << endl;
}

int main(){
    ll n,m; cin >> n >> m;
    vector<ll> price(m);
    vector<int> c_bit(m);
    rep(i,m){
        ll a,b; cin >> a >> b;
        price[i] = a;
        int temp = 0;
        rep(j,b){
            int c;cin >> c;
            c--;
            temp += (1 << c);
        }
        c_bit[i] = temp;
    }
    // print(c_bit);
    ll INF = INT_MAX;
    vector<vector<ll>> dp(1010,vector<ll>(5000,INF));
    dp[0][0] = 0;
    rep(i,m){
        // if(!i)continue;
        rep(j,(1 << n)){
            if(dp[i][j] == INF)continue;
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
            dp[i+1][(j | c_bit[i])] = min(min(dp[i][j | c_bit[i]],dp[i+1][j | c_bit[i]]), dp[i][j] + price[i]);
            // print(i,j,j | c_bit[i], dp[i][j | c_bit[i]], dp[i][j] + price[i], dp[i+1][(j | c_bit[i])]);
        }
    }
    // rep(i,m+1){
    //     rep(j,20)cout << (dp[i][j] == INF ? -1 : dp[i][j]) << " ";
    //     cout << endl;
    // }
    cout << (dp[m][(1 << n)-1] == INF ? -1 : dp[m][(1 << n)-1]) << endl;
}

Measured memory_bytes: 39808
#include<bits/stdc++.h>
#define inf 1000000000
#define N 300009
#define M 1100009
using namespace std;

int W,H,n,ans,p[N],q[N],mx[M],icr[M];
struct node{ int x,y; }a[N];
bool cmp(node u,node v){ return u.y<v.y; }
void build(int k,int l,int r){
	mx[k]=-inf; icr[k]=0;
	if (l==r) return;
	int mid=l+r>>1;
	build(k<<1,l,mid); build(k<<1|1,mid+1,r);
}
void ins(int k,int l,int r,int x,int y,int z){
	if (x<=l && r<=y){
		mx[k]+=z; icr[k]+=z; return;
	}
	int mid=l+r>>1;
	if (x<=mid) ins(k<<1,l,mid,x,y,z);
	if (y>mid) ins(k<<1|1,mid+1,r,x,y,z);
	mx[k]=max(mx[k<<1],mx[k<<1|1])+icr[k];
}
void ins(int x,int y,int z){
	if (!y) y=1; if (y>=x) return;
	ins(1,1,n,y,x-1,z);
}
void mdy(int k,int l,int r,int x,int y){
	if (l==r){ mx[k]=y; icr[k]=0; return; }
	int mid=l+r>>1;
	if (x<=mid) mdy(k<<1,l,mid,x,y); else mdy(k<<1|1,mid+1,r,x,y);
	mx[k]=max(mx[k<<1],mx[k<<1|1])+icr[k];
}
void solve(int W,int H){
	int i,j,k,mid=W>>1; bool flag=0;
	for (i=1; i<=n; i++) if (!a[i].y) break;
	if (i>n){
		flag=1; a[++n]=(node){mid,0};
	}
	sort(a+1,a+n+1,cmp);
	build(1,1,n);
	for (i=1,j=k=0; i<=n; i++){
		ans=max(ans,mx[1]+a[i].y);
		if (a[i].x<=mid){
			for (; j && a[i].x>a[p[j]].x; j--) ins(p[j],p[j-1],a[p[j]].x);
			ins(i,p[j],-a[i].x); p[++j]=i;
		} else{
			for (; k && a[i].x<a[q[k]].x; k--) ins(q[k],q[k-1],W-a[q[k]].x);
			ins(i,q[k],a[i].x-W); q[++k]=i;
		}
		mdy(1,1,n,i,W-a[i].y);
	}
	ans=max(ans,mx[1]+H);
	if (flag){
		for (i=1; i<n; i++) a[i]=a[i+1]; n--;
	}
}
int main(){
	scanf("%d%d%d",&W,&H,&n); ans=max(W,H)+1;
	int i;
	for (i=1; i<=n; i++) scanf("%d%d",&a[i].x,&a[i].y);
	solve(W,H);
	for (i=1; i<=n; i++) swap(a[i].x,a[i].y);
	solve(H,W);
	printf("%d\n",ans<<1);
	return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<ll> v(n);
  ll M = 0,m = inf;
  map<ll,ll> ma;
  rep(i,n){
    cin >> v[i];
    ma[v[i]]++;
    m = min(m,v[i]);
    M = max(M,v[i]);
  }
  bool f = false;
  if(m == M){
    if(m == n-1 || m <= n/2) f = true; 
  }
  else if(M - m == 1){
    int p = 0,q = 0;
    rep(i,n){
      if(v[i] == m){
        ++p;
      }
      else
        ++q;
    }
    if(p + 1 <= M && M <= p +  q/2) f = true;
  }
  std::cout << (f ? "Yes" : "No") << std::endl;
  return 0;
}


Measured memory_bytes: 7296
#include<stdio.h>

int main()
{
    int a[101],n;
    scanf("%d",&n);
    int op = 101;
    int result = 0;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]%10 != 0 && op > a[i])
            op = a[i];
        result += a[i];
    }
    if(result%10 != 0)
    {
        printf("%d",result);
    }
    else
    {
        if(op != 101)
        {
            if((result-op)%10 != 0)
                printf("%d",result-op);
        }
        else
            printf("0");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;


int main() {
	int a,b;
	cin>>a>>b;
	cout<<max(0,a-2*b)<<endl;
}

Measured memory_bytes: 256