akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define boost ios::sync_with_stdio(0); cin.tie(0)
#define fi first
#define se second
#define  pb push_back
#define  pob pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define sz(x) (int)x.size()
#define endl '\n'
#define mod 1000000007
#define MAX 100005

typedef long long ll;
//typedef int ll;
typedef double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

/********************************************************/

signed main()
{
    boost;
    #ifndef ONLINE_JUDGE
    // freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
    #endif // ONLINE_JUDGE
    
    ll tests = 1LL;
    cin >> tests; 
    map<string,ll> m;
    m["AC"] = m["WA"] = m["TLE"] = m["RE"] = 0;
    rep(testno,1,tests+1){
       //cout<<"Case #"<<testno<<": ";
       string g;
       cin >> g;
       m[g]++;
       
    }

    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;

    return 0;

}



Measured memory_bytes: 3660
import math
import fractions
import collections
import itertools
import pprint
N=int(input())
A=list(map(int,input().split()))
que=[]
dp=[[0 for _ in range(N+1)] for _ in range(N+1)]    #dp[i][j]…左にiこ、みぎにjこあること状態になった時の最大をいれる
for i in range(N):
    que.append([A[i],i])
que.sort(key=lambda x:x[0],reverse=True)
#pprint.pprint(dp)
#print(que)
for i in range(0,N+1):
    if i!=0:
        for j in range(i+1):
            if j==0:#dp[i][0],左にiこつまる状態に
                dp[i-j][j]=dp[i-j-1][j]+(que[i-1][0]*abs((i-1)-que[i-1][1]))
            elif j==i:#dp[0][i],みぎにiこ詰まる状態に
                dp[i-j][j]=dp[i-j][j-1]+(que[i-1][0]*abs(N-j-que[i-1][1]))
            else:
                dp[i-j][j]=max(dp[i-j-1][j]+(que[i-1][0]*abs(((i-1)-j)-que[i-1][1])),dp[i-j][j-1]+(que[i-1][0]*abs(N-j-que[i-1][1])))
        #input()
        #pprint.pprint(dp)
ma=0
for i in range(0,N+1):
    #print(dp[N-i][i])
    ma=max(ma,dp[N-i][i])
print(ma)


"""
st=[-1]*N
en=[-1]*N
s=[[0,[0,0]] for _ in range(N*N)]
for i in range(N):
    for j in range(N):
        s[i*N+j][0]=A[i]*abs(i-j)
        s[i*N+j][1][0]=i
        s[i*N+j][1][1] = j
s.sort(key=lambda x:x[0],reverse=True)
print(s)
cnt=0
for i in range(len(s)):
    a=s[i][1][0]
    b=s[i][1][1]
    c=s[i][0]
    if (st[a]==-1)and(en[b]==-1):
        cnt=cnt+c
        st[a]=0
        en[b]=0
print(cnt)
"""


Measured memory_bytes: 107488
#include <stdio.h>
#include <stdlib.h>
#define N 100005
#define NIL -1
typedef struct node{
  int parent;
  int right;
  int left;
}Node;

Node T[N];
int n,D[N];

void print(int);

int main()
{
  int i,j,d,v,c,l,r;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].parent = T[i].right = T[i].left = NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0){
	T[v].left=c;
      }
      else T[l].right=c;
      l=c;
      T[c].parent=v;
    }
  }

  for(i=0;i<n;i++){
    if(T[i].parent==NIL){
      r=i;
    }
  }

  rec(r,0);

  for(i=0;i<n;i++){
    print(i);
  }
 
  return 0;
  
}

void print(int a){
  int i,c;
  printf("node %d: ",a);
  printf("parent = %d, ",T[a].parent);
  printf("depth = %d, ",D[a]);

  if(T[a].parent==NIL) printf("root, ");
  else if(T[a].left==NIL) printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i=0, c=T[a].left; c != NIL; i++, c=T[c].right){
    if(i) printf(", ");
    printf("%d",c);
  }

  printf("]\n");
  
}

int rec(int u,int p){
  D[u] = p;
  if(T[u].right != NIL) rec(T[u].right,p);
  if(T[u].left != NIL) rec(T[u].left,p+1);
}





Measured memory_bytes: 6476
N = int(input())
a = input().split()
list_a = list(a)
d = dict()
for i in range(len(list_a)):
    d[list_a[i]] = 0

for i in range(len(list_a)):
    d[list_a[i]] += 1

sum = 0
for item in d:
    key = int(item)
    val = d[item]
    if key > val:
        sum += val
    elif key < val:
        sum += val - key

print(sum)

Measured memory_bytes: 21364
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll ans=0;
  if(b<=0){
    if(c<=0)
      ans=a*c;
    else 
      ans=c*b;
  }
  else if(a>=0){
    if(d<=0)
      ans=d*a;
    else
      ans=d*b;
  }
  else{
    ans=max(a*c,a*d);
    ans=max(ans,b*c);
    ans=max(ans,b*d);
  }
  cout<<ans<<endl;
}

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

int main() {
  int k, n;
  cin >> n >> k;
  vector<double> v(n), s(n-k+1);
  rep(i, n) cin >> v[i];
  rep(i, n) v[i] = (1 + v[i]) / 2;
  rep(i, k) s[0] += v[i];
  double m = s[0];
  rep(i, n-k){
    s[i+1] = s[i];
    s[i+1] += v[k+i];
    s[i+1] -= v[i];
    if(s[i+1] > m) m = s[i+1];
  }
  cout << fixed << setprecision(8) << m << endl;
  return 0;
}

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

int main(int argc, char *argv[])
{
    int coins[] = {10, 50, 100, 500};
    int wallet[4], res[4];
    int price, sum, sub;
    bool flg = true;
    while (cin >> price, price) {
        if (flg)
            flg = false;
        else
            cout << endl;
        sum = 0;
        for (int i = 0; i < 4; ++i)
            cin >> wallet[i];
        for (int i = 0; i < 4; ++i) {
            sum += coins[i] * wallet[i];
        }
        sub = sum - price;
        for (int i = 3; i >= 0; --i) {
            res[i] = wallet[i] - sub / coins[i];
            sub %= coins[i];
        }
        for (int i = 0; i < 4; ++i) {
            if (res[i] > 0)
                cout << coins[i] << ' ' << res[i] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int n,k;
    scanf("%d", &n);
    scanf("%d", &k);

    
    int *input;
    int *min;
    input = (int *)malloc(n * sizeof(int));
    min = (int *)malloc(n * sizeof(int));

    for(int i = 0; i < n; i++){
        scanf("%d", &input[i]);
    }
    
    min[0] = 0;
    min[1] = abs(input[1] -input[0]);

    for(int i = 2; i < n; i++){
        int smaller = abs(input[i] - input[i-1]) + min[i-1];
        for(int j = 2;j <  k + 1; j++){
            if(i - j > -1){
                if(abs(input[i] - input[i - j]) + min[i-j] < smaller){
                    smaller = abs(input[i] - input[i - j]) + min[i-j];
                }
            }
            continue;
        }
        min[i] = smaller;
    }

    printf("%d", min[n-1]);

}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
const int siz = 1e5 + 7;
vector<int>adj[siz];
bool vis[siz];
int n;
int degree[siz];
int nax;
int ans[siz];
map<pi, int>m;
vector<pi>have;
void bfs(int node) {
	queue<int>q;
	vis[node] = true;
	q.push(node);
	while (!q.empty()) {
		int v = q.front();
		q.pop();
		int colour = 1;
		for (auto k : adj[v]) {
			if (!vis[k]) {
				if (colour == ans[v])colour++;
				m[ {k, v}] = m[ {v, k}] = colour;
				ans[k] = colour;
				colour++;
				vis[k] = true;
				q.push(k);
			}
		}
	}
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int u, v;
		cin >> u >> v;
		adj[u].pb(v);
		adj[v].pb(u);
		have.pb({u, v});
		degree[u]++;
		degree[v]++;
		nax = max(nax, degree[u]);
		nax = max(nax, degree[v]);
	}
	bfs(1);
	cout << nax << endl;
	for (auto k : have) {
		cout << m[k] << endl;
	}
}


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

vector<int> adj[100005];
vector<bool> vis(100005, false);

void dfs(int i){
	if(!vis[i]) {
		vis[i] = true;
		for(auto v : adj[i])
			dfs(v);
	}
}

void solve() {
	int n, m;
	cin >> n >> m;
	for(int i=0; i<m; i++) {
		int x, y;
		cin >> x >> y;
		--x;
		--y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	int comp = 0;
	for (int i=0; i<n; i++) {
		if(!vis[i]) {
			comp++;
			dfs(i);
		}
	}
	cout << comp-1;
}

int main() {

	solve();	
	return 0;
}

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

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

void dfs_visit(int);
void dfs(void);

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

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

void dfs_visit(int u){
  int v;

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

void dfs(){
  int u;

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

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


#define N 200005
long long int arr[N];
long long int usearr[N];
long long int weight[N];
long long int seg[4*N+10000];

void build(int id,int st,int end)
{
	if(st == end)
	{
		seg[id] = 0;
		return ;
	}
	int mid = (st+end)/2;
	build(2*id,st,mid);
	build(2*id+1,mid+1,end);
	seg[id] = 0;
}

void update(int id,int st,int end,int k,long long int val)
{
	if(st == end && st == k)
	{
		seg[id] = max(val,seg[id]);
	}
	else
	{
		int mid = (st+end)/2;
		if(k<=mid)
		{
			update(2*id,st,mid,k,val);
		}
		else
		{
		
			update(2*id+1,mid+1,end,k,val);
		}
		seg[id] = max(seg[2*id],seg[2*id+1]);
	}
}

long long int query(int id,int st,int end,int l,int r)
{
	if(l > end || r < st)
	{
		return 0;
	}

	if(l <= st && end <= r)
	{
		return seg[id];
	}

	int mid = (st+end)/2;
	long long int lm = query(2*id,st,mid,l,r);
	long long int rm = query(2*id+1,mid+1,end,l,r);
	return max(lm,rm);
}
int main()
{
	int n;
	cin>>n;
	map<long long int,long long int> mp;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		usearr[i] = arr[i];
	}
	for(int i=0;i<n;i++)
	{
		cin>>weight[i];
	}
	sort(usearr,usearr+n);
	for(int i=0;i<n;i++)
	{
		//cout<<usearr[i]<<" "; 
		mp[usearr[i]] = i;
	}

	build(1,0,n-1);
	
	for(int i=0;i<n;i++)
	{
		long long int m;
		if(mp[arr[i]] == 0)
		{
			m = 0;
			update(1,0,n-1,mp[arr[i]],m+weight[i]);
		}
		else
		{
			//cout<<mp[arr[i]]-1<<" ";
			m = query(1,0,n-1,0,mp[arr[i]]-1);
			update(1,0,n-1,mp[arr[i]],m+weight[i]);
			// for(int i=1;i<=7;i++)
			// {
			// 	cout<<i<<": "<<" "<<m<<" "<< seg[i]<<endl;
			// }
			
		}
	}
	cout<<query(1,0,n-1,0,n-1)<<"\n";
}

Measured memory_bytes: 23808
#include <bits/stdc++.h> 
     
    using namespace std; 
    // using namespace arma;
     
    #define ll long long
    #define ld long double
    // int ans(vector < vector<int > > xx)
    // {
    // 	return 0;
    // }
    int main()
    {
    	ll n;
        cin >> n;
        ll ct1=0,ct2=0,ct3=0,ct4=0;
        for(ll i=0;i<n;i++)
        {
            string s;
            cin >> s;
            if(s=="AC")
                ct1+=1;
            if(s=="WA")
                ct2+=1;
            if(s=="TLE")
                ct3+=1;
            if(s=="RE")
                ct4+=1;
        }
        cout << "AC x " << ct1 << "\n";
        cout << "WA x " << ct2 << "\n";
        cout << "TLE x " << ct3 << "\n";
        cout << "RE x " << ct4 << "\n";
    }

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

class MainClass
{
    static void Main()
    {
        var ABQ = ReadLine().Split().Select(int.Parse).ToArray();
        int A = ABQ[0];
        int B = ABQ[1];
        int Q = ABQ[2];
        var ST = new long[2][];
        ST[0] = new long[A];
        ST[1] = new long[B];
        
        for (int i = 0; i < A; i++)
        {
            ST[0][i] = long.Parse(ReadLine());
        }
        Array.Sort(ST[0]);
        for (int i = 0; i < B; i++)
        {
            ST[1][i] = long.Parse(ReadLine());
        }
        Array.Sort(ST[1]);
        var ans = new long[Q];
        for (int i = 0; i < Q; i++)
        {
            var x = long.Parse(ReadLine());
            ans[i] = long.MaxValue;
            for (int j = 0; j < 2; j++)
            {
                int index = SearchIndex(ST[j], x);
                var distf = long.MaxValue;
                if (index < ST[j].Length - 1)
                {
                    long f = ST[j][index + 1];
                    distf =Abs( f - x);
                    distf += SearchDistance(ST[(j + 1) % 2], f);
                }
                var b = ST[j][index];
                var distb = Abs( x - b);
                distb += SearchDistance(ST[(j + 1) % 2], b);

                ans[i] = Min(ans[i], Min(distb, distf));
            }
            
        }
        foreach (var i in ans)
        {
            WriteLine(i);
        }
    }
    static int SearchIndex(long[] C,long now)
    {
        int lb = 0, ub = C.Length;
        while (ub - lb > 1)
        {
            int mid = (ub + lb) / 2;
            if (C[mid] < now) lb = mid;
            else ub = mid;
        }
        return lb;
    }
    static long SearchDistance(long[] C,long now)
    {
        var index = SearchIndex(C, now);
        long f = long.MaxValue, b = long.MaxValue;
        if (index < C.Length - 1)
        {
            f = Abs(C[index + 1] - now);
        }
        b =Abs( now - C[index]);
        return Min(f, b);
    }
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

signed main() {
  
  priority_queue<int, vector<int>, greater<int> > queue;
  int j;
  for(int i=0;i<3; i++){
    cin >> j;
    queue.push(j);
  }
  
  bool isFirst = true;
  while(!queue.empty()){
      if(!isFirst) cout << " ";
      cout << queue.top();
      queue.pop();
      isFirst = false;
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3140
N = input()
L = len(N)
K = int(input())


def main(d, k):
    if d == L:
        if k == 0:
            return 1
        else:
            return 0
    if N[d] == "0":
        return main(d + 1, k)
    if (L - d) < k:
        return 0
    if k == 0:
        return 1
    return main1(d+1, k)+main1(d+1, k-1)*(int(N[d])-1)+main(d+1, k-1)


lmain1 = [[-1 for j in range(K+1)] for i in range(L+1)]


def main1(d, k):
    if d == L:
        if k == 0:
            return 1
        else:
            return 0
    if k == 0:
        return 1
    if lmain1[d][k] != -1:
        return lmain1[d][k]
    ret = main1(d+1, k-1)*9+main1(d+1, k)
    lmain1[d][k] = ret
    return ret


print(main(0, K))


Measured memory_bytes: 3064
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin >> n >> k;
    int ans = 0;
    REP(i,n){
        int h;
        cin >> h;
        if(h>=k)ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
a,b,k = map(int,input().split())
for i in range(k//2):
  b = b + a//2
  a = a//2
  a = a + b//2
  b = b//2
if k % 2 ==0:
  print(a,b)
else:
  b = b + a//2
  a = a//2
  print(a,b)
    

Measured memory_bytes: 2940
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import itertools as ite
import math
import random
import sys
import codecs
from collections import defaultdict

INF = 10 ** 18
MOD = 10 ** 9 + 7

sys.setrecursionlimit(1000000)

A, B = map(int, raw_input().split())
if (A + B) % 2 == 1:
    print "IMPOSSIBLE"
else:
    print (A + B) / 2


Measured memory_bytes: 4832
import java.util.Scanner;

public class Main {
	public static void main(String []args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);
		//a?????????
		int a = sc.nextInt();
		//b?????????
		int b = sc.nextInt();
		//c?????????
		int c = sc.nextInt();
		//?????¶??? a < b < c ??????
		if(a < b && b < c){
			//Yes?????¨???
			System.out.println("Yes");
		}else{
			//No?????¨???
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 26144
#include <bits/stdc++.h>
        using namespace std;
        #define rep(i,a,b) for(int i =a; i<b;++i)
        #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        #define endl "\n"
        typedef  long long int ll;
        const int N = 5e5+5;
        const int mod = 1e9+7;
        ll m,n,_left[N],_right[N],a[N];
        bool comp(const pair <int ,int > &p1 , const pair<int ,int > &p2)
        {
            return p2.first < p1.first;
        }
    int  main()
    {
   //     IOS;
        int t = 1;
       // cin>>t;
        while(t--)
        {
              cin>>n;
              ll a[n],b[n];
              rep(i,0,n)
              {
                  cin>>a[i]>>b[i];
              }
              int max_a = *max_element(a,a+n);
              int min_b=  *min_element(b,b+n);
              int ans = 0;
              vector< pair<int ,int > > p(n);
              rep(i,0,n)
              {
                  p[i] = { min_b- a[i]+1 , b[i]- max_a + 1 };
              }
              sort(p.begin(),p.end());
              ll max_second = 1e10;
              rep( i , 0 , n-1 )
              {
                  max_second = min(max_second,1ll*p[i].second);
                  ans = max(1ll*ans , max_second + p[i+1].first);
              }
              int cur = 0;
              rep(i,0,n)
              {
                  cur = b[i] - a[i] + 1;
                  ans = max(ans,cur + max(min_b - max_a + 1,0));
              }
              cout<<ans<<endl;
        }
    }


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

int main()
{
  long long h;
  cin >> h;
  
  long long add = 1, ans = 0;
  
  while(h){
    ans += add;
    h /= 2;
    add *= 2;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
def gcd(x,y):
  if x < y:
    x,y=y,x
  if y == 0:
    return x
  if x%y == 0:
    return y
  else:
    return gcd(y, x%y)

n = int(input())
a = list(map(int,input().split()))
x = [0]*n
y = [0]*n

for i in range(1,n):
  x[i] = gcd(x[i-1],a[i-1])
for i in range(n-1,0,-1):
  y[i-1] = gcd(y[i],a[i])

z = [gcd(x[i],y[i]) for i in range(n)]

print(max(z))






Measured memory_bytes: 14428
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
	
		MyScanner sc = new MyScanner();
		int n=sc.nextInt();
		int l=sc.nextInt();
		String s[]=new String[n];
		for(int i=0;i<n;i++) {
			s[i]=sc.next();
		}
		Arrays.sort(s);
		
		StringBuilder bf=new StringBuilder();
		for(int i=0;i<n;i++) {
			
			bf.append(s[i]);
		}
		String ans=bf.toString();
		System.out.println(ans);
	}
	
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	

}





Measured memory_bytes: 23252
N, M = map(int, input().split())
A = list(map(int, input().split()))
p = [(A[i], 1) for i in range(N)]
for j in range(M):
    B, C = map(int, input().split())
    p.append((C, B))
p.sort()
p.reverse()
ans, cnt = 0, N
for (v, c) in p:
    use = min(c, cnt)
    ans += use * v
    cnt -= use
print(ans)


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    string atcoder, s, contest;
    cin >> atcoder >> s >> contest;

    cout << 'A' << s[0] << 'C' << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(a>c)(b>a)?printf("%d",a+c):printf("%d",b+c);
  else(b>c)?printf("%d",a+c):printf("%d",b+a);
  return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ll mod =1e9+7;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> T maxt(T x,T y) {if (x>y) return x;else return y;}
template<class T> T mint(T x,T y) {if (x>y) return y;else return x;}
//sort(v.begin(), v.end(), [](auto& x, auto& y){return x[1] < y[1];});


//小数出力
// double print_double(double d){printf("%.6f", d);}

//約数列挙
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}



// ll combination_mod(int n, int k) {
//   k = mint(k,n-k);
//   ll ans = 1;
//   if (n==0 || k ==0) return ans;
//   rep(i,k) {
//     ans = ans*(n-i)%mod;
//     ans = ans*modinv(i+1)%mod;
//   }
//   return ans;
// }

struct edge {
  int from; //出発点
  int to;   //到達点
  ll cost; //移動コスト
};

//ベルマンフォード法
vector<ll> bellman_ford (vector<edge> edges, int V, int E, int r, ll INF = 100000000000) {  
  vector<ll> cost_to(V,INF);
  cost_to[r] = 0;
  rep(i,V) {
    rep(j,E) {
      edge e = edges[j];
      if (cost_to[e.from]==INF) continue;
      if (cost_to[e.to] > cost_to[e.from] + e.cost) {
        cost_to[e.to] = cost_to[e.from] + e.cost;
        if (i==V-1) {
          printf("NEGATIVE CYCLE\n");
          return {};
        }
      }

    }
  }
  return cost_to;
}

// combination
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}


// 木上の探索
vector<int> cnt;
void dfs(const vector<vector<int>> &G, int v, int p) {
    for (auto nv : G[v]) {
        if (nv == p) continue; // nv が親 p だったらダメ
        dfs(G, nv, v);
    }

    // 帰りがけ時に、部分木サイズを求める
    cnt[v] = 1; // 自分自身
    for (auto c : G[v]) {
        if (c == p) continue;
        cnt[v] += cnt[c]; // 子のサイズを加える
    }
}

int main() {
  int N,K;
  cin >> N >> K;
  vector<ll> a(N);
  rep(i,N) cin >> a[i];
  
  vector<vector<ll>> dp(N+1,vector<ll> (K+1,0));
  dp[0][0]++;
  rep2(i,1,N+1){
    ll tmp=0;
    rep(j,K+1) {
      tmp+=dp[i-1][j];
      if (a[i-1]<j) tmp-=dp[i-1][j-a[i-1]-1];
      tmp %= mod;
      dp[i][j] = tmp;
      // cout << dp[i][j] << ' ';
    }
    // cout << endl;
  }
  cout << (dp[N][K]+mod)%mod << endl;
}


Measured memory_bytes: 80256
#include <iostream>
#include <cctype>
#include <string>
using namespace std;
int main(){
    string number;
    while(true){
        cin >> number;
        int sum = 0;
        int a;
        if(number != "0"){
            for(int i = 0; i < number.size(); i++){
                a = number[i] - '0';
                sum += a;
            }
            cout << sum << endl;
        } else {
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3168
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#define waru 1000000000+7

using namespace std;

bool che(vector<int> y,vector<int> z){
  int sum = 0;
  rep(i, y.size()){
    sum += (y[i] - z[i])*(y[i] - z[i]);
  }
  int root = sqrt(sum);
  return root*root == sum;
}

int main(){
  int n, d;
  cin >> n >> d;
  vector<vector<int>> x;
  rep(i,n){
    vector<int> buf(d);
    rep(j,d){
      cin >> buf[j];
    }
    x.push_back(buf);
  }
  int res = 0;
  for(int i = 0; i < n; i++){
    for(int j = i+1; j < n; j++){
      if(che(x[i], x[j])){
        res++;
      }
    }
  }
  cout << res;


}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Scanner cin = new Scanner();
            int N = cin.Int();
            int K = cin.Int();
            int[] A = cin.ArrayInt(N);

            int gcd = A[0]; //A_subの各要素の最大公約数
            for (int i = 0; i < N; i++)
            {
                gcd = GCD(gcd, A[i]);
            }

            Console.WriteLine(K <= A.Max() && K % gcd == 0 ? "POSSIBLE" : "IMPOSSIBLE");
            Console.ReadLine();
        }
        static int GCD(int a, int b) //a,bの最大公約数
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return GCD(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;

        }
    }

        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 Int()
        {
            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] = Int() + add;
            }
            return Array;
        }

        public long Long()
        {
            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] = Long() + add;
            }
            return Array;
        }

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


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



Measured memory_bytes: 18528
package main

import "fmt"

func solve() {
	var N, K int
	fmt.Scan(&N, &K)
	ans := 1
	for i := 0; i < N; i++ {
		if ans < K {
			ans = ans * 2
		} else {
			ans = ans + K
		}
	}
	fmt.Println(ans)
}

func main() {
	solve()
}


Measured memory_bytes: 512
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define jkl int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7

//cout << setfill('0') << right << setw(4) << a;

int main(){
    ll n, m;
    ll p[100002], y[100002];
    cin >> n >> m;
    vector<vector <ll> > v;
    v.resize(n);
    REP(i, m){
        cin >> p[i] >> y[i];
        v[p[i] - 1].push_back(y[i]);
    }
    REP(i, n)sort(v[i].begin(), v[i].end());
    ll pref;
    REP(i, m){
        pref = p[i];
        cout << setfill('0') << right << setw(6) << pref;
        auto num = lower_bound(v[p[i] - 1].begin(), v[p[i] - 1].end(), y[i]);
        cout << setfill('0') << right << setw(6) << num - v[p[i] - 1].begin() + 1;
        print("");
    }
}

Measured memory_bytes: 8576
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	map<string, int> map;
	int n;
	char c;
	string s;
	while(cin >> n >> c >> s){
		map[s]++;
	}
	FIN(map["A"]);
	FIN(map["B"]);
	FIN(map["AB"]);
	FIN(map["O"]);
	return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include<math.h>
#include<bitset>
using namespace std;

int main() {
	int h, w, k; cin >> h >> w >> k;
	char c[h][w];
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++)cin >> c[i][j];
	}
	int ans = 0;
	for (int maskr = 0; maskr < (1 << h); maskr++) {
		for (int maskc = 0; maskc < (1 << w); maskc++) {
			int black = 0;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (((maskr >> i) & 1) == 0 && ((maskc >> j) & 1) == 0 && c[i][j] == '#') {
						black++;
						//maskr,maskcで選んだ列ではないことをfor文の条件で確認
					}
				}
			}
			if (black == k)ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3552
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int N;
    cin >> N;
    float ans;
    if (N % 2 == 1)
    {
        ans = (float)(N / 2 + 1) / N;
    }
    else
    {
        ans = 0.5000000000;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import math
a,b,x=map(int,input().split())
A,B=a**2,b**2
print(math.degrees(math.asin((B/((2*x/(a*b))**2+B))**0.5) if 2*x<=a*a*b else math.acos((A/((2*(a*a*b-x)/A)**2+A))**0.5)))

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

using namespace std;

const int INF = 1e8;

int dp[20][1<<17];
int sum[1<<17];
int main(){
	int N, M;
	while(cin>>N>>M, N|M){
		vector<int> s(N), d(M);
		rep(i,N) cin >> s[i];
		rep(i,M) cin >> d[i];

		N++;
		s.push_back(INF);

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

		fill( dp[0], dp[0]+20*(1<<17), INF );
		fill( sum, sum+(1<<17), 0 );
		dp[0][0] = 0;
		rep(i,N) rep(k,1<<16) rep(j,N){
			if( k & (1<<j) ) continue;
			int nx = k | (1<<j);
			sum[nx] = sum[k] + s[j];
			auto bg = lower_bound( d.begin(), d.end(), sum[k] );
			auto en = lower_bound( d.begin(), d.end(), sum[nx] );
			int df = 0;
			for(auto a = bg; a != en; a++){
				df += min( *a-sum[k], sum[nx]-*a );
			}
			dp[i+1][nx] = min( dp[i+1][nx], dp[i][k] + df );
		}

		int ans = dp[N][(1<<N)-1];
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 13856
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    int[] l = [0, 0, 6, 13, 18, 23, 43, 58];
    auto c = [
        [1,2]: 300, [1,3]: 500, [1,4]: 600, [1,5]: 700, [1,6]: 1350, [1,7]: 1650,
        [2,3]: 350, [2,4]: 450, [2,5]: 600, [2,6]: 1150, [2,7]: 1500,
        [3,4]: 250, [3,5]: 400, [3,6]: 1000, [3,7]: 1350,
        [4,5]: 250, [4,6]: 850, [4,7]: 1300,
        [5,6]: 600, [5,7]: 1150,
        [6,7]: 500
    ];
    while(true) {
        auto d = readInt();
        if(d == 0) {
            return;
        }
        int hd, md;
        readlnTo(hd, md);
        md += hd*60;
        auto a = readInt();
        int ha, ma;
        readlnTo(ha, ma);
        ma += ha*60;

        if(a < d) {
            swap(a, d);
        }
        if((17*60+30 <= md && md <= 19*60+30) || (17*60+30 <= ma && ma <= 19*60+30)) {
            if(l[a]-l[d] <= 40) {
                auto ans = c[[d,a]]/2;
                if(ans%50 != 0) {
                    ans = ans / 50 * 50 + 50;
                }
                writeln(ans);
            } else {
                writeln(c[[d,a]]);
            }
        } else {
            writeln(c[[d,a]]);
        }
    }
}

Measured memory_bytes: 2428
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	m := scanInt()
	h := scanInts(n)

	g := make([][]int, n)
	for i := 0; i < m; i++ {
		a := scanInt() - 1
		b := scanInt() - 1
		g[a] = append(g[a], b)
		g[b] = append(g[b], a)
	}

	ans := 0
	for i := 0; i < n; i++ {
		f := true
		for _, v := range g[i] {
			if h[i] <= h[v] {
				f = false
			}
		}
		if f {
			ans++
		}
	}

	fmt.Fprintln(wr, ans)
}


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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for (int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

vector<edge> graph[16];
int dp[16][1 << 16];

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

    int V, E;
    cin >> V >> E;

    REP(i, E)
    {
        int s, t, d;

        cin >> s >> t >> d;

        graph[s].push_back(edge{t, d});
    }

    REP(i, V)
    {
        REP(j, 1 << V)
        {
            dp[i][j] = iINF;
        }
    }

    dp[0][0] = 0;

    REP(S, 1 << V)
    {
        REP(i, V)
        {
            if (dp[i][S] == iINF)
                continue;

            for (auto e : graph[i])
            {

                if ((S >> e.to) & 1)
                    continue;

                dp[e.to][S | 1 << e.to] = min(dp[e.to][S | 1 << e.to], dp[i][S] + e.cost);
            }
        }
    }

    cout << (dp[0][(1 << V) - 1] == iINF ? -1 : dp[0][(1 << V) - 1]) << endl;

    return 0;
}


Measured memory_bytes: 5152
s=input()
o="RUD"
e="LUD"
for i in range(0,len(s),2):
    if s[i] not in o:
        print("No")
        exit()
for i in range(1,len(s),2):
    if s[i] not in e:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 61908
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a>=b && a>=c && b>=c) cout<<((a*10)+b)+c<<endl;
    else if(a>=b && a>=c && c>=b) cout<<((a*10)+c)+b<<endl;
    else if(b>=a && b>=c && a>=c) cout<<((b*10)+a)+c<<endl;
    else if(b>=a && b>=c && c>=a) cout<<((b*10)+c)+a<<endl;
    else if(c>=a && c>=b && a>=b) cout<<((c*10)+a)+b<<endl;
    else if(c>=a && c>=b && b>=a) cout<<((c*10)+b)+a<<endl;

    return 0;
}


Measured memory_bytes: 256
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>
#include <assert.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF32		INT32_MAX
#define	INF64		INT64_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

// main function
int main()
{
	ll a = 0;
	ll b = 0;
	ll ans = 0;

	cin >> a >> b;

	ans = (a <= b) ? a : (a - 1);
	cout << ans << endl;

	return 0;
}

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

typedef pair<int, int> Pii;

void readline(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readline(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}

signed main(){

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if(abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)){
        cout << "Yes";
    }else{
        cout << "No";
    }

    return 0;
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

class modint {
  private:
    ll m_val;
    ll m_mod;
  public:
    modint() : m_val(0), m_mod() { m_mod = MOD; }
    modint(const ll x) : m_val(0), m_mod(0) { m_mod = MOD; m_val = x % m_mod; }
    modint(const ll x, const ll mod) : m_val(0), m_mod(0) { m_mod = mod; m_val = x % m_mod; }
    ll val() const { return m_val; }
    modint operator+(const modint &rhs) const { return modint(*this) += rhs; }
    modint operator-(const modint &rhs) const { return modint(*this) -= rhs; }
    modint operator*(const modint &rhs) const { return modint(*this) *= rhs; }
    modint operator/(const modint &rhs) const { return modint(*this) /= rhs; }
    modint &operator+=(const modint &rhs) {
      m_val += rhs.m_val;
      if (m_val >= m_mod) m_val -= m_mod;
      return *this;
    }
    modint &operator-=(const modint &rhs) {
      if (m_val < rhs.m_val) m_val += m_mod;
      m_val -= rhs.m_val;
      return *this;
    }
    modint &operator*=(const modint &rhs) {
      m_val = m_val * rhs.m_val % m_mod;
      return *this;
    }
    modint &operator/=(const modint &rhs) {
      *this *= rhs.pow(m_mod - 2);
      return *this;
    }
    modint pow(ll n) const {
      if (n == 0) return 1;
      modint o = pow(n >> 1);
      o *= o;
      if (n & 1) o *= *this;
      return o;
    }
    friend ostream& operator<<(ostream& os, const modint &a) { os << a.val(); return os; }
};

modint comb(ll n, ll r) { // nCr: O(min(r,n-r) + logMOD)
  if (n == 0 && r == 0) return 1;
  if (n < r || n < 0) return 0;
  r = min(r, n-r);
  modint x = 1;
  modint y = 1;
  for (ll i = 0; i < r; ++i) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

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

  modint ans = modint(2).pow(n) - 1;
  ans -= comb(n, a);
  ans -= comb(n, b);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() {
  int k;
  cin >> k;
  
  queue <ll> a;
  if(k<10){
    cout << k << endl;
    return 0; 
  }
  for(int i=1; i<10; i++){
   a.push(i); 
  }
  
  ll x=0;
  while(k>0){
    x=a.front();
    a.pop();
    int d=x%10;
    for(int j=-1; j<2; j++){
      d+=j;
      if(d<0 || d>9){
        d-=j;
        continue;
      }
      ll nx = x*10+d;
      a.push(nx);
      d-=j;
    }
    k--;
  }  
  cout << x << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a=0,b=0;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        if(x%2==0){
            a++;
        }else{
            b++;
        }
    }
    string ans;
    if(b%2==0){
        ans="YES";
    }else{
        ans="NO";
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n;
string s,t;

void solve(){
    cin >> n;
    cin >> s >> t;
    int ans=0;
    Per(i,1,n+1){
        //cout << s.substr(n-i,i) << " " << t.substr(0,i) << endl;
        if (s.substr(n-i,i)==t.substr(0,i)) {
            ans=i;
            break;
        }
    }

    cout << 2*n-ans << endl;
}

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

Measured memory_bytes: 256
let solve (n:bigint) (k:bigint) =
    let rec solve' idx result =
        if idx >= n then result
        else
            let nextResult = result * (k - bigint 1)
            solve' (idx + bigint 1) nextResult
    solve' (bigint 1) k


let () =
    let n, k = stdin.ReadLine () |>
               (fun line -> line.Split()) |>
               (fun arr -> (int arr.[0], int arr.[1])) |>
               (fun (n, k) -> bigint n, bigint k)

    solve n k |> printfn "%A"

Measured memory_bytes: 6064
#include <stdio.h>
int main(void){
 
  int	N, D;
  int	X, Y;
  
  scanf("%d %d", &N, &D);
  
  X = N / ((D*2) +1);
  Y = N % ((D*2) +1);

  if(Y!=0){ X = X + 1; }
  
  printf("%d", X);
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#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 ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1000000007;
ll add(ll x, ll y){
    return (x+y)%mod;
}

ll mul(ll x, ll y){
    return (x%mod)*(y%mod)%mod;
}

ll powll(ll x, ll y){
    x %= mod;
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

ll divll(ll x, ll y){
    x %= mod;
    return (x * powll(y,mod-2)) % mod;
}

int main(void){
    ll n;
    cin >> n;
    ll ans = powll(10, n) - 2 * powll(9, n) + powll(8, n);
    ans = (ans + 30 * mod) % mod;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3636