akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)

func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func()
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx++
		return cur
	}
	this.initWordIdx = func() {
		idx = 0
	}
	return &this
}

func (me *ReaderEx) ScanAndSplit() (isScanned bool) {
	isScanned = me.baseScanner.Scan()

	me.words = strings.Fields(me.baseScanner.Text())
	me.initWordIdx()
	return
}

func (me *ReaderEx) Scan() (ok bool) {
	ok = me.baseScanner.Scan()
	return
}
func (me *ReaderEx) getString() string {
	return me.baseScanner.Text()
}

func (me *ReaderEx) getInt() int {
	n, err := strconv.Atoi(me.baseScanner.Text())
	defer func() {
		if err != nil {
			panic(err)
		}
	}()

	return n
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, fa)
		}
	}
	if n > 1 {
		facts = append(facts, factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func solve(stdin io.Reader, stdout io.Writer) {
	r := NewScannerEx(stdin)
	r.Scan()
	n := r.getInt()
	r.ScanAndSplit()
	sum := func(v []int) (w int) {
		w = 0
		for _, val := range v {
			w += val
		}
		return
	}
	a := r.nextStringArray().toInts()
	fmt.Fprintln(stdout, sum(a)-n)
}



Measured memory_bytes: 768
def main():
    n, k = map(int, input().split())
    p_list = [int(_) for _ in input().split()]

    p_list = sorted(p_list)

    f_list = []
    for i in range(k):
        f_list.append(p_list[i])

    out = sum(f_list)
    
    print(out)

main()

Measured memory_bytes: 9196
<?php
fscanf(STDIN, "%d%d%d%d%d", $n, $a, $b, $c, $d);
$s = "#".trim(fgets(STDIN));
 
$f = strpos(substr($s, $a, $c-$a+1), "##")===false && strpos(substr($s, $b, $d-$b+1), "##")===false;
if($c > $d){
  $f = $f && strpos(substr($s, $b-1, $d-$b+3), "...")!==false;
}
echo $f ? "Yes" : "No";

Measured memory_bytes: 4604
fun main(args: Array<String>) {
    val N = nextLong()
    val T = Array(5) { nextLong() }.asList().sorted()
    val ans = (N + T.first() - 1) / T.first() + 4
    println(ans)
}
fun next() = readLine()!!
fun nextLong() = next().toLong()

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

int main(){
    int n,m;
    cin >> n >> m;
    int ans = 1900*m + 100*(n-m);
    rep(i,m) ans *= 2;
    cout << ans << endl;
}

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

int main( void )
{
    string s;
    cin >> s;
    
    if ( s[0] != s[1] && s[1] != s[2] && s[2] != s[0] )
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	int counter = 0;
	
	for(int i = 0; i<n; i++){
		for(int j = i+1; j<n; j++){
			counter++;
		}
	}
	
	for(int i = 0; i<m; i++){
		for(int j = i+1; j<m; j++){
			counter++;
		}
	}
	
	printf("%d\n", counter);
	
	return 0;
}

Measured memory_bytes: 1676
N, K, S = map(int, input().split())
ans = [S] * K
 
if S != 10**9:
    for i in range(N-K):
        ans.append(S+1)
else:
    for j in range(N-K):
        ans.append(1)
 
print(" ".join([str(x) for x in ans]))

Measured memory_bytes: 20952
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <stack>
#include <utility>
#include <cmath>
#include <cstdio>

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;
LL MOD = 1000000007;

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

    vector<vector<int> > match(N, vector<int>(N,0));
    for(int i=0; i<N; i++)
        for(int j=0; j<N; j++)
            cin >> match[i][j];
    
    vector<vector<int> > check(N+1, vector<int>());
    for(int k=0; k<(1<<N)-1; k++) {
        int bc = 0;
        for(int j=0; j<N; j++) bc += (((1<<j) & k) ? 1 : 0);
        check[bc].push_back(k);

    }


    vector<int> dp(1<<N, 0);
    dp[0] = 1;
    for(int i=0; i<N; i++) {
    //    for(int k=(1<<N)-1; k>=0; k--) {
        for(auto k: check[i]){
            for(int j=0; j<N; j++) {
                if(match[i][j] == 0) continue;
                if(k & (1<<j)) continue;
                int ind = k | (1<<j) ;
                dp[ind] += dp[k];
                dp[ind] %= MOD;
            }

        }

    }

    cout << dp[(1<<N) - 1] << endl;

    return 0;
}

Measured memory_bytes: 17852
N, T = map(int, input().split())

current_c = 10000

for n in range(N):
  c, t = map(int, input().split())
  if t > T:
    continue
  if current_c > c:
    current_c = c

if current_c == 10000:
  print('TLE')
else:
  print(current_c)



Measured memory_bytes: 2940
#include<iostream>
#include<stdio.h>

int main()
{
	int n;
	double x[4], y[4];
	std::cin >> n;
	while( n-- ){
		for( int i = 0; i < 4; i++ ){
	 		std::cin >> x[i] >> y[i];
		}
		
		if( ( x[1] - x[0] ) * ( y[3] - y[2] ) == ( x[3] - x[2] ) * ( y[1] - y[0] ) ) puts("YES");
		else if( x[0] == x[1] && x[2] == x[3] ) puts("YES");
		else if( y[0] == y[1] && y[2] == y[3] ) puts("YES");
		else puts("NO");
	}

 	return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
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; }

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
typedef long long ll;
const int mod = 1e9 + 7;

int main()
{
  int a, b;
  cin >> a >> b;
  
  if(a >= 13) cout << b << endl;
  else if(a >= 6 && a <= 12) cout << b / 2 << endl;
  else cout << '0' << endl;
}


Measured memory_bytes: 256
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var n,graph,depth,ans;

//var myOut = main();
//if(myOut !== undefined)console.log(myOut);

function main(){
  n = next();
  graph = xArray("[]", n);
  depth = Array(n);
  ans = Array(n);
  for(var i = 1; i < n; i++){
    var a = next()-1, b = next()-1;
    graph[a].push(b);
    graph[b].push(a);
  }
  dfs(0,-1,0);
  var odd = 0, even = 0;
  for(var i = 0; i < n; i++){
    ans[i] = depth[i] % 2;
    if(ans[i])odd++;
    else even++;
  }
  var n1 = Math.ceil(n/3), n3 = n/3|0, n2 = n-n1-n3;
  var a1 = 1, a2 = 2, a3 = 3;
  if(odd <= n3){
    for(var i = 0; i < n; i++){
      if(ans[i])ans[i] = a3, a3 += 3;
      else{
        if(a1 <= n)ans[i] = a1, a1 += 3;
        else if(a2 <= n)ans[i] = a2, a2 += 3;
        else ans[i] = a3, a3 += 3;
      }
    }
  }else if(even <= n3){
    for(var i = 0; i < n; i++){
      if(ans[i] === 0)ans[i] = a3, a3 += 3;
      else{
        if(a1 <= n)ans[i] = a1, a1 += 3;
        else if(a2 <= n)ans[i] = a2, a2 += 3;
        else ans[i] = a3, a3 += 3;
      }
    }
  }else{
    for(var i = 0; i < n; i++){
      if(ans[i]){
        if(a1 <= n){
          ans[i] = a1;
          a1 += 3;
        }else{
          ans[i] = a3;
          a3 += 3;
        }
      }else{
        if(a2 <= n){
          ans[i] = a2;
          a2 += 3;
        }else{
          ans[i] = a3;
          a3 += 3;
        }
      }
    }
    }
  
  return ans.join(" ");
}

function dfs(v,p,d){
  depth[v] = d;
  for(var i = 0; i < graph[v].length; i++){
    var V = graph[v][i];
    if(V === p)continue;
    dfs(V,v,d+1);
  }
}

if (process.argv.length <= 2) require("child_process").fork("Main.js", ["1"], { execArgv: ["--stack-size=240000"] });
else {
  var myOut = main();
  if(myOut !== undefined)console.log(myOut);
}

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

ll in_cnt(vector<pll>& point, ll x1, ll y1, ll x2, ll y2)
{
  ll res = 0;
  ll N = point.size();
  for (ll i = 0; i < N; ++i) {
    if ((min(x1, x2) <= point.at(i).first) && (point.at(i).first <= max(x1, x2)) && (min(y1, y2) <= point.at(i).second) && (point.at(i).second <= max(y1, y2))) {
      res += 1;
    }
  }
  return res;
}

ll calc(ll x1, ll y1, ll x2, ll y2)
{
  ll res = abs(x1 - x2) * abs(y1 - y2);
  return res;
}

int main()
{
  ll N, K;
  cin >> N >> K;
  vector<pll> point(N);
  vector<ll> x_list(N);
  vector<ll> y_list(N);
  for (ll i = 0; i < N; ++i) {
    ll x, y;
    cin >> x >> y;
    x_list.at(i) = x;
    y_list.at(i) = y;
    point.at(i) = {x, y};
  }
  ll ans = INF;
  for (ll x1 = 0; x1 < N - 1; ++x1) {
    ll px1 =  x_list.at(x1);
    for (ll x2 = 0; x2 < N; ++x2) {
      ll px2 = x_list.at(x2);
      for (ll y1 = 0; y1 < N - 1; ++y1) {
        ll py1 = y_list.at(y1);
        for (ll y2 = 0; y2 < N; ++y2) {
          ll py2 = y_list.at(y2);
          ll cnt = in_cnt(point, px1, py1, px2, py2);
          if (cnt >= K) {
            ans = min(ans, calc(px1, py1, px2, py2));
          }
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import collections
LX=[]
LY=[]
def Solve():
    N=int(input())
    for i in range(N):
        x,y=(int(t) for t in input().split())
        LX.append(x)
        LY.append(y)
        
    if N==1:
        return 1
    
    LLX=[]
    LLY=[]
    for i,x1 in enumerate(LX):
        for j,x2 in enumerate(LX):
            if i==j:
                continue
            LLX.append(x2-x1)

    for i,y1 in enumerate(LY):
        for j,y2 in enumerate(LY):
            if i==j:
                continue
            LLY.append(y2-y1)


    LLL=[str(dx)+'&'+str(dy) for dx,dy in zip(LLX,LLY)]

    return N-collections.Counter(LLL).most_common(1)[0][1]

print(Solve())


Measured memory_bytes: 3828
/**
 *   author: Shubham Srivastava
 *   created: 18 August 2019  17:34:07
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int n;cin>>n;
    vector <int> arr(n);
    double sum = 0.0, mul = 1.0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        sum += 1.0/((double)arr[i]);
    }
    cout<<1/sum;
return 0;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int d = b/a;
  if(d<c){
    cout << d << endl;
  }else{
    cout << c << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() 
{
  int i,n,big=0,small=0;
  cin >> n;
  vector<int> number(n);
  for(i=0;i<n;i++)
  {
    cin >> number.at(i);
  }
  sort(number.begin(), number.end());
  for(i=0;i<n;i++)
  {
    if(i % 2 == 0)
    {
  	 big += number.at(n-i-1);
    }
    else
    {
  	 small += number.at(n-i-1);
    }
  }
  cout << big - small;
  
  return 0;
}

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

length = len(str(N))
reuslt = 0
r_list = []

if length <= 2:
    print(0)
    exit()

def search(now, lastNum):
    if lastNum == 0:
        r_list.append(now)
        return
    search(now + "3", lastNum - 1)
    search(now + "5", lastNum - 1)
    search(now + "7", lastNum - 1)


for i in range(length-2):
    search("", length-i)
count = 0
for r in r_list:
    num = int(r)
    if num <= N and (r.count("7") >= 1 and r.count("5") >= 1 and r.count("3") >= 1):
        count += 1
print(count)


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

const ll SMAX = 90909;
ll dp[330][SMAX+1] = {0};
ll dp2[330][SMAX+1] = {0};

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

    ll N;
    cin >> N;
    vector<ll> a(N);
    REP(i, N) cin >> a[i];
    ll S = 0;
    REP(i, N) S += a[i];

    
    dp[0][0] = 1;
    REP(i, N){
    	REP(j, SMAX){
    		dp[i+1][j] += 2*dp[i][j], dp[i+1][j] %= mod;
    		if(j+a[i]<SMAX)dp[i+1][j+a[i]] += dp[i][j], dp[i+1][j+a[i]] %= mod;
    	}
    }

    ll sum = 0;
    REP(j, SMAX) if(j>=(S+1)/2) sum +=dp[N][j], sum %= mod;

    dp2[0][0] = 1;
    REP(i, N){
    	REP(j, SMAX){
    		dp2[i+1][j] += dp2[i][j], dp2[i+1][j] %= mod;
    		if(j+a[i]<SMAX)dp2[i+1][j+a[i]] += dp2[i][j], dp2[i+1][j+a[i]] %= mod;
    	}
    }


    ll ho = (S%2==0 ? dp2[N][S/2] : 0);

    ll res = powLL(3, N);
    //dump(res)
    //dump(sum)
    //dump(ho)
    //dump(S)
    res -= (3*sum)%mod;
    res += mod;
    res %= mod;
    res += (3*ho)%mod;
    res %= mod;
    cout << res << endl;
    return 0;
}

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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
  int N, D;
  std::cin >> N >> D;

  std::cout << N / (2 * D + 1) + (N % (2 * D + 1) > 0 ? 1 : 0) << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <algorithm>
#include <string>
using namespace std;
int num[5] = { 5,7,5,7,7 };
int main() {
	int n;
	int w[53];
	while (1) {
		cin >> n;
		if (n == 0)break;
		string s;
		for (int i = 0; i < n; i++) {
			cin >> s;
			w[i] = s.length();
		}
		for (int i = 0; i < n; i++) {
			int now = i;
			int x = 0;
			int cnt = 0;
			int judge = 0;
			while (1) {
				if (x == 5) {
					judge = 1;
					break;
				}
				cnt += w[now++];
				if (cnt == num[x]) {
					cnt = 0;
					x += 1;
				}
				if (cnt > num[x] || (now >= n&&x!=5))break;
			}
			if (judge == 1) {
				cout << i + 1 << "\n";
				break;
			}
		}
	}
}


Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
long long n,m,v,p,a[100010];
bool check(int x){
	long long cnt=0;
	if(a[x]+m<a[p-1])
		return 0;
	cnt+=(p-1)*m+(n-x)*m;
	for(int i=p-1;i<x;i++)
		cnt+=a[x]+m-a[i];
	return (cnt>=m*v);
}
int main(){
	cin>>n>>m>>v>>p;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	reverse(a,a+n);
	long long l=0,r=n-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(check(mid))
			l=mid+1;
		else
			r=mid-1;
	}
	cout<<l;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,m;
char s[55][55];
int w;
int sx,sy,gx,gy;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int d[55][55];
void bfs(){
	queue<P> que;
	que.push(P(sx,sy));
	while(que.size()){
		P p=que.front(); que.pop();
		if(p.first==gx&&p.second==gy) break;
		for(int i=0;i<4;i++){
			int nx=p.first+dx[i],ny=p.second+dy[i];
			if(0<=nx&&nx<n&&0<=ny&&ny<m&&s[nx][ny]!='#'&&d[nx][ny]==1000000000){
				que.push(P(nx,ny));
				d[nx][ny]=d[p.first][p.second]+1;
			}
		}
	}
}
int main(void){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>s[i][j];
			if(s[i][j]=='.') w++;
			d[i][j]=1000000000;
		}
	}
	gx=n-1; gy=m-1;
	d[0][0]=0;
	bfs();
	if(d[n-1][m-1]==1000000000){
		cout<<-1<<endl;
		return 0;
	}
	//cout<<w<<" "<<d[n-1][m-1]<<endl;
	cout<<w-d[n-1][m-1]-1<<endl;
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k;
	int n,sum;
	while(1) {
		cin>>n;
		if(n==-1) break;
		sum=4280-1150;
		for(i=0;i<n;i++) {
			if(i<10) {}
			else if(i<20) sum-=125;
			else if(i<30) sum-=140;
			else sum-=160;
		}
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A = 0, B = 0, N;
  cin >> N;
  vector<int> card(N);
  for(int i = 0; i < N; i++){
  	cin >> card[i];
  } 
  sort(card.begin(), card.end()); 
  reverse(card.begin(), card.end());
  for(int i = 0; i < N; i++){
  	if(i % 2 == 1){
    	B += card[i];
    }else {
    	A += card[i];
    }   
  } 
  cout << A - B <<endl;
  
}

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

int main(){
    int a,b;
    cin >> a >> b;
    int d=a+b;
    if(d==4){
        cout  <<"2"<< endl;
    }else if(d==3){
        cout << "3" << endl;
    }else{
        cout << "1" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long int ll;

int main() {
  ll H;
  cin>>H;
  
  ll ans=0;
  ll count=1;
  
  while(H>0){
    ans+=count;
    H/=2;
    count*=2;
  }
  
  cout<<ans<<endl;
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
#define dancila 3.14159265359
#define eps 1e-9

using namespace std;

typedef long long ll;

int n, m;
int v[1002];
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> m;
    int cnt = 0;
    int sum = 0;
    for(int i = 1; i <= n; ++i)
    {
        cin >> v[i];
        sum += v[i];
    }
    int rp = 4 * m;
    for(int i = 1; i <= n; ++i)
    {
        if(1LL * v[i] * rp >= sum)
            ++cnt;
    }
    cout << (cnt >= m ? "Yes" : "No");
    return 0;
}


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

int main() {
    int n[4];
    for (int i = 0; i < 4; i++) {
        cin >> n[i];
    }
    sort(n, n + 4);
    bool aa = true;

    if (n[0] == 1) {
        if (n[1] == 4) {
            if (n[2] == 7) {
                if (n[3] == 9) {
                    cout << "YES" << endl;
                    aa = false;
                }
            }
        }
    }
    if (aa) {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	s <- B.getLine
	t <- B.getLine
	let f str = sort $ map ( `B.elemIndices` str ) [ 'a' .. 'z' ] 
	putStrLn $ which "Yes" "No" $ f s == f t

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

int A, B, C, K;

int main() {
	cin >> A >> B >> C >> K;
	for (int i = 1; i <= K; i++) {
		if (A >= B && A >= C) A *= 2;
		else if (B >= A && B >= C) B *= 2;
		else C *= 2;
	}
	cout << A + B + C << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    ll a[n];
    rep(i, 0, n) {
        cin >> a[i];
        if (a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    ll ans = 1;
    rep(i, 0, n) {
        if (a[i] <= (ll)1e18 / ans) {
            ans *= a[i];
        } else {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4404
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (true) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            return 0;
        }
    }

}

Measured memory_bytes: 3656
def main():
    n = int(input())
    h = list(map(int, input().split()))
    for i in reversed(range(1,n)):
        if h[i-1] <= h[i]:
            continue
        h[i-1] = h[i-1] - 1
        if not h[i-1] <= h[i]:
            print('No')
            return
        else:
            continue
    print('Yes')

if __name__ == '__main__':
    main()

Measured memory_bytes: 63856
#include <iostream>
#include <algorithm>

using namespace std;

bool solve(long long a, long long b, long long c, long long d) {
    if (a < b || d < b)return false;
    if (b - 1 < c + 1)return true;

    long long x = __gcd(b, d);
    a %= x;
    return a + (b - a - 1) / x * x <= c;
}

int main() {
    int t;
    cin >> t;
    for (; t > 0; t--) {
        long long a, b, c, d;
        cin >> a >> b >> c >> d;
        cout << (solve(a, b, c, d) ? "Yes" : "No") << endl;
    }
    return 0;
}

Measured memory_bytes: 256
use proconio::input;
use std::cmp::Reverse;

fn main() {
   input! {
      n:usize,
      a:[usize;n]
   }
   let mut v = vec![];
   for (i, x) in a.iter().enumerate() {
      v.push((x, i));
   }
   v.sort_by_key(|&x| Reverse(x.0));
   let mut dp = vec![vec![0; n + 2]; n + 2];
   for i in 0..n {
      for j in 0..n {
         if i + j >= n {
            continue;
         }
         dp[i][j + 1] = std::cmp::max(
            dp[i][j + 1],
            dp[i][j]
               + (n as isize - j as isize - 1 - v[i + j].1 as isize).abs() as usize * v[i + j].0,
         );
         dp[i + 1][j] = std::cmp::max(
            dp[i + 1][j],
            dp[i][j] + (i as isize - v[i + j].1 as isize).abs() as usize * v[i + j].0,
         );
      }
   }
   let mut ans = 0;
   for i in 0..=n {
      ans = std::cmp::max(ans, dp[i][n - i]);
   }
   println!("{}", ans);
}


Measured memory_bytes: 33448
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vrsort(v) sort((v).rbegin(), (v).rend())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 1000000007
#define MOD 1e9+7
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  int h,w,n,i,j;cin>>h>>w>>n;
  vint a(n);for(i=0;i<n;i++){cin>>a[i];}
  //caricurate
  vvint ans(h,vint(w,0));
  int y,ph,pw;ph=0;pw=0;
  for(i=0;i<n;i++){
    y=0;
    while(y!=a[i]){
      ans[ph][pw]=i;
      y++;
      if(pw==(w-1)){
        ph++;pw=0;
      }else{
        pw++;
      }
    }
  }
  //output
  for(i=0;i<h;i++){
    if(i%2==0){
      for(j=0;j<w;j++){
      cout<<(ans[i][j]+1);
      if(j!=(w-1)){cout<<" ";}else{cout<<endl;}
      }
    }else{
      for(j=w-1;j>-1;j--){
      cout<<(ans[i][j]+1);
      if(j!=0){cout<<" ";}else{cout<<endl;}
    }
  }
  }
}

Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#define BUFSIZE 1000000

int N,K;
int  hoge[BUFSIZE]={0};
long long V,W,T;
int count = 0;
int x,N;
int p[BUFSIZE] = {0};
int rem;
int rem2;

int check(int num) {
  for(int i = 0; i < N;i++){
    if(num == p[i]) return 0;
  }
  printf("%d" ,num);
  exit(0);
}


int main(void){

  scanf("%d %d",&x,&N);
  for(int i = 0; i < N; i++){
    scanf("%d",&p[i]);
  }
  for(int i = 0;i < 100;i++){
      if(check(x-i) == 1 || check(x+i) == 1){

      }
  }

  return 0;
}


Measured memory_bytes: 1736
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int a[4005] = { 0 };
int main() {
	int n, i, j;
	long long total;
	char temp;
	string str;
	cin >> n;
	temp = getchar();
	getline(cin, str);
	long long x = 0, y = 0, z = 0;
	for (i = 0; i < n; i++) {
		if (str[i] == 'R')a[i] = 1, x++;
		else if (str[i] == 'G')a[i] = 2, y++;
		else if (str[i] == 'B')a[i] = 3, z++;
	}
	total = x * y * z;
	for (i = 0; i < n - 2; i++) {
		for (j = 1; i + 2 * j < n; j++) {
			if (a[i] != a[i + j] && a[i] != a[i + 2 * j] && a[i + j] != a[i + 2 * j])total -= 1;
		}
	}
	cout << total << endl;
	return 0;
}

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

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;


int main() {
    int A, B;
    cin >> A >> B;
    map<int, int> cnt;
    cnt[1] = 1;
    cnt[2] = 1;
    cnt[3] = 1;
    cnt[A]++;
    cnt[B]++;
    if(cnt[1] == 1) puts("1");
    else if(cnt[2] == 1) puts("2");
    else puts("3");
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>

int main(){
    char s[201], p[101], tmp[101];
    scanf("%s %s", s, p);
    
    strcpy(tmp, s);
    strcat(s, tmp);
    if(strstr(s, p) == NULL) printf("No\n");
    else printf("Yes\n");

    return 0;
}


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

struct S
{
	ll t{0};
	ll f{0};
	ll c{};
};

int main(int argc, char **argv)
{
	string str; cin >> str;
	ll Q; cin >> Q;

	bool is_rev{false};
	for (ll i = 0; i < Q; ++i)
	{
		ll t; cin >> t;
		if (t == 1)
		{
			is_rev ^= true;
			continue;
		}
		ll f; char c; cin >> f >> c;

		if ((!is_rev && f == 2) || (is_rev && f == 1))
			str += c;
		else
			str.insert(str.begin(), c);
	}
	if (is_rev)
		reverse(str.begin(), str.end());
	std::cout << str << std::endl;
}


Measured memory_bytes: 900
function Main(input) {
  var N = parseInt(input)

  var answer = 0

  for (var i = 1; i <= N; i++) {
    if (String(i).length % 2 !== 0) {
      answer++
    }
  }

  console.log(answer)
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 10956
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
typedef unsigned long long ULL;
using namespace std;

const LL INF = 99999999999999;
const int inf = 999999999, maxn = 1023;
int n, m, a[12], x[12], y[12], g[12][12], p[12];

bool check(int u)
{
	memset(a, 0, sizeof(a));
	memset(y, 0, sizeof(y));
	// int h = log2(u + 1);
	for(int i = n; i >= 0; i--) {
		a[i] = (1 & (u >> i)) ? 1 : 0;
	}

	for(int i = 1; i <= m; i++) {
		for(int j = 1; j <= x[i]; j++) {
			if(a[g[i][j] - 1] == 1) y[i]++;
		}
	}

	for(int i = 1; i <= m; i++) {
		if((y[i] & 1) != (p[i] & 1)) return false;
	}

	return true;
}


int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	while(scanf("%d%d", &n, &m) == 2) {
		memset(g, 0, sizeof(g));
		for(int i = 1; i <= m; i++) {
			scanf("%d", &x[i]);
			for(int j = 1; j <= x[i]; j++) {
				scanf("%d", &g[i][j]);
			}
		}
		for(int i = 1; i <= m; i++) scanf("%d", &p[i]);
		int cnt = 0;
		for(int u = 0; u <= pow(2, n) - 1; u++) {
			// if(u == 3) cout << check(u) << "\n";
			if(check(u)) cnt++;
		}
		printf("%d\n", cnt);
	}

	return 0;
}
/*
    input:
    output:
    modeling:
    methods:
    complexity:
    summary:
*/

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

int main(void) {
	int n, m; cin >> n >> m;
	int a[m], b[m], ans[n]={0};
	int i;
	for (i = 0; i < m; i++) {
		cin >> a[i];
		cin >> b[i];
	}
	for (i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (i + 1 == a[j]) {
				ans[i] += 1;
			}
			if (i + 1 == b[j]) {
				ans[i] += 1;
			}
		}
	}
	
	for (i = 0; i < n; i++) {
		cout << ans[i] << endl;
	}

	return 0;
}



Measured memory_bytes: 256
/* DIU_HowCow */

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <ctime>
#include <iomanip>

#define LLI long long
#define LLU unsigned long long
#define pi 2*acos(0.0)
#define MOD 10007

#define scan(x) scanf("%d",&x)


using namespace std;


int main()
{
    double v;
    while(scanf("%lf",&v) != EOF)
    {
        double t = v / (9.8) ;
        double y = t*t*( 4.9 );

        LLI flr = ceil( (y + 5) / 5 );

        printf("%lld\n",flr);
    }

	return 0;
}

Measured memory_bytes: 1216
import java.util.*;

class Main {
	Scanner sc = new Scanner(System.in);

	class Data {
		int id;
		int suc;
		int rank;

		Data(int id, int suc) {
			this.id = id;
			this.suc = suc;
		}
	}

	public void run() {
		List<Data> list = new ArrayList<Main.Data>();
		while (true) {
			String[] str = sc.next().split(",");
			if ("0".equals(str[0]) && "0".equals(str[1]))
				break;

			list.add(new Data(Integer.parseInt(str[0]), Integer
					.parseInt(str[1])));
		}
		Collections.sort(list, new Comparator<Data>() {
			@Override
			public int compare(Data o1, Data o2) {
				return o2.suc - o1.suc;
			}
		});

		for(int i=0,s=list.size(),rank=0,val=100;i<s;i++){
			Data data=list.get(i);
			if(data.suc!=val){
				rank++;
				val=data.suc;
			}
			data.rank=rank;
		}
		Hashtable<Integer,Data> hash=new Hashtable<Integer,Data>();
		for(Data data:list){
			hash.put(data.id,data);
		}
		while (sc.hasNext()) {
			ln(hash.get(sc.nextInt()).rank);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

Measured memory_bytes: 12000
import math
import sys
s = input()
n = int(len(s))

if s[0:math.floor(n/2)] != s[math.ceil(n/2):]:
  print('No')
  sys.exit()

j = int((n-1)/2)-1
for i in range(int((n-1)/2)):
  if s[i] != s[j]:
    print('No')
    sys.exit()
  j -= 1

print('Yes')


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main() {
	int K, S;
	int ans = 0;

	cin >> K >> S;

	for (int i = 0; i <= K; i++) {
		for (int j = 0; j <= K; j++) {
			if (S - i - j >= 0 && S - i - j <= K)	ans++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
import os
import heapq
import sys,threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10**5)
from io import BytesIO, IOBase
def gcd(a,b):
    if b==0:

        return a
    else:
        return gcd(b,a%b)
def power(x, p,m):
    res = 1
    while p:
        if p & 1:
            res = (res * x) % m
        x = (x * x) % m
        p >>= 1
    return res
def inar():
    return [int(k) for k in input().split()]

def lcm(num1,num2):
    return (num1*num2)//gcd(num1,num2)

def main():
    #t=int(input())
    t=1
    for _ in range(t):

        n=int(input())
        arr=inar()
        dp=[0]*n
        for i in range(n-1,-1,-1):
            if i==(n-1):
                dp[i]=arr[i]
                continue
            dp[i]=arr[i]+dp[i+1]
        #print(dp)
        ans=0
        mod=10**9+7
        for i in range(n-1):
            ans+=(arr[i]*dp[i+1])% mod
        print(ans%mod)




BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()
    #threadin.Thread(target=main).start()


Measured memory_bytes: 96860
#include <stdio.h>

int main(void){
    int n, m, x;
    scanf("%d%d%d", &n, &m, &x);
    int a[n];
    for (int i = 0; i < m; i++){
        scanf("%d", &a[i]);
    }

    int ans1 = 0;
    int ans2 = 0;
    for (int i = 0; i < m; i++){
        if (a[i] > x){
            ans1 += 1;
        }
        if (a[i] < x){
            ans2 += 1;
        }
    }
    if (ans1 <= ans2){
        printf("%d\n", ans1);
    }
    else {
        printf("%d\n", ans2);
    }

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

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

Measured memory_bytes: 256
using ll=long long;using ull=unsigned long long;
#include<limits>
namespace pcl{template<typename T>constexpr T TNF=std::numeric_limits<T>::max()/2;constexpr int INF=TNF<int>;constexpr ll LNF=TNF<ll>;constexpr double DNF=TNF<double>;constexpr double EPS=1e-8;constexpr int P7=1'000'000'007;constexpr int DX[]={1,0,-1,0,1,1,-1,-1};constexpr int DY[]={0,1,0,-1,-1,1,1,-1};}
#include<algorithm>
#include<cmath>
#include<iostream>
namespace pcl{template<typename T>void updmax(T&a,T const&b){a=std::max(a,b);}template<typename T>void updmin(T&a,T const&b){a=std::min(a,b);}template<typename T,typename U,typename V>bool in_range(T const&begin,U const&mid,V const&end){return begin<=mid&&mid<end;}template<typename T,typename U,typename V>bool in_range(T const&begin,std::initializer_list<U>list,V const&end){auto p=std::minmax_element(list.begin(),list.end());return begin<=*p.first&&*p.second<end;}template<typename T,typename U,typename V>bool in_range_strict(T const&begin,std::initializer_list<U>list,V const&end){if(!std::is_sorted(list.begin(),list.end()))return false;return in_range(begin,list,end);}template<typename T>inline T cget(){T x;std::cin>>x;return x;}}
#include<iostream>
#include<vector>
namespace pcl{template<typename T>std::ostream&operator<<(std::ostream&os,std::vector<T>const&v){os<<'[';for(size_t i=0;i<v.size();i++){if(i!=0)os<<",";os<<v[i];}os<<']';return os;}template<typename T>std::istream&operator>>(std::istream&is,std::vector<T>&v){for(size_t i=0;i<v.size();i++)is>>v[i];return is;}}
#include<bits/stdc++.h>
using namespace std;using namespace pcl;int main(){int N,K;cin>>N>>K;int E=N-1;int P=(N-1)*(N-2)/2;if(K>P){cout<<-1<<endl;return 0;}cout<<E+(P-K)<<endl;for(int i=1;i<N;i++)cout<<"1 "<<i+1<<endl;int c=0;for(int i=1;i<N&&c<P-K;i++){for(int j=i+1;j<N&&c<P-K;j++,c++){cout<<i+1<<' '<<j+1<<endl;}}}


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

using namespace std;

int main()
{
    int n;
    long long int W;
    cin >> n >> W;
    vector<long long int>v(n+1);
    vector<long long int>w(n+1);
    for(int i=1;i<=n;++i){
        cin >> w[i] >> v[i];
    }
    long long int m=1e5+9;
    vector<long long int>dp(m,INT_MAX);
    dp[0]=0;
    for(int i=1;i<=n;++i){
        for(long long int j=m;j>=0;--j){
            if(j>=v[i]){
                if(dp[j-v[i]]!=INT_MAX)
                    dp[j]=min(dp[j],w[i]+dp[j-v[i]]);
            }
        }
    }
    long long int ans=0;
    for(long long int j=1;j<m;++j){
        if(dp[j]<=W)
            ans=j;
    }
     cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 4052
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

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;
}



int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int n,ans;
    cin >> n;
    bool flag = false;
    for(int i = 0; i < 50000; i++){
        int sub = i*1.08;
        if(sub == n){
            flag = true;
            ans = i;
        }
    }
    if(flag){
        cout << ans << endl;
    }else{
        cout << ":(" << endl;
    }
    



    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  double ans = 0;
  rep(i, n) {
    double v;
    string k;
    cin >> v >> k;
    if (k == "JPY") {
      ans += v;
    } else {
      ans += 380000 * v + 0.000001;
    }
  }
  printf("%.6f", ans);
  return 0;
}

Measured memory_bytes: 3784
#include <iostream>
using namespace std;
#define debug(x) std::cerr << #x << " = " << (x) << std::endl
typedef long long LL;
const int MAXN = 2e5+17;
LL dp[2],ocr[26+3];
int main(int argc ,char const *argv[])
{
    #ifdef noob
    freopen("Input.txt","r",stdin);freopen("Output.txt","w",stdout);
    #endif
    string str;
    cin>>str;
    dp[0] = 1;
    ocr[str[0]-'a']++;
    for (int i = 1; i < str.length(); ++i)	
    	dp[i&1] = dp[!(i&1)]+i-ocr[str[i]-'a'],ocr[str[i]-'a']++;
    cout<<dp[(str.length()-1)&1]<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int n = 0, x = 0, l[101], res = 0, k = 0;

    scanf("%d %d", &n, &x);

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

    while(res <= x) {
        res += l[k];
        k++;
    }

    printf("%d\n", k);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<queue>
using namespace std;
int main() {
	int n; cin >> n;
	int score[114] = {}, rank[114];
	priority_queue<pair<int, int>>p;
	for (int i = 0; i < n*(n - 1) / 2; i++) {
		int a, b, c, d; cin >> a >> b >> c >> d;
		if (c > d)score[a] += 3;
		else if (c < d)score[b] += 3;
		else { score[a]++; score[b]++; }
	}
	for (int i = 1; i <= n; i++) 
		p.push(make_pair(score[i], i));
	int mem1 = 1, mem2 = 0;//mem1:score, mem2:rank
	for (int i = 1; i <= n; i++) {
		pair<int, int>pr = p.top();
		//pr.first:score, pr.second:id
		p.pop();
		if (pr.first == mem1) { rank[pr.second] = mem2; }
		else { rank[pr.second] = i; mem2 = i; mem1 = pr.first; }
	}
	for (int i = 1; i <= n; i++) {
		cout << rank[i];
		cout << '\n';
	}
}

Measured memory_bytes: 3088
#include <string>
#include <iostream>

using namespace std;

void No() {
    cout << "No" << endl;
    exit(0);
}

void Yes() {
    cout << "Yes" << endl;
    exit(0);
}

int main() {
    int a, b;
    string s;
    cin >> a >> b >> s;
    for (int i = 0; i < a; ++i) {
        if (!('0' <= s[i] && s[i] <= '9')) {
            No();
        }
    }
    if (s[a] != '-') {
        No();
    }
    for (int i = a + 1; i < a + b + 1; ++i) {
        if (!('0' <= s[i] && s[i] <= '9')) {
            No();
        }
    }
    Yes();
}


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

#include <iostream>
#include <fstream>

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


//#define int ll
int f(int t[], int e[], int n)
{
    int i, j,sum = 1,time = 0;

    time = 0;
    rep(i,0,n){
        time += t[i];
        if(time > e[i])return false;
    }

    return true;
}

pii P[202020];
int st[202002],en[202020];
class DMegalomania {
public:

void solve(std::istream& cin, std::ostream& cout) {
    int N;
    cin >> N;
    _for(i,N){
        int a,b;
        cin >> a >> b;
        P[i] = {b,a};
    }
    sort(P,P+N,[&](pii p1, pii p2){return p1.F < p2.F || (p1.F == p2.F && p1.S > p2.S);});
    _for(i,N)st[i] = P[i].S, en[i] = P[i].F;
    cout << (f(st, en, N) ? "Yes":"No") << endl;
//    cout << (printMaxActivities(st,en,N) == N? "Yes":"No") << endl;
}
};


#undef int
int main() {
	DMegalomania solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(0); ios::sync_with_stdio(0); out<<fixed<<setprecision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3456
#include <vector>
#include <algorithm>
#include <iostream>
#include <chrono>
#include<bitset>
#include<deque>
#include <map>
#define vint vector<int>
#define vint2 vector<vint>
#define vchar vector<char>
#define vchar2 vector<vchar> 
#define vchar3 vector<vchar2> 
#define pr pair<int,int>
#define vpr vector<pr>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
typedef  long long int ll;
using namespace std;
//CHAR_BIT	ビット フィールドではない最小変数のビット数。	8
//SCHAR_MIN	signed char 型変数の最小値。	–128
//SCHAR_MAX	signed char 型変数の最大値。	127
//UCHAR_MAX	unsigned char 型変数の最大値。	255 (0xff)
//CHAR_MIN	char 型変数の最小値。 - 128、 / J オプション使用時は 0
//CHAR_MAX	char 型変数の最大値。	127、 / J オプション使用時は 255
//MB_LEN_MAX	多文字定数の最大バイト数。	5
//SHRT_MIN	short 型変数の最小値。	–32768
//SHRT_MAX	short 型変数の最大値。	32767
//USHRT_MAX	unsigned short 型変数の最大値。	65535 (0xffff)
//INT_MIN	int 型変数の最小値。	–2147483647 – 1
//INT_MAX	int 型変数の最大値。	2147483647
//UINT_MAX	unsigned int 型変数の最大値。	4294967295 (0xffffffff)
//LONG_MIN	long 型変数の最小値。	–2147483647 – 1
//LONG_MAX	long 型変数の最大値。	2147483647
//ULONG_MAX	unsigned long 型変数の最大値。	4294967295 (0xffffffff)




int  main() {
	string s;
	cin >> s;
	if (s.length() == 2)cout << s << endl;
	else cout << s[2] << s[1] << s[0] << endl;
//while (true) {}

	return 0;
}


Measured memory_bytes: 256