akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdint>
#include<cstdlib>
#include<cstdio>
template<int BUFSIZE>
struct ans_buf {
  char buf[BUFSIZE];
  int i;
  ans_buf(): i(0) {}
  void putZ(unsigned int v, char delim='\n') {
    unsigned int k = 1;
    while(k <= v/10) k*=10;
    for(; k>0; v%=k, k/=10) buf[i++] = (v/k)+'0';
    buf[i++] = delim;
  }
  void out() { std::fwrite(buf, 1, i, stdout); }
};
u_int64_t getZ() {
  uint64_t v = 0; int c;
  while((c = getchar_unlocked()) >= '0') v=v*10+c-'0';
  return v;
}

int const MAXN = 3e5;
int const MAXA = 6.4e5;
int N, m[MAXN], d[MAXN+1];

int main() {
  N = getZ();
  std::fill_n(m, N, 0);
  for(int i = 0; i < N; ++i) ++m[getZ()-1];
  std::fill_n(d, N+1, 0);
  for(int i = 0; i < N; ++i) ++d[m[i]];
 
  ans_buf<MAXA> buf;
  int sum_D = 0, sum_iD = N, k = 1;
  for(int ans = N; ans >= 1; --ans) {
    sum_D += d[ans];
    sum_iD -= d[ans]*ans;
    int next_k = sum_iD/ans + sum_D + 1;
    for(int i = k; i < next_k; ++i) buf.putZ(ans);
    k = next_k;
  }
  while(k <= N) { buf.putZ(0); ++k; }
  buf.out();
  return 0;
}


Measured memory_bytes: 3840
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    long res = 0;
    long r = 0;
    long g = 0;
    long b = 0;
    for (int i = 0; i < n; i++) {
      char tmp = s.charAt(i);
      if (tmp == 'R') {
        r++;
      } else if (tmp == 'G') {
        g++;
      } else {
        b++;
      }
    }

    res = r*g*b;

    for (int i = 0; i < n-2; i++) {
      for (int j = i+1; 2*j-i < n; j++) {
        int k = 2*j-i;
        char first = s.charAt(i);
        char second = s.charAt(j);
        char third = s.charAt(k);
        if (first != second && second != third && third != first) res--;
      }
    }

    // for (int i = 0; i < n - 2; i++) {
    //   for (int j = i + 1; j < n - 1; j++) {
    //     char first = s.charAt(i);
    //     char second = s.charAt(j);
    //     if (first != second) {
    //       for (int k = j + 1; k < n; k++) {
    //         if (j - i == k - j) continue;
    //         char third = s.charAt(k);
    //         if (first != third && second != third) {
    //           res++;
    //         }
    //       }
    //     }
    //   }
    // }
    System.out.println(res);
    sc.close();
  }
}

Measured memory_bytes: 36404
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define watch(x) cout<<(#x)<<" = "<<(x)<<'\n'
#define mset(a,v) memset(a,v,sizeof(a))
#define setp(x) cout<<fixed<<setprecision(x)
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e9;
const LL INF = 1e9;

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n;
    LL d,x,y;
    cin>>n>>d;
    d = d * d;

    int ans = 0;
    loop(i,0,n)
    {
        cin>>x>>y;
        if((x * x) + (y * y) <= d) ++ans;
    }

    cout<<ans<<'\n';

    /*
    int t,n;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int a[n];
        loop(i,0,n)
        {
            cin>>a[i];
        }
    }
    */

    /*
    int n;
    cin>>n;
    int a[n];
    loop(i,0,n)
    {
        cin>>a[i];
    }
    */

    /*
    cout<<ans<<'\n';

    if(f) cout<<"YES\n";
    else cout<<"NO\n";

    if(f) cout<<"Yes\n";
    else cout<<"No\n";
    */

    return 0;
}


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

	class Program
{
	static void Main(string[] args)
	{
		string input = ReadLine();
		int n=int.Parse(input);
		List<int>h= ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
		int[] cost = new int[n];
		cost[0] = 0;
		cost[1] = Math.Abs(h[1]- h[0]);
		for (int y = 2; y < n; y++)
		{
			cost[y] = Math.Min(Math.Abs(h[y] - h[y - 1]) + cost[y - 1], (Math.Abs(h[y] - h[y - 2]) + cost[y - 2]));
		}
		Write(cost[n - 1]);
	}
}

Measured memory_bytes: 17632
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    
    if op == '?':
        break
    elif op == '+':
            print(a+b)
    elif op == '-':
            print(a-b)
    elif op == '*':
            print(a*b)
    elif op == '/':
            print(a//b)


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

int main(){
    int a, b, c, cont;
    scanf("%i %i %i", &a, &b, &c);
    for(a;a <= b;a++)
    {
        if(c %a == 0)
        {
        cont++;
        }
    }
    printf("%i\n", cont);
    return 0;
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define ss string
#define ll long long int
#define Endl endl
#define forn for(long long int i=0;i<n;i++)
#define u_b upper_bound
#define rep(i,n)         for(int i=0;i<n;i++)
#define ld long double
#define tc long long t;cin>>t;while(t--)
#define fr(i,a,b)        for(long long int i=a;i<=b;i++)
#define E endl
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define V vector<ll>v;
#define aaste long long int n;cin>>n;long long int a[n];for(long long int i=0;i<n;i++)cin>>a[i];
const ll   mod=            1e9 + 7;
const ll   MOD1=           (int)1e9 + 9;
const ll   MOD2=           998244353;
const ld    pi=             atan2(0, -1);
const ld    eps=            1e-9;
ll         tests=          1;

using namespace std;
int binarySearch(int arr[], int l, int r, int x)
{
	if (r >= l) {
		int mid = l + (r - l) / 2;
		if (arr[mid] == x)
			return mid;
		if (arr[mid] > x)
			return binarySearch(arr, l, mid - 1, x);
		return binarySearch(arr, mid + 1, r, x);
	}
	return l;
}
void swap(ll *p1, ll *p2)
{
   ll temp=*p1;
   *p1=*p2;
   *p2=temp;
}
// ll ctr=1;
// ll vis[10001];
// ll color[10001];
// vector<ll>v[10001];
// void dfs(ll node,ll colr)
// {
// 	vis[node]=1;
// 	for(ll i=0;i<v[node].size();i++)
// 	{
//        if(!vis[v[node][i]])
//        {
//        	  if(color[v[node][i]]!=colr)
//        	  	ctr++;
//        	dfs(v[node][i],color[v[node][i]]);
//        }
// 	}
// }
 // for(ll i=2;i<=n;i++)
    // {
    //       ll x;
    //      cin>>x;
    //    v[i].push_back(x);
    //    v[x].push_back(i);
    // }
    // fr(i,1,n)
    // {
    // 	cin>>color[i];
    // }
    // ll result=0;
    // dfs(1,color[1]);
    // result+=ctr;
    // cout<<result;
   // for(ll i=1;i<=n;i++)
   // {
   // 	   cout<<i;
   // 	for(ll j=0;j<v[i].size();j++)
   // 	{
   // 		cout<<"-"<<v[i][j];
   // 	}
   // 	cout<<endl;
   // }
int main()
{
    #ifndef ONLINE_JUDGE
	{
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	}
   #endif
  
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll flag=1;
    while(a>=1&&c>=1)
    {
      if(flag)
      {
      	c-=b;
      	flag=0;
      }
      else
      {
      	a-=d;
      	flag=1;
      }
    }
    if(a>0)
    {
    	cout<<"Yes";
    }
    else
    	cout<<"No";
}



Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define assn(n,a,b) assert(n<=b && n>=a)
using namespace std;
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,b) for(i=0;i<b;i++)
#define rep1(i,b) for(i=1;i<=b;i++)
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long LL;
#define MOD 1000000007
LL mpow(LL a, LL n)
{LL ret=1;LL b=a;while(n) {if(n&1)
    ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;}
return (LL)ret;}
#define MAXK 100000
#define MAXN 1000000000
int ar[MAXK];
int get(int n, int k){
    int i=0;
    while(i<k and ar[i]<=n)i++;
    return n-i;
}
typedef unsigned long long int ULL;
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()

bool isSafe(int r, int c, vector<vector<int> > arr) {
	int n = arr.size();
	int m = arr[0].size();
	return (r>=0 && r<n && c>=0 && c<m);
}

/////////////////////////////////////////////////////////////
bool diffSign(int a,int b) {
	return ((a>0 && b<0) || (a<0 && b>0));
}  

int main() 
{ 
	LL a,b,x;
	cin>>a>>b>>x;
	LL mn = (a%x == 0) ? a : ((x*(a/x))+x);
	LL mx = x*(b/x);
	cout<<((mx-mn)/x)+1<<endl;
	return 0; 
} 


Measured memory_bytes: 256
import java.util.*;

public class Main {

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

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<Long> a = new ArrayList<>();
		for(int i=0; i<n; i++) {
			long v = sc.nextLong();
			if(v==0) {
				System.out.println(0);
				sc.close();
				return;
			}
			a.add(v);
		}
		long ans = 1;
		long MAX = (long)1e18;
		for(int i=0; i<n; i++) {
			long v = a.get(i);
			if(ans > MAX/v) {
				System.out.println(-1);
				sc.close();
				return;
			}
			ans *= v;
		}
		System.out.println(ans);
		sc.close();
	}


}

Measured memory_bytes: 59084
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double PI = 3.14159265358979;
const double E = 2.718281828459045;
const double root2 = sqrt(2);
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	ll n, m;
	while (cin >> n >> m) {
		if (n == 0)break;
		pair<ll,ll> p[10000];
		int D, P;
		for (ll i = 0; i < n; i++) {
			cin >> D >> P;
			p[i] = make_pair(P, D);
		}
		sort(p, p + n);
		ll count = 0;
		for (ll i = n - 1; i >= 0; i--) {
			ll x = min(p[i].second, m);
			m -= x; p[i].second -= x;
			count += p[i].first*p[i].second;
		}
		cout << count << endl;
	}
	return 0;
}



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

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

typedef long long ll;

const char nl = '\n' ;
const ll MOD = 1e9 + 7;


int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);
   string s, t; cin >> s >> t;
   sort(all(s));
   sort(all(t));
   reverse(all(t));
   if(s < t)
      cout << "Yes" << nl;
   else
      cout << "No" << nl;
   return 0;
}


Measured memory_bytes: 3656
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    static final FS sc = new FS();  // 封装输入类
    static final PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int[] a = sc.nextArray(n);
        Arrays.sort(a);
        long res = a[n - 1];
        int count = 1;
        for(int i = n - 2;i >= 0;i--) {
            if (count == n - 1) {
                break;
            }
            if (count == n - 2) {
                res += a[i];
                count += 1;
            } else {
                res += (long) a[i] * 2;
                count += 2;
            }
        }
        pw.println(res);
        pw.flush();
    }

    static class FS {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        String next() {
            while(!st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch(Exception ignored) {}
            }
            return st.nextToken();
        }
        int[] nextArray(int n) {
            int[] a = new int[n];
            for(int i = 0;i < n;i++) {
                a[i] = nextInt();
            }
            return a;
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 55748
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,e) for(ll i=0;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;
struct Dijkstra{
    vector<long long> cost;
    vector<vector<P>> hen;
    queue<long long> find;
    Dijkstra(long long N,long long S): cost(N,INF),hen(N){
        
        cost.at(S)=0;
        find.push(S);
    }

    void search(){
        while(!find.empty()){
            long long  f=find.front();
            find.pop();
            for(long long  i=0;i<hen.at(f).size();i++){
                if(cost.at(hen.at(f).at(i).first)>cost.at(f)+hen.at(f).at(i).second){
                    find.push(hen.at(f).at(i).first);
                    cost.at(hen.at(f).at(i).first)=cost.at(f)+hen.at(f).at(i).second;
                }
            }
        }
    }
};

ll i;


int main(){
    ll N;
    cin>>N;
    V u(N-1),v(N-1),w(N-1);
    rep(i,N-1)cin>>u.at(i)>>v.at(i)>>w.at(i);

    Dijkstra tree(N,0);
    rep(i,N-1){
        tree.hen.at(u.at(i)-1).push_back(P(v.at(i)-1,w.at(i)));
        tree.hen.at(v.at(i)-1).push_back(P(u.at(i)-1,w.at(i)));
    }

    tree.search();
    rep(i,N){
        if(tree.cost.at(i)%2)cout<<1;
        else cout<<0;
        cout<<endl;
    }
}


Measured memory_bytes: 11008
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
max_digit = 60


result = 0
base = 1
for _ in range(max_digit + 1):
  c0 = 0
  for i in range(N):
    a = A[i] % 2
    A[i] >>= 1
    c0 += (a==0)
  
  result = (result + (base*(N - c0)*c0) % MOD) % MOD
  base = base*2 % MOD

print(result)

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

using namespace std;

double prob[100000];
double dp[3000][3000];

int main(){

    int N;
    cin >> N;

    for(int i = 1; i <= N; i++)
        cin >> prob[i];

    dp[0][0] = 1;

    for(int i = 1; i <= N; i++)
        dp[i][0] = dp[i-1][0] * (1-prob[i]);

    for(int i = 1; i <= N; i++)
        for(int j = 1; j <= i; j++)
            dp[i][j] = prob[i]*dp[i-1][j-1] + dp[i-1][j]*(1-prob[i]);

    double ans;

    for(int i = 1; i <= N; i++) if(2*i > N) ans += dp[N][i];
     cout<<fixed<<setprecision(20)<<ans;
}


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

import numpy as np

def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return np.array(x)

N = int(input())

if N%1000 > 0:
    print(1000-N%1000)
else:
    print(0)

Measured memory_bytes: 27136
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;


/* TEMPLATE ENDS HERE */

#define MAXN (1 << 20)

ll n, c;
ll x[MAXN];
ll v[MAXN];
ll a[MAXN];
ll ret;

void solve() {
	x[n] = c;
	a[n] = 0;
	for (int i = n - 1; i >= 0; i--) {
		a[i] = a[i + 1] + v[i];
		a[i] -= x[i + 1] - x[i];
	}
	for (int i = n - 2; i >= 0; i--) {
		a[i] = max(a[i], a[i + 1]);
	}
	for (int i = 0; i < n; i++) {
		ret = max(ret, a[i]);
	}
	ll cum = 0;
	for (int i = 0; i < n; i++) {
		cum += v[i];
		ret = max(ret, cum - x[i]);
		ll cur = a[i + 1] + cum - 2 * x[i];
		ret = max(ret, cur);
	}
}

int main() {
	cout << fixed << setprecision(12);	
	cin >> n >> c;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> v[i];
	}
	ret = 0;
	solve();
	reverse(x, x + n);
	for (int i = 0; i < n; i++) {
		x[i] = c - x[i];
	}
	reverse(v, v + n);
	solve();
	cout << ret << endl;
	return 0;
}


ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
		x %= MOD;
	}
	
	mod& operator=(const ll & tx) {
		x = tx % MOD;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return mod((x + m2.x) % MOD);
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return mod((x - m2.x + MOD) % MOD);
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return mod((x * m2.x) % MOD);
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return (*this) * m2.inv();
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}



Measured memory_bytes: 5984
package main

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

func main() {
	var wtr = bufio.NewWriter(os.Stdout)
	var a, b, c, sum int
	fmt.Scan(&a, &b, &c)
	for {
		if a == b && b == c {
			if a%2 != 0 {
				sum = 0
			} else {
				sum = -1
			}
			break
		}
		a, b, c = b+c, c+a, a+b
		if a%2 != 0 || b%2 != 0 || c%2 != 0 {
			break
		}
		a /= 2
		b /= 2
		c /= 2
		sum++
	}
	fmt.Fprintln(wtr, sum)
	_ = wtr.Flush()
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <complex>
#define repi(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) repi(i, 0, n)
#define endl "\n"
#define int long long
using namespace std;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    while(true){
        int n, m;
        pair<int,int> ans(INF,INF);
        vector<int> s, s2;
        int p1 = 0, p2 = 0;
    
        cin>>n>>m;

        if(!n && !m) break;

        s.resize(n);

        s2.resize(m);

        for(int i = 0; i < n; i++){
            cin>>s[i];
            p1 += s[i];
        }

        for(int i = 0; i < m; i++){
            cin>>s2[i];
            p2 += s2[i];
        }

        for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                int num1 = p1 - s[i] + s2[j];
                int num2 = p2 - s2[j] + s[i];
                
                if(num1 == num2){//cout<<"<<< "<<endl;
                    // cout<<ans.first + ans.second<<" "<<s[i] + s2[j]<<endl;
                    if(ans.first + ans.second > s[i] + s2[j]){
                        ans.first = s[i];
                        ans.second = s2[j];
                    }
                }
            }
        }

        if(ans.first == INF) cout<<-1<<endl;
        else cout<<ans.first<<" "<<ans.second<<endl;
    }
    return 0;
}



Measured memory_bytes: 3120
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
	int n;
	while(true){
	cin>>n;
	if(n==0)
		break;
	if(n==1)
		cout<<"deficient number"<<endl;
	else{
	int s=1;
	for(int i=2;i*i<n;i++){
		if(n%i==0)
			s+=i+n/i;
	}
	if((int)sqrt((double)n+0.0)*(int)sqrt((double)n+0.0)==n)
		s+=(int)sqrt((double)n+0.0);
	if(s>n)
		cout<<"abundant number"<<endl;
	if(s==n)
		cout<<"perfect number"<<endl;
	if(s<n)
		cout<<"deficient number"<<endl;
	}
	}
	return 0;
}

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

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

  for(int i = 1 ; i <= N ; i++){
       cin >> S ;
    
    if( i == K ){
        S = S+32 ;
   		cout << S ; 
    }
    else{
        cout << S ; 
    }
    
  }
cout << endl ; 
}

Measured memory_bytes: 3628
#include<stdio.h>
#define SIZE 101

int main(void)
{
  int n, m, l;
  int A[SIZE][SIZE];
  int B[SIZE][SIZE];
  int i,  j, k;
  double c;

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

  for(i=1; i <= m; i++){
    for(j = 1; j <= l; j++){
       scanf("%d ", &B[i][j]);
     }
   }
  
  for(i = 1; i <= n; i++){
    for(j = 1; j <= l; j++){
      c = 0;
      for(k = 1; k <= m; k++){
        c = c + A[i][k]*B[k][j];
      }
      printf("%.0f%c", c, (j == l)?('\n'):(' '));
    }
  }
  
  return(0);
}

Measured memory_bytes: 712
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int N, A;
	cin >> N >> A;
	while (N - 500 >= 0)N -= 500;
	if (N <= A) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 10

int mypow(int n , int m) {
	int i , ans = 1;
	for(i = 0; i < m; i++) {
		ans = ans * n;
	}
	return ans;
}

void output(int ary[MAX]) {
	int i;
	int spaceFlag = 0;
	for(i = 0; i < MAX; i++) {
		if (ary[i]) {
			if (spaceFlag) {
				printf(" ");
			}
			printf("%d" , mypow(2 , i));
			spaceFlag = 1;
		}
	}
	printf("\n");
}

void getWeight(int weight) {
	int used[MAX] = {0};
	int i;
	for(i = MAX - 1; i >= 0; i--) {
		if (mypow(2 , i) <= weight) {
			used[i] = 1;
			weight = weight - mypow(2 , i);
		}
	}
	output(used);
}

int main () {
	int weight;
	while(scanf("%d" , &weight) > 0) {
		getWeight(weight);
	}
	return 0;
}

Measured memory_bytes: 600
/***"In the name of Allah(swt), the most gracious, most merciful. Allah(swt) blesses with knowledge whom he wants."***/
/*** "ALHAMDULILLAH for Everything..." ***/
#include<bits/stdc++.h>
using namespace std;
#define  fastt       ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  ll         long long
#define  debug      printf("Come here!")
#define  inf        1000000000000000000
#define  pb         push_back
#define  mp         make_pair
#define  sz(a)      a.size()
#define  mem(a,b)   memset(a,b,sizeof(a))
#define  clr(x)     x.clear()
#define  ff         first
#define  ss         second
#define  case(x)    cout << "Case " << x <<": "

#define  md         1000000007
#define  pi         acos(-1.0)
#define  cos(a)     cos(a*pi/180)
#define  sin(a)     sin(a*pi/180)
#define  tan(a)     tan(a*pi/180)
#define  cosi(a)    acos(a)/(pi/180)
#define  sini(a)    asin(a)/(pi/180)
#define  tani(a)    atan(a)/(pi/180)

#define  vl         vector <ll>
#define  vs         vector <string>
#define  vc         vector <char>
#define  vpll       vector < pair <ll, ll> >
#define  vpsl       vector < pair <string, ll> >
#define  vpls       vector < pair <ll, string> >
#define  pql        priority_queue<ll>
#define  minpql     priority_queue<ll,vector<ll>,greater<ll> >

#define  setbits(x)     __builtin_popcountll(x)
#define  zerobits(x)    __builtin_ctzll(x)

#define toll(a) atoll(a.c_str())
string tostr(ll a) {stringstream rr;rr<<a;return rr.str();}
ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}

/* mpp.max_load_factor(0.25); mpp.reserve(1024); */
/* cout << fixed << setprecision(12);*/

int main()
{
    fastt;

        ll n, m, k, i, j, x, y, p=0, s=0, h, f=0;
        cin>>n>>x>>y;
        string a;
        cin>>a;
        for(i=0; i<a.size(); i++){
            if(a[i]=='c')cout<<"No"<<endl;
            else if(a[i]=='a'){
                if((p+s)<(x+y)){
                    p++;
                    cout<<"Yes"<<endl;
                }
                else cout<<"No"<<endl;
            }
            else{
                if((p+s)<(x+y) && f<y){
                    s++;
                    f++;
                    cout<<"Yes"<<endl;
                }
                else cout<<"No"<<endl;
            }
        }

    return 0;
}



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

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

Measured memory_bytes: 256
//#pragma GCC target ("avx2,sse2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
using namespace std;

const int N = 1e6 + 9;
const int INF = 1e9;
const int mod = 1e9;
const int SZ = (1 << 17) - 1;

#define eb emplace_back
#define sz(s) (int)(s.size())

#define ll long long

const int NN = 2e3;

#define int ll

void solve() {
	int n, m;
	cin >> n >> m;
	if (m == 1 or n == 1) {
		cout << 1;
		return;
	}
	if (n & 1) {
		cout << (n / 2 + 1) * m - (m / 2);
	}
	else {
		cout << (n / 2) * m;
	}
}

signed main() {
	ios_base::sync_with_stdio(false);
	solve();
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    keyence2019a()
}

fun keyence2019a() {
    val numbers = readLine()!!.split(" ").map { it.toInt() }

    val answer = if (numbers.sorted() == listOf(1, 4, 7, 9)) "YES" else "NO"

    println(answer)
}


Measured memory_bytes: 36072
#include <iostream>
#include <string>
#define foor for(int i=0;i<n;i++)
#define en endl;
#define el else
#define co cout
#define in int
int s = 0;
using namespace std;
int main() {
	int n = 3;
	char a;
	foor{
		cin >> a;
	if (a == 'A') {
		s++;
	}
	}
	if (s!=0&&s!=3)co << "Yes"<<en
		el co<<"No"<<en
}

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

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

int ans;

int main(void) {
    int n;
    cin >> n;
    int x = n%10;

    if (x==3) {
        puts("bon");
    } else if (x==0||x==1||x==6||x==8) {
        puts("pon");
    } else {
        puts("hon");
    }
    



	return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>

int main(){
    int Sq, H, M, S;
    scanf("%d", &Sq);
    H = Sq / 3600;
    M = ( Sq - 3600 * H ) / 60;
    S = Sq - ( H * 3600 + M * 60 );
    printf("%d:%d:%d\n", H, M, S);
    return 0;
} 


Measured memory_bytes: 2100
#include "bits/stdc++.h"
using namespace std;

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int dp[120][10200] = {};
int main() {
	int r, g, b;
	cin >> r >> g >> b;
	int sum = 100 * r + 10 * g + b;
	if (sum % 4 == 0) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}
}

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

#define int long long

int MOD = 1e9 + 7;

void solve() {
    int n;
    cin >> n;
    vector<vector<int>> dp(n + 1, vector<int>(4));

    dp[0][0] = 1;

    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j < 10; ++j) {
            if (j == 0) {
                dp[i][1] = (dp[i][1] + dp[i - 1][0] + dp[i - 1][1]) % MOD;
                dp[i][3] = (dp[i][3] + dp[i - 1][2] + dp[i - 1][3]) % MOD;
            } else if (j == 9) {
                dp[i][2] = (dp[i][2] + dp[i - 1][0] + dp[i - 1][2]) % MOD;
                dp[i][3] = (dp[i][3] + dp[i - 1][1] + dp[i - 1][3]) % MOD;
            } else {
                for (int k = 0; k < 4; ++k) {
                    dp[i][k] = (dp[i][k] + dp[i - 1][k]) % MOD;
                }
            }
        }
    }

    cout << dp[n][3];
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    //cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 73236
#![doc = " # Bundled libraries"]
#![doc = ""]
#![doc = " ## `kyopro_lib` (private)"]
#![doc = ""]
#![doc = " ### Modules"]
#![doc = ""]
#![doc = " - `::__kyopro_lib::unionfind` → `$crate::unionfind`"]
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
fn main() {
    input! { n : usize , q : usize , tuv : [(i32 , usize , usize) ; q] , }
    let mut uf = unionfind::UnionFind::new(n);
    for (t, u, v) in tuv {
        if t == 0 {
            uf.unite(u, v);
        } else {
            println!("{}", if uf.is_same(u, v) { 1 } else { 0 });
        }
    }
}
pub mod unionfind {
    struct Node {
        parent: usize,
        size: usize,
    }
    pub struct UnionFind {
        node: Vec<Node>,
    }
    impl UnionFind {
        pub fn new(n: usize) -> Self {
            Self {
                node: (0..n).map(|i| Node { parent: i, size: 1 }).collect(),
            }
        }
        pub fn root(&mut self, i: usize) -> usize {
            if self.node[i].parent == i {
                return i;
            }
            let r = self.root(self.node[i].parent);
            self.node[i].parent = r;
            r
        }
        pub fn unite(&mut self, i: usize, j: usize) -> bool {
            let i = self.root(i);
            let j = self.root(j);
            if i == j {
                false
            } else {
                self.node[i].parent = j;
                self.node[j].size += std::mem::replace(&mut self.node[i].size, 0);
                true
            }
        }
        pub fn size(&mut self, i: usize) -> usize {
            let r = self.root(i);
            self.node[r].size
        }
        pub fn is_same(&mut self, i: usize, j: usize) -> bool {
            self.root(i) == self.root(j)
        }
    }
    #[test]
    fn test_unionfind() {
        let mut uf = UnionFind::new(5);
        assert_eq!(uf.size(0), 1);
        assert_eq!(uf.unite(0, 1), true);
        assert_eq!(uf.is_same(0, 1), true);
        assert_eq!(uf.size(0), 2);
        assert_eq!(uf.size(1), 2);
        assert_eq!(uf.unite(1, 2), true);
        assert_eq!(uf.is_same(0, 2), true);
        assert_eq!(uf.size(2), 3);
        assert_eq!(uf.unite(0, 0), false);
        assert_eq!(uf.size(0), 3);
    }
}


Measured memory_bytes: 10812
/*  
    |\_/|
    |* *|
    \_+_/
*/
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/


  int x,a,b;

  cin>>x>>a>>b;

  if(a-b<0){
    if(abs(a-b)>x){
      cout<<"dangerous"<<endl;
    }else{
      cout<<"safe"<<endl;
    }
  }else{
    cout<<"delicious"<<endl;
  }

  
  
  return 0;

}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int64_t choose(int64_t n) {
  return n*(n-1)/2;
}

int main() {
  int N;
  cin>>N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  vector<int> kaz(N+1);
  
  for(int i=0;i<N;i++){
    
    kaz.at(vec.at(i))++;
  }
  int64_t sum=0;
  for(int i=1;i<=N;i++){
    sum+=choose(kaz.at(i));
  }
  for(int i=0;i<N;i++){
    int64_t ans=sum-choose(kaz.at(vec.at(i)))+choose(kaz.at(vec.at(i))-1);
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 4844
#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define str string

ll MOD = 1000000007, INFL = 1ll << 60, INF = 1 << 30;
ll A[10000000] = {}, X[1000][1000] = {};
int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
vector <ll> v;
ll a = 0, m = 0, c = 0, n = 0, sum = 0, max = INF;
str S;
int ans = 0;

int findDigits(int n) {
	int i = 0;
	while (n > 0) {

		sum += n % 10;
		n /= 10;
		i++;
	}
	return i;
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Code Line
	cin >> n >> m >> c;
	for (int i = 0; i < m; i++)cin >> A[i];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++)cin >> X[i][j];
	}
	for (int i = 0; i < n; i++) {
		sum = 0;
		for (int j = 0; j < m; j++) {
			sum += X[i][j] * A[j];
		}
		if (sum + c > 0)ans++;
	}

	cout << ans << endl;
	cin >> ans;

	//Code Line
	return 0;
}


Measured memory_bytes: 2432
#include<iostream>
#include<string>
#include<map>
#define int long long int

using namespace std;

signed main(){

    int a[5], k, i, ante = 0;

    for(i = 0; i < 5; i++){
        cin >> a[i];      
    }

    cin >> k;

    for(i = 0; i < 4; i++){
        ante = ante + a[i + 1] -a[i];
    }
    
    if(ante > k){
        cout << ":(\n";
        return 0;
    }else{
        cout << "Yay!\n";
        return 0;
    }
}


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

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first

int n,k,a[100005],dp[100005];

int main(){
  cin >> n >> k;
  for(int i=0;i<n;++i){
    cin >> a[i];
  }
  dp[0]=0;
  dp[1]=abs(a[0]-a[1]);
  for(int i=2;i<n;++i){
    int mn=INT_MAX;
    for(int j=max(i-k,0);j<i;++j){
        mn=min(abs(a[j]-a[i])+dp[j],mn);
    }
    dp[i]=mn;
  }
  cout << dp[n-1];
  return 0;
}

Measured memory_bytes: 1024
#include<vector>
#include<algorithm>
#include<iostream>
#include<utility>
#include<climits>
using namespace std;



class RMQ{//RangeMinimumQuery
	int n;
	std::vector<int> dat,idx;
	static int calcsize(int n){
		int res=1;
		while(res<n)res<<=1;
		return res;
	}
	int query(int a,int b,int k,int l,int r)const{
		if(r<=a||b<=l)return dat.size()-1;
		if(a<=l&&r<=b)return idx[k];
		else{
			int vl=query(a,b,k*2+1,l,(l+r)/2);
			int vr=query(a,b,k*2+2,(l+r)/2,r);
			return dat[vl]<dat[vr]?vl:vr;
		}
	}
public:
	RMQ(){}
	~RMQ(){}
	void build(const std::vector<int> &a){
		n=calcsize(a.size());
		idx.resize(2*n-1);
		for(int i=0;i<(int)a.size();i++)idx[n-1+i]=i;
		for(int i=a.size();i<n;i++)idx[n-1+i]=a.size();
		dat=a;
		dat.push_back(INT_MAX);
		for(int i=n-2;i>=0;i--){
			idx[i]=dat[idx[i*2+1]]<dat[idx[i*2+2]]?idx[i*2+1]:idx[i*2+2];
		}
	}
	int query(int a,int b)const{//[a,b)の最小値
		return query(a,b,0,0,n);
	}
};


class LCA{
	vector<pair<int,int> > eulertour;
	vector<int> vertex;
	//SparseTableRMQ rmq;
	RMQ rmq;
	void dfs(const vector<int> edge[],int n,vector<int> &depth,int d,int u){
		eulertour[u].first=vertex.size();	
		vertex.push_back(u);
		depth.push_back(d);
		for(int i=0;i<edge[u].size();i++){
			dfs(edge,n,depth,d+1,edge[u][i]);
			eulertour[edge[u][i]].second=vertex.size();
			vertex.push_back(u);
			depth.push_back(d);
		}
	}
public:
	LCA(const vector<int> edge[],int n,int root):eulertour(n){
		vector<int> depth;
		dfs(edge,n,depth,1,root);
		eulertour[root].second=vertex.size();
		vertex.push_back(root);
		depth.push_back(0);
		rmq.build(depth);
	}
	int query(int u,int v)const{
		if(u==v)return u;
		if(eulertour[u].first<eulertour[v].first && eulertour[v].second<eulertour[u].second)
			return u;
		if(eulertour[v].first<eulertour[u].first && eulertour[u].second<eulertour[v].second)
			return v;
		if(eulertour[u].first>eulertour[v].first)swap(u,v);
		return vertex[rmq.query(eulertour[u].second, eulertour[v].first)];
	}
};


vector<int> edge[100000];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int k,v;
		cin>>k;
		for(int j=0;j<k;j++){
			cin>>v;
			edge[i].push_back(v);
		}
	}
	LCA lca(edge,n,0);
	int q,u,v;
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>u>>v;
		cout<<lca.query(u,v)<<endl;
	}
	return 0;
}

Measured memory_bytes: 16428
N = int(input())
spot = list(map(int, input().split()))
spot.insert(0, 0)
spot.append(0)
all_cost = 0
for i in range(N + 1):
    all_cost += max(spot[i + 1] - spot[i], spot[i] - spot[i + 1])
for i in range(1, N + 1):
    cost = all_cost
    if (spot[i] > spot[i - 1] and spot[i] > spot[i + 1]) or (spot[i] < spot[i - 1] and spot[i] < spot[i + 1]):
        cost -= 2 * min(max(spot[i] - spot[i - 1], spot[i - 1] - spot[i]), max(spot[i] - spot[i + 1], spot[i + 1] - spot[i]))
    print(cost)

Measured memory_bytes: 14172
#include <bits/stdc++.h>
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;
    int n;
    vector<long long> s(n);
    bool binary(long long key,int k){
    	long long left = -1;
    	long long right = k;
    	
    	bool go = false;
    	while(right -left > 1){
    	long long mid = left + (right - left)/2;
    	
    		if(s[mid] == key){
    			go = true;
    			return go;
    		} else if(s[mid] > key){
    			right = mid;
    		} else{
    			left = mid;
    		}
    	}
    	
    	return go;
    }
    int main() {
    int q;
    cin >> n;
    s.resize(n);
    rep(i,n)	cin >> s[i];
    cin >> q;
    long long t[q]; 
    rep(i,q)	cin >> t[i];
    int count = 0;
    rep(i,q){
    	bool can = binary(t[i],n);
    	if(can) count++;
    }
   	cout << count << endl;
     return 0;
    }
    


Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
   vector<int> n(3);
   for(int i=0;i<3;i++){
      cin >> n[i];
   }
   sort(n.begin(),n.end());
   cout << abs(n[0] - n[1])+abs(n[1] - n[2]) << endl;
   return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextInt();
            }

            boolean approve = true;
            for (int a : A) {
                if (a % 2 == 0) {
                    if (a % 3 != 0 && a % 5 != 0) {
                        approve = false;
                        break;
                    }
                }
            }

            if (approve) {
                System.out.println("APPROVED");
            } else {
                System.out.println("DENIED");
            }
        }
    }

}


Measured memory_bytes: 23764
#include <stdio.h>
int A[2000],M[2000],n;
int main(){
  int q,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&M[i]);
  }
  for(i=0;i<q;i++){
    if(solve(0,M[i]) > 0) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int x,int m){
  int res;
  if(m==0) return 1;
  if(x>=n) return 0;
  res = solve(x+1,m)+solve(x+1,m-A[x]);
  return res;
}

Measured memory_bytes: 584
#include <iostream>

using namespace std;

const int MOD = 1'000'000'007;

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

	int count[3] = {};
	long long result = 1;
	for(int i = 0; i < N; i++) {
		int A;
		cin >> A;
		
		// Aの色の可能性の数
		int n = 0;
		for(int j = 0; j < 3; j++) {
			if(A == count[j]) {
				n++;
			}
		}

		result = (n * result) % MOD;

		// Aの色を一つに決める
		for(int j = 0; j < 3; j++) {
			if(A == count[j]) {
				count[j]++;
				break;
			}
		}
	}

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		char[] str = sc.next().toCharArray();

		long sum = 0;
		for(int i = 0; i < str.length; i++){
			sum += str[i] - '0';
		}

		System.out.println(sum % 9 == 0 ? "Yes" : "No");
	}
}


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

using ll = long long int;

const int MAX_N = (int)(1e5 + 5);

int n;
ll a, b;
ll x[MAX_N];

ll len[MAX_N];
ll acc_len[MAX_N];

ll ans = (ll)(1e17 + 5);

int main(void) {
  // Here your code !
  scanf("%d %lld %lld", &n, &a, &b);
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(x[i]));
  }

  for (int i = 0; i < n - 1; ++i) {
    len[i] = x[i + 1] - x[i];
  }
  sort(len, len + n - 1);

  acc_len[1] = len[0];
  for (int i = 2; i < n; ++i) {
    acc_len[i] += len[i - 1] + acc_len[i - 1];
  }

  for (int t = 0; t < n; ++t) {
    ans = min(ans, b * t + a * (acc_len[n - 1 - t]));
  }

  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        List<Tuple<long, long>>[] from = new List<Tuple<long, long>>[n + 1];
        for (int i = 0; i < n + 1; i++)
        {
            from[i] = new List<Tuple<long, long>>();
        }
        for (int i = 0; i < n - 1; i++)
        {
            long a = sc.NextLong();
            long b = sc.NextLong();
            long c = sc.NextLong();
            from[a].Add(Tuple.Create(b, c));
            from[b].Add(Tuple.Create(a, c));
        }

        long q = sc.NextLong();
        long k = sc.NextLong();

        long[] dists = new long[n + 1];
        for (int i = 0; i < n + 1; i++)
        {
            dists[i] = long.MinValue;
        }

        Queue<Tuple<long, long>> que = new Queue<Tuple<long, long>>();
        que.Enqueue(Tuple.Create(k, (long)0));
        while (que.Count > 0)
        {
            var item = que.Dequeue();
            var point = item.Item1;
            var cost = item.Item2;
            if (dists[point] != long.MinValue)
            {
                continue;
            }
            dists[point] = cost;
            foreach (var target in from[point])
            {
                que.Enqueue(Tuple.Create(target.Item1, cost + target.Item2));
            }
        }

        for (int i = 0; i < q; i++)
        {
            long x = sc.NextLong();
            long y = sc.NextLong();

            long answer = dists[x] + dists[y];
            Console.WriteLine(answer);
        }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

using namespace std;

int main()
{
	string a, b, c;
	cin >> a >> b >> c;
	
	if(*(a.end() - 1) == *b.begin() && *(b.end() - 1) == *c.begin())
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
// ABC067_A.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if(a <= c && c <= b){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}



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

using namespace std;

#define INF 1000000000
#define INFLL 0x3f3f3f3f3f3f3f3fLL 
#define EPS 10e-9
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define st first
#define nd second
#define sz(v) int(v.size())
#define all(X) (X).begin(), (X).end()
#define FOR(I, A, B) for(int I = A; I < B; I++)
#define RFOR(I, A, B) for(int I = A; I >= B; I--)

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<iii> viii;
typedef vector<ll> vll;

int n, m, x;
int ans = INF;
vvi books;

void rec(int i, vi &sum){
	if(i == n){
		for(int j = 1; j <=m; j++){
			if(sum[j] < x) return;
		}
		ans = min(ans, sum[0]);
		return;
	}
	rec(i+1, sum);
	for(int j = 0; j <=m; j++){
		sum[j] += books[i][j];
	}
	rec(i+1, sum);
	for(int j = 0; j <=m; j++){
		sum[j] -= books[i][j];
	}
}

int main(){
	scanf("%d %d %d", &n, &m, &x);
	books.assign(n, vi(m+1));
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= m; j++){
			scanf("%d", &books[i][j]);
		}
	}
	vi sum(m+1, 0);
	rec(0, sum);
	if(ans == INF) ans = -1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3692
#include <stdio.h>
int main(){
	int i,n,a,b,s,mn=1e9;
	scanf("%d",&n);
	for(i=1;i<n;++i){
		s=0;
		for(a=i;a;a/=10)s+=a%10;
		for(b=n-i;b;b/=10)s+=b%10;
		if(mn>s)mn=s;
	}
	printf("%d",mn);
	return 0;
}


Measured memory_bytes: 128
#define DEBUG(...) cerr << __VA_ARGS__ << endl;

#ifndef CDEBUG
#undef DEBUG
#define DEBUG(...) ((void)0);
#define NDEBUG
#endif

#define ran(i, a, b) for (auto i = (a); i < (b); i++)

#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;
#ifndef M_PI
const double M_PI = acos(-1.0);
#endif
int a[100111];
ll a_sum[100111];

int main() {
  int n;
  cin>>n;
  ll l=1;
  ll r=0;
  for(int i=0; i<=n; ++i){
    scanf("%d", a+i);
  }
  for(int i=n; i>=0; --i){
    a_sum[i] = a_sum[i+1] +a[i];
  }
  for(int i=0; i<=n; ++i){
    r += l;
    l -= a[i];
    if(l < 0){
      r = -1;
      break;
    }
    l = min(l*2, a_sum[i+1]);
  }
  cout<<r<<endl;
  return 0;
}


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

int main() {
  int n;
  cin>>n;
  vector<string> s(n);
  rep(i,n){
    cin>>s[i];
  }
  int m;
  cin>>m;
  vector<string> t(m);
  rep(i,m){
    cin>>t[i];
  }
  int max_ans=0;
  for(auto x : s){
    int ans=0;
    rep(i,n){
      if(s[i]==x)ans++;
    }
    rep(i,m){
      if(t[i]==x)ans--;
    }
    max_ans=max(max_ans,ans);
  }
  cout<<max_ans<<endl;
}


Measured memory_bytes: 256
s = input()
lisS = []
lisT = []
for i in range(len(s)):
  if s[i] == 'S':
    lisS.append(i)
  else:
    lisT.append(i)
ans = 0
cnt = 0
cs = 0
ct = 0
while cnt < len(s)//2:
  if lisS[cs] < lisT[ct]:
    cs += 1
    ct += 1
    ans += 2
  else:
    ct += 1
  cnt += 1
print(len(s)-ans)

Measured memory_bytes: 11368