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

#define sswap(x, y) { x+=y; y=x-y; x-=y; }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	int a, b, k;
	cin >> a >> b >> k;
	int i = min(a, b)+1;
	while (k) {
		i--;
		if (!(a%i) && !(b%i)) k--;
	}
	cout << i << ende;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    int N, A, B;
    cin >> N >> A >> B;
    if ((B - A) % 2 == 1){
        cout << "Borys" << endl;
    }
    else {
        cout << "Alice" << endl;
    }
}




Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
money=1000
i=0
while i<N-1:
    k=1
    while A[i]==A[i+k]:
        if i+k==N-1:
            i=i+k
            break
        else:
            k+=1
    if i==N-1:
        break
    if A[i+k]>A[i]:
        kabu=money//A[i]
        money-=kabu*A[i]
        money+=kabu*A[i+k]
        i=i+k
    elif A[i+k]<A[i]:
        i=i+k

print(money)

Measured memory_bytes: 9080
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define msp multiset < pair < long long , long long > > S;
#define pll pair<lli, lli>
#define mll map<lli, lli>            //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x) // also valid for set and multiset
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
//string binary = bitset<32>(n).to_string();  
   vl v[10001] ;   //To determine the level of each node
    bool vis[10001]; //Mark the node if visited 
    lli t[10001];
    lli ans[10001];
    lli j=0;
    void bfs(lli s) {
        queue <lli> q;
        q.push(s);
        vis[s] = true;
        while(!q.empty())
        {
            lli p = q.front();
            q.pop();
            ans[p]=t[j];
            //cout<<p<<endl;
            j++;
            for(lli i = 0;i < v[p].size() ; i++)
            {
                if(vis[ v[ p ][ i ] ] == false)
                {
            //Setting the level of each node with an increment in the level of parent node
                     q.push(v[ p ][ i ]);
                     vis[ v[ p ][ i ] ] = true;
      			}
            }
        }
    }
int main()
{
 	ios::sync_with_stdio(0);
    cin.tie(0);
    lli n;
    cin>>n;
    for(lli i=0;i<n-1;i++){
    	lli a,b;
    	cin>>a>>b;
    	v[a].pb(b);
    	v[b].pb(a);
    }
    for(lli i=0;i<n;i++)cin>>t[i];
    sort(t,t+n);
	reverse(t,t+n);
	bfs(1);
	lli an=0;
	for(lli i=1;i<n;i++)an+=t[i];cout<<an<<endl;
	for(lli i=1;i<n+1;i++)cout<<ans[i]<<" ";
	
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstring>
#include <set>
using namespace std;
int main(){
    //cout << strcmp("a","aa") << endl;
    string s;
    cin >> s;
    int n = s.size();
    int k;
    cin >> k;
    set<string> sts;
    string a;
    for(int i = 0;i<n;i++){
        a = "";
        a+=s[i];
        sts.insert(a);
        for(int j = i+1;j<min(n,i+k);j++){
            a+=s[j];
            sts.insert(a);
        }
    }
    auto itr = sts.begin();
    for(int i = 0;i<k-1;i++){
        itr++;
    }
    cout << *itr << endl;
}

Measured memory_bytes: 1664
import java.util.Scanner;

public class Main {
    static int[][] learn;
    static int[] price;
    static int minCost = 1000000000;
    static int bookNum;
    static int algNum;
    static int minLearn;

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        bookNum = scan.nextInt();
        algNum = scan.nextInt();
        minLearn = scan.nextInt();
        price = new int[bookNum];
        learn = new int[bookNum][algNum];
        for (int i = 0; i < bookNum; i++) {
            price[i] = scan.nextInt();
            for (int j = 0; j < algNum; j++) {
                learn[i][j] = scan.nextInt();
            }
        }
        getPrice(0, new int[algNum], 0);
        if (minCost == 1000000000){
            System.out.println(-1);
        }else{
            System.out.println(minCost);
        }
    }

    static void getPrice(int book, int[] nowLearn, int priceNow) {
        if (priceNow + price[book] < minCost) {
            int[] newLearn = new int[algNum];
            boolean done = true;
            for (int i = 0; i < algNum; i++) {
                newLearn[i] = nowLearn[i] + learn[book][i];
                if (newLearn[i] < minLearn) {
                    done = false;
                }
            }
            if (done) {
                minCost = Math.min(minCost, priceNow + price[book]);
            } else if (book < bookNum - 1) {
                getPrice(book + 1, newLearn, priceNow + price[book]);
            }
        }
        if (book < bookNum - 1) {
            getPrice(book + 1, nowLearn, priceNow);
        }
    }
}

Measured memory_bytes: 36980
#include<bits/stdc++.h>
#define N 100000010
//#define int long long
#define INF 1e9
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
using namespace std;
inline int read()
{
	register char cc = getchar();register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - '0'; cc = getchar();}
	return cn * flus;
}
signed main()
{
	int a, b, n;
	a = read();
	b = read();
	n = read();
	int l = max(a, b);
	int ans(0);
	ans = n / l;
	if(ans * l < n) ans ++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        // ターゲット
        final int target = 753;

        // 入力
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        int diff = 999; // 3桁同士の差なので初期値は最大値999を設定

        // 検査
        for(int i=0; i<=s.length()-3; i++){
            int t = Integer.parseInt(s.substring(i, i + 3));

            int abs = Math.abs(target - t);
            diff = (diff > abs) ? abs : diff;
        }

        System.out.println(diff);
    }
}


Measured memory_bytes: 21588
fn b_754() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input);

    let mut ans = 753i32;
    let ch: Vec<char> = input.chars().collect();
    for i in 0..(ch.len() - 3) {
        let value =
            (ch[i].to_digit(10).unwrap() * 100 +
            ch[i + 1].to_digit(10).unwrap() * 10 +
            ch[i + 2].to_digit(10).unwrap()) as i32;
        if ans > (value - 753).abs() {
            ans = (value - 753).abs();
        }
    }
    println!("{}", ans);
}

fn main() {
    b_754();
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		
		while( true ) {
			c-=b;
			if(c<=0)break;
			a-=d;
			if(a<=0)break;

		}
		
		System.out.println(a>c ? "Yes" : "No");

	}

}



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

#define LIMIT_YABASI 150
#define MAX_VILLAGER 100

typedef struct  {
    int weight;
    int time_s, time_e;
    int flag;
} Villager;

Villager vi_set[MAX_VILLAGER];


int compare(const void *a, const void *b) {
    return ((Villager*)a)->time_s - ((Villager*)b)->time_s;
}


int main(void) {
    int i, j, n, w, a, b, time, now_weight;
    int isBreak;

    while (EOF != scanf("%d", &n)) {
        if (n <= 0) {
            break;
        }

        isBreak = now_weight = time = 0;

        for (i = 0; i < n; i++) {
            scanf("%d %d %d", &w, &a, &b);

            vi_set[i].weight = w;
            vi_set[i].time_s = a;
            vi_set[i].time_e = b;
            vi_set[i].flag   = 0;
        }
        qsort(vi_set, n, sizeof(Villager), compare);

        for (i = 0; i < n; ++i) {
            time = vi_set[i].time_s;

            for (j = 0; j < i; ++j) {
                if (vi_set[j].flag == 1 && vi_set[j].time_e <= time) {
                    vi_set[j].flag = 0;
                    now_weight -= vi_set[j].weight;
                }
            }

            now_weight += vi_set[i].weight;
            vi_set[i].flag = 1;

            /* printf("weight is %d\n", now_weight); */
            if (LIMIT_YABASI < now_weight) {
                isBreak = 1;
                break;
            }
        }

        printf("%s\n", (isBreak == 1)?("NG"):("OK"));
    }

    return 0;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9) + 7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n)
{
	vector<pair<ll, ll>> p;
	for (ll i = 2; i * i <= n; i++)
	{
		if ((n % i) != 0)
			continue;
		pair<ll, ll> a = make_pair(i, 0);
		while ((n % i) == 0)
		{
			n /= i;
			a.second += 1;
		}
		p.push_back(a);
	}

	if (n != 1)
		p.push_back(make_pair(n, 1));
	return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a)
{
	ll b = MOD, u = 1, v = 0;
	while (b)
	{
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0)
	{
		u += MOD;
	}
	return u;
}
// 順列
ll permutation(const ll n, const ll m)
{
	ll result = 1;
	for (ll i = n; i > n - m; i--)
	{
		result = (result * i) % MOD;
	}
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x)
{
	if (x == 0)
		return 1;
	ll res = repeat_square(n, x / 2);
	res = res * res % MOD;
	if ((x % 2) == 1)
		res = res * n % MOD;
	return res;
}
// 組み合わせ nCm
ll combination(ll n, ll m)
{
	ll p = permutation(n, m);
	ll div = 1;
	for (ll i = 2; i <= m; i++)
	{
		div = (div * i) % MOD;
	}
	return (p * modinv(div)) % MOD;
}

bool is_prime(int n) {
	vector< pair<int, int> > p;
	for (int i = 2; i * i <= n; i++) {
		if ((n % i) != 0) continue;
		pair<int, int> a = make_pair(i, 0);
		while ((n % i) == 0) {
			n /= i;
			a.second += 1;
		}
		p.push_back(a);
	}

	if (n != 1)
		p.push_back(make_pair(n, 1));
	return p.size() == 1;
}

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

	int result = 0;

	vector< pair<ll, ll> > a = prime_factorize(N);
	rep(i, a.size()) {
		pair<ll, ll> b = a[i];

		int co = 1;
		for(int j = b.second; j > 0; j--) {
			int t = 1;
			rep (k , co) {
				t *= b.first;
			}
			N /= t;
			j -= co;
			result += 1;
			co += 1;
		}
	}
	cout << result << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define mod 1000000007
#define inf 2147483647
#define range(x,a,b) (a)<=x&&x<=(b)
ll pow5(ll a){
	return a*a*a*a*a;
}
int main(){
	int x;
	cin>>x;
	ll a,b,remainder=1;
	while(1){
		a=1;
		b=a-remainder;
		while(a<abs(b)||pow5(a)-pow5(b)<=x){
			if(pow5(a)-pow5(b)==x){
				cout<<a<<" "<<b;
				return 0;
			}
			a++;
			b++;
		}
		remainder++;
	}
	return 0;
}

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

int main(){
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;

    int ans = 0, x;
    for(int i = 0; i < n; i++){
        cin >> x;
        ans += x-1;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#include <atcoder/all>
using namespace atcoder;

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
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 (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const double PI = acos(-1);
const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;

int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int k;
    cin >> k;
    string s;
    rep(i, k){
        s += "ACL";
    }
    print(s);
    
}


Measured memory_bytes: 3692
#include <map> 
#include <ctime>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define debug(x) cerr << "<<< " << #x << " = " << x << endl
using namespace std;

int const N = 40;
int n;
char ch[N];
map < pair <string, string>, long long> cnt;

int main() {
//	freopen("hh.txt", "r", stdin);
//	double st = clock();
	scanf("%d", &n);
	scanf("%s", ch);
	for (int i = 0; i < (1 << n); i++) {
		string s1 = "", s2 = "";
		for (int j = 0; j < n; j++) {
			if (i & (1 << j)) s1 += ch[j];	//s1保存正向的 
			else s2 += ch[j];
		}
		cnt[make_pair(s1, s2)]++;
	}
	
	long long ans = 0;
	for (int i = 0; i < (1 << n); i++) {
		string s1 = "", s2 = "";
		for (int j = n - 1; j >= 0; j--) {
			if (i & (1 << j)) s2 += ch[j + n];
			else s1 += ch[j + n];
		}
		ans += cnt[make_pair(s1, s2)];
	}
	printf("%lld\n", ans);
//	printf("%.lf\n", clock() - st);
	return 0;
}

Measured memory_bytes: 91904
#include<cstdio>
 int main(){
     int W,H,x,y,r;
     scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
     if(0 <= x - r & x + r <= W & 0 <= y - r & y + r <= H ){
         printf("Yes");
     }
         else{
             printf("No");
         }
     printf("\n");
 }


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

int64_t create_scc(int64_t s, int64_t c, int64_t scc = 0) {
    if (c == 0 || c == 1 || (s == 0 && c < 4)) {
        return scc;
    } else if (s == 0) {
        return create_scc(c / 4, c - c / 4 * 2, scc);
    } else if (s <= c / 2) {
        return create_scc(0, c - s * 2, scc + s);
    } else {
        return create_scc(s - c / 2, c - c / 2 * 2, scc + c / 2);
    }
}

int main() {
    int64_t n, m;
    cin >> n >> m;
    cout << create_scc(n, m) << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'pp'
attrs = Array.new
while line = $stdin.gets
  attrs << line.chomp.split
end

a = attrs[0][0].to_i
B = attrs[0][1].to_i
c = attrs[0][2].to_i
D = attrs[0][3].to_i
while (a!=0 || c != 0) do
  c -= B
  break if c <= 0
  a -= D
  break if a <= 0
end
puts (a > 0 ) ? 'Yes' : 'No'

Measured memory_bytes: 14516
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    string S;
    cin >> S;

    if(S[0]==S[1] && S[0]==S[2]) cout << "No" << endl;
    else cout << "Yes" << endl;




}


Measured memory_bytes: 256
#include<stdio.h>

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

for(i=0;i<n;i++){
printf("%d",x[n-1-i]);
if(i!=n-1)printf(" ");
}
printf("\n");
return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
#include<string.h>
int s[15],t[15],N,M;
int F(int n,int A)
{
	if(n>=N)return 0;
	int r;
	if(s[n]==A)r=F(n+1,A);
	else if(s[n]==1)
	{
		r=F(n+1,-A+2);
		r+=1+F(n+1,A);
	}
	else
	{
		r=F(n+1,A)+1;
		r+=F(n+1,-A+2)+1;
		r+=F(n+1,A);
	}
	s[n]=A;
	return r;
}
int main()
{
	int i,j,x,y,c;
	while(scanf("%d%d",&N,&M),N)
	{
		for(i=0;i<3;++i)for(j=!scanf("%d",&c);j<c;++j)
		{
			scanf("%d",&x);
			s[x-1]=t[x-1]=i;
		}
		x=F(0,0);
		memcpy(s,t,sizeof(s));
		y=F(0,2);
		x=x<y?x:y;
		if(x>=M)x=-1;
		printf("%d\n",x);
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int MAX = 1e9;
const ll LLMAX = 1e18;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

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

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

    cout << N / 3 << endl;
    return 0;
}


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

int main() {
  vector<int>data(26,0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  for(int j = 0;j < s.size();j++){
    data[s[j]-'a']++;
  }
  for(int i = 1;i < n;i++){
    vector<int>pre(26,0);
    cin >> s;
    for(int j = 0;j < s.size();j++){
      pre[s[j]-'a']++;
    }
    for(int j = 0;j < 26;j++){
      if(data[j] > pre[j]) data[j] = pre[j];
    }
  }
  for(int i = 0;i < 26;i++){
    if(data[i] == 0) continue;
    for(int j = 0;j < data[i];j++){
      char t = 'a'+i;
      cout << t;
    }
  }
  cout << "" << endl;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
a = [[None] * m for _ in range(n)]
b = [None] * m
for i in range(n):
    a[i] = list(map(int, input().split()))
for i in range(m):
    b[i] = int(input())
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j] * b[j]
    print(c)


Measured memory_bytes: 5956
#include <bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
const int MAXN=2100;
int main()
{
    char a[4];
    int b[3]={0,0,0};
    scanf("%c%c%c",&a[0],&a[1],&a[2]);
    for(int i=0;i<3;i++)
    {
        if(a[i]=='a') b[0]=1;
        if(a[i]=='b') b[1]=1;
        if(a[i]=='c') b[2]=1;                       
    }
    if(b[0]&&b[1]&&b[2]) printf("Yes\n");
    else printf("No\n");
    return 0;
}


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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

void solve() {
    int x;
    cin >> x;
    cout << ((x >= 30) ? "Yes" : "No") << endl;
}

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

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

int main()
{
    int dmin = 1 << 30;
    int N;
    cin >> N;
    vector<int> A(N, 0);
    for (int i = 0; i < N;++i){
        cin >> A[i];
        int d = 0;
        while(A[i]%2 == 0){
            A[i] /= 2;
            ++d;
        }
        dmin = min(dmin, d);
    }

    cout << dmin << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mmod 1000000007
#define pi acos(-1)
int main()
{
    faster;
    ll n;
    string st;
    cin>>st;
    ll mini=1e13,cnt=0;
    char ch='0';
    for (int i=0;i<st.size();i++)
    {
        if (st[i]!=ch)
            cnt++;
        if (ch=='0')
            ch='1';
        else
            ch='0';
    }
    ch='1';

    mini=cnt;
    cnt=0;
    for (int i=0;i<st.size();i++)
    {
        if (st[i]!=ch)
            cnt++;
        if (ch=='0')
            ch='1';
        else
            ch='0';
    }


    cout<<min(mini,cnt)<<endl;
    return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <climits>

using namespace std;

int main(){
    int n; cin >> n;
    string s; cin >> s;
    int x=0, y=0;
    for(auto c : s){
        if(c=='(') ++x;
        else if(x>0) --x;
        else ++y;
    }
    while(y){
        cout << '(';
        --y;
    }
    cout << s;
    while(x){
        cout << ')';
        --x;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n, k; cin >> n >> k;
    vector<int> b(n, 0);
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        int l = max(0, i - a), r = min(n, i + a + 1);
        b[l]++;
        if (r < n) b[r]--;
    }
    for (int i = 1; i < n; i++) b[i] += b[i-1];
    while (--k) {
        bool upd = false;
        vector<int> tmp(n, 0);
        for (int i = 0; i < n; i++) {
            int l = max(0, i - b[i]), r = min(n, i + b[i] + 1);
            tmp[l]++;
            if (r < n) tmp[r]--;
        }
        for (int i = 1; i < n; i++) {
            tmp[i] += tmp[i-1];
            if (b[i] != tmp[i]) upd = true;
        }
        if (!upd) break;
        b.swap(tmp);
    }
    for (int x : b) cout << x << " "; cout << endl;
}


Measured memory_bytes: 5048
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll solve(vector<pair<int,int>>& t)
{
    sort(t.begin(),t.end(),greater<pair<int,int>>());
    priority_queue<int> pq;
    ll res=0;
    for(int i=(int)t.size(),j=0;i>0;i--)
    {
        while(j<(int)t.size() && t[j].first>=i)
            pq.push(t[j++].second);
        if(!pq.empty())
            res+=pq.top(),pq.pop();
    }
    return res;
}
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        int n;
        scanf("%d",&n);
        ll base=0;
        vector<pair<int,int>> tl,tr;
        for(int i=1;i<=n;i++)
        {
            int k,l,r;
            scanf("%d%d%d",&k,&l,&r);
            if(l>r)tl.push_back({k,l-r}),base+=r;
            else tr.push_back({n-k,r-l}),base+=l;
        }
        printf("%lld\n",base+solve(tl)+solve(tr));
    }
    return 0;
}


Measured memory_bytes: 5668
N=gets.to_i
names = Hash.new{|h,k|h[k]=[]}

N.times do
  name = gets.chomp
  names[name[0].downcase] << name
end
ans = 0
choices = ['mar', 'mac', 'mah', 'mrc', 'mrh', 'mch', 'arc', 'arh', 'ach', 'rch']
choices.each do |seq|
  t = 1
  seq.chars do |c|
    t *= names[c].size
  end
  ans += t
end
puts ans

Measured memory_bytes: 9596
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const int INF = 10000000000;
const int MOD = 1000000007;
using Data = pair<long long, vector<ll> >;

int main() {
  string s;
  cin >> s;
  int index=0;
  int ans=0;
  string prev="";
  while(index<s.size()){
    string now=s.substr(index,1);
    if(prev!=now){
      ans++;
      index++;
      prev=now;
    }
    else{
      if(index==s.size()-1) break;
      else{
        ans++;
        prev=s.substr(index,2);
        index+=2;
      }
    }
  }
  cout << ans << endl;     
}

Measured memory_bytes: 640
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
using namespace std;
signed main()
{
	fastio;
	int n;
	cin>>n;
	int a[n+1][3];
	int s[n+1]={0};
	int m[n+1]={0};
	int h[n+1]={0};
	forci(1,n+1)
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	s[1]=a[1][0];
	m[1]=a[1][1];
	h[1]=a[1][2];
	for(int i=2;i<=n;i++)
	{
		s[i]=a[i][0]+max(m[i-1],h[i-1]);
		m[i]=a[i][1]+max(s[i-1],h[i-1]);
		h[i]=a[i][2]+max(s[i-1],m[i-1]);
	}
	int mx=max(s[n],m[n]);
	cout<<max(mx,h[n])<<endl;
}

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

using namespace std;

int main(void) {
  
  int L, R, d;
  cin >> L >> R>> d;

  int count = 0;
  for (int i = L; i <= R; i++) {
    if (i % d == 0) {
      count++;
    }
  }
  cout << count  << endl;

}


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

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ll long long unsigned
#define pii pair<int,int>
#define tii tuple <int,int,int>
#define N 1000005
#define mod 2000003
#define X first
#define Y second
#define eps 0.0000000001
#define all(x) x.begin(),x.end()
#define tot(x) x+1,x+n+1
using namespace std;
string s,e,d;
int i,j,k,n;
int main()
{
    cin.sync_with_stdio(0);
    cout.sync_with_stdio(0);
    cin>>s;
    n=s.size();
    e="erase";
    d="dream";
    for(i=0; i<n; i++)
    {
        if(j)
        {
            if(s[i]!=e[j])
            {
                cout<<"NO\n";
                return 0;
            }
            else
            {
                j++;
                if(j==5)
                {
                    j=0;
                    if(s[i+1]=='r')
                        i++;
                }
            }
        }
        else if(k)
        {
            if(s[i]!=d[k])
            {
                cout<<"NO\n";
                return 0;
            }
            else
            {
                k++;
                if(k==5)
                {
                    k=0;
                    if(s[i+1]=='e'&&s[i+2]=='r'&&s[i+3]!='a')
                        i+=2;
                }
            }
        }
        else if(s[i]==e[j])
            j++;
        else if(s[i]==d[k])
            k++;
        else
        {
            cout<<"NO\n";
            return 0;
        }
    }
    if(j==0&&k==0)
        cout<<"YES\n";
    else
        cout<<"NO\n";
    return 0;
}




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

int main() {
	int a,b;
	cin >> a;
	b=0;
	for(int i = a;i>0;i--){
		if(0<i&&i<10){b++;}
		else if(99<i&&i<1000){b++;}
		else if(9999<i&&i<100000){b++;}
	}
	cout << b << endl;
}

Measured memory_bytes: 3564
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int ans=n;
int[] a=new int[n];
int d=0;
int i;
for(i=0;i<n;i++){
a[i]=sc.nextInt();
}
Arrays.sort(a);
for(i=0;i<n-1;i++){
if(a[i]==a[i+1])d++;
}
ans-=((int)((d+1)/2))*2;
System.out.println(ans);
}
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

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

int main(){

    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];
    sort(v.begin(), v.end());
    int ans = 0;
    if(v[0] % 2 != v[1] % 2){
        ans++;
        v[0]++;
        v[2]++;
    }

    ans += v[2] - v[1] + (v[1] - v[0]) / 2;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int h[100005];
int dp[100005];
int func(int i,int n)
{
    if(i==n)
        return 0;
    if(dp[i]!=INT_MAX)
        return dp[i];
    int ans1=abs(h[i]-h[i+1]);
        ans1+=func(i+1,n);
    int ans2=INT_MAX;
    if(i!=n-1)
    {
        ans2=abs(h[i]-h[i+2]);
        ans2+=func(i+2,n);
    }
    dp[i]=min(ans1,ans2);
    return dp[i];
}

int main()
{   int n;
    cin>>n;
    fill(dp,dp+n,INT_MAX);
    for (int i = 1; i <= n ; i++) {
        cin>>h[i];
    }
    cout<<func(1,n);
   
   
}

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

int main() {
  
  int N, K; cin >> N >> K; int sum = 0;
  
  for (int i = 0; i < N; i++) {
    int h; cin >> h;
    if (K <= h) sum++;
  }
  
  cout << sum << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
#define INF LLONG_MAX
#define mod 1000000007
typedef long long ll;
int main(void)
{
	int K, X;
	cin >> K >> X;
	if(K*500<X) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define double long double
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define rsort(a) sort(all(a),greater<>())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> V;
const long long MOD=1000000007;
const long long INF = 1e18;
vector <ll> dp;


void solve_old(long long N, long long A, long long B){
    ll ans = 0, sum = 0;
    for (ll i = 1; i <= N; i++) {
        // ll sum = i%10+i/10+i/100+i/1000;
        // sum = i/1000 + (i%1000)/100 + (i%100)/10 + (i%10);
        sum = i/10000;
        sum += i%10000 ? i%10000/1000 : 0;
        sum += i%1000 ? i%1000/100 : 0;
        sum += i%100 ? i%100/10 : 0;
        sum += i%10 ? i%10 : 0;
        if (sum >= A && sum <= B)
        {
            ans += i;
        }
        sum = 0;
    }
    cout << ans << "\n";
}

ll findSumOfDigits(ll n){
    ll sum = 0;
    while (n>0)
    {
        sum += n%10;
        n /= 10;
    }
    return sum;
}

void solve(long long N, long long A, long long B){
    ll ans = 0;
    for (ll i = 1; i <= N; i++) {
        ll sum = findSumOfDigits(i);
        if (sum >= A && sum <= B)
        {
            ans += i;
        }
        sum = 0;
    }
    cout << ans << "\n";
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(N, A, B);
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>
#include <climits>
#include <set>

using namespace std;

double sq(double x){return x*x;}

int main(){
	int n,s;
	while(cin>>n>>s,(n||s)){
		int comb = (1 << n) - 1;
		int ans = 0;
		while(comb < (1 << 10)){
			int x = comb & -comb,y = comb + x;

			int sum = 0;
			for (int i = 0; i < 10; i++)
			{
				if(comb & (1 << i)){
					sum += i;
				}
			}
			if(sum == s) ans++;

			comb = ((comb & ~y) / x >> 1) | y;
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main(){
    int a[4][3][10]={0};
    int n;
    cin>>n;
    for(int i=0; i<n; i++){
        int b,f,r,v;
        cin>>b>>f>>r>>v;
        a[b-1][f-1][r-1]+=v;
    }
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            for(int k=0; k<10; k++){
                cout<<" "<<a[i][j][k];
            }
            cout<<endl;
        }
        cout<<"####################"<<endl;
    }
    for(int i=0; i<3; i++){
        for(int j=0; j<10; j++){
            cout<<" "<<a[3][i][j];
        }
        cout<<endl;
    }
    return 0;
}



Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    int num,a,b;
    char c;
    string str,meirei,p,ans;
    cin>>str>>num;
    for(int i=0;i<num;i++){
        cin>>meirei>>a>>b;
        if(meirei=="print"){
            for(int j=a;j<=b;j++){
                cout<<str[j];
            }
            cout<<endl;
        }else if(meirei=="reverse"){
            for(int j=0;j<str.size();j++){
                if(a<=j&&j<=b){
                    for(int k=b;k>=a;k--){
                        c=str[k];
                        ans+=c;
                    }
                    j=b;
                }else{
                    c=str[j];
                    ans+=c;
                }
            }
            swap(str,ans);
            ans="";
        }else{
            cin>>p;
            for(int j=0;j<=str.size();j++){
                if(a<=j&&j<=b){
                    for(int k=0;k<p.size();k++){
                        c=p[k];
                        ans+=c;
                    }
                    j=b;
                }else{
                    c=str[j];
                    ans+=c;
                }
            }
            swap(str,ans);
            ans="";
        }
    }
    return 0;
}

Measured memory_bytes: 3196
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <vector> 
using namespace std;
long long  n, W, a, b ,x, y;
vector <pair <long long , long long > >v; 
long long  dp[110][1000100];

long long solve(long long u, long long left){
	
	if(u==n)
		return 0;
	
	if(dp[u][left]!=-1)return dp[u][left]; 
	
	long long x=solve(u+1, left);
	if(left>=v[u].first)
		x=max(x, v[u].second+solve(u+1, left-v[u].first));
		
	return dp[u][left]=x;
}

int main() {
	cin >> n >> W;

	memset(dp, -1, sizeof dp);

	for (int i = 0; i < n; i++)
	{
		cin >> a >> b;
		v.push_back({ a,b });
	}
	long long ans = solve(0,W);
	cout << ans;
	return 0;
}

Measured memory_bytes: 859776
#include<bits/stdc++.h>
#define fastio 	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long int
using namespace std;
int mod = 1e9 + 7;

int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio;

	int n;
	cin >> n;
	string s = "ACL", str;
	while (n-- > 0) {
		str += s;
	}
	cout << str;
	return 0;
}

Measured memory_bytes: 3584
#include <stdio.h>

int a[10010];

int main() {
	int n, q, t, cnt = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
	}

	scanf("%d", &q);
	for (int i = 0; i < q; ++i) {
		scanf("%d", &t);
		for (int j = 0; j < n; ++j) {
			if (a[j] == t) {
				cnt++;
				break;
			}
		}
	}

	printf("%d\n", cnt);
}



Measured memory_bytes: 2112
temp = input()
n, m = temp.split(' ')
n, m = int(n), int(m)

a = [[0 for i in range(m)] for j in range(n)]
b = [0 for i in range(m)]

for i in range(n):
    temp = input()
    sp = temp.split(' ')
    
    for j in range(m):
        a[i][j] = int(sp[j])

for i in range(m):
    temp = input()
    b[i] = int(temp)

for i in range(n):
    sum = 0
    for j in range(m):
        sum += a[i][j] * b[j]
    print(sum)
    


Measured memory_bytes: 5960
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W;
	cin >> H >> W;
	string maze[H];
	int res[H][W];
	rep(i, 0, H) {
		cin >> maze[i];
	}
	int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
	int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

	memset(res, -1, sizeof(res));
	rep(i, 0, H) {
		rep(j, 0, W) {
			int count = 0;
			if(maze[i][j] == '#') res[i][j] = -1;
			else {
				rep(k, 0, 8) {
					int nx = j + dx[k];
					int ny = i + dy[k];
					if(0 <= nx && nx < W && 0 <= ny && ny < H) {
						if(maze[ny][nx] == '#') count++;
					}
				}
				res[i][j] = count;
			}
		}
	}

	rep(i, 0, H) rep(j, 0, W) {
		if(res[i][j] == -1) cout << '#';
		else cout << res[i][j];
		if(j == W - 1) cout << endl;
	}

			



}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	x := n / k
	ans := x * x * x
	if k%2 == 0 {
		x = n/(k/2) - x
		ans += x * x * x
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
import sys
input = sys.stdin.readline

H, N = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(N)]

INFTY = 10**8
dp = [INFTY]*(H+1)
dp[0] = 0

for i in range(1, H+1):
    for j in range(N):
        if S[j][0] > i:
            dp[i] = min(dp[i], S[j][1])
        else:
            dp[i] = min(dp[i], dp[i-S[j][0]]+ S[j][1])

print(dp[H])

Measured memory_bytes: 42348
n = int(input())
a = list(map(int, input().split()))

cnt = [0] * (10**6)
# cnt = [0] * (3 + 1)

for _a in a:
    cnt[_a-1] += 1
    cnt[_a] += 1
    cnt[_a+1] += 1

# print(cnt)
print(max(cnt))

Measured memory_bytes: 15868
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;


static class P
{
    static void Main()
    {
        var lr = Console.ReadLine().Split().Select(long.Parse).ToArray();
        if (lr[1] - lr[0] >= 2019) Console.WriteLine(0);
        else
        {
            long min = 2018;
            for (long i = lr[0]; i <= lr[1]; i++)
            {
                for (long j = i + 1; j <= lr[1]; j++)
                {
                    min = Min(min, i * j % 2019);
                }
            }
            Console.WriteLine(min);
        }

    }
}


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

using namespace std;

int main()
{
    long long n,m,x,y,z,i,j,k=0;
    cin>>n;
    long long a[n];

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

    }
    if(k==1)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
}


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

int main() {
  string s;
  ll k;
  cin >> s >> k;

  ll r = 0;
  if (k < 5) {
    string t;
    for (int i = 0; i < k; i++) t += s;
    for (int i = 0; i + 1 < t.size(); i++) {
      if (t[i] == t[i + 1]) {
        t[i + 1] = '*';
        r++;
      }
    }
  } else {
    int l = k % 2 ? 5 : 4;
    string t;
    for (int i = 0; i < l; i++) t += s;
    vector<ll> rv(l);
    for (int i = 0; i + 1 < t.size(); i++) {
      if (t[i] == t[i + 1]) {
        t[i + 1] = '*';
        rv[(i + 1) / s.size()]++;
      }
    }
    r += rv.front() + rv.back();
    r += (k - 1) / 2 * rv[1];
    r += (k - 2) / 2 * rv[2];
  }
  cout << r << endl;
}


Measured memory_bytes: 256
using System;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var strArr = ReadLine().Split();
        var i = int.Parse(strArr[0]+ strArr[1]);
        var sq = Math.Sqrt(i);

        if (sq == (int)sq)
            WriteLine("Yes");
        else
            WriteLine("No");
    }
}


Measured memory_bytes: 11092
let N = stdin.ReadLine() |> int
let S = stdin.ReadLine().ToCharArray()
let A = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray()

let rot c =
    A
    |> Array.findIndex (fun x -> x = c)
    |> fun i -> (i + N) % 26
    |> fun i -> A.[i]

S
|> Array.map rot
|> stdout.WriteLine


Measured memory_bytes: 13396
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define YY cout << "Yes" << endl
#define NN cout << "No" << endl
const int INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
int solve(){
  int R,G,B,N;
  cin >> R >> G >> B >> N;
  int ans = 0;
  rep(i,(N / R) + 1){
    rep(j,((N - i * R) / G) + 1){
      if((N - (R * i + G * j)) == 0 || (N - (R * i + G * j)) % B == 0){ans++;}
    }
  }
  cout << ans << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16) << endl; 
  solve();
  return 0;
} 

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    ll M,D;
    cin >> M >> D;

    ll cnt = 0;

    for (int i = 1;i <= M;i++){
        for (int j = 1;j <= D;j++){
            if(j%10 >= 2 && j/10 >= 2 && (j%10)*(j/10) == i) cnt++;
        }
    }

    cout << cnt << endl;

}

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

int main(){
  int x1,x2,y1,y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << x2-(y2-y1) << " " << y2+(x2-x1) << " " << x1-(y2-y1) << " " << y1+(x2-x1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n,k;
int a[N];
int dp[N];

int f(int idx){
  if (idx==n-1) return 0;
  int &ret = dp[idx];
  if (ret != -1) return ret;
  ret = 2e9;
  for(int i=idx+1; i<=min(idx+k,n-1); i++){
    ret = min(ret, f(i)+abs(a[idx]-a[i]));
  }
  return ret;
}

int main(){
   scanf("%d%d",&n,&k);
   for(int i=0; i<n; i++){
     scanf("%d",a+i);
   }
   memset(dp,-1,sizeof dp);
   cout << f(0) << endl;
}

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

int main() {
    int A,B,C,D;
    cin >> A >> B>> C>>D;
    if (A+B>C+D){
        cout << "Left" << endl;
    }else if (A+B<C+D){
        cout << "Right" << endl;
    }else{
        cout << "Balanced" << endl;
    }
}


Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
    int n,x,y,z,re,count=0;
    bool a[101]={false},b[101]={false},c[101]={false};
    scanf("%d%d",&n,&x);
    for(int i=0;i<x;++i){
        scanf("%d",&re);
        a[re]=true;
    }
    scanf("%d",&y);
    for(int i=0;i<y;++i){
        scanf("%d",&re);
        b[re]=true;
    }
    scanf("%d",&z);
    for(int i=0;i<z;++i){
        scanf("%d",&re);
        c[re]=true;
    }
    for(int i=1;i<=n;++i){
        if((!a[i] && c[i])||(b[i]&&c[i])){
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 3224
use std::io;

fn main() {
    let vec = read_vec::<i32>();

    if let(1...9, 1...9) = (vec[0], vec[1]){
        println!("{}", vec[0] * vec[1])
    } else {
        println!("-1")
    }

}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut line = String::new();
    io::stdin().read_line(&mut line)
        .ok()
        .expect("Faild to read Vec");
    line.trim().split_whitespace()
        .map(|i| i.parse().ok().unwrap()).collect()
}


Measured memory_bytes: 4352