akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N, M;
  cin >> N >> M;
  priority_queue<int> q;
  for (int i = 0; i < N; ++i) {
    int A;
    cin >> A;
    q.push(A);
  }
  for (int i = 0; i < M; ++i) {
    int A = q.top();
    q.pop();
    q.push(A / 2);
  }
  ll sum = 0;
  for (int i = 0; i < N; ++i) {
    int A = q.top();
    q.pop();
    sum += A;
  }
  cout << sum << endl;
  return 0;
}


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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;

int main() {
  int K;
  cin >> K;
  rep(i,K){
    cout << "ACL";
  }
  
}      
     

Measured memory_bytes: 3584
#pragma GCC optimize("Ofast")

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

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define PI 3.1415926536
#define INF 2e18
#define endl "\n"

ll power(ll b,ll e,ll m)
{
	if(e==0)
		return 1;
	if(e%2)
		return b*power(b*b%m,(e-1)/2,m)%m;
	else
		return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0)
		return 1;
	if(e%2)
		return b*power(b*b,(e-1)/2);
	else
		return power(b*b,e/2);
}
ll inv[1000000+5],fac_inv[1000000+5],fac[1000000+5];
void initialize()
{
	ll i;
	inv[1]=1;
	for(i=2;i<=1000000;i++)
		inv[i]=(M-M/i)*inv[M%i]%M; 
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n,lcm,i;
	cin>>n;
	ll a[n],count,j,k;
	map<ll,ll> m;
	initialize();
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		k=a[i];
		for(j=2;j<=sqrt(k);j++)
		{
			if(k%j==0)
			{
				count=0;
				while(k%j==0){
					k/=j;count++;
				}
				m[j]=max(m[j],count);
			}
		}
		if(k>1)
		{
			m[k]=max(m[k],1LL);
		}
	}
	ll sum=0;
	for(i=0;i<n;i++)
	{
		sum+=(inv[a[i]]);
	}
	sum%=M;
	ll temp=1;
	for(auto j:m)
	{
		temp=(temp*power(j.F,j.S,M))%M;
	}
	cout<<(temp*sum)%M;
	return 0;
}


Measured memory_bytes: 10112
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<cmath>
#include<complex>
#include<utility>
#include<list>
#include<random>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<stdlib.h>
#include<unordered_map>
using namespace std;

signed main() {
	int a; cin >> a;
	cout << 32 * a << endl;
}

Measured memory_bytes: 3072
package main

import (
	"fmt"
)

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func count(W int, ws []int, vs []int) int {
	// Definition of DP
	dp := make([]int, W+1)

	for i := range ws {
		wi := ws[i]
		for j := W; j >= wi; j-- {
			dp[j] = max(dp[j], dp[j-wi]+vs[i])
		}
	}

	return dp[W]
}

func main() {
	var N, W int
	fmt.Scanf("%d %d", &N, &W)

	ws := make([]int, N)
	vs := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d %d", &ws[i], &vs[i])
	}

	fmt.Println(count(W, ws, vs))
}


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

int main(){
  int N;
  string S;
  cin >> N >> S;
  int64_t mod=1e9+7;
  vector<int> count(26,0);
  for(int i=0;i<N;i++){
    count.at(S.at(i)-'a')++;
  }
  int64_t ans=1;
  for(auto c:count){
    ans*=(c+1);
    ans%=mod;
  }
  ans-=1;
  if(ans<0){
    ans+=mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3744
#include <stdio.h>

int main() 
{
	long long n, x, c, t, y;
	
	scanf("%lld%lld", &n, &x);
	c = n, t = n - x;
	while(1){
		c += 2 * (t / x) * x;
		y = x, x = t % x;
		if(!x){
			c -= y;
			break;
		} 
		t = y;
	}
	printf("%lld\n", c);
			
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
#define Mod 998244353
#define MOD 1000000007
using namespace std;
using lint = long long;
using vi = vector<lint>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<lint, lint>;

// cout << fixed << setprecision(12)

lint modpow(lint a, lint n, lint m = MOD){
  lint ans = 1;
  while(n>0){
    if(n%2==1) ans *= a; 
    ans %= m;
    a *= a; 
    a %= m;
    n /= 2;
  }
  return ans;
}

lint inv(lint a, lint m = MOD){
  return modpow(a, m-2, m);
}

///////////////////////////////////

int main(){
  lint x; cin >> x;
  if(x<600) cout << 8 << endl;
  else if(x<800) cout << 7 << endl;
  else if(x<1000) cout << 6 << endl;
  else if(x<1200) cout << 5 << endl;
  else if(x<1400) cout << 4 << endl;
  else if(x<1600) cout << 3 << endl;
  else if(x<1800) cout << 2 << endl;
  else  cout << 1 << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ans=0;
  long long l[105];
  cin>>n;
  for(int i=1;i<=n;i++) cin>>l[i];
  for(int i=1;i<=n;i++){
    for(int j=i+1;j<=n;j++){
      for(int k=j+1;k<=n;k++){
        if(l[i]==l[j] || l[j]==l[k] || l[i]==l[k]) continue;
        if(l[i]+l[j]>l[k] && l[i]+l[k]>l[j] && l[j]+l[k]>l[i]) ans++;
      }
    }
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;
void inssort(int A[], int n, int g) {
	for (int i = g; i < n; i++)
	{
		int v = A[i];
		int j = i - g;
		while (j >= 0 && A[j] > v)
		{
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
	}
}

void shellsort(int A[], int n) {
	for (int h = 1; ;)
	{
		if (h > n) break;
		G.push_back(h);
		h = 3 * h + 1;
	}
	for (int i = G.size()-1; i >= 0; i--)
	{
		inssort(A, n, G[i]);
	}
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) scanf("%d", &A[i]);
	cnt = 0;
	shellsort(A, n);
	
	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0 ; i--)
	{
		printf("%d", G[i]);
		if (i) printf(" ");
	}
	printf("\n");
	printf("%d\n", cnt);
	for (int i = 0; i < n; i++) printf("%d\n", A[i]);

	return 0;
}

Measured memory_bytes: 7168
def main():
    n = int(input())
    C = input()
    r_all = C.count('R')
    # ある場所を境に右側をRとする.
    # |WWWWWWW
    # R|WWWWWW
    # RR|WWWWW
    # .......
    # RRRRRR|W
    # RRRRRRR|
    move = [0] * (n+1)
    # 実際の並びにおいて、|の左のW右のRの数をw, rとする
    w = 0
    r = r_all
    # 初期値はすべてWを目指すので
    move[0] = max(0, r_all)
    for idx, c in enumerate(C):
        if c == 'W':
            w += 1
        else:
            r = r - 1 
        move[idx+1] = max(w, r)
    ans = min(move)
    print(ans) 

if __name__ == '__main__':
    main()

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int &
#define SZ(a) ((int)((a).size()))
#define watch(x) cout << (#x) << " = " << (x) << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


inline void transpose(vector<string> &a) {

    int n = a.size();
    if (n == 0) return;
    int m = a[0].size();
    vector<string> b(m, string(n, ' '));
    fori (i, n) fori (j, m) b[j][i] = a[i][j];
    a = b;
}


template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "{";
    fori (i, SZ(a))
        out << a[i] << vector<string>{", ", "}"}[i + 1 == SZ(a)];
    return out;
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);


#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#define cerr cout
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\n";
    cout << "TOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}


const int N = 1e5 + 9;
const int L = 1e4 + 9;
const ll oo = 1e18;


void smain() {


    int n;
    cin >> n;
    vl h(n + 1, 0), dp(n + 1, oo);
    int k;
    cin >> k;
    fori (i, n) cin >> h[i + 1];
    dp[1] = 0;
    for (int i = 2; i <= n; ++i) {
        for (int step = 1; step <= k; ++step) {
            if (i - step >= 1) inmin(dp[i], dp[i - step] + abs(h[i] - h[i - step]));
        }
    }
    cout << dp[n];
}

Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
	int i,j,a[5][5],x,y,z,count=0;
	for(i=1;i<=3;i++)
	 for(j=1;j<=3;j++)
	  scanf("%d",&a[i][j]);
	x=a[2][1]-a[1][1];
	y=a[2][2]-a[1][2];
	z=a[2][3]-a[1][3];
	if(x==y && y==z) count++;
	x=a[3][1]-a[2][1];
	y=a[3][2]-a[2][2];
	z=a[3][3]-a[2][3];
	if(x==y && y==z) count++;
	x=a[1][1]-a[1][2];
	y=a[2][1]-a[2][2];
	z=a[3][1]-a[3][2];
	if(x==y && y==z) count++;
	x=a[1][2]-a[1][3];
	y=a[2][2]-a[2][3];
	z=a[3][2]-a[3][3];
	if(x==y && y==z) count++;
	if(count==4)  printf("Yes\n");
	else  printf("No\n");
	return 0;
}

Measured memory_bytes: 256
S = input()
while(len(S)>=5):
    if S[-5:] =="dream":
        S = S[:-5]
    elif S[-5:] =="erase":
        S = S[:-5]
    elif S[-7:] =="dreamer":
        S = S[:-7]
    elif S[-6:] =="eraser":
        S = S[:-6]
    else:
        break
if S == "":
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3188
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <unordered_map>
//#include"testlib.h"
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout << (#x)<<" = "<<x<<endl
#define sz(s)    (int)(s.size())
#define PI acos(-1)
#define EPS 1e-100
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
//	file();
	fast();
	int n, m; cin >> n >> m;
	int sum = 0;
	for (int i = 0; i < m; i++) {
		int x; cin >> x;
		sum += x;
	}
	cout << max(-1, n - sum) << endl;
	return 0;
}

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

const int maxn = 1e5 + 5;
bool vis[maxn];
int cnt = 0;

int main(){
	int n,k; cin >> n >> k;
	for(int i = 1; i <= k; i++){
		int t; cin >> t;
		for(int j = 1; j <= t; j++){
			int a; cin >> a;
			vis[a] = 1;
		}
	}

	for(int i = 1; i <= n; i++){
		if(!vis[i]) cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3628
"use strict";
function main(input) {
    const line = input.split("\n");
    let A = line[0].split(" ").map(Number);
    console.log(22 <= A.reduce((Ai, x) => Ai + x) ? "bust" : "win");
    return;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29568
s=input()
abc="abcdefghijklmnopqrstuvwxyz"
if len(s)<26:
  print(s+sorted(list(set(abc)-set(s)))[0])
else:
  x=s[-1]
  Tail=[x]
  count,flag=0,0
  for i in range(2,27):
    if s[-i]<x:
      count=i
      flag=1
      break
    else:
      x=s[-i]
      Tail.append(x)
  t="z"
  if count!=0:
    for tt in Tail:
      if tt>s[26-count]:
        t=min(t,tt)  
  print(-1 if flag==0 else s[:-count]+t)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
using namespace std;
 
int main(){
    
    int A,B,K,tmp[100],c,ans=0;
    cin >> A>>B>>K;

    for(int i=1;i<=100;i++){
        if((A%i)==0 && (B%i)==0){
            c+=1;
           	tmp[c]=i;
        }
    }

  	ans = tmp[c-(K-1)];
    
    cout << ans;
  
    return 0;

}

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

using namespace std;

int check(vector<int> &v) {
	int n = v.size();
	vector<int> cumuls(n + 1, 0);

	for (int i = 0; i < n; i++) {
		cumuls[i+1] = cumuls[i] ^ v[i];
	}

	vector<int> pos(n / 2, -1);
	set<int> vals;
	for (int i = 0; i < n; i++) {
		int x = v[i];
		if (pos[x] == -1) {
			pos[x] = i;
		} else {
			auto val = cumuls[i+1] ^ cumuls[pos[x]];
			vals.insert(val);
		}
	}

	if (vals.size() > 1) {
		return -1;
	} else {
		return *vals.begin();
	}
}

void check_for_small_case() {
	int m = 2;
	int limit = 1 << m;

	vector<int> v(limit * 2);
	for (int i = 0; i < limit; i++) {
		v[2*i] = i;
		v[2*i + 1] = i;
	}

	do {
		auto val = check(v);
		if (val >= 1) {
			if (v[0] != 0 || v[2] != 0) {
				continue;
			}
			printf("%3d: ", val);
			for (auto x: v) {
				printf(" %2d", x);
			}
			printf("\n");
		}
	} while (next_permutation(v.begin(), v.end()));
}

int main() {
	// check_for_small_case();
	// exit(0);

	int m, k;
	cin >> m >> k;

	if (k >= (1 << m)) {
		cout << -1 << endl;
		return 0;
	}

	if (m == 1 && k == 1) {
		cout << -1 << endl;
		return 0;
	}

	int x = 1 << m;
	vector<int> ret;

	if (k == 0) {
		for (int i = 0; i < x; i++) {
			ret.emplace_back(i);
			ret.emplace_back(i);
		}
	} else {
		ret = {0, k, 0};
		for (int i = 1; i < x; i++) {
			if (i != k) {
				ret.emplace_back(i);
			}
		}
		ret.emplace_back(k);
		for (int i = x - 1; i >= 1; i--) {
			if (i != k) {
				ret.emplace_back(i);
			}
		}
	}

	for (int i = 0; i < ret.size(); i++) {
		if (i != 0) {
			cout << " ";
		}
		cout << ret[i];
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 2932
<?php
  $n = intval(trim(fgets(STDIN)));
  $arr = array_map("intVal", explode(" ", trim(fgets(STDIN))));
  $arr = array_reverse($arr);
  $ans = array_fill(0, $n, 0);
  for($i=1; $i<$n; $i++){
    if($arr[$i] >= $arr[$i-1]){
      $ans[$i] = $ans[$i-1] + 1;
    }
  }
  echo max($ans) . PHP_EOL;
?>

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

int a, b, c, d;

int main(){
	cin >> a >> b >> c >> d;
	int flag = 0;
	
	if(abs(a - c) <= d) flag = 1;
	else if(abs(b - c) <= d and abs(b - a) <= d) flag = 1;
	
	if(flag) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, k, q;

int pref[N];

int32_t main(){_

   cin>>n>>k>>q;

   while(q--){
      int x;
      cin >> x;
      if(x == 1){
         pref[x+1]--;
         pref[n+1]++;
      }
      else if (x == n){
         pref[1]--;
         pref[x]++;
      }
      else{
         pref[1]--;
         pref[x]++;
         pref[x+1]--;
         pref[n+1]++;
      }
   }   

   for (int i = 1; i <= n; ++i)
   {
      pref[i] += pref[i-1];
      int x = pref[i] + k;
      if(x <= 0){
         cout<<"No";
      }
      else{
         cout<<"Yes";
      }
      cout<<endl;
   }
   

   return 0;
}

Measured memory_bytes: 1408
import sys

input = sys.stdin.readline

X, Y, Z, K = map(int, input().split())

list_cake_1 = list(map(int, input().split()))
list_cake_2 = list(map(int, input().split()))
list_cake_3 = list(map(int, input().split()))

list_cake_1 = sorted(list_cake_1, reverse=True)
list_cake_2 = sorted(list_cake_2, reverse=True)
list_cake_3 = sorted(list_cake_3, reverse=True)

list_total_sum = []

for i, cake_1 in enumerate(list_cake_1, 1):
	for j, cake_2 in enumerate(list_cake_2, 1):
		for k, cake_3 in enumerate(list_cake_3, 1):
			if i*j*k > K:
				break
			list_total_sum.append(cake_1 + cake_2 + cake_3)

for element in sorted(list_total_sum, reverse=True)[:K]:
	print(element)

Measured memory_bytes: 9536
def solve():
  n,m = map(int,input().split())
  lst = [0]
  for i in range(n - 1):
    lst.append(lst[-1] + int(input()))
  ans = 0
  num = 0
  for i in range(m):
    a = int(input())
    ans += abs(lst[num] - lst[num + a])
    num += a
  print(ans % 100000)
solve()


Measured memory_bytes: 9636
package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)
)

func main() {
	defer writer.Flush()
	var H, W int
	fmt.Fscanf(reader, "%d %d\n", &H, &W)
	yBoxes := make([]string, H)

	for i := 0; i < H; i++ {
		fmt.Fscanf(reader, "%s\n", &yBoxes[i])
		fmt.Fprintf(writer, "%s\n", yBoxes[i])
		fmt.Fprintf(writer, "%s\n", yBoxes[i])
	}
}


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

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int)(x).size())

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

i64 x;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "r", stdin);
#endif

    cin >> x;
    i64 now = 100, cnt = 0;
    while (now < x) {
        i64 interest = now/100;
        ++cnt;
        now += interest;
    }
    cout << cnt << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


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

int main(){
    ll k,x;
    cin>>k>>x;
    ll n=k-1;
    for(ll i=x-n;i<=x+n;i++){
        cout<<i<<" ";
    }
    cout<<endl;

}


Measured memory_bytes: 3604
n=int(input())
a=[]
b=[]
for i in range(n):
	x,y=map(int,input().split())
	a.append(x)
	b.append(y)
a.reverse()
b.reverse()
cnt=0
for i in range(n):
	if (a[i]+cnt)%b[i]!=0:
		cnt+=b[i]-(a[i]+cnt)%b[i]
print(cnt)



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

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

  int a[n], s[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i > 0) s[i] = a[i] - a[i-1];
  }

  s[0] = k - a[n-1] + a[0];

  cout << accumulate(s, s + sizeof(s)/sizeof(s[0]), 0) - *max_element(s, s + sizeof(s)/sizeof(s[0])) << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <utility> 
#include <unordered_set>
#include <vector>
#include <list> 
#include <string>
#include <iterator> 
#include <deque>
#include <array>
#include <forward_list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <bitset>
using namespace std;

#define N 1e5
#define EPS 1e-9


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	long long a, c;
	string s;
	cin >> a >> s;
	c = (s[0] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
	cout <<a * c / 100 << '\n';
	
	
}


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

using namespace std;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}

int main(){

    cin.sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //freopen("input.txt", "r", stdin);

    int n, k;
    string s;

    // get 0 spots
    // flip K consecutive 0 spots
    // Get length

    cin >> n >> k >> s;

    int best = 0;
    int regions = 0;
    int left = 0;

    for(int i = 0; i < n;){
        
        int cur = s[i] - '0';

        if(cur == 0)
            regions++;

        while(i < n && s[i] - '0' == cur)
            ++i;

        if(regions > k){
            cur = s[left] - '0';
            while(left < n && s[left] - '0' == cur)
                ++left;
            if(cur == 1){
                cur = 0;
                while(left < n && s[left] - '0' == cur)
                    ++left;
            }
            --regions;
        }

        best = max(best, i - left);

    }

    cout << best;

    return 0;
}


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

using namespace std;

#define MOD 2019

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	long l, r;
	cin >> l >> r;                                         
	long long ans = 10000000;
	for (long i = l; i <= r - 1; ++i){
		for (long j = i+1; j <= r; ++j){
		    long long tmp = (i*j)%2019;
			ans = min(tmp,ans);
			if (ans == 0){
				cout << 0;
				return 0;
			}
		}
	}
	cout << ans;
	return 0;
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 7400000;
int x[N];

int main()
{
    int m,n;
    while(cin >>m >>n,m)
    {
        fill(x,x+N,0);

        int i;
        for(i=m; i<N; ++i)
        {
            if(x[i]==0)
            {
                for(int j=i; j<N; j+=i) x[j]=1;
                --n;
                if(n==0) break;
            }
        }

        while(x[i]==1) ++i;
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 31940
#include<bits/stdc++.h>
#define PI 3.141592653589
#define ll long long
using namespace std;

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

  int h[n];

  for(int i=0; i<n; ++i){
    cin >> h[i];
  }
  int cnt = 0;
  for(int i=0; i<n; ++i){
    if(h[i] >= k) cnt++;
  }

  cout << cnt;

}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define Elhabashy ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void input()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}
const int N=1e5+5,mod=1e9+7;
typedef long long ll;
int n;
int main()
{
    Elhabashy
    input();
    cin>>n;
    if(n%1000==0)cout<<0<<endl;
    else{
        cout<<(((n/1000)+1)*1000)-n<<endl;
    }


}


Measured memory_bytes: 3660
#include<stdio.h>
void print_array(int[], int);
void swap(int*, int*);
int main(void){
    int i, j, N, count = 0, flag = 1;
    int data[100];

    scanf("%d", &N);
    for(i = 0; i < N; i++){
        scanf("%d", &data[i]);
    }
    while(flag){
        flag = 0;
        for(j = N - 1; j > 0; j--){
            if(data[j] < data[j - 1]){
                swap(&data[j] , &data[j - 1]);
                count++;
                flag = 1;
            }
        }
    }
    print_array(data, N);
    printf("%d\n", count);
    return 0;
}
void swap(int *a, int *b){
    int t;
    t = *a;
    *a = *b;
    *b = t;
    return;
}
void print_array(int a[], int n){
    int i = 1;
    printf("%d", a[0]);
    while(i < n){
        printf(" %d", a[i]);
        i++;
    }
    printf("\n");
    return;
}


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

using namespace std;

int LeftEyeData[4], RightEyeData[4];
const double EXP = 1e-13;

void judge(const double n, int *EyeData) {

	if (n > 1.1 || fabs(n - 1.1) <= EXP) {
		EyeData[0]++;
	}
	else if (n > 0.6 || fabs(n - 0.6) <= EXP) {
		EyeData[1]++;
	}
	else if (n > 0.2 || fabs(n - 0.2) <= EXP) {
		EyeData[2]++;
	}
	else {
		EyeData[3]++;
	}
}

int main(void) {
	double l, r;

	while (cin >> l >> r) {
		judge(l, LeftEyeData);
		judge(r, RightEyeData);
	}

	for (int i = 0; i < 4; i++) {
		cout << LeftEyeData[i] << " " << RightEyeData[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),n.end()
#define PI acos(-1)
using namespace std;
int main(){

  int n;
  while(cin>>n,n){
    char in[n][2];
    rep(i,n){
      char a,b;
      cin>>a>>b;
      in[i][0]=a;
      in[i][1]=b;
      //cout<<in[0][0];
      //cout<<i<<in[i][0]<<"!"<<in[i][1]<<endl;
    }
    //cout<<in[0][0];
    int m;
    cin>>m;
    rep(i,m){
      char a;
      cin>>a;
      //cout<<in[0][0];
      //cout<<in[0][1]<<"!"<<a<<endl;
      rep(j,n){
	//cout<<j<<" "<<(char)in[j][0];
	if(in[j][0]==a){a=in[j][1];break;}
      }
      cout<<a;
    }
    cout<<endl;
  }

}

Measured memory_bytes: 1152
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion

vector<bool> used;
vector<vector<int>> G;


void dfs(int cur, vector<int>& v) {
  used[cur] = true;
  v.pb(cur);
  for (int next : G[cur]) {
    if (used[next])
      continue;
    dfs(next, v);
    return;
  }
}

signed main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M);

  G = vector<vector<int>>(N);

  rep(i, M) {
    cin >> A[i] >> B[i];
    A[i]--, B[i]--;
    G[A[i]].pb(B[i]);
    G[B[i]].pb(A[i]);
  }

  used = vector<bool>(N, false);


  vector<int> l, r;
  dfs(0, l), dfs(0, r);

  reverse(all(l));
  l.pop_back();

  vector<int> ans;
  for (int i : l)
    ans.pb(i + 1);
  for (int i : r)
    ans.pb(i + 1);

  cout << len(ans) << endl;
  cout << ans << endl;
}

Measured memory_bytes: 13300
#include <stdio.h>
#include <string.h>

int main(){
	char s[200001];
	int i,j;
	int ans;

	scanf("%s", s);

	j = strlen(s) - 1;

	for(i=0; i<strlen(s); i++){
		if(s[i] == 'A'){
			break;
		}
	}

	for(;j>=0; j--){
		if(s[j] == 'Z'){
			break;
		}	
	}
	
	printf("%d\n", j-i+1);
	
	return 0;	

}


Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <climits>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;


void solve(void){
    int N, X;
    cin >> N >> X;
    vector <int> ms(N);
    rep(N, i) {
        cin >> ms.at(i);
        X -= ms[i];
    }
    sort(all(ms));
    int ans = N + X / ms[0];
    cout << ans << '\n';
}

int main(void){
  solve();
  return 0;
}


Measured memory_bytes: 256
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007

#define read(type) readInt<type>()
#define max1 100001
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
const double pi=acos(-1.0);

typedef pair<int, int> PII;

typedef vector<int> VI;

typedef vector<string> VS;

typedef vector<PII> VII;

typedef vector<VI> VVI;

typedef map<int,int> MPII;

typedef set<int> SETI;

typedef multiset<int> MSETI;

typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;

bool isPowerOfTwo (int x)
{
  /* First x in the below expression is
    for the case when x is 0 */
  return x && (!(x&(x-1)));
}
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
ll modInverse(ll n, ll p)
{
    return power(n, p-2, p);
}

// Returns nCr % p using Fermat's little
// theorem.
ll ncr(ll n, ll r,ll p)
{
   // Base case
   if (r==0)
      return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
}

vector<int> v[max1];

void dfs(int ans[],bool x[],int cnt[],int j,int c){
    x[j]=true;
  for(int i=0;i<v[j].size();i++){
        if(cnt[v[j][i]]>=c){ans[v[j][i]]=j;cnt[v[j][i]]=c;}
    if(x[v[j][i]]==false){
        ans[v[j][i]]=j;
        cnt[v[j][i]]=c;
        dfs(ans,x,cnt,v[j][i],c+1);
    }
  }
}
#define deg_to_rad(deg) (((deg) / 360) * 2 * PI)
int main() {
ll n;
cin>>n;
ll ans=0;
while(n!=1){
    ll x=sqrt(n);
    for(ll i=2;i<=x;i++){
        if(n%i==0){
            int cnt=0;
            while(n%i==0){
                cnt++;
                n=n/i;
            }
            ll y=1;
            ll tot=y*(y+1);
            cnt=cnt*2;
            int ch=0;
            while(tot<=cnt){
                y++;
                ch++;
                tot=(y*(y+1));
            }
            ans+=ch;
            goto f;
        }
    }
    n=1;
    ans++;
    f:;

}
out(ans);
}





Measured memory_bytes: 6028
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
ll mae[12345678], ato[12345678], ok[12345678];
signed main() {
	ll n, a, ans = 0;
	cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> ok[h];
	}
	for (int h = 0; h < n; h++) {
		if (h == 0) { mae[h] = ok[h]; }
		else { mae[h] = (mae[h - 1] ^ ok[h]); }
	}
	for (int h = n - 1; h >= 0; h--) {
		if (h == n) { ato[h] = ok[h]; }
		else { ato[h] = (ato[h + 1] ^ ok[h]); }
	}
	for (int h = 0; h < n; h++) {
		if (h == 0) { cout << ato[1]; }
		else if (h == n - 1) { cout << ' ' << mae[n - 2]; }
		else { cout << ' ' << (mae[h - 1] ^ ato[h + 1]); }
	}
	cout << endl;
	return 0;
}

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

int main() {
  int n, b, f, r, v;
  int a[4][3][10];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 10; k++) {
        a[i][j][k] = 0;
      }
    }
  }
  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> b >> f >> r >> v;
    a[b - 1][f - 1][r - 1] += v;
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 10; k++) {
        cout << " " << a[i][j][k];
      }
      cout << '\n';
    }
    if (i < 3) {
      cout << "####################\n";
    }
  }
  cout << flush;
}

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

using namespace std;

void solve()
{
	int k;
	cin >> k;
	vector<long> xs(k);
	for (int i = 0; i < k; i++)
	{
		cin >> xs[i];
	}
	reverse(xs.begin(), xs.end());
	if (xs[0] != 2)
	{
		cout << -1 << endl;
		return;
	}
	long l = 2, r = 3;
	for (int i = 1; i < k; i++)
	{
		long nl = (max(l, xs[i])+xs[i]-1)/xs[i]*xs[i], nr = max(r, (2*xs[i]-1))/xs[i]*xs[i]+xs[i]-1;
		if (xs[i] > r || nl > nr)
		{
			cout << -1 << endl;
			return;
		}
		l = nl, r = nr;
	}
	cout << l << ' ' << r << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 1024
from math import sin, cos, tan,radians

a, b, h, m = map(int, input().split())

m = 60 * h + m
hour = 0.5
minute = 6

c = hour * m % 360
d = minute * m % 360

seta = min(abs(c - d), 360 - abs(d - c))

ans = a ** 2 + b ** 2 - 2 * a * b * cos(radians(seta))
print(ans ** 0.5)


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

int main(){
    int i = 0;
    int n;
    int *A = malloc(sizeof(int) *100);
    scanf("%d", &n);
    for (i = 0; i < n;i++){
        scanf("%d", &A[i]);
    }

    long long int kane = 1000;
    long long int kabu = 0;

    int selled = 1;

    long long int num;

    for (i = 0; i < n-1;i++){
        num = 0;
        if(selled==1){
            if(A[i]<A[i+1]){
                num = kane / A[i];
                kabu = num;
                kane -= A[i] * num;
                selled = 0;
            }
        }else{
            if(A[i]>A[i+1]){
                kane += kabu * A[i];
                kabu = 0;
                selled = 1;
            }
        }
    }
    kane += kabu * A[n - 1];
    int kanekane = 1000;
    if(kane>kanekane){
        printf("%lld", kane);
    }else{
        printf("%d", kanekane);
    }
    return 0;
}

Measured memory_bytes: 1716
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#define INF 10e10

using namespace std;

//  #define y cout << "yes"<< endl
  #define Y cout << "YES" << endl
  #define y cout << "Yes" << endl
//  #define n cout << "no"<< endl
  #define N cout << "NO" << endl
  #define n cout << "No" << endl
  #define pu(q) cout << q ;
  #define put(q) cout << q << " ";
  #define puts(q) cout << q << endl;
  
  
	int a,b,c,d,e,f,g,h,ans,res;
//	char a,b,c,d,e,f,g,h,ans,res;
//	string a,b,c,d,e,f,g,h,ans,res;
//	double a,b,c,d,e,f,g,h,ans,res;
	
void take(int x);
  
int main(void){
	take(3);//数
	puts(c/a*b);
	
	
	/*if(){
		
		
	//	y;	//Yes
	//	Y;	//YES
	//	n;	//No
	//	N;	//NO
	}
	
	else if(){
		
		
	//	y;
	//	Y;
	//	n;
	//	N;
		
	}
	else if(){
		
		
	//	y;
	//	Y;
	//	n;
	//	N;
		
	}
	else if(){
		
		
	//	y;
	//	Y;
	//	n;
	//	N;
		
	}
	
	else{
		
		
	//	y;
	//	Y;
	//	n;
	//	N;
		
	}*/
//	cout << ans << endl;
	
	return 0;
}
void take(int x){
	if(x==1)
		cin >> a;
	else if(x==2)
		cin >> a >> b;
	else if(x==3)
		cin >> a >> b >> c;
	else if(x==4)
		cin >> a >> b >> c >> d;
	else if(x==5)
		cin >> a >> b >> c >> d >> e;
	else if(x==6)
		cin >> a >> b >> c >> d >> e >> f;
	else if(x==7)
		cin >> a >> b >> c >> d >> e >> f >> g;
	else if(x==8)
		cin >> a >> b >> c >> d >> e >> f >> g >> h;
	return ;
}

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

using namespace std;

using ll = long long int;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int x, a, b;
	cin >> x >> a >> b;

	cout << (abs(x - a) < abs(x - b) ? "A" : "B") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int h, w;
char s[51][52];
int d[51][51];

bool bfs()
{
    queue<P> q;
    rep(i, w)
        rep(j, h) d[i][j] = MOD;
    q.push(P(0, 0));
    d[0][0] = 0;

    int f = 0;
    while(!q.empty())
    {
        P p = q.front(); q.pop();
        if (p.first == w - 1 && p.second == h - 1)
        {
            f = 1;
            break;
        }

        rep(i, 4)
        {
            int x = p.first + dx[i], y = p.second + dy[i];
            if (x >= 0 && x < w && y >= 0 && y < h && s[y][x] != '#' && d[x][y] == MOD)
            {
                q.push(P(x, y));
                d[x][y] = d[p.first][p.second] + 1;
            }
        }
    }
    if (f) return true;
    else return false;
}

int main()
{
    cin >> h >> w;
    int road = 0, wall = 0;
    rep(i, h)
    {
        rep(j, w)
        {
            cin >> s[i][j];
            if (s[i][j] == '#')
                wall++;
        }
    }
    int area = h * w;
    if (bfs())
    {
        int shortest = d[w - 1][h - 1] + 1;
        int ans = area - wall - shortest;
        //cout << shortest << endl;
        cout << ans << endl;
    }
    else cout << -1 << endl;
}

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

int main() {
    long long N, ans = 1e12;
    cin >> N;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            ans = min(ans, i + N / i - 2);
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

// const ll mod = 1e9+7;

// void chmod(ll &M){
//     if(M >= mod) M %= mod;
//     else if(M < 0){
//         M += (abs(M)/mod + 1)*mod;
//         M %= mod;
//     }
// }


int main(){
    int N; cin >> N;
    vector<int> a(N), b(N);
    for(int i=0; i<N; ++i) cin >> a[i];
    for(int i=0; i<N; ++i) cin >> b[i];

    int ans = 0;

    for(int k=28; k>=0; --k){
        int T = 1<<k;
        for(int i=0; i<N; ++i) { a[i] %= 2*T; b[i] %= 2*T; }
        sort(b.begin(), b.end());
        ll cnt = 0; // ここは long long じゃないとダメです
        for(int i=0; i<N; ++i){
            cnt += lower_bound(b.begin(), b.end(), 2*T-a[i]) - lower_bound(b.begin(), b.end(), T-a[i]);
            cnt += lower_bound(b.begin(), b.end(), 4*T-a[i]) - lower_bound(b.begin(), b.end(), 3*T-a[i]);
        }
        if(cnt%2 == 1) ans += T;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
package main

import (
    "fmt"
)

func main(){
    var monsterLife, attackNum, attack int
    fmt.Scan(&monsterLife, &attackNum)
    
    sum := 0
    
    for i := 0; i < attackNum; i++ {
        fmt.Scan(&attack)
        sum += attack
    }
    
    if monsterLife <= sum {
        fmt.Println("Yes")
    } else {
        fmt.Println("No")
    }
}


Measured memory_bytes: 5504
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppiii;

void die() {
  cout << "-1\n";
  exit(0);
}

void solve() {
  int m, k;
  cin >> m >> k;
  int maxv = -1 + (1<<m);
  if(m <= 1) maxv = 0;
  if(k > maxv) die();
  if(maxv == 0 || k == 0) {
    for(int i = 0; i < (1<<m); i++) {
      cout << i << " ";
      cout << i << " ";
    }
    cout << "\n";
    return;
  }
  cout << 0 << " " << k << " " << 0;
  for(int i = 1; i < (1<<m); i++) {
    if(i == k) continue;
    cout << " " << i;
  }
  cout << " " << k;
  for(int i = (1<<m)-1; i > 0; i--) {
    if(i == k) continue;
    cout << " " << i;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}


Measured memory_bytes: 1792
#pragma GCC optimize ("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = unsigned long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) v.begin(),v.end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,st,en) for(int i=st; i<en; i++)
#define gnr(i,l,r) for(int i=int(r)-1; i>=int(l); i--)
#define eb emplace_back
#define pri1(a) cout<<a<<'\n'
#define pri2(a,n) rep(i,n)cout<<a[i]<<'\n'
#define pri3(a,n) rep(i,n-1)cout<<a[i]<<' '; cout<<a[n-1]<<'\n'
#define prip(p) cout<<p.first<<' '<<p.second<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

Int n,m,_,x,y,q,key;
string s,sb;
bool ok;

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

  cin>>n>>m; pair<int,P>p[m]; //p,(y,idx)
  rep(i,m){
	cin>>x>>y;
	p[i]=pair<int,P>{x,P(y,i)};
  }
  sort(p,p+m);
  //rep(i,m)cout<<p[i].first<<' '<<p[i].second.first<<' '<<p[i].second.second<<'\n';
  Int ans[m];
  int id=1;
  rep(i,m){
	if(i&&p[i-1].first==p[i].first)id++;
	else id=1;
	ans[p[i].second.second]=p[i].first*1e6+id;
  }
  rep(i,m){
	  s=to_string(ans[i]);
	  sb="00000";
	  s=sb+s;
	  s.erase(s.begin(),s.begin()+s.size()-12);
	  pri1(s);
  }
}

Measured memory_bytes: 3584
import java.util.ArrayList;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		ArrayList<Integer> numList01 = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			numList01.add(i, scanner.nextInt());
		}
		n = scanner.nextInt();
		ArrayList<Integer> numList02 = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			numList02.add(i, scanner.nextInt());
		}

		int count = 0;
		for (int i = 0; i < n; i++) {
				if (numList01.contains(numList02.get(i))) {
					count++;
			}
		}
		System.out.println(count);
		scanner.close();
	}
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

string T;
int main(int argc, char **argv)
{
	cin >> T;
	string res;
	for (auto &e : T)
	{
		if (e == '?')
			res.push_back('D');
		else
			res.push_back(e);
	}

	std::cout << res << std::endl;
}


Measured memory_bytes: 3864
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <regex>
#include <queue>
#include <math.h>
typedef long long ll;
using namespace std;

int solve() {
  ll n;

  ll MAX = 1000000;
  cin >> n;
  ll ans = 1000000000000000;
  for(ll i = 1;i <= 1000000; i++){
    if(n % i == 0){
      ans = min((i - 1) + (n / i - 1), ans);
    }
  }
  if (ans == 1000000000000000){
    cout << n - 1 << endl;
  }
  cout << ans << endl;
  return 0;
}

int main(void){
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 

using namespace std;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	vector<int> dp(n+1);
	rep(i, 0, n)dp[i] = i;
	vector<int> r;
	int x = 1;
	rep(i, 0, 6)
	{
		r.push_back(x);
		x *= 6;
	}
	x = 9;
	rep(i, 0, 4)
	{
		r.push_back(x);
		x *= 9;
	}
	rep(i, 0, n)
	{
		rep(j, 0, r.size() - 1)
		{
			if (i + r[j] <= n)
			{
				dp[i + r[j]] = min(dp[i + r[j]], dp[i] + 1);
			}
		}
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 640