akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;

namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            int[] dice = null;
            Action<int,int,int,int> shift = (i1, i2, i3, i4) => {
                int temp = dice[i1];
                dice[i1] = dice[i2];
                dice[i2] = dice[i3];
                dice[i3] = dice[i4];
                dice[i4] = temp;
            };
            Dictionary<string, Action> control = new Dictionary<string, Action> {
                {"North", () => shift(4, 0, 1, 5)},
                {"East" , () => shift(2, 0, 3, 5)},
                {"West" , () => shift(3, 0, 2, 5)},
                {"South", () => shift(1, 0, 4, 5)},
                {"Right", () => shift(3, 1, 2, 4)},
                {"Left" , () => shift(2, 1, 3, 4)},
            };
            int count;
            while((count = int.Parse(Console.ReadLine())) != 0) {
                dice = new[] { 1, 2, 3, 4, 5, 6 };
                int total = dice[0];
                while(count-- > 0){
                    control[Console.ReadLine()]();
                    total += dice[0];
                }
                Console.WriteLine(total);
            }
        }
    }
}

Measured memory_bytes: 5988
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cctype>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

int main() {
    int A, B;
    cin >> A >> B;
    vector<vector<char>> ans(100, vector<char>(100, '.'));
    REP(i, 100) REP(j, 50) ans[i][j] = '#';
    --A; --B;
    REP(i, 50) REP(j, A / 50) ans[2 * i][2 * j] = '.';
    REP(i, A % 50) ans[2 * i][A / 50 * 2] = '.';
    REP(i, 50) REP(j, B / 50) ans[2 * i][2 * j + 51] = '#';
    REP(i, B % 50) ans[2 * i][B / 50 * 2 + 51] = '#';
    cout << "100 100\n";
    REP(i, 100) {
        REP(j, 100) cout << ans[i][j];
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 3596
const BKRT = "\n";
const SPAC = " ";
const NOSP = "";

function Main(input){
	input = [].concat(...input.split(BKRT).map(a=>a.split(SPAC)));
  const strShift = ()=>input.shift();
  const intShift = ()=>~~input.shift();
  
  var X = intShift();
  
  if(X == 1)return "1";
  
  var o = [];
  
  for(var b = 2; b <= 31; b++){
  	var aaa = b * b;
  	for(var p = 2; p <= 9; p++){
    	if(aaa <= X){o.push(aaa);}else{break;}
      aaa *= b;
    }
  }
  
  return ~~Math.max(...o);
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
1000
`);

Measured memory_bytes: 19272
#include<iostream>
using namespace std;
int main() {
	int N, amari = 0, oturi = 0;
	cin >> N;
	amari = N % 1000;
	if (N % 1000 == 0) {
		cout << '0' << endl;
		return 0;
	}
	else {
		oturi = 1000 - amari;
		cout << oturi << endl;
	}
	return 0;
}


Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	static int M = 1046527;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			int n = Integer.parseInt(br.readLine());

			Long[] dict = new Long[M];

			for (int i = 0; i < n; i++) {
				String[] in = br.readLine().split(" ");
				Long val = replaceACGT(in[1]);
				doMethod(in[0], val, dict);

			}

		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	private static Long replaceACGT(String in) {
		long result = 0;
		int p = 1;
		for (char c : in.toCharArray()) {
			int now;

			switch (c) {
			case 'A':
				now = 1;
				break;
			case 'C':
				now = 2;
				break;
			case 'G':
				now = 3;
				break;
			case 'T':
				now = 4;
				break;
			default:
				now = 1;
				break;
			}

			result += p * now;
			p *= 5;
		}
		return result;
	}

	private static int h1(long key) { return (int)key % M; }
	private static int h2(long key) { return (int)(1 + (key % (M-1))); }

	private static void doMethod(String method, Long val, Long[] dict) {

		if(method.charAt(0) == 'i') {
			for (int i = 0; ; i++) {
				int h = ( h1(val) + i * h2(val) ) % M;
				if(dict[h] == null) {
					dict[h] = val;
					return;
				}
			}

		} else {
			for (int i = 0; ; i++) {
				int h = ( h1(val) + i * h2(val) ) % M;
				if(dict[h] == null) {
					System.out.println("no");
					return;
				} else if(dict[h].equals(val)) {
					System.out.println("yes");
					return;
				}
			}
		}
	}
}

Measured memory_bytes: 194396
#include <iostream>
using namespace std;
#include <functional>
#include <vector>
template<class T> struct SegTree {
  private:
    int size;
    vector<T> v;
    using F = function<T(T,T)>;
    F f; T default_value;
  public:
    SegTree(int n, T default_value, F f) : default_value(default_value), f(f) {
      size = 1;
      while (size < n) size *= 2;
      v.resize(2 * size - 1, default_value);
    }
    void update(int index, T val) {
      index = index + size - 1;
      v[index] = val;
      while (index > 0) {
        index = (index - 1) / 2;
        v[index] = f(v[2 * index + 1], v[2 * index + 2]);
      }
    }
    T query(int l, int r) { return query(l, r, 0, size, 0); }
    T query(int l, int r, int cur_l, int cur_r, int index) {
      // [l, r)に対するクエリ
      if (cur_r <= l || r <= cur_l) return default_value;
      if (l <= cur_l && cur_r <= r) return v[index];

      int mid = (cur_l + cur_r) / 2;
      return f(query(l, r, cur_l, mid, 2 * index + 1), query(l, r, mid, cur_r, 2 * index + 2));
    }
};

int main() {
  int n, q; cin >> n >> q;
  SegTree<int> T(n, 0, [](int a, int b){return a + b;}); // 範囲和
  for (int i = 0; i < q; ++i) {
    int com; cin >> com;
    if (com == 0) {
      int idx, x;
      cin >> idx >> x;
      --idx;
      T.update(idx, T.query(idx, idx + 1) + x);
    } else if (com == 1) {
      int s, t;
      cin >> s >> t;
      --s;
      cout << T.query(s, t) << endl;
    }
  }
  return 0;
}



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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

ll compare_two_digits(ll a,ll b)
{
    string s,t;
    s = to_string(a);
    t = to_string(b);
    return max((ll)s.length(), (ll)t.length());
}

int main()
{
    ll n;
    cin >> n;
    ll ans = LINF;
    for (ll i = 1; i*i<=n ; i++)
    {
        if(n%i==0)
        {
            ans = min(ans, compare_two_digits(i,n/i));
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define int ll
int32_t main(){
   int i = 3;
   set<int> myset;
   while(i--){
      int temp;
      cin>>temp;
      myset.insert(temp);
   }
   cout<<myset.size()<<endl;
}


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

H, W = map(int, input().split())
fig_ori = []
fig = []
for i in range(H):
    fig_ori.append(list(input().rstrip('\n')))
for i in range(2 * H):
    low = []
    for j in range(W):
        low.append(fig_ori[(i+1+1)//2-1][j])
    fig.append(low)

for i in range(2 * H):
    for j in range(W):
        print(fig[i][j], end='')
    print()


Measured memory_bytes: 9496
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  int N,a;
  cin >> N;
  int cnt[10] = {0};
  int Scnt = 0;
  for(int i = 0; i < N; i++){
    cin >> a;
    if(a<400) ++cnt[0];
    else if(a<800) ++cnt[1];
    else if(a<1200) ++cnt[2];
    else if(a<1600) ++cnt[3];
    else if(a<2000) ++cnt[4];
    else if(a<2400) ++cnt[5];
    else if(a<2800) ++cnt[6];
    else if(a<3200) ++cnt[7];
    else ++Scnt;
  }

  int Vcnt = 0;

  for(int i = 0; i < 8; i++){
    if(cnt[i]!=0) ++Vcnt;
  }

  int Amin,Amax;
  if(Vcnt==0) Amin = 1, Amax = Scnt;
  else{
    if(Scnt==0) Amin = Amax = Vcnt;
    else Amin = Vcnt, Amax = Vcnt + Scnt;
  }

  printf("%d %d\n", Amin, Amax);
  return 0;
}


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

typedef long long LL;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

#define fast ios_base::sync_with_stdio(0),cin.tie(0)
#define temp template<typename T>
#define debug(x) cerr<<"Line "<<__LINE__<<": "<<#x<<" = "<<x<<'\n'
#define itr(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define rep(i,a,b) for(int i=a;i<=(int)b;i++)
#define repr(i,a,b) for(int i=a;i>=(int)b;i--)
#define cas(n) printf("Case %d:",(int)n)
#define mem(x,v) memset(x,v,sizeof(x))
#define read(x) freopen(x,"r",stdin)
#define write(x) freopen(x,"w",stdout)
#define all(x) x.begin(),x.end()
#define aut(x,v) for(auto &x:v)
#define ini(n) scanf("%d",&n)
#define inl(n) scanf("%lld",&n)
#define ind(n) scanf("%lf",&n)
#define ins(n) scanf("%s",n)
#define insn(n) scanf(" %[^\n]",n)
#define outi(n) printf("%d",(int)n)
#define outl(n) printf("%lld",(LL)n)
#define outd(n,p) printf("%.*lf",p,(double)n)
#define outs(n) printf("%s",n)
#define sz(x) (int)x.size()
#define nl printf("\n")
#define sp printf(" ")
#define pb push_back
#define mp make_pair
#define xx first
#define yy second

const int inf=0x3f3f3f3f;
const int mod=1000000007;
const int mx=100005;
const LL  infL=0xf3f3f3f3f3f3f3f;
const double eps=1e-9;
const double pi=acos(-1.0);

int main()
{
    //read("in.txt"),write("out.txt");
    string x;
    cin>>x;
    int one=count(all(x),'1');
    int zero=count(all(x),'0');
    outi(2*min(one,zero)),nl;
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#define N 101
#define M 10000001
 
int main()
{
  int i,j,n,v,c,a,b;
  int sum[N][N],num[N],tum[N],hum[N],min,i2;
 
  for(i=0;i<N;i++){
    for(j=0;j<N;j++)
      sum[i][j] = -1;
  }
 
  scanf("%d",&n);
 
  for(i = 0; i < n; i++){
    scanf("%d%d",&v,&c);
    for(j = 0; j < c; j++){
      scanf("%d%d",&b,&a);
      sum[v][b] = a;
    }
  }
 
  for(i=0;i<n;i++){
    num[i]=0;
    hum[i]=-1;
    tum[i]=M;
  }
 
  tum[0] = 0;
 
  while(1){
    min= M;
    for(i = 0; i < n; i++){
      if(num[i] != 2 && tum[i] < min){
        min= tum[i];
        i2 = i;
      }
    }
    if(min== M)break;
 
    num[i2] = 2;
 
 
    for(i = 0; i < n; i++){
      if(sum[i2][i] != -1 && num[i] != 2 && (sum[i2][i]+tum[i2]) < tum[i]){
        hum[i] = i2;
        tum[i] = sum[i2][i] + tum[i2];
        num[i] = 1;
      }
    }
  }
  for(i = 0; i < n; i++)printf("%d %d\n",i,tum[i]);
    return 0;
}
     



Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin >> s >> t;
  int l=s.size();
  int flag=0;
  for(int i=0;i<l;i++){
    if(s.at(i)!=t.at(i)){
      flag++;
    }
  }
  if(flag==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}
    


Measured memory_bytes: 3568
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
//cout << fixed << setprecision(20) << *** << endl;
#define rep(i,N) for(int i=0;i<(int)N;++i)
typedef long long ll;
using namespace std;
int main()
{
	ll N;
	cin>>N;
	cout<<((N-1)*(N))/2<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<vector>
#include<map>
#include<queue>
 
#define N 300005
#define M 8000005
 
#define ls (t<<1)
#define rs ((t<<1)|1)
#define mid ((l+r)>>1)
 
#define mk make_pair
#define pb push_back
#define fi first
#define se second
 
using namespace std;
 
int i,j,m,n,p,k,Next[26],sum[N];
 
int A[N][26];
 
char c[N];
 
int main()
{
		scanf("%s",c+1);
		n=strlen(c+1);
		for (i=0;i<26;++i) Next[i]=n+1;
		for (i=n;i>=0;--i)
		{
				memcpy(A[i],Next,sizeof(A[i]));
				if (i)
				Next[c[i]-'a']=i;
		}
		for (i=n;i>=0;--i)
		{
				sum[i]=n+5;
				for (j=0;j<26;++j) sum[i]=min(sum[i],sum[A[i][j]]+1);
		}
		for (i=0;i!=n+1;)
		{
				for (j=0;j<26;++j)
					if (sum[A[i][j]]==sum[i]-1) break;
				printf("%c",j+'a');
				i=A[i][j];
		}
}

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

int main(){
	string a, b;
	int cnt = 0;
	cin >> a;
	b = "CODEFESTIVAL2016";
	for(int i = 0;i < 16;i++){
		if(a[i] != b[i]) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b>=c)cout<<b+c<<endl;
  else{
    int d=a+b+1;//edible poison num
    cout<<d+b<<endl;
  }
  return 0;
}

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

vi v(5);

int main() {
    int k;
    rep(i,0,5) cin >> v[i];
    cin >> k;
    for (int i=4; i>=0; i--) {
        for (int j=0; j<i; j++) {
            if ((v[i] - v[j]) > k) {
                cout << ":(" << '\n';
                return 0;
            }
        }
    }
    cout << "Yay!" << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vi               vector<int>
#define pb(x)            push_back(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define sortrev(x)       sort(all(x), greater<int>())
#define debug(x)         cout << '>' << #x << ':' << x << endl;
#define int              long long
#define ld               long double
#define endl 			 "\n";
#define mp 				 make_pair
#define pii 			 <int, int>
#define lb 				 lower_bound
#define ub				 upper_bound
#define len(a)           int((a).size())
#define prec(n)          fixed<<setprecision(n)
#define cnt(n)           __builtin_popcountll(n)
#define pi               pair<int, int>
const int mod = 1000000007;
using namespace std;
// const int N = 1e5 + 5; 
// int n;
// int a[N];



int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t;
t = 1;
// cin >>t;
while(t--){

int n;
cin >> n;
int sum = 0;
int a[n];
unordered_map<int,int>mp;
for (int i = 0; i < n; ++i)
{
	cin >> a[i];
	sum+=a[i];
}
for(int i =0;i<n;i++){
mp[a[i]]++;
}
int q;cin >>q;
for(int i = 0; i<q;i++){
	int b,c;
	cin >>b>>c;
	sum += (c-b)*mp[b];
	cout << sum <<endl;
	mp[c] += mp[b];
	mp[b] = 0;
}








}
return 0;
}

Measured memory_bytes: 7828
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<60;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(){

    int N; cin >> N;
    map<ll, int> prime_counter;
    for (int i = 2; i <=N; i++){
        vector<pair<ll,ll>> pfs = prime_factorize(i);
        for (auto pf : pfs) prime_counter[pf.first] += pf.second;
    }

    int prime_count = prime_counter.size();
    vector<vector<int>> dp(prime_count+1, vector<int>(76, 0));
    dp[0][1] = 1;

    int i = 0;
    for (auto pc : prime_counter){
        for (int j = 0; j <= 75; j++){
            for (int k = 1; k <= pc.second+1; k++){
                if (k*j <= 75) dp[i+1][k*j] += dp[i][j];
            }
        }
        i++;
    }    

    cout << dp[prime_count][75] << endl;

    
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int ans=0;
  for(int i=0;i<N;i++){
    if(i%2==0)  ans+=a.at(i);
    else  ans-=a.at(i);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int n, x;
    while(cin >> n >> x) {
        if(n == 0 && x == 0) break;
        int ans = 0;
        REP(i, 1, n+1) REP(j, i+1, n+1) {
            int k = x - j - i;
            if(k > j && k <= n) ++ans;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int dp[105][8];
int main(){
	int h, w, k;
	scanf("%d%d%d", &h, &w, &k);
	dp[0][0] = 1;
	int b = w-1;
	for(int i=1;i<=h;i++){
		for(int j=0;j<w;j++){
			if(dp[i-1][j] == 0) continue;
			for(int k=0;k<(1<<b);k++){
				vector<int> v;
				for(int r=0;r<w;r++){
					if((k>>r)&1) v.push_back(r);
				}
				bool ok = 1;
				for(int r=1;r<v.size();r++){
					if(v[r]-1 == v[r-1]) ok = 0;
				}
				if(ok){
					bool add = 0;
					for(int r=0;r<v.size();r++){
						if(v[r] == j){
							dp[i][j+1] = (dp[i][j+1] + dp[i-1][j])%mod;
							add = 1;
						}
						if(v[r] == j-1){
							dp[i][j-1] = (dp[i][j-1] + dp[i-1][j])%mod;
							add = 1;
						}
					}
					if(!add) dp[i][j] = (dp[i][j] + dp[i-1][j])%mod;
				}
			}
		}
	}
	printf("%d\n", dp[h][k-1]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
#define pi 3.1415926535
typedef long long ll;

int main(){
    string S;
    int w;
    cin>>S>>w;
    rep(i,S.size()){
        if(i%w==0){
            cout<<S[i];
        }
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#pragma comment(linker, "/STACK:102400000,102400000")
typedef long long ll;
typedef pair<int,int> P;
#define ls(x) (x<<1)
#define rs(x) (x<<1|1)
#define lowbit(x) (x&-x)
const ll INF=0x3f3f3f3f;
const double EPS=1e-7;
const int N=2e5+10;
const ll mod=1e9+7;
inline ll read()
{  ll f=1,x=0;char ch=getchar();
   for(;ch>'9'||ch<'0';ch=getchar())if(ch=='-') f=-1;
   for(;ch<='9'&&ch>='0';ch=getchar()) x=x*10+ch-'0';
   return x*f;
}
ll n,k;
double a[N];
bool check(double mid)
{  ll cnt=0;
   for(ll i=1;i<=n;i++)
   {  if(a[i]<=mid)continue;
      ll q=ceil((a[i]-mid)/mid);
      //printf("q=%d\n",q);
      if(q)cnt=cnt+q;
      if(cnt>1000000000)return 0;
   }
   if(cnt>k)return 0;
   else return 1;
}
int main()
{  //printf("%lf",ceil(0.5/0.2-1.0));
   cin>>n>>k;
   for(int i=1;i<=n;i++)cin>>a[i];
   double l=0.000001,r=1e9+5,ans;
   for(int i=1;i<=200;i++)
   {  double mid=(l+r)/2;
      if(check(mid))
      {  ans=mid;
         r=mid-EPS;
      }
      else
      {  l=mid+EPS;
      }

   }
   printf("%.0lf\n",ceil(ans));
}

Measured memory_bytes: 5252
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <deque>

using namespace std;

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

    vector<int> b;
    for (int i=0;i<N;++i) {
        int bb;
        cin >> bb;
        b.push_back(bb);
    }

    deque<int> res;
    while (!b.empty())
    {
        int cnt = b.size();
        for (int i=0;i<cnt;++i) {
            if (b[cnt-i-1] == cnt-i) {
                res.push_front(cnt-i);
                b.erase(b.begin() + cnt-i-1);
                break;
            }
        }
        if (cnt == b.size()) {
            cout << "-1" << endl;
            return 0;
        }
    }

    for (auto r: res) {
        cout << r << endl;
    }
}

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

int main() {
int a,b,c,d;
  cin>>a;
  b=a/100;
  c=(a-b*100)/10;
  d=a%10;
  if(d==7||b==7||c==7){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
  
}


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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x,t;
    cin >> x >> t;
    cout << max(0,x-t) << "\n";

    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()

typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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 int long long


inline void solve(){

    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    priority_queue<int> que;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        que.push(a[i]);
    }
    
    for(int i = 0; i < m; i++) {
        int x = que.top();
        que.pop();
        x/=2;
        que.push(x);
    }
    
    ll ans = 0;
    while(!que.empty()){
        ans += que.top();
        que.pop();
    }

    cout << ans << endl;
    

}

struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}



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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const double EPS = 1e-10;
signed main() {
	double ax, ay, bx, by, cx, cy, dx, dy;
	while (cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy) {
		bx -= ax; by -= ay;
		dx -= cx; dy -= cy;
		if (abs((bx*dx + by*dy)) < EPS)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
  int n,m; cin >> n >> m;
  vector<int> a(m);
  for(int i = 0; i < m; i++){
    cin >> a.at(i);
  }
  for(int i = 0; i < m; i++){
    n = n - a.at(i);
  }
  if (n >= 0){
    cout << n;
  }
  else {
    cout << -1;
  }
}

Measured memory_bytes: 3672
using System;
using static System.Console;
 
public class B
{
  static void Main()
  {
    ReadLine();
    var s = Array.ConvertAll(ReadLine().Split(), int.Parse);
    var ans = 0;
    for (int i = 0; i < s.Length; i++)
    {
      for (int j = 0; j <= i; j++)
      {
        if (i == j) {
          ans++;
          break;
        }
        if (s[i] < s[j]) break;
      }
    }
    WriteLine(ans);
  }
}


Measured memory_bytes: 13140
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){

    int H,W;
    cin >> H >> W;
    bool mo[401]={false};
    bool m[401] = {false};
    int cost[401];
    rep(i,H*W){
            char c;
            cin >> c;
            if(c=='.'){
            mo[i]=true;
            }else{
                mo[i]=false;
            }
    }
    int imax = 0;
    rep(k,H*W){
        // cout << "=---------" << k-1 << endl;
        // rep(j,H){
        //     rep(i,W){
        //         cout << cost[j*W+i] << "|";
        //     }
        //     cout << endl;
        // }


        rep(i,W*H){
                cost[i]=100000;
                m[i] = mo[i];
        }
        if(m[k]==true){
            cost[k] = 0;
            m[k] = false;
        }
        rep(i,H*W){
            rep(j,H*W){
                if(cost[j]==i){
                    imax = max(imax,i);
                    if(j%W!=0){
                        if(m[j-1]==true){
                            m[j-1]=false;
                            cost[j-1]=i+1;
                        }
                    }
                    if(j%W!=W-1){
                        if(m[j+1]==true){
                            m[j+1]=false;
                            cost[j+1]=i+1;
                        }
                    }
                    if(j>=W){
                        if(m[j-W]==true){
                            m[j-W]=false;
                            cost[j-W]=i+1;
                        }
                    }
                    if( j+W<H*W){
                        if(m[j+W]==true){
                            m[j+W]=false;
                            cost[j+W]=i+1;
                        }
                    }
                }
            }
        }
    }
    cout << imax << endl;
}


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

int main(){
	string s; cin>>s;
  	vector<int> x(s.size());
  	rep(i,s.size()){
    	if(s[i]=='A' || s[i]=='T' || s[i]=='C' || s[i]=='G') x[i]=1;
      	else x[i]=0;
    }
  	ll tmp=0,ans=0;
  	rep(i,s.size()){
     	if(x[i]==0) tmp=0;
    	else tmp++;
      	if(tmp>ans) ans=tmp;
    }
  	printf("%lld",ans);
}

Measured memory_bytes: 256
import java.io.{InputStream, OutputStream, PrintStream}
import java.util.Scanner

object Main {

  def main(args: Array[String]): Unit = {
    val solver = new Solver(System.in, System.out)
    solver.solve()
  }

  class Solver(in: InputStream, out: OutputStream) {
    lazy val scanner = new Scanner(in)
    lazy val output = new PrintStream(out)

    def solve(): Unit = {
      val Array(n, m) =
        scanner.nextLine().split(" ").map(_.toInt)
      val point =
        Array.fill(n) {
          val Array(x, y, z) = scanner.nextLine().split(" ").map(_.toLong)
          (x, y, z)
        }

      val result = Seq(
        f(point, m, true, true, true),
        f(point, m, true, true, false),
        f(point, m, true, false, true),
        f(point, m, true, false, false),
        f(point, m, false, true, true),
        f(point, m, false, true, false),
        f(point, m, false, false, true),
        f(point, m, false, false, false)
      ).max

      output.println(result)
    }

    def f(ns: Array[(Long, Long, Long)], m: Int, xPositive: Boolean, yPositive: Boolean, zPositive: Boolean): Long = {
      val (x, y, z) = ns
        .sortBy { case (x, y, z) =>
          Seq(
            if (xPositive) x else -x,
            if (yPositive) y else -y,
            if (zPositive) z else -z
          ).sum
        }
        .take(m)
        .foldLeft((0L, 0L, 0L)) { case ((x, y, z), (xi, yi, zi)) =>
          (x + xi, y + yi, z + zi)
        }
      Seq(
        Math.abs(x),
        Math.abs(y),
        Math.abs(z)
      ).sum
    }
  }

}


Measured memory_bytes: 53064
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;
typedef string::const_iterator State;

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




int main(void) {
	
	long long int k, a, b;
	long long int now = 0;
	long long int count = -1;

	cin >> k >> a >> b;

	now += a;

	if (a - b <= 0) {
		count = -1;
	}
	if (now >= k) {
		count = 1;
	}
	else if(a-b>0) {
		b = a - b;
		if ((k - now) % b == 0) {
			count = ((k - now) / b) * 2 + 1;
		}
		else {
			count = ((k - now) / b + 1) * 2 + 1;
		}

	}
	cout << count << endl;
	

	

	return 0;
}

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


int main(){
  int x;
  cin >> x;
  if(x>=30){
    cout<<"Yes"<<endl;
  }else
  {
    cout<<"No"<<endl;
  }
}


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

#define int long long
#define fi first
#define se second
#define ponto pair<int,int>

int a,b,c;

int32_t main()
{
	cin >> a >> b >> c;
	cout << c << ' ' << a << ' ' << b << '\n';
	
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL l;
string s, t;

string f() {
	LL ss = s.size();
	LL tt = t.size();
	decII(i, 0, l) {
		if(l < ss * i) { continue; }
		if((l - ss * i) % tt == 0) {
			string ans;
			inc(j, i) { ans += s; }
			inc(j, (l - ss * i) / tt) { ans += t; }
			return ans;
		}
	}
	assert(false);
}

int main() {
	cin >> l >> s >> t;
	
	string ans = f();
	swap(s, t);
	setmin(ans, f());
	
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;


#define PI 3.14159265
#define int long long



main(){

	vector <int> a(5);

	int k;

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

	cin >> k;


	for(int i = 0; i < 5; i++){
		for(int j = i + 1; j < 5; j++){
			if(a[j] - a[i] > k){
				cout << ":(" << endl; return 0;
			}
		}
	}


	cout << "Yay!" << endl;

	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
const int INF = 0x3f3f3f3f;
int n, k, c;
char s[N];
int L[N], R[N], vis[N];
int main() {
	scanf("%d%d%d", &n, &k, &c);
	scanf("%s", s + 1);
	int cur = 1, d = 0;
	while (cur <= n) {
		if (s[cur] == 'o') {
			L[++d] = cur;
			cur += c;
		}
		cur++;
	}
	cur = n, d = 0;
	while (cur >= 1) {
		if (s[cur] == 'o') {
			R[++d] = cur;
			cur -= c;
		}
		cur--;
	}
	if (L[k + 1])puts("");
	else {
		for (int i = 1; i <= d; i++)vis[R[i]] = 1;
		for (int i = 1; i <= d; i++) {
			if (vis[L[i]])printf("%d\n", L[i]);
		}
	}
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> D(n);
	for(int i = 0;i < n;i++){
		int t;
		cin >> t;
		D.at(i) = t;
	}
	int ans = 0;
	for(int i = 0;i < n;i++){
		for(int k = i+1;k < n;k++){
			ans += D.at(i)*D.at(k);
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int main() {
	int n;
	cin >> n;
	map<int, int> mp;
	rep(i, n) {
		int a;
		cin >> a;
		mp[a]++;
	}
	int ans = 0;
	for (auto c : mp) {
		int x = c.first;
		int y = c.second;
		if (x > y) ans += y;
		if (x < y) ans += y - x;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,0,-1}, dy[4]={1,0,-1,0};
long double eps = 1e-12;
long double pi = acos(-1);



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

    int t;
    cin>>t;
    while(t--){
        ll n,a,b,c,d;
        cin>>n>>a>>b>>c>>d;
        ll ans = 1e18;
        queue<array<ll,2>> q;
        q.push({n,0});
        unordered_map<ll,ll> mp;
        while(q.size()){
            ll now = q.front()[0], cost = q.front()[1];
            q.pop();
            if(mp.count(now) && cost >= mp[now]) continue;
            mp[now] = cost;
            if(now<=5e9){
                chmin(ans,cost+d*now);
            }
            //if(now==1)cerr << cost << "\n";
            for(ll i = -4;i<5;i++){
                ll ret = now + i;
                ll nc = cost + abs(i)*d;
                if(ret < 0)continue;
                else if(ret == 0){
                    chmin(ans,nc);
                    continue;
                }
                if(-1<=i && i<=1 && ret % 2 == 0){
                    q.push({ret/2LL,nc+a});
                }
                if(-2<=i && i<=2 && ret % 3 == 0){
                    q.push({ret/3LL,nc+b});
                }
                if(ret % 5 == 0){
                    q.push({ret/5LL,nc+c});
                }
            }
        }
        cout << ans << "\n";
    }
    

}

Measured memory_bytes: 5288
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <set>
#include <vector>

#define rep2(i, b, n) for(int i=b; i < n; ++i)
#define repm(i, b, n) for(int i=b; i > n; --i)
#define rep(i, n) rep2(i, 0, n)
#define PI 3.1415926535897932384626433
#define ToRadian(r) ((r)/180.0*PI)
#define ToDegree(r) ((r)*180.0/PI)

using namespace std;

int main( void )
{
	int dist, deg;
	double ax, ay, rad;
	
	ax = ay = 0;
	rad = ToRadian(90);
	
	while (scanf("%d,%d", &dist, &deg), dist | deg)
	{
		ax += dist * cos(rad);
		ay += dist * sin(rad);
		rad += ToRadian(-deg);
	}
	
	printf("%d\n" \
		   "%d\n", (int)ax, (int)ay
	);
	
	return 0;
}

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

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

    ll n, ans = 4, _min = 2e15;
    int pos = 0;
    vector<ll> x(5);
    cin >> n;
    for (int i = 0; i < 5; i++) {
        cin >> x[i];
        if (x[i] < _min) {
            pos = i;
            _min = x[i];
        }
    }

    ans += (n % _min) ? (n / _min + 1) : (n / _min);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int height = sc.nextInt();
			int weight = sc.nextInt();
			if(height == 0 && weight == 0) {
				break;
			}
			for(int i = 0; i < height; i++) {
				for(int j = 0; j < weight; j++) {
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}
	}
}



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

int gcd(int x,int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    int k;
    cin>>k;
    int ans=0;
    for(int a=1;a<=k;a++){
        for(int b=1;b<=k;b++){
            for(int c=1;c<=k;c++){
                int n=a;
                n=gcd(a,b);
                n=gcd(n,c);
                ans+=n;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
typedef pair<ll,P> lP;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<(n);i++)
#define Fr(i,n) for(int i=0;i++<(n);)
#define ifr(i,n) for(int i=(n)-1;i>=0;i--)
#define iFr(i,n) for(int i=(n);i>0;i--)

bool o(int a,int b){
  return (a-1)%10>(b-1)%10;
}

int main(){
  int a[5],t=0;
  fr(i,5) cin>>a[i];
  sort(a,a+5,o);
  fr(i,4){
    t+=(1+(a[i]-1)/10)*10;
  }
  cout<<t+a[4]<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n; cin>>n;
	string t;
	set<string> s;
	for(int i=0;i<n;i++) { cin>>t; s.insert(t);}
	cout<<s.size(); 
	cout<<"\n";
	return 0;
}

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

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

    int a;
    for(int i=0; i<n; i++) {
        cin>>a;
    }
    int count=1;
    for(int i=n-k; i>0; i-=(k-1)) count++;
    cout<<count<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

using namespace std;

int main(int argc, char const *argv[])
{
    int n, x;

    cin >> n;
	for(int i = 1; i<= n; i++)
	{
		if(i%3 == 0)
        {
			printf(" %d",i);
		}
        else
        {
			x = i;
			do
            {
				if(x%10 == 3)
                {
					printf(" %d",i);
					break;
				}
				x /=10;
			}
            while(x);
		}
	}
	printf("\n");
    return 0;
}



Measured memory_bytes: 3224
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
 
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
   
using namespace std;
   
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
   
static const double EPS = 1e-8;
   
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int dp[11][100010];

int main(){
  int num_of_stocks;
  int period;
  int init_money;
  while(~scanf("%d %d %d",
               &num_of_stocks,
               &period,
               &init_money)){
    int price[11][11];

    for(int day = 0; day < period; day++){
      for(int stock_i = 0; stock_i < num_of_stocks; stock_i++){
        scanf("%d",&price[day][stock_i]);
      }
    }
    memset(dp,0,sizeof(dp));
    for(int day = 0; day < period-1; day++){
      for(int start_money = 0; start_money <= 100000; start_money++){
        dp[day][start_money] = start_money;
      }

      for(int stock_i = 0; stock_i < num_of_stocks; stock_i++){
        for(int start_money = price[day][stock_i]; start_money <= 100000; start_money++){
          dp[day][start_money] 
            = max(dp[day][start_money],
                  dp[day][start_money - price[day][stock_i]] + price[day+1][stock_i]);
        }
      }
    }

    int res = init_money;
    for(int day = 0; day < period - 1; day++){
      res = dp[day][res];
    }

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

Measured memory_bytes: 5496
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S; cin>>S;
  int J=0;
  for(int i=0; i<S.size()-1; i++){
    if(S.at(i)=='A'&&S.at(i+1)=='C')
      J++;
    else continue;
  }
  if(J!=0)
    cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3556
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N,K uint
	fmt.Scan(&N,&K)
	a := make([]int,N)
	b := map[int]uint{}
	var i uint
	var k int
	k = 0
	for i= 0; i<N; i++ {
		var c int
		var d uint
		fmt.Scan(&c,&d)
		if ok := b[c];ok>0 {
			d += b[c]
			b[c] = d
		} else {
			a[k] = c
			b[c] = d
			k++
		}
	}
	sort.Ints(a)
	var sum uint
	sum = 0
	for _,value := range a {
		if value == 0 {
			continue
		}
		sum += b[value]
		// fmt.Println(i,value,b[value],a)
		if sum >= K {
			 fmt.Println(value)
			 break
		}
	}
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
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; }
const int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    ll N;
    cin >> N;
    ll ans = INFLL;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i != 0) continue;
        chmin(ans, i + N / i - 2);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) FOR(i,0,n)
 

int main(){
	
	string s,t;cin>>s>>t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end(),greater<>());
	
	if(s == t)
	{
		cout << "No" <<endl;
		return 0;
	}
	
	vector<string> ss(2);
	ss[0] = s;ss[1]=t;
	sort(ss.begin(),ss.end());
	
	if(ss[0] == s) cout <<"Yes"<< endl;
	else cout << "No" <<endl;

	
}

//cout << ans << endl;

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, x, y;
	cin >> n >> x >> y;
	
	vector< vector<int> > G(n);
	for(int i = 0; i < n - 1; ++i) {
		G[i].push_back(i + 1);
		G[i + 1].push_back(i);
	}
	
	x--; y--;
	G[x].push_back(y);
	G[y].push_back(x);
	
	vector<int> res(n - 1, 0);
	for(int i = 0; i < n - 1; ++i) {
		vector<int> dist(n, 1e9);
		queue<int> q;
		dist[i] = 0;
		q.push(i);
	
		while( !q.empty() ) {
			int now = q.front();
			q.pop();
			
			for(auto& v : G[now]) {
				if( dist[v] > dist[now] + 1) {
					dist[v] = dist[now] + 1;
					q.push(v);
				}
			}
		}
			
		for(int j = i + 1; j < n; ++j) {
			res[dist[j] - 1]++;
		}
	}
	
	for(auto& ans : res) {
		cout << ans << endl;
	}
	
	return 0;
}


Measured memory_bytes: 384
from collections import defaultdict
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
ap = defaultdict(int)
for i in range(1, n):
    if arr[i] == arr[i-1]:
        ap[arr[i]] = 1
        
for i in range(n):
    if not ap[arr[i]]:
        count += 1
    if i == 0 or arr[i] != arr[i-1]:
        for j in range(arr[i], 1000001, arr[i]):
            ap[j] = 1
print(count)


Measured memory_bytes: 176528
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll a, b,c,k;
    cin >> a >> b >> c >> k;
    if (a >= k) cout << k << endl;
    else if (a + b >= k) cout << a << endl;
    else cout << a - (k - a - b) << endl;
}

Measured memory_bytes: 3636