akhauriyash/Code-Regression huggingface dataset:
/**Bismillahir Rahmanir Rahim.**/
/*gcd=--gcd(a,b);*/
#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#include<string>
using namespace std;
int main()
{
    long long int a,b,c,d,y=0,j,n,x[100000],i,xx;
     cin>>n;
     a=n/1000;
     if(n%1000==0)b=a;
     else b=a+1;
     c=(b*1000)-n;
     cout<<c<<endl;

}


Measured memory_bytes: 3572
N, M = map(int, input().split())
A = set([int(input()) for _ in range(M)])
mod = 10**9 +7
dp = [0]*(N+1)
dp[:2]= 1, 1 if 1 not in A else 0
for i in range(2, N+1):
    if i not in A:
        dp[i] = (dp[i-1]+dp[i-2])%mod
print(dp[-1])

Measured memory_bytes: 56664
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
using namespace std;
//ll arr[1000002];
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/

int main()
{
ll n,k;
string s;
cin>>n>>k;
cin>>s;
s[k-1]=tolower(s[k-1]);
cout<<s<<endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int m[N][N];
int p[N+1];
int n;


void matrixChainOrder();

int main(){
  int A[N][2];
  int r,c,i;

  scanf("%d",&n);

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

  p[0] = A[0][0];
  for(i=1;i<=n+1;i++){
    p[i] = A[i-1][1];
  }

  matrixChainOrder();

  return 0;

}

void matrixChainOrder(){
  int a,i,j,k,l,q;
  a=n;
  if(a == 1){
    printf("%d\n",0);
    return;
  }
  for(i=1;i<=a;i++){
    m[i][i] = 0;
  }
  for(l=2;l<=a;l++){
    for(i=1;i<=a-l+1;i++){
      j=i+l-1;
      m[i][j] = 1000000;
      for(k=i;k<=j-1;k++){
	q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	m[i][j]=min(m[i][j],q);
	if(l == a && k == j-1){
	  printf("%d\n",m[i][j]);
	}
      }
    }
  }
}

int min(int a,int b){
  if(a>b){
    return b;
  }
  if(b>a){
    return a;
  }
  if(a == b){ 
    return a;
  }
}




Measured memory_bytes: 2076
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        int h = input[0];
        int w = input[1];
        string[] ans = new string[h + 2];
        string firstAndlast = "";
        for (int i = 0; i < w + 2; i++)
        {
            firstAndlast += "#";
        }
        ans[0] = firstAndlast;
        ans[h + 1] = firstAndlast;

        for (int i = 1; i <= h; i++)
        {
            ans[i] = $"#{Console.ReadLine()}#";
        }
        foreach (var i in ans)
        {
            Console.WriteLine(i);
        }

    }
}

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



int main() {
	int N;

	cin >> N;
	vector<int>A(N);
	vector<int>ans(N);
	rep(0,N) {
		cin >> A[i];
		ans[A[i] - 1] = i+1;
		}
	rep(0, N) {
		cout << ans[i]<<" ";
	}
	cout<< endl;
}

Measured memory_bytes: 1664
#include<stdio.h>

int main(){
	int i,j,sum=0;
	char a[1001];
	
	while(1){
		scanf("%s",a);
		if(a[0]=='0'){
			break;
		}
		
		for(i=0;i<1000;i++){
			if(a[i]=='\0'){
				break;
			}else if(a[i]=='0'){
				sum+=0;
			}else if(a[i]=='1'){
				sum+=1;
			}else if(a[i]=='2'){
				sum+=2;
			}else if(a[i]=='3'){
				sum+=3;
			}else if(a[i]=='4'){
				sum+=4;
			}else if(a[i]=='5'){
				sum+=5;
			}else if(a[i]=='6'){
				sum+=6;
			}else if(a[i]=='7'){
				sum+=7;
			}else if(a[i]=='8'){
				sum+=8;
			}else if(a[i]=='9'){
				sum+=9;
			}
		}
		
		printf("%d\n",sum);
		sum=0;
	}
	
	
	return 0;
}

Measured memory_bytes: 536
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn dijkstra(graph: &Vec<Vec<(usize, usize)>>, s: usize) -> Vec<(usize, usize)> {
    let mut distance = vec![(INF, INF); graph.len()];
    distance[s] = (0, 0);
    let mut queue = BinaryHeap::new();
    queue.push(Reverse((0, s)));
    while !queue.is_empty() {
        let Reverse((d, u)) = queue.pop().unwrap();
        if distance[u].0 < d {
            continue;
        }
        for &(v, c) in &graph[u] {
            if distance[u].0 + c < distance[v].0 {
                distance[v] = (distance[u].0 + c, u);
                queue.push(Reverse((distance[v].0, v)));
            }
        }
    }
    distance
}

fn main() {
    input! {
        n: usize,
        m: usize,
        ab: [(Usize1, Usize1); m],
    }
    let mut graph = vec![vec![]; n];
    for &(ai, bi) in &ab {
        graph[ai].push((bi, 1));
        graph[bi].push((ai, 1));
    }
    let distance = dijkstra(&graph, 0);
    println!("Yes");
    for i in 1..n {
        println!("{}", distance[i].1 + 1);
    }
}


Measured memory_bytes: 22040
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;
ll mod = 1e9+7;

int main(){
 ll n,k;
 cin>>n>>k;
 vector<mp> a(n+1);
 a[0] = mp(0,n);
 for(ll i=1;i<=n;i++){
  a[i] = mp( a[i-1].first + i , a[i-1].second+ n-i );
 }
 ll sum = 0;
 for(ll i=k-1;i<=n;i++){
  sum += a[i].second-a[i].first+1;
  sum %= mod;
 }
 cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 6344
# -*- coding: utf-8 -*-

A,B,M = [int(i) for i in input().rstrip().split()]
a_list = [int(i) for i in input().rstrip().split()]
b_list = [int(i) for i in input().rstrip().split()]
xyc_list = [list(map(int, input().rstrip().split())) for i in range(M)]
#-----

min_price = min(a_list) + min(b_list)

for x,y,c in xyc_list:
    price_discount = a_list[x-1] + b_list[y-1] - c
    min_price = min( min_price, price_discount)

print(min_price)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
 
#define Set(a, b) memset(a, (b), sizeof(a))
#define F first
#define S second
#define FT front()
#define BK back()
#define PB push_back
#define MP make_pair
#define repi(i, l, r) for (int i=l ; i <= (int)(r) ; ++i)
#define repd(i, r, l) for (int i=r ; i >= (int)(l) ; --i)
#define repv(x, v) for (auto (x) : v)
#define all(cont) cont.begin(), cont.end()
#define Sort(n) sort(all(n))
#define Sortcmp(n) sort(all(n), cmp)
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define nl "\n"

using namespace std;

bool cmp(const pair<long,long> &a,
              const pair<long,long> &b)
{
    return (a.second < b.second || (a.second == b.second && a.first < b.first));
}

bool binarySearch(int arr[], int n, int x){
    int k = 0;
    for (int b = n/2; b >= 1; b/2)
        while (k+b < n && arr[k+b] <= x) k += b;

    if (arr[k] == x) return k;
    return -1;
}

/* ASCII Table */
/* 48 == '0', 57 = '9', 65 == 'A', 90 == 'Z', 97 == 'a', 122 == 'z' */  

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

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

    long ar[100001];
    Set(ar, 0);
    long i = 1, inc = 2;
    while(i <= 100000){
        ar[i] = inc;
        i += inc;
        inc++;
    }

    vector<long> mat[100000];

    long n;

    cin >> n;

    if(ar[n]){
        cout << "Yes\n";
        cout << ar[n] << nl;
        inc = 1;
        repi(i, 0, ar[n]-1){
            repi(j, i+1, ar[n]-1){
                mat[i].PB(inc);
                mat[j].PB(inc);
                inc++;
            }
        }
        repi(i, 0, ar[n]-1){
            cout << mat[i].size() << " ";
            bool first = true;
            while(!mat[i].empty()){
                if(!first) cout << " ";
                cout << mat[i].back();
                mat[i].pop_back();
                first = false;
            }
            cout << nl;
        }

    } else {
        cout << "No";
    }
    cout << nl;

    return 0;
}

/* Compile */
// g++ -std=c++11 -O2 -Wall test.cpp -o test
 
 
/* Source code dengan case
 
int main(){
    int T;
    cin >> T;
    for(int counterT = 1 ; counterT <= T ; T++){
         
        printf("%d\n", ans);
    }
    return 0;
}
 */
 
/* Source code dengan case
 
int main(){
    int T;
    cin >> T;
    for(int counterT = 1 ; counterT <= T ; T++){
         
        printf("Case #%d: %d\n", counterT, ans);
    }
    return 0;
}
 */

Measured memory_bytes: 6400
fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input);
    let mut nums = input.split_whitespace().map(|e| e.parse::<i32>().unwrap());
    let a = nums.next().unwrap();
    let b = nums.next().unwrap();
    let c = nums.next().unwrap();
    if a < b && b < c {
        println!("Yes");
    } else {
        println!("No");
    }
}



Measured memory_bytes: 5024
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,i,j;
    int ans[200001];
    int arr[101];
    memset(ans,0,sizeof(ans));
    cin>>n>>k;
    for(i=1;i<=n;i++)
    cin>>arr[i];
    for(i=arr[1];i<=k;i++)
    {
        int flag = 0;
        for(j=1;j<=n;j++)
        {
            if(i-arr[j]>=0)
            {
                if(ans[i-arr[j]]==0)
                flag = 1;
            }
        }
        if(flag)
        ans[i] = 1;
    }
    if(ans[k])
    cout<<"First"<<endl;
    else
    cout<<"Second"<<endl;
    
}

Measured memory_bytes: 1024
#include <iostream>
#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<long,long>
#define mid (L+R)/2
#define S second
#define F first
#define bi(x) x&-x
typedef long long ll;
using namespace std;
const int MAXN=1e5;
ll a[MAXN+10],b[MAXN+10];
ll abs1(ll x)
{
    return x<-1?-x:x;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    ll x,y;
    cin>>x>>y;
    if(abs1(x-y)>=2)
        printf("Alice\n");
    else
        printf("Brown\n");

}



Measured memory_bytes: 256
n=int(input())
m=[]
for i in range(n-1):
    tmp=list(map(int,input().split()))
    m.append(tmp[0])
m.extend(list(map(int,input().split())))
dp=[[10**9]*n for i in range(n)]
for i in range(n):
    dp[i][i]=0
for W in range(1,n):
    for l in range(n-W):
        r=l+W
        for k in range(l,r+1):
            dp[l][r]=min(dp[l][r],m[l]*m[k]*m[r+1]+dp[l][k-1]+dp[k][r])
print(dp[0][n-1])


Measured memory_bytes: 5656
import sys

input = sys.stdin.readline


def main():
    N, W = [int(x) for x in input().split()]
    WV = [[int(x) for x in input().split()] for _ in range(N)]

    sumv = 0
    for w, v in WV:
        sumv += v

    dp = [[10 ** 9 + 1] * (sumv + 1) for j in range(N + 1)]

    for i in range(1, N + 1):
        for j in range(sumv + 1):
            w, v = WV[i - 1]
            if j <= v:
                dp[i][j] = min(w, dp[i - 1][j])
            else:
                dp[i][j] = min(dp[i - 1][j], w + dp[i - 1][j - v])

    ans = 0
    for i in range(sumv + 1):
        if dp[N][i] > W:
            break
        else:
            ans = i

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 120300
using System;
class Program{
    static void Main(string[]args){
        string S=Console.ReadLine();
        long K=long.Parse(Console.ReadLine());
        int []s=new int[S.Length];
        for(int i=0;i<s.Length;i++){
            int j=1;
            s[i]=int.Parse(S.Substring(i,j));
            //Console.WriteLine(s[i]);
            j++;
        }
        for(int i=0;i<s.Length;i++){
            long count=(long)Math.Pow(s[i],5*Math.Pow(10,15));
                if(K-count>0){
                    K=K-count;
                }else{
                    Console.WriteLine(s[i]);
                    break;
                }
        }
        

    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.141592653589793238
#define dcout cout<<fixed<<setprecision(50)
#define _popcnt __builtin_popcount

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long
#define double long double

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

double dp[3000][3000];

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

  int N; double p[3000]; cin >> N;
  REP(i, N) cin >> p[i];

  dp[0][0] = 1.0;
  REP(i, N) REP(j, N){
    REP(k, 2){
      dp[i+1][j+k] += dp[i][j] * (k ? p[i] : (1.0-p[i]));
    }
  }
  double ans = 0.0;
  for(int i = ceil(N/2.0); i <= N; i++){
    ans += dp[N][i];
  }
  dcout << ans << endl;
}

Measured memory_bytes: 140928
#include <bits/stdc++.h>
#include <boost/functional/hash.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    string s;
    cin >> s;

    unordered_map<pair<string, string>, int64_t,
                  boost::hash<pair<string, string>>>
            d;
    unordered_map<pair<string, string>, int64_t,
                  boost::hash<pair<string, string>>>
            d2;
    d.emplace(make_pair("", ""), 1);
    for (auto c : s) {
        for (const auto& dd : d) {
            if (dd.first.second.size() < 2) {
                auto key = make_pair(dd.first.first, dd.first.second + c);
                d2[key] = max(d2[key], dd.second);
            }

            if (dd.first.first != dd.first.second) {
                auto key = make_pair(dd.first.second, string(1, c));
                d2[key] = max(d2[key], dd.second + 1);
            }
        }

        d.swap(d2);
        d2.clear();
    }

    int64_t m = -1;
    for (const auto& dd : d) {
        if (dd.first.first == dd.first.second && dd.first.second.size() == 1) {
            continue;
        }
        m = max(m, dd.second);
    }

    std::cout << m << endl;
}


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

int a, b, c;

int main() {
	cin >> a >> b >> c;
	int ans=0;
	if(c<=a+b+1) {
		ans=c+b;
	} else {
		ans=a+b+b+1;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    int num = 0;
    for (int i = 0; i < 3; ++i) {
        if (s.at(i) == 'o') {
            num++;
        }
    }
    cout << num*100 + 700 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
#define di(a) ('0'<=a&&a<='9')
#define az(a) ('A'<=a&&a<='Z')
#define INF 1ll<<40
using namespace std;
typedef unsigned long long ll;
string s; int n; ll tL[100],fL[100];
int fNext(int p){
	while(di(s[p]))p++;
	if(s[p]=='(')for(int d=0;p<n;p++){
		if(s[p]=='(')d++;
		if(s[p]==')'){
			d--; if(d==0)break;
		}
	}
	return p<n-1&&di(s[p+1])|az(s[p+1])?p+1:-1;
}
ll tLen(int p){
	if(tL[p])return tL[p];
	int m=0,fn=fNext(p),pp=p;
	while(di(s[p]))m*=10,m+=s[p++]-'0'; if(m==0)m=1;
	if(az(s[p]))tL[pp]=m+(fn<0?0:tLen(fn));
	else tL[pp]=m*(tLen(p+1))+(fn<0?0:tLen(fn));
	if(tL[pp]>=INF)tL[pp]=INF;
	return tL[pp];
}
ll fLen(int p){
	if(fL[p])return fL[p];
	int m=0,pp=p;
	while(di(s[p]))m*=10,m+=s[p++]-'0'; if(m==0)m=1;
	if(az(s[p]))return fL[pp]=m;
	fL[pp]=m*(tLen(p+1));
	if(fL[pp]>=INF)fL[pp]=INF;
	return fL[pp];
}
char ge(int p,int idx){
	int m=0,fn=fNext(p),pp=p;
	if(idx>=fLen(p))return fn<0?'0':ge(fn,idx-fLen(p));
	while(di(s[p]))m*=10,m+=s[p++]-'0'; if(m==0)m=1;
	if(s[p]=='('){
		if(fLen(pp)<INF)idx%=fLen(pp)/m;
		return ge(p+1,idx);
	}
	if(idx<m)return s[p];
	return ge(p+1,idx-m);
}
int main(){
	int idx;
	while(cin>>s>>idx,s[0]!='0'){
		rep(i,100)fL[i]=tL[i]=0;
		n=s.size();
		cout<<ge(0,idx)<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> x(m);
    rep(i, m) cin >> x[i];
    if (n >= m) {
        cout << 0 << endl;
        return 0;
    }
    sort(x.begin(), x.end());
    vector<ll> dif(m-1);
    ll sum = 0;
    rep(i, m-1) {
        dif[i] = x[i+1] - x[i];
        sum += x[i+1] - x[i];
    }
    sort(dif.rbegin(), dif.rend());
    //cout << sum << endl;
    //for (auto d: dif) {
    //    cout << d << " ";
    //}
    //cout << endl;
    rep(i, n) {
        if (i == 0) continue;
        sum -= dif[i-1];
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 4664
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    char s[10];
    scanf("%s",s);
    if(strlen(s)==2){printf("%s",s);}
    else{s[4]=s[0];s[0]=s[2];s[2]=s[4];printf("%c%c%c",s[0],s[1],s[2]);}
    return 0;
}

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

using namespace std;

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

const uint64_t MOD = 1e+9 + 7;
const uint64_t MAX_A = 1e+6 + 100;

namespace IntegerMath
{
  int64_t sqrt(int64_t x) {
    return static_cast<int64_t>(
      ::floorl( ::sqrtl( 
        static_cast<long double>(x)
      ) )
    );
  }
};

class Prime
{
private:
  std::set<uint64_t> _primes;

  bool _is_prmie(uint64_t n) const {
    uint64_t m = IntegerMath::sqrt(n);
    for (uint64_t d : _primes) {
      if (n % d == 0) { return false; }
      if (d > m) { break; }
    }
    return true;
  }

public:
  Prime(uint64_t n = 2) {
    _primes.insert(2);

    for (uint64_t i = 3; i <= n; i += 2) {
      if (_is_prmie(i)) {
        _primes.insert(i);
      }
    }
  }

  std::set<uint64_t> set() const { return _primes; }
};

uint64_t bin_pow(uint64_t x, uint64_t y)
{
  if (y <= 1) { return y == 0 ? 1 : (x % MOD); }

  uint64_t w = bin_pow(x % MOD, y >> 1);
  uint64_t z = (w * w) % MOD;
  if ((y & 1) == 1) {
    z = (z * x) % MOD;
  }
  return z;
}

uint64_t inv(uint64_t x)
{
  return bin_pow(x, MOD - 2);
}

int main()
{
  std::set<uint64_t> primes = Prime(1e+3 * 2).set();
  uint64_t M = primes.size();

  uint64_t N;
  cin >> N;

  vector<uint64_t> A(N);
  N_TIMES(n, N) { cin >> A[n]; }

  vector< vector<uint64_t> > b(N);
  vector<uint64_t> c(N, 1);
  N_TIMES(n, N) {
    b[n] = vector<uint64_t>(M, 0);

    uint64_t x = A[n], m = 0;
    for (const uint64_t &p : primes) {
      for (b[n][m] = 0; x % p == 0; ++b[n][m]) { x /= p; }
      if (x == 1) { break; }
      ++m;
    }

    if (x > 1) { c[n] = x; }
  }

  vector<uint64_t> B(M);
  set<uint64_t> C;
  N_TIMES(n, N) {
    N_TIMES(m, M) {
      B[m] = max(B[m], b[n][m]);
    }

    C.emplace(c[n]);
  }

  uint64_t LCM = 1;

  uint64_t m = 0;
  for (const uint64_t &p : primes) {
    LCM = (LCM * bin_pow(p, B[m])) % MOD;
    ++m;
  }
  for (const uint64_t &x : C) {
    LCM = (LCM * x) % MOD;
  }

  uint64_t S = 0;
  N_TIMES(n, N) {
    uint64_t x = (LCM * inv(A[n])) % MOD;
    S = (S + x) % MOD;
  }
  cout << S << endl;

  return 0;
}

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

string str;
string ans[6];

char c[6] = {'U','F','R','D','B','L'};

int v[6][48] = {{
     0,  1, 10,  2,  4,  5,  6,  7,
     8,  9, 11,  3, 12, 13, 14, 15,
    18, 19, 20, 21, 22, 23, 16, 17,
    24, 25, 26, 27, 28, 29, 30, 31,
    32, 33, 34, 35, 36, 37, 38, 39,
    40, 41, 42, 43, 44, 45, 46, 47
  },{
     0,  1,  2,  3,  4,  5,  6,  7,
     8,  9, 25, 17, 12, 13, 14, 15,
    16, 34, 26, 18, 10, 21, 22, 23,
    24, 35, 27, 19, 11, 29, 30, 31,
    32, 33, 28, 20, 36, 37, 38, 39,
    40, 41, 42, 43, 44, 45, 46, 47
  },{
     0,  1,  2, 19,  4,  5,  6,  7,
     8,  9, 10, 27, 12, 13, 14, 15,
    16, 17, 18, 35, 28, 20, 11, 23,
    24, 25, 26, 43, 29, 21,  3, 31,
    32, 33, 34, 30, 36, 37, 38, 39,
    40, 41, 42, 22, 44, 45, 46, 47
  },{
     0,  1,  2,  3,  4,  5,  6,  7,
     8,  9, 10, 11, 12, 13, 14, 15,
    16, 17, 18, 19, 20, 21, 22, 23,
    30, 31, 24, 25, 26, 27, 28, 29,
    32, 33, 42, 34, 36, 37, 38, 39,
    40, 41, 43, 35, 44, 45, 46, 47
  },{
     0,  1, 21, 29,  4,  5,  6,  7,
     8,  9, 10, 11, 12, 13, 14, 15,
     3, 17, 18, 19, 20, 43, 30, 22,
     2, 25, 26, 27, 28, 42, 31, 23,
    32, 33, 34, 35, 36, 37, 38, 39,
    40, 41, 16, 24, 44, 45, 46, 47
  },{
     0,  1, 31,  3,  4,  5,  6,  7,
     8,  9, 23, 11, 12, 13, 14, 15,
    24, 16,  2, 19, 20, 21, 22, 42,
    25, 17, 10, 27, 28, 29, 30, 34,
    32, 33, 18, 35, 36, 37, 38, 39,
    40, 41, 26, 43, 44, 45, 46, 47
  }
};

void solve(){
  for(int i=0;i<str.size();i++){
    for(int j=0;j<6;j++){
      if(str[i] == c[j]){
        char tmp[6][8];
        for(int k=0;k<48;k++) tmp[k/8][k%8] = ans[v[j][k]/8][v[j][k]%8];
        for(int k=0;k<48;k++) ans[k/8][k%8] = tmp[k/8][k%8];
        break;
      }
    }
  }
}

int main(){
  while(cin >> str){
    for(int i=0;i<2;i++) ans[i] = "..rr....";
    for(int i=2;i<4;i++) ans[i] = "ggyybbww";
    for(int i=4;i<6;i++) ans[i] = "..oo....";
    solve();
    for(int i=0;i<6;i++) cout << ans[i] << endl;
  }
}

Measured memory_bytes: 1176
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	private boolean check(int n) {
		char[] c = String.valueOf(n).toCharArray();

		boolean result = true;
		for (int i = 0; i < c.length / 2; i++) {
			if (c[i] != c[c.length - i - 1]) {
				result = false;
			}
		}

		return result;

	}

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int A = sc.nextInt();
		int B = sc.nextInt();

		sc.close();

		int ans = 0;

		for (int x = A; x <= B; x++) {
			if (check(x)) {
				ans++;
			}
		}

		out.println(ans);

	}

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


Measured memory_bytes: 31060
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
for i in range(d):
  s.append(list(map(int,input().split())))
last=[0]*26
score=0
solution=[]
for day in range(1,d+1):
  co=[]
  dla=[]
  down=0
  for (i,j) in zip(last,c):
    down+=(day-i)*j
  for (i,j) in zip(last,c):
    dla.append(down-(j*(day-i)))
  for con in range(26):
    co.append(s[day-1][con]-dla[con])
  choice=co.index(max(co))
  score+=co[choice]
  last[choice]=day
  #print(choice+1)
  #print(score)
  solution.append(choice)
#print(score)
stemp=7500
etemp=1
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(5)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[day-i][j]
  try:
    prob = math.exp((sc-score)/tem())
  except:
    prob=0
  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    score=sc
    #print(score)
for i in solution:
  print(i+1)
#print(sco)


Measured memory_bytes: 10516
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,k;cin>>n>>k;
  ll t[n],d[n];
  vector<pair<ll,ll>> v;
  for(ll i=0;i<n;i++){
    cin>>t[i]>>d[i];
    v.push_back(make_pair(d[i],t[i]));
  }
  sort(v.begin(),v.end(),greater<pair<ll,ll>>());
  bool used[n+1],used2[n+1];
  fill(used,used+n+1,false);
  fill(used2,used2+n+1,false);
  ll h=k;
  vector<ll> tu,notu;
  ll syu=0;
  for(ll i=0;i<n;i++){
    ll vs=v[i].second;
    if(used2[vs]==false){
      used[i]=true;
      used2[vs]=true;
      h--;
      syu++;
      tu.push_back(i);
    }
    if(h==0)break;
  }
  reverse(tu.begin(),tu.end());
  if(h>0){
    for(ll i=0;i<n;i++){
      if(used[i])continue;
      used[i]=true;
      h--;
      if(h==0)break;
    }
  }
  for(ll i=0;i<n;i++){
    if(used[i]==false)notu.push_back(i);
  }
  ll num=0;
  for(ll i=0;i<tu.size();i++){
    if(num>=notu.size())break;
    ll now=tu[i];
    ll ata=v[now].first;
    ll aite=v[notu[num]].first;
    if(aite>2*syu-1+ata){
      used[now]=false;
      used[notu[num]]=true;
      num++;
      syu--;
    }
    else break;
  }
  ll ans=0;
  bool uu[n+1];
  ll ka=0;
  fill(uu,uu+n+1,false);
  for(ll i=0;i<n;i++){
    if(used[i]){
      ans+=v[i].first;
      ll yyy=v[i].second;
      if(uu[yyy]==false){
        ka++;
        uu[yyy]=true;
      }
    }
  }
  cout<<ans+ka*ka<<endl;
}
    

Measured memory_bytes: 5488
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


void infeasible()
{
  std::cout << -1 << std::endl;

  exit(0);
}


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int K, A[111111];

  std::cin >> K;

  for (int i = 0; i < K; i ++)
    std::cin >> A[i];

  if (A[K - 1] != 2)
    infeasible();

  long long l = 2, u = 2;

  for (int i = K - 1; i >= 0; i --) {
    long long ll = (l + A[i] - 1) / A[i] * A[i], uu = u / A[i] * A[i] + A[i] - 1;

    if (ll > u)
      infeasible();

    l = ll;
    u = uu;
  }

  std::cout << l << ' ' << u << std::endl;

  return 0;
}


Measured memory_bytes: 888
x=int(input())
l=[]
for i in range(1,33):
    for j in range(2,11):
        if i**j<=1000:
            l.append(i**j)
s=sorted(list(set(l)))
for i in s:
    if x<i or x==1000:
        print(s[s.index(i)-1])
        break
        
    



Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int,int>;
using Graph = vector<vector<int>>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); ++i)
 
constexpr double PI = acos(-1);
int alre[1000000];
int main() {
    ll n,k;
    cin >> n >> k;
    vector<int> g(n+1,0);
    int a;
    rep(i,n) {
        cin >> a;
        g.at(i+1) = a;
    }
    vector<int> log;
    int nowPos;
    nowPos = 1;
    log.emplace_back(1);
    ll s,e,flag,loop;
    s = e = flag = loop = 0;
    rep(i,k+1) {
        int ii = i + 1;
        nowPos = g.at(nowPos);
        log.emplace_back(nowPos);
        if(flag == 0 && alre[nowPos]) {
            s = ii;
            flag++;
        } else if(flag == 1 && log.at(ii)==log.at(s)) {
            flag++;
            e = ii;
            loop = (k-s)%(e-s);
            break;
        }
        alre[nowPos]=1;
    }
    if(loop==0 && flag<2) {
        cout << log.at(k) << "\n";
        return 0;
    }
    nowPos = log.at(s+loop);
    cout << nowPos << "\n";
    return 0;
}

Measured memory_bytes: 6760
import java.io.BufferedInputStream;
        import java.util.Scanner;

/**
 *
 */
public class Main {

    public static void solve(){
        Scanner sc = new Scanner(new BufferedInputStream(System.in));
        String[] str = sc.nextLine().split(" ");
        if (str[0].charAt(str[0].length()-1) == str[1].charAt(0) &&
                str[1].charAt(str[1].length()-1) ==
                        str[2].charAt(0)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }
    public static int gcd(int a, int b){
        return b==0 ? a : gcd(b, a % b);
    }

    public static void solve2(){
        Scanner sc = new Scanner(new BufferedInputStream(System.in));
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (c % gcd(a,b)==0){

            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }
    public static void main(String[] argc) {
        solve2();
    }
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
//const int INF = INT_MAX  ;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

const int mod = 1000000007;

typedef tuple<ll, int, int, int> PC;

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

    string s;
    cin >> s;

    vector<ll> dp(n + 1, 0);
    for (int i = 1; i < n; i++) {
        if (s[i - 1] == 'A' && s[i] == 'C') {
            dp[i] = dp[i - 1] + 1;
        } else {
            dp[i] = dp[i - 1];
        }
    }

    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        l--;
        r--;
        cout << dp[r] - dp[l] << endl;
    }


}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    ll K, N;
    cin >> K >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A.at(i);
    sort(all(A));
    vector<ll> D(N);
    rep(i,N){
        if(i==N-1){
            D.at(i) = A.at(0) + K - A.at(i);
        }else{
            D.at(i) = A.at(i+1)-A.at(i);
        }     
    }
    sort(all(D),greater<ll>());
    cout << K - D.at(0) << endl;
    return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        final int likeNum = 753;
        int ans = 10000;
        for (int i = 0; i < s.length() - 2; i++) {
            int subNum = Integer.parseInt(s.substring(i, i+3));
            int abs = Math.abs(likeNum - subNum);
            ans = (abs < ans)? abs : ans ;
        }
        System.out.println(ans);

    }
}

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

int main(void) {
  int N, K;
  string S;
  cin >> N >> K >> S;

  if(S[K-1]=='A')
    S[K-1]='a';
  if(S[K-1]=='B')
    S[K-1]='b';
  if(S[K-1]=='C')
    S[K-1]='c';
  
  cout << S << endl;

  return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
ans=True
if n>1:
  for i in range(n-1):
    if a[n-1-i]+1<a[n-2-i]:
      ans=False
      break
    elif a[n-1-i]+1==a[n-2-i]:
      a[n-2-i]-=1
if ans:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long a,b,c,d,e,f,g,h,i,N;
  cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> e;
    cin >> f;
    cin >> g;
    cin >> h;
    cin >> i;
  cin >> N;
 vector<int> vec(N);
for (int k = 0; k < N; k++) {
  cin >> vec.at(k);
  if (vec.at(k)==a) {a=101;}
  if (vec.at(k)==b) {b=101;}
  if (vec.at(k)==c) {c=101;}
  if (vec.at(k)==d) {d=101;}
  if (vec.at(k)==e) {e=101;}
  if (vec.at(k)==f) {f=101;}
  if (vec.at(k)==g) {g=101;}
  if (vec.at(k)==h) {h=101;}
  if (vec.at(k)==i) {i=101;}
} 
  if (a*b*c==1030301 || d*e*f==1030301 || g*h*i==1030301 || a*d*g==1030301 || b*e*h==1030301 || c*f*i==1030301 || a*e*i==1030301 || c*e*g==1030301) {
  cout << "Yes" << endl;
  }
  else {
  cout << "No" << endl;  
  }
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        int sum = 0;
        for(int i=0;i<n;i++){
            x[i] = sc.nextInt();
            sum+=x[i];
        }
        int res1_ave = sum/n;
        int res2_ave = sum/n + 1;
        int res1 = 0;
        int res2 = 0;
        for(int i=0;i<n;i++){
            res1 += (x[i]-res1_ave)*(x[i]-res1_ave);
            res2 += (x[i]-res2_ave)*(x[i]-res2_ave);
        }
        if(res1>res2){
            System.out.println(res2);
        }
        else{

            System.out.println(res1);
        }



    }
}


Measured memory_bytes: 22612
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(){
	int n,cnt=0,i,j;
	long long int d;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%lld", &d);
		if (d == 2||d==3||d==5||d==7) cnt++;
		for (j = 3;j<=(int)sqrt((double)d) ; j+=2) {
			if (d%j == 0||d%2==0) break;
			if(j>=(int)sqrt((double)d)-1)	cnt++;
		}
	}
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 596
import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
sumnum = 0
for key,value in c.items():
    if value >= 2:
        sumnum += value*(value-1)//2

for i in range(n):
    key = [a[i]]
    ans = sumnum
    value = c[a[i]]
    if value >= 3:
        ans -= value*(value-1)//2
        ans += (value-2)*(value-1)//2
    if value <= 2:
        ans -= value*(value-1)//2
    print(ans)

Measured memory_bytes: 90188
import re

s = input()
s = s.translate(str.maketrans({'A': 'x', 'C': 'x', 'G': 'x', 'T': 'x'}))
s = re.sub(r'[^x]', ' ', s)
s_ls = list(map(len, (s.split())))
if len(s_ls) == 0:
    print(0)
else:
    s_ls.sort()
    print(s_ls[-1])


Measured memory_bytes: 38768
A, B, C = map(int, input().split())
K       = int(input())

if A >= B and A >= C:
    print(A * 2 ** K + B + C)
elif B >= A and B >= C:
    print(A + B * 2 ** K + C)
else:
    print(A + B + C * 2 ** K)


Measured memory_bytes: 2940
#include <iostream>
#include <utility>
#include <algorithm>
#include <set>
#include <string>
using namespace std;
signed main(void)
{
	int n, a, b;
	cin >> n >> a >> b;
	int x[100004];
	for (int i = 0; i < n; i++) {
		scanf("%d", &x[i]);
	}
	long long ans = 0;
	for (int i = 1; i < n; i++) {
		if ((long long)(x[i] - x[i - 1])*(long long)a>b)ans += b;
		else ans += (long long)(x[i] - x[i - 1])*(long long)a;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  int total_count = 0;
  for (int i = 1; i <= n; i++) {
    int count = 0;
    if (i % 2 == 0) {
      continue;
    }
    for (int j = 1; j <= i; j++) {
      if (i % j == 0) {
        count++;
      }
    }
    if (count == 8) {
      // cout << i << "[8]" << count << endl;
      total_count++;
    } else {
      // cout << i << "[not 8]" << count << endl;
    }
  }
  cout << total_count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  string s,t,u;cin>>s>>t;
  int a,b;cin>>a>>b;
  cin>>u;

  if(s==u)a--;
  else b--;
  cout<<a<<' '<<b<<endl;
  
  return 0;
}


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

int main()
{
  // ここにプログラムを追記
  double R, G;
  cin >> R >> G;

  if (R < G)
  {
    cout << R + ((G - R) * 2) << endl;
  }
  else
  {
    cout << R - ((R - G) * 2) << endl;
  }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));

		int H = Integer.parseInt(br.readLine());

		int[] A = new int[H+1]; //A[0...H]
		String[] data = br.readLine().split(" ");
		for (int i=0; i < H; i++) {
			A[i+1] = Integer.parseInt(data[i]);
		}

		buildMaxHeap(A);

		for (int i=1; i < H+1; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
	}

	// index of left child of Node of index i
	private static int left(int i) {
		return i*2;
	}

	// index of right child
	private static int right(int i) {
		return i*2 + 1;
	}

	// index i ???Node????????¨?????????????????????????????¨????????????
	// 3??????Node??????????????????????????§???????????????????????´??????
	public static void maxHeapify(int[] A, int i) {
		int H = A.length - 1; // A[0...H]
		int l = left(i);
		int r = right(i);
		int largest;

		//????????????????????????????????§???????????§????????????????????¶
		if (l <= H && A[l] > A[i]) largest = l;
		else largest = i;
		if (r <= H && A[r] > A[largest])
			largest = r;

		if (largest != i) { // i???????????????????????§????????´???
			int temp = A[i];
			A[i] = A[largest];
			A[largest] = temp;
			maxHeapify(A, largest);
		}
	}

	// H/2 = q -> H = 2q or H = 2q + 1
	// i = H/2 +1 -> 2i >= H+1 ?????£???i?????????????????¨?????????
	public static void buildMaxHeap(int[] A) {
		int H = A.length - 1;
		for (int i = H/2; 0 < i; i--) {
			maxHeapify(A, i);
		}
	}
}

Measured memory_bytes: 95576
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=200001 ;
int main()
{
   fast ;
   ll x ; cin>>x ;
   ll p=100 ;
   for(ll i=1;i<=1000001;i++)
   {
       p+=p/100 ;
       if(p>=x)
       {
           cout<<i ; exit(0) ;
       }
   }




}



Measured memory_bytes: 3684
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		char[] c = str.toCharArray();
		String ans = "Yes";

		if (str.length() % 2== 1) {
			ans = "No";
			System.out.println(ans);
			return;
		}
		for (int i=0; i < str.length(); i++) {
			if (i % 2 == 1) {
				if (c[i] != 'i') {
					ans = "No";
					break;
				}
			}
			if (i % 2 == 0) {
				if (c[i] != 'h' ) {
					ans = "No";
					break;
				}
			}
		}

		scan.close();
		System.out.println(ans);
	}
}


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

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define endl '\n'
#define FASTIO std::ios::sync_with_stdio(false)

#define PRIME (1000000007)
#define oo (1 << 30)

#define debug(x) cerr << #x << " = " << x << endl
#define all(x) x.begin(), x.end()

#define loop(i, begin, end)                            \
  for (__typeof(end) i = (begin) - ((begin) > (end)); \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

template <class T>
std::vector<T> ReadVec(int n) {
    std::vector<T> answer(n);

    loop(i, 0, n) {
        std::cin >> answer[i];
    }
    return answer;
}

template <class T>
void PrintVec(std::vector<T> v) {
    loop(i, 0, v.size()) {
        std::cout << v[i] << " ";
    }
    std::cout << endl;
}

using namespace std;

int main() {
    FASTIO;

    ll n, m;
    ll sum = 0;
    cin >> n >> m;
    priority_queue<ll> v;

    loop(i, 0, n) {
        ll a;
        cin >> a;

        v.push(a);
    }

    loop(i, 0, m) {
        ll a = v.top();
        v.pop();
        a /= 2;
        v.push(a);
    }

    loop(i, 0, n) {
        ll a = v.top();
        sum += a;
        v.pop();
    }

    cout << sum << endl;
}

Measured memory_bytes: 1528
#include <stdio.h>

int main(void){

int W, H, x, y, r;

scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

if((r <= x && x <= (W-r)) && (r <= y && y <= (H-r))){
printf("Yes\n");
}else{
printf("No\n");
}

return 0;
}

Measured memory_bytes: 584
import java.util.Scanner;
public class Main{
	public static void main(String[]args){
	Scanner scan=new Scanner(System.in);
	String a=scan.next();
	boolean bool=false;
	for(int i=0;i<a.length();i++) {
		for(int j=0;j<a.length()-i+1;j++) {
			String str1=a.substring(0,j);
			String str2=a.substring(j+i,a.length());
			String str=str1+str2;
			if(str.equals("keyence")) {
				bool=true;
			}
		}
	}
	System.out.println(bool?"YES":"NO");
	}
}

Measured memory_bytes: 25940
n, k = map(int, input().split())
A = [*map(int, input().split())]
ng, ok = 0, 1<<30 # (ng,ok] = (l,r]
while ok - ng > 1:
    m = (ng + ok) // 2
    c = 0
    for a in A: c += (a-1) // m
    if c <= k: ok = m
    else: ng = m
print(ok)


Measured memory_bytes: 30840
import java.util.*;
import java.lang.*;
import java.math.*;

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

	class P {
		Double x;
		Double y;

		P() {
		};

		P(Double x, Double y) {
			this.x = x;
			this.y = y;
		}

		Double vec(P p) {
			return this.x * p.y - p.x * this.y;
		}

		P org(P p) {
			return new P(this.x - p.x, this.y - p.y);
		}
	}

	void run() {
		int n = sc.nextInt();
		double EPS = 0.00000001;
		for (int i = 0; i < n; i++) {
			P[] data = new P[4];
			for (int j = 0; j < 4; j++) {
				data[j] = new P(sc.nextDouble(), sc.nextDouble());
			}
			System.out.println(Math.abs(data[0].org(data[1]).vec(
					data[2].org(data[3]))) < EPS ? "YES" : "NO");
		}

	}

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

	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int X; cin >> X;
    int ans = 10 - X / 200 ;

    cout << ans << '\n';

    return 0;
}

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


int main(){
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    set<int> s;
    int arr[n];
    for (int i = 0 ; i < n; ++i){
        cin >> arr[i];
        s.insert(arr[i]);
    }
    cout << (s.size()==n? "YES":"NO");
    return 0;
}


Measured memory_bytes: 10368
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>
#include <fstream>

using namespace std;
using ll = long long;

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

template<typename T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};

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

    int M, D;
    cin >> M >> D;

    int ans = 0;
    FOR(m, 1, M + 1) {
        FOR(d, 1, D + 1) {
            int d1 = d % 10;
            int d10 = d / 10;
            if (d1 < 2)continue;
            if (d10 < 2)continue;
            if (d1 * d10 == m) {
                ans++;
            }
        }
    }

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

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

int main()
{
  int n, i;
  char c[20];
  while(true)
  {
    for(i = 0; i < 20; i++)
      c[i] = 0;
    c[0] = '0';
    cin >> n;
    if(n < 0)
      break;
    for(i = 0; n > 0; i++)
    {
      c[i] = n % 4 + '0';
      n = n / 4;
    }
    reverse(c, c + i);
    cout << c << endl;
  }
}

Measured memory_bytes: 1152
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>
#include <set>
#include <map>


//マクロ
/*動かない・・・
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _roverload3(_1,_2,_3,name,...) name
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(...) _roverload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
//*/
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
//*/
#define All(a) (a).begin(),(a).end()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define INFL 1e18
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
int n;
int x[100];

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

ll calc(ll a) {
	if (a == 1)return 1;
	return calc(a / 2) * 2 + 1;
}

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

	cin >> n;

	REP(i, n) {
		cin >> x[i];
	}

	int ans = INF;
	REP(i, 100) {
		int anst = 0;
		REP(j, n) {
			anst += (x[j] - i)*(x[j] - i);
		}
		chmin(ans, anst);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256