akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 1000000007;
//const int MOD = 998244353;

//long long int N, M, K, H, W, L, R;
int N, M, K, H, W, L, R;


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

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> L;
		M = max(M, L);
		K += M == L;
	}
	cout << K << endl;
	return 0;
}

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

int main() {
    int h,w;
    cin>>h>>w;
    string a[h];
    for(int i=0;i<h;i++){
    	cin>>a[i];
    }
    for(int i=0;i<h;i++){
   		if(i==0){
   			cout<<"#";
    		for(int k=0;k<w;k++){
    			cout<<"#";
    		}
    		cout<<"#"<<endl;
    	}
    		cout<<"#"<<a[i];
    	cout<<"#"<<endl;
    	if(i==(h-1)){
    		cout<<"#";
    		for(int k=0;k<w;k++){
    			cout<<"#";
    		}
    		cout<<"#"<<endl;
    	}	
    }
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAXW = 1E5 + 3;
const int MAXN = 100 + 3;
long long arr[MAXN][MAXW];

int main () {
	int n, W;
	cin >> n >> W;
	int w, v;
	for (int num = 1; num <= n; num ++) {
		cin >> w >> v;
		for (int j = num - 1; j >= 0; j --) 
			for (int we = 0; we <= W - w; we ++) {
				arr[j + 1][we + w] = max(arr[j][we] + v, arr[j + 1][we + w]);
			}
	}
	long long ans = -1;
	for (int i = 0; i <= n; i ++)
		for (int j = 0; j <= W; j ++)
			ans = max(ans, arr[i][j]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 81516
while True:
    try:
        c1, c2, c3 = map(int, input().split())
    except:
        break

    N = list(range(1,11))
    N.remove(c1)
    N.remove(c2)
    N.remove(c3)
    y = 0
    n = 0
    for i in range(7):
        S = c1 + c2 + N[i]
        if S<=20:
            y += 1
        if 20<S:
            n += 1
    j = y/(y+n)
    if 0.5<=j:
        print('YES')
    else:
        print('NO')


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

using namespace std;


#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search  >
#define lower(arr,n,fixed) lower_bound(arr,arr+n,fixed)-arr  //Lower value search  >=
#define FOR(i,a,n) for(int i=a; i<(int)n; i++)
#define FORI(i,a,n) for(int i=a; i>=(int)n; i--)
#define pii pair<int,int>
#define vpii vector<pii>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(a) int((a).size())
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0)
#define endl "\n"
#define all(a) a.begin(), a.end()
#define MEMSET(p,i) memset(p,i,sizeof(p))

typedef long long LL;
typedef unsigned long long ULL;

int main(void)
{
	fastIO();
	int n, k;

	cin >> n >> k;
	vector<int> v(n);
	int dp[100010] = {0};



	
	FOR(i,0,n){
		cin >> v[i];
		dp[v[i]] = 1; // win
	}
	
	FOR(i,0,k+1){
		if(dp[i] == 1){
			for(auto j : v){
				if(i+j <= k){
					if(dp[i+j] == 0){
						dp[i+j] = 2; // lose
					}
				}
			}
		}
		else {
			for(auto j : v){
				if(i+j <= k){
					dp[i+j] = 1; // win
				}
			}
		}
		
	}
	
	if(dp[k] == 1)
		cout << "First\n";
	else
		cout << "Second\n";


	
	
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int h, w; cin >> h >> w;
    vector<string> s(h); cin >> s;
    FOR(i, 0, w + 2)cout << '#';
    cout << "\n";
    FOR(i, 0, h)cout << '#' << s[i] << "#\n";
    FOR(i, 0, w + 2)cout << '#';
    cout << "\n";
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool flag;

void dfs(int n){
	if(n==0){
		flag = 1;
		return;
	}
	if(n>=4){
		dfs(n-4);
	}
	if(n>=7){
		dfs(n-7);
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	dfs(n);
	if(flag){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

// RAQ and RSQ
// varify : https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_G
template<typename Monoid>
struct LazySegmentTree {
private:
    using Func = std::function<Monoid(Monoid, Monoid)>;
    Func F = [](Monoid a, Monoid b) { return a + b; };
    Monoid UNITY = 0;
    int n;
    std::vector<Monoid> node, lazy;

    // propagation
    void eval(int k, int l, int r) {
        if (lazy[k] != 0) {
            node[k] += lazy[k];
            if (r - l > 1) {
                lazy[2 * k + 1] += lazy[k] / 2;
                lazy[2 * k + 2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }
public:
    LazySegmentTree() {}

    LazySegmentTree(int m) {
        build(m);
    }

    LazySegmentTree(const std::vector<Monoid>& v) {
        build(v);
    }

    void build(int m) {
        n = 1; while (n < m) n <<= 1;
        node.resize(n * 2 - 1, UNITY);
        lazy.resize(n * 2 - 1, 0);
    }

    void build(const std::vector<Monoid>& v) {
        int sz = v.size();
        n = 1; while (n < sz) n <<= 1;
        node.resize(n * 2 - 1, UNITY);
        lazy.resize(n * 2 - 1, 0);
        for (int i = 0; i < sz; i++) node[i + n - 1] = v[i];
        for (int i = n - 2; i >= 0; i--) node[i] = F(node[2 * i + 1], node[2 * i + 2]);
    }

    // [a,b)
    void add(int a, int b, Monoid x, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        eval(k, l, r);

        // out of range
        if (b <= l || r <= a) return;

        if (a <= l && r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
        }
        else {
            add(a, b, x, 2 * k + 1, l, (r - l) / 2 + l);
            add(a, b, x, 2 * k + 2, (r - l) / 2 + l, r);
            node[k] = F(node[2 * k + 1], node[2 * k + 2]);
        }
    }

    // [a,b)
    Monoid query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (r <= a || b <= l) return UNITY;
        eval(k, l, r);
        if (a <= l && r <= b) return node[k];
        Monoid vl = query(a, b, 2 * k + 1, l, (r - l) / 2 + l);
        Monoid vr = query(a, b, 2 * k + 2, (r - l) / 2 + l, r);
        return F(vl, vr);
    }

    Monoid operator[](int x) {
        return query(x, x + 1);
    }

    void print() {
        for (int i = 0; i < n; i++) {
            std::cout << i << "\t: " << query(i, i + 1) << std::endl;
        }
    }
};

int main() {
    int n, d, a; cin >> n >> d >> a;
    vector<pair<ll, ll>> b(n);
    for (int i = 0; i < n; i++) {
        cin >> b[i].first >> b[i].second;
        b[i].second = (b[i].second + a - 1) / a;
    }
    sort(b.begin(), b.end());
    vector<ll> c(n), e(n);
    for (int i = 0; i < n; i++) {
        c[i] = b[i].first;
        e[i] = b[i].second;
    }
    ll ans = 0;
    LazySegmentTree<ll> seg(e);
    for (int i = 0; i < n; i++) {
        if (seg[i] <= 0) continue;
        ans += seg[i];
        seg.add(i, upper_bound(c.begin(), c.end(), c[i] + 2 * d) - c.begin(), -seg[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 14720
"use strict"
function KP(callback) {
    this.data = [];
    this.reader = require('readline').createInterface({
        input: process.stdin,
        output: process.stdout
    });
    this.id = 0;
    this.start = function(callback) {
        self.reader.on('line', function(line) {
            var dt = line.split(" ");
            for (var i = 0; i < dt.length; ++i) {
                self.data.push(dt[i]);
            }
        });
        self.reader.on('close', function() {
            callback(self);
        });
    }
    this.input = function() {
        var id = self.id++;
        if (id >= self.data.length) {
            self.error("reached eof");
        }
        return self.data[id];
    }
    this.output = function(data) {
        if (arguments.length > 1) {
            data = [];
            for (var i = 0; i < arguments.length; ++i) {
                data[i] = arguments[i];
            }
        }
        else if (typeof data !== "object") {
            data = [data];
        }
        console.log(data.join(" "));
    }
    this.error = function(err) {
        console.error(err);
        console.abort();
    }
    var self = this;
};

new KP().start(function(kp) {
    var a = +kp.input();
    var b = +kp.input();
    kp.output([a*b, (a+b)*2]);
    process.exit(0);
});

Measured memory_bytes: 16356
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef char keytype;

int gcd(int a, int b){ return (a % b) ? gcd(b, a % b) : b;}
int lcm(int a, int b){ return (a / gcd(a, b)) * b;}

/* a[0], ..., a[n-1] の数の最大公約数 */
int ngcd(int n, int a[])
{
    int i, d;

    d = a[0];
    for (i = 1; i < n && d != 1; i++)
        d = gcd(a[i], d);
    return d;
}

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int is_prime(int x){
    if(x <= 1) return 0;
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0) return 0;
    }
    return 1;
}

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

//#define N 5
//int p[N + 1];
int nextperm(int p[], int N)  /* 辞書式順序で次の順列 */
{
    int i, j, t;

    i = N - 1;
    p[0] = 0;  /* 番人 */
    while (p[i] >= p[i + 1]) i--;
    if (i == 0) return 0;  /* 完了 */
    j = N;
    while (p[i] >= p[j]) j--;
    t = p[i];  p[i] = p[j];  p[j] = t;
    i++;  j = N;
    while (i < j) {
        t = p[i];  p[i] = p[j];  p[j] = t;  i++;  j--;
    }
    return 1;  /* 未了 */
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

int abs_val(int a, int b){
    if(a > b) return a - b;
    else return b - a;
}

const int inf = 1012345678;
int main(){
    int a, b, c;
    ll k;

    scanf("%d %d %d %lld", &a, &b, &c, &k);

    int ans = a - b;
    if((k % 2) == 1) ans = -ans;

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 1728
import java.lang.Math.max
import java.lang.Math.min
import java.util.*

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

fun p14() {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val aList = readLine()!!.split(' ').map { it.toLong() }

    val maxes = LongArray(n)
    maxes[0] = aList.first()
    for (i in 1 until n) maxes[i] = max(maxes[i - 1], aList[i])

    var answer = Long.MAX_VALUE

    for (i in 0 until (1L shl n)) {
        val bitSet = BitSet.valueOf(longArrayOf(i))
        if (bitSet.cardinality() != k) continue

        val filtered = aList.withIndex().filter { bitSet[it.index] }

        var sum = 0L
        var prevHeight = -1L

        for ((index, height) in filtered) {
            if (index != 0) prevHeight = max(prevHeight, maxes[index - 1])
            if (prevHeight >= height) {
                sum += (prevHeight - height) + 1
                prevHeight++
            } else {
                prevHeight = height
            }
        }
        answer = min(answer, sum)
    }

    println(answer)
}


Measured memory_bytes: 40072
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>

using namespace std;

int main() {
	int n, m, a, b;
	cin >> n >> m;

	vector<set<int>> connect(n + 1);
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		connect[a].insert(b);
		connect[b].insert(a);
	}


	bool update = true;
	int ans = 0;
	while (update) {
		update = false;

		for (int i = 1; i <= n; i++) {
			if (connect[i].size() == 1) {
				ans++;
				update = true;
				int tmp = *connect[i].begin();
				connect[i].clear();
				connect[tmp].erase(i);
				break;
			}
		}
	}

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


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

class Program
{
    static void Main(string[] args)
    {
        solve();
    }
    static Scanner cin;
    static int A, B, C, D, E, F;
    static void input()
    {
        cin = new Scanner();
        A = cin.nextInt() * 100;
        B = cin.nextInt() * 100;
        C = cin.nextInt();
        D = cin.nextInt();
        E = cin.nextInt();
        F = cin.nextInt();
    }
    static void solve()
    {
        input();
        int suger = 1;
        int water = F;

        for(int a = 0; a <= F; a += A)
        {
            for (int b = 0; a + b <= F; b += B)
            {
                int w = a + b;
                for(int c = 0; w + c <= F; c += C)
                {
                    for(int d = 0; w + c + d <= F; d += D)
                    {
                        int s = c + d;
                        if (E * w < s * 100)
                            continue;

                        if (s * (suger + water) >= suger * (s + w))
                        {
                            suger = s;
                            water = w;
                        }
                    }
                }
            }
        }
        WriteLine(water + suger + " " + suger);
    }
    class Scanner
    {
        string[] s;
        int i;

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

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

        public int nextInt()
        {
            return int.Parse(next());
        }

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

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

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

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

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

Measured memory_bytes: 13140
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int main() {

    double N,M;
    cin >> N >> M;

    double sum = (N - M) * 100.0 + M * 1900.0;
    double ans = 0.0;
    
    REP(j,100000) {
        double ps = 1.0 / pow(2.0, M);
        double pn = pow(1.0 - ps, j) * ps;
        ans += (sum * (j + 1.0)) * pn;
    }
    
    ans += 1.0e-6;

    cout << (ll) ans << endl;

    return 0;
}

Measured memory_bytes: 512
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n = INT()
    a = LIST()
    l = [[a[i], i+1] for i in range(n)]
    l.sort()
    ans = [x[1] for x in l]
    print(*ans)

if  __name__=='__main__':
    main()


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef unsigned long long ull;

const int N = (int)1e5 + 7;
const int inf = (int)1e9 + 7;
const ll linf = (ll)1e18;

string s;

int main(){
  cin >> s;
  cout << (equal(s.begin(), s.end(), s.rbegin()) ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 764
//优先队列
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll Inf = 1e17 + 779;
const int maxx = 3e5 + 8;

priority_queue <ll, vector<ll>, less<ll> > qua; //降序, 队头大
priority_queue <ll, vector<ll>, greater<ll> > que; //升序, 队头小

int n;
ll a[maxx];
ll suml[maxx], sumr[maxx];
ll s1, s2;

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n * 3; i++) {
		scanf("%lld", &a[i]);
		if(i <= n) {
			s1 += a[i];
			que.push(a[i]);
		}
		else if(i >= 2 * n + 1) {
			s2 += a[i];
			qua.push(a[i]);
		}
	}
	suml[n] = s1;
	sumr[n * 2 + 1] = s2;
	int l = n + 1, r = 2 * n;
	while(l <= r) {
		if(a[l] > que.top()) {
			s1 += a[l];
			s1 -= que.top();
			que.pop();
			que.push(a[l]);
		}
		suml[l] = s1;
		l++;
	}
	l = n + 1, r = 2 * n;
	while(l <= r) {
		if(a[r] < qua.top()) {
			s2 += a[r];
			s2 -= qua.top();
			qua.pop();
			qua.push(a[r]);
		}
		sumr[r] = s2;
		r--;
	}
	ll ans = -Inf;
	for(int i = n; i <= n * 2; i++) ans = max(ans, suml[i] - sumr[i + 1]);
	printf("%lld\n", ans);
}

Measured memory_bytes: 7668
#include<bits/stdc++.h>
using namespace std;
int main(){
 double n,d,ans=0,x,y;
 cin>>n>>d;
vector<vector<int>> v(n,vector<int>(2));
for(int i=0; i<n; i++){
  for(int j=0; j<2; j++){
    cin>>v[i][j];
  }
}

for(int i=0; i<n; i++){
  x=v[i][0]; y=v[i][1];
  if(sqrt(x*x+y*y)<=d) ans++;
}
cout<<ans<<endl;
}


Measured memory_bytes: 14432
use proconio::input;

#[allow(unused_variables)]
fn main() {
    input! {
      n: usize,
    };

    let mut ans = 0;
    let candidates = vec![1, 2, 4, 8, 16, 32, 64];

    for c in candidates {
        if n >= c {
            ans = c
        } else {
            break;
        }
    }

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


Measured memory_bytes: 2176
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <functional>
#include <set>
#define DB cerr<<"D"<<endl
#define pb push_back
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";}
using P=pair<ll,ll>;
const ll M = 1e9+7;
void add(ll& x, ll y) {x+=y; x%=M;}
void chmax(ll& x, ll y) {if (x<y) x=y;}

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

  int an=0;
  for(int i=0;i<n;i++) {
    if (a[i] == -1) continue;
    int like = a[i];
    if (a[like] == i) an++, a[like]=-1;
  }
  cout<<an<<endl;
}

Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

signed main() {
    int n;
    string s;

    cin>>n>>s;

    string sx;
    sx = s;

    REP(i,s.size()){
        sx.at(i) = s.at(i) + n;
        if ( sx.at(i) > 'Z'){
            sx.at(i) = sx.at(i) - 26;
        }
    }

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

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 99999999;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };



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

	if(N%111 != 0)printf("%d", (N / 111 + 1) * 111);
	else printf("%d", N);


}



/*         提出前の確認事項

・デバッグ用の関数は＜＜コメント化＞＞しているか？
・すべての＜＜入力例＞＞は試したか？
・＜＜限界値分析＞＞はしたか？
・＜＜出力の改行＞＞の有無は確認したか？
・文字列の＜＜スペル＞＞は確認したか？
・＜＜解の存在性＞＞は確認したか？
　　　　　　　　↓
	 ＜＜提出先＞＞に注意して提出！！
*/

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int hantei(int n,int *a){
	int x =n;
	while(1){
		if(x==0)return 1;
		if(a[x%10]==1)return 0;
		x = x/10;
	}
}

int main(){
	int n,k,m,ans;
	int a[10]={};
	cin >>n >>k;
	for(int i=0;i<k;i++){
		cin >> m;
		a[m]=1;
	}
	ans=n;
	while(1){
		if(hantei(ans,a)==1)break;
		ans +=1;
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v){stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n<<=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES\n":"NO\n");}
void Yn(bool z){cout<<(z?"Yes\n":"No\n");}
void yn(bool z){cout<<(z?"yes\n":"no\n");}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 0;

int n;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  cout << ((n-1)/111+1)*111 << endl;
  return 0;
}

Measured memory_bytes: 256
import math

a,b,h,m = (int(x) for x in input().split())

xa = a*math.sin(math.pi * m /30)
ya = a*math.cos(math.pi * m /30)
xb = b*math.sin((math.pi * h /6) + (math.pi * m /360))
yb = b*math.cos((math.pi * h /6) + (math.pi * m /360))

print(math.sqrt((xa - xb)**2 + (ya - yb)**2))


Measured memory_bytes: 9512
n = int(input())
h = list(map(int,input().split()))
sign=[None]*(n-1)
ans = 0
for i in range(n-1):
  if h[i]>=h[i+1]:
    sign[i]="-"
ans = 0
cnt = 0
for j in range(n-1):
  if sign[j]=="-":
    cnt+=1
  else:
    ans = max(ans,cnt)
    cnt=0
ans = max(ans,cnt)    
print(ans)    
  
  


Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mod 1000000007
#define reset(s,val) memset(s,val,sizeof(s))
#define eps 1e-8
#define pi acos(-1)
#define sqr(x) (x)*(x)
#define two(x) (1<<(x))

int n,lis[222],ans;

int main( ){
    // freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    // ios::sync_with_stdio(0);
    cin>>n;
    For(i,0,2*n) cin>>lis[i];
    sort(lis,lis+2*n);
    ans=0;
    For(i,0,n) ans+=lis[2*i];
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007


signed main(){

	lli n;
	cin>>n;
	vector<lli> h(n);
	REP(i,0,n)cin>>h[i];

	/*逆から見る*/
	/*最小値を常に持って手前の数をその数以下にできない場合はNG*/

	lli num = h[n-1];

	for(lli i=n-1;i>=0;i--){
		if(h[i]-1 > num){
			cout<<"No"<<endl;
			return 0;
		}
		num = min(num,h[i]);
	}
	cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 1024
import Control.Applicative
main = do
  n <- getLine
  as <- map read.words<$>getLine
  q <- getLine
  ms <- map read.words<$>getLine
  mapM_ (\m -> do
          let res = solve m as
          if res then putStrLn "yes"
                 else putStrLn "no" ) ms

solve m [] = False
solve m (x:xs)
  | m == x = True
  | m <  x = solve m xs
  | m >  x = solve (m-x) xs || solve m xs

Measured memory_bytes: 5136
n,k=map(int,input().split())
d = 2
while k>n:
    d*=2
    k=(k+1)//2
ans = max(n-k+1,0)/d*2
while k>1:
    ans += (k//2)/d
    d *=2
    k = (k+1)//2
print(ans/n)

Measured memory_bytes: 3060
N, M, X = map(int,input().split())
CA = list(list(map(int,input().split())) for _ in range(N))

cost = (10 ** 5) * 12

for i in range(2 ** N):
  total, a = 0, [0] * M
  for j in range(N):
    if i >> j & 1:
      total += CA[j][0]
      for k in range(M): a[k] += CA[j][k + 1]
  for j in range(M):
    if a[j] < X:
      if i == 2 ** N - 1: cost = -1
      break
  else: cost = min(cost, total)

print(cost)

Measured memory_bytes: 9176
import math

a,b=map(int,input().split())
ans=1e9

for i in range(1300):
    if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
        ans=min(ans,i)
            
if ans==1e9:
    print("-1")
else:
    print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    map<string,int> mp;
    int maxi=0;
    for(int i=0;i<n;i++){
        cin >> s[i];
        mp[s[i]]++;
        maxi=max(maxi,mp[s[i]]);
    }
    vector<string> ans;
    for(auto x:mp){
        if(x.second==maxi){
            ans.push_back(x.first);
        }
    }
    sort(ans.begin(),ans.end());
    for(auto x:ans){
        cout << x << endl;
    }
    return 0;
}

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

//FX取引(最大利益算出)
int main()
{
	int n, a, first, second, small;

	cin >> n >> first >> second;	
	small = min(first, second);
	
	//三つ目からの時価
	for (int i = 1; i < n - 1; i++) {
		//時間tの時価入力
		cin >> a;

		//新たな最大利益
		if (second - first <= a - small) {
			first = move(small);
			second = a;
		}
		//一番小さい数値を記憶
		if (a < small) {
			small = move(a);
		}
	}

	cout << second - first << endl;

	return 0;
}


Measured memory_bytes: 3100
#include<cmath>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
const int N = 4005;
const int inf = 0x3f3f3f3f;
typedef long long ll;
vector<int>VR,VG,VB;
char a[N];
ll ans=0;
void fun(vector<int>VR,vector<int>VG,vector<int>VB)
{
    for(int i=0; i<VR.size(); i++)
    {
        int x=upper_bound(VG.begin(),VG.end(),VR[i])-VG.begin();
        if(x==VG.size())
            break;
        for(int j=x; j<VG.size(); j++)
        {
            int y=upper_bound(VB.begin(),VB.end(),VG[j])-VB.begin();
            if(y==VB.size())
                break;
            ans+=VB.size()-y;
            int id=2*VG[j]-VR[i];
            if(id<=VB.back()&&a[id]==a[VB[0]])
                ans--;
        }
    }
}
int main()
{
    int n;
    scanf("%d%s",&n,a);
    for(int i=0; i<n; i++)
        if(a[i]=='R')
            VR.push_back(i);
        else if(a[i]=='G')
            VG.push_back(i);
        else
            VB.push_back(i);
    fun(VR,VG,VB);
    fun(VR,VB,VG);
    fun(VG,VR,VB);
    fun(VG,VB,VR);
    fun(VB,VR,VG);
    fun(VB,VG,VR);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3704
import java.util.*;

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);

    int p = sc.nextInt();
    int q = sc.nextInt();
    int r = sc.nextInt();

    int ans = Math.min(p + q, q + r);
    ans = Math.min(ans, p + r);
    
    System.out.println(ans);
  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <cmath>
#include <stack>
#include <string>
using namespace std;
using ll=long long;

const ll nmax=500;
const ll cmax=30;
ll c0[cmax+1],c1[cmax+1],c2[cmax+1];
ll d[cmax+1][cmax+1];

int main(){
    ll N,C;
    cin>>N>>C;
    for(ll i=1;i<=C;i++){
        for(ll j=1;j<=C;j++){
            cin>>d[i][j];
        }
    }
    ll ctm;
    for(ll i=1;i<=N;i++){
        for(ll j=1;j<=N;j++){
            cin>>ctm;
            if((i+j)%3==0) c0[ctm]++;
            if((i+j)%3==1) c1[ctm]++;
            if((i+j)%3==2) c2[ctm]++;
        }
    }
//    for(ll i=0;i<ct0;i++)cout<<c0[i]<<" ";
//    cout<<endl;
//    for(ll i=0;i<ct1;i++)cout<<c1[i]<<" ";
//    cout<<endl;
//    for(ll i=0;i<ct2;i++)cout<<c2[i]<<" ";
//    cout<<endl;
    ll ans=100000000*3;
    for(ll i=1;i<=C;i++){
        for(ll j=1;j<=C;j++){
            for(ll k=1;k<=C;k++){
                if(i!=j&&j!=k&&i!=k){
                    ll ct=0;
                    for(ll l=1;l<=C;l++){
                        ct+=c0[l]*d[l][i]+c1[l]*d[l][j]+c2[l]*d[l][k];
                    }
                ans=min(ans,ct);
            }
        }
    }
}
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque

def main():
    h, w = map(int, input().split())
    ch,cw = map(int, input().split())
    dh, dw = map(int, input().split())
    ls = [input() for _ in range(h)]

    widou = []
    for i in range(-2,3):
        for j in range(-2, 3):
            widou.append((i, j))
    widou.remove((0,0))
    widou.remove((1,0))
    widou.remove((0,1))
    widou.remove((-1,0))
    widou.remove((0,-1))

    start = (ch-1, cw-1)
    goal = (dh-1, dw-1)

    explored = set()
    tempexplored = set()

    ytemp= deque()
    ytemp.append(start)

    wap = 0

    while ytemp:
        now = ytemp.popleft()

        if now == goal:
            print(wap)
            exit(0)

        x = now[0]
        y = now[1]

        explored.add((x, y))
        tempexplored.add((x, y))

        idou = [(1,0), (0,1), (0,-1), (-1,0)]
        for i, j in idou:
            a = x + i
            b = y + j
            if 0 <= a < h and 0 <= b < w:
                if ls[a][b] == '.':
                    if (a, b) not in explored:
                        ytemp.append((a,b))
                        explored.add((a,b))
                        tempexplored.add((a,b))

        if len(ytemp) ==0:
            wap += 1
            tempx = set()
            for s,t in tempexplored:
                for i, j in widou:
                    a = s + i
                    b = t + j
                    if 0 <= a < h and 0 <= b < w:
                        if ls[a][b] == '.':
                            if (a, b) not in explored:
                                ytemp.append((a, b))
                                explored.add((a, b))
                                tempx = set()
            tempexplored = tempx
    print('-1')
if __name__ == '__main__':
    main()


Measured memory_bytes: 166496
#include<bits/stdc++.h>
#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 fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/














int L, R;
//---------------------------------------------------------------------------------------------------
int solve() {
	int ans = inf;
	rep(i, L, R) rep(j, i + 1, R + 1) {
		chmin(ans, (int)(1LL * i * j % 2019));
		if (ans == 0)return 0;
	}
	return ans;
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> L >> R;
	cout << solve() << endl;
}







Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

int main(int argc, const char * argv[]) {
     
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, d; cin >> n >> d;
    int r = 2 * d + 1;
    
    cout << (n + r - 1) / r << endl;;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b)
#define chmin(a, b) (a)=min(a, b)
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main() {
  ll i, j, k;
  
  ll N, M;
  cin >> N >> M;
  
  ll s=0;
  for(i=0; i<M; i++) {
    ll a;
    cin >> a;
    s+=a;
  }
  
  if(N-s>=0) pt(N-s);
  else pt(-1);
  
  
  
}




Measured memory_bytes: 3624
# -*- coding: utf-8 -*-
stra, strb, strk = input().split()
a = int(stra)
b = int(strb)
k = int(strk)
if a >= k :
  a = a - k
  k = 0
else:
  k = k - a
  a = 0
#  print("{} {} {}\n".format(a,b,k))

  if b >= k:
    b = b - k
  else:
    b = 0

print("{} {}".format(a, b))



Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define fi first
#define se second
#define Mp make_pair
#define pb push_back
#define rep(i, j, k) for (int i = (j); i <= (k); i++)
#define per(i, j, k) for (int i = (j); i >= (k); i--)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int, int> PII;
typedef vector<int> VI;

int ch[4]={0,300000,200000,100000},ans;

int main(){
    int x,y; scanf("%d %d",&x,&y);
    if(x==1&&y==1) ans+=400000;
    if(x<=3) ans+=ch[x];
    if(y<=3) ans+=ch[y];
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String str;
    char[] ch;
    int i, n, m;

    n = 'a' - 'A';
    str = sc.nextLine();
    m = str.length();
    ch = new char[m];
    for(i = 0;i < m;i++){
      ch[i] = str.charAt(i);
      if(ch[i] >= 'a' && ch[i] <= 'z'){
        ch[i] -= n;
      }
    }

    for(i = 0;i < m;i++){
      System.out.print(ch[i]);
    }
    System.out.println();



    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

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

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

int main() {
	int n;
	ll ans = 0;
	cin >> n;
	REP(i, 1, n) {
		ans += i * f(n / i);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main(void){
    int N;         //景品が何種類あるか
    int k[10000];  //各景品の在庫

    while(true){
        cin >> N;
        if(N == 0) break;

        for(int i = 0; i < N; i++){
            cin >> k[i];
        }
        
        int max = 0; //全ての種類の中で在庫が一番多い景品の在庫
        for(int i = 0; i < N; i++){
            if(k[i] > max) max = k[i];
        }
        if(max <= 1) cout << "NA" << endl;
        else{
            if(N == 1) cout << "2" << endl;
            else{
                int times = 0; //ガチャガチャを回す回数
                for(int i = 0; i < N; i++){
                    if(k[i] == 0) times += 0;
                    else times += 1; 
                }
                cout << times + 1 << endl;
            }
        }
    }
}


Measured memory_bytes: 3108
s = input()
t = input()
for i in [chr(i) for i in range(97, 97+26)]:
    a = s.count(i)
    b = t.count(i)
    s = s.replace(i, str(a))
    t = t.replace(i, str(b))
if s == t:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 6836
#include<bits/stdc++.h>
 
#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();
 
using namespace std;
const int N=2e3+1, mod= 1e9+7;

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	
	int a,b;
	cin>>a>>b;
	if(a<10&&b<10)cout<<a*b;
	else cout<<"-1";
	
	
    yogeshk972();
}


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

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main(){
  int n,m;
  cin >> n >> m;
  vector<pair<int, int> > pairs(m);
  for(int i=0;i<m;i++){
    int a, b;
    cin >> a >> b;
    pairs[i] = make_pair(a, b);
  }
  sort(pairs.begin(), pairs.end(), compare_by_b);
  // for(int i=0;i<m;i++){
  //   cout << pairs[i].first << pairs[i].second << endl;
  // }
  int ans = 1;
  int i_prev = 0;
  for(int i=1;i<m;i++){
    if(pairs[i_prev].second<=pairs[i].first){
      i_prev = i;
      ans += 1;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	ll n, m, k;
	cin >> n >> m >> k;
	
	vector<ll> a(n), b(m), sumA(n + 1, 0), sumB(m + 1, 0);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
		sumA[i + 1] = sumA[i] + a[i];
	}
	
	for(int i = 0; i < m; ++i) {
		cin >> b[i];
		sumB[i + 1] = sumB[i] + b[i];
	}
	
	ll ans = 0LL, j = m;
	for(int i = 0; i <= n; ++i) {
		
		if( sumA[i] > k ) continue;
	
		while( sumA[i] + sumB[j] > k ) {
			j--;
		}

		ans = max(ans, (ll)(i) + j);
	}
	
	cout << ans << endl;
	
	return 0;
}


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

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

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K, C;
    string S;
    cin >> N >> K >> C;
    cin >> S;

    vector<int> L, R;
    int i = 0, d = 0;
    while(i < N && d < K) {
        if (S[i] == 'o') {
            L.push_back(i);
            d++;
            i += C + 1;
        } else {
            ++i;
        }
    }
    i = N-1; d = 0;
    while(i >= 0 && d < K) {
        if (S[i] == 'o') {
            R.push_back(i);
            d++;
            i -= C + 1;
        } else {
            --i;
        }
    }
    reverse(R.begin(), R.end());
//    rep(i, L.size()) cout << L[i] << ' ';
//    cout << endl;
//    rep(i, R.size()) cout << R[i] << ' ';
//    cout << endl;
    vector<int> ans;
    for (int j = 0; j < K; ++j) {
        if (L[j] == R[j]) {
            ans.push_back(L[j] + 1);
        }
    }
    rep(j, ans.size()) cout << ans[j] << endl;
}


Measured memory_bytes: 4236
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define debug cout << __LINE__ << endl
typedef long long int ll;
using namespace std;

ll M, N, a[114514], b[114514];

int main(){
  cin >> N >> M;
  vector<vector<ll>> rlist(M+1);
  for(int i=0;i<N;i++){
    cin >> a[i] >> b[i];
    if (a[i] <= M) rlist[a[i]].push_back(b[i]);
  }
  ll ans = 0;
  priority_queue<ll> rs;
  for(int i=1;i<=M;i++){
    for(auto r : rlist[i]){
      rs.push(r);
    }
    if (rs.empty()) continue;
    ans += rs.top(); rs.pop();
  }
  cout << ans << endl;
  return 0;
}
  

Measured memory_bytes: 7168
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vii = vector<int>;
using pii = pair<int, int>;
template <typename T = vii>
using vec = vector<T>;

const ll INF = 1e18, MOD = 1e9 + 7;

const int MAX = 1e6;

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    // freopen("in.in", "r", stdin);

    int n;
    cin >> n;
    vec<pii> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i].first;
        v[i].second = i;
    }
    sort(v.begin(), v.end(), greater<pii>());
    multiset<int> s({-1, -1, n, n});
    ll res = 0;
    for (const auto p : v) {
        const int e = p.first, i = p.second;
        auto it = s.upper_bound(i);
        auto jt = it;
        const ll a = *it, b = *++it;
        const ll c = *--jt, d = *--jt;
        const ll right = b - a;
        const ll left = c - d;
        ll cnt = 0;
        cnt += left * (a - i);
        cnt += (i - c) * right;
        res += cnt * e;
        s.insert(i);
    }
    cout << res << '\n';
}

Measured memory_bytes: 5760