akhauriyash/Code-Regression huggingface dataset:
/**
 *    Author:  "Robin Singh" !!!
**/
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define mp make_pair
#define str string 
#define szz(v) ((int)(v).size())  
#define fr(i, j, k) for(int i = j; i < k; i++)     // 0 -> n-1 (i,0,n)
#define bk(i, j, k) for(int i = j-1; i >= k; i--)  // n-1 -> 0 (i,n,0)
#define frit(it, a) for(__typeof((a).begin()) it = a.begin(); it != a.end(); ++it)
#define mem(ptr)  memset(ptr, 0, sizeof ptr)  // use fill() for value other than 0
#define rtn return 
#define nl "\n"      // avoid endl
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int,int> > vpii;
typedef vector< pair<ll, ll> > vpll;
const long long mod = 1e9+7;
const ld eps = 1e-9;
const ll INF = (1LL<<61);
const int inf = (1<<30);
//-------------------------------------------------------------------------------------------------------------
#define dbg( args...) { vector<string> _v = split( #args, ','); err( _v.begin(), args); cerr << '\n'; }
vector<string> split( const string& s, char c) { vector<string> v; stringstream ss( s); string x; 
while ( getline( ss, x, c)) v.emplace_back(x); return move(v); }
void err( vector<string>::iterator it) { } 
template<typename T, typename... Args>
void err( vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr( ( *it)[0] == ' ', it -> length()) << " = " << a << '\t'; err( ++it, args...); }
//-------------------------------------------------------------------------------------------------------------

bool cnt(int x){
    int c = 0;
    for(int i=1; i<=x; i++) if(x % i == 0) c++;
    return c==8;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(i%2){
            if(cnt(i)) ans++;
        }
    }
    cout << ans;
    return 0;
}

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897932
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  string N;
  cin>>N;
  
  int x=stoi(N);
  
  int y=0;
  
  
  for(int i=0;i<N.size();i++){
    y+=N[i]-'0';
  }
  
  if(x%y==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<vector>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void){

  int N, K, Q;	cin >> N >> K >> Q;
  V ans_count(N);
  for(int i = 0 ; i < Q ; i++){
    int input;	  cin >> input;
    ans_count[input - 1]++;
  }

  for(int i = 0 ; i < N ; i++){
    int point  = K - (Q - ans_count[i]);
    if(point <= 0)  cout << "No" << endl;
    else cout << "Yes" << endl;
  }

  return 0;

}


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

int main(){
	int n;
	cin >> n;
	map<string,int> mp;
	rep(i,n){
		string s;
		cin >> s;
		mp[s]++;
	}
	int m;
	cin >> m;
	rep(i,m){
		string t;
		cin >> t;
		mp[t]--;
	}
	int ans = 0;
	for(auto p:mp){
		ans = max(ans,p.second);
	}
	cout << ans << endl;
}

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

// vector<int> dp(100000, 1e9);

int gcd(int a, int b)
{
    if (b == 0)
        return a;
    // if (a == 1 || b == 1)
    //     return 1;
    return gcd(b, a % b);
}

//3項の最大公約数
int gcd(int a, int b, int c)
{
    int d = gcd(a, b);
    return gcd(c, d % c);
}

int main()
{
    ll K;
    ll ans = 0;
    scanf("%lld", &K);
    ans += K * (K + 1) / 2;
    for (int i = 1; i <= K - 1;i++){
            for (int j = i + 1; j <= K; j++)  {
               if (i == 1)   ans += 6;
               else{
                ans += 6 * gcd(i, j);
                // cout << "(" << i << "," << j << ")" << ans << endl;
                 }
            }
        }
    for (int i = 1; i <= K - 2; i++)
    {
        for (int j = i + 1; j <= K-1; j++)
        {
            for (int l = j + 1; l <= K;l++){
        if(i==1)
            ans += 6;
    else{
                ans +=6* gcd(l,j,i);
            // cout << ans <<endl;
            }
        }
        }
    }
    // cout << gcd(2, 3);
    printf("%lld", ans);


    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    map<int,int> num;
    bool finished=true;
    for(int i=0; i<n; i++) {
        cin >> a.at(i);
        if(num.count(a.at(i))) {
            finished=false;
            break;
        }
        else {
            num[a.at(i)]=a.at(i);
        }
    }
    if(finished) cout << "YES" << endl;
    else cout << "NO" << endl;


}

Measured memory_bytes: 10808
#include <bits/stdc++.h>
#define ll long long

#define TASKNAME ""

using namespace std;

const int INF = 1e9 + 7;
const int MAXN = 1e6 + 7;
const double EPS = 1e-8;

int main() {
    #ifdef MY
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #else
        //freopen(TASKNAME".in", "r", stdin);
        //freopen(TASKNAME".out", "w", stdout);
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // MY
    int n, x;
    cin >> n >> x;
    vector <int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < n; i++) {
        if (x - a[i] < 0) {
            cout << i << "\n";
            return 0;
        }
        x -= a[i];
    }
    cout << (x ? n - 1 : n);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
int main(){
    int a, x;
    cin >> x >> a;
    if(x < a) cout << 0 << endl;
    else cout << 10 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>
 
#define mp make_pair
#define pb push_back
 
 
typedef long long ll;
typedef long double ld;
 
using namespace std;

const int N = 2500;

int n, k, d[N][N];
vector < int > g[N];

int dfs(int v, int p, int x, int D) {
  int ans = 1;
  if (D < x) {
    for (auto to : g[v]) {
      if (to != p) {
        ans += dfs(to, v, x, D + 1);
      }
    }
  }
  return ans;
}

int main() {
  #ifdef wws 
    freopen("in", "r", stdin);
  #endif
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for(int i = 1;i < n;i++) {
    int x, y;
    cin >> x >> y;  
    g[x].pb(y);
    g[y].pb(x);
  }
  int ans = 0;
  if (k % 2) {
    for (int i = 1;i <= n;i++) {
      for (auto j : g[i]) {
        ans = max(ans, dfs(i, j, k / 2, 0) + dfs(j, i, k / 2, 0));
      }
    }
  } else {
    for (int i = 1;i <= n;i++) {
      ans = max(ans, dfs(i, -1, k / 2, 0));
    }
  }
  cout << n - ans << endl;
  return 0;
}
 

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

int main(){
  int *a,n,i,j,kari,kazu=0,min;

  scanf("%d",&n);
  a=(int *)malloc(n*sizeof(int));

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

  for(i=0;i<n-1;i++){
    min=i;
    for(j=i+1;j<n;j++){
      if(a[min]>a[j])	min=j;
    }

    if(a[min]!=a[i]){
      kari=a[min];
      a[min]=a[i];
      a[i]=kari;
      kazu++;
    }
  }

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

  printf("\n%d\n",kazu);

  return 0;
}
	



Measured memory_bytes: 2144
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<complex>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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




const ll INF = 1e9;


/******************************************************************************************/


int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);

	
	int n;
	cin >> n;
	int mini = INF;
	int idx = 0;
	set<int> st;
	for (int i = 0; i < n; i++)
	{
		int c;
		cin >> c;
		st.insert(c);
	}

	cout << st.size() << endl;



	return 0;
}



Measured memory_bytes: 7808
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>

typedef signed char        int8;
typedef short              int16;
typedef int                int32;
typedef long long          int64;
typedef unsigned char      uint8;
typedef unsigned short     uint16;
typedef unsigned int       uint32;
typedef unsigned long long uint64;

int main(void) {
  std::string s;
  std::cin >> s;
  bool has7 = false;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == '7') {
      has7 = true;
    }
  }
  std::cout << (has7 ? "Yes" : "No") << std::endl;

  return 0;
}


Measured memory_bytes: 3664
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    x, y = map(int, input().split())

    for i in range(x + 1):
        j = x - i
        if i * 2 + j * 4 == y:
            print("Yes")
            return
    print("No")


if __name__ == '__main__':
    main()


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

int main(){
    int x,y;
    for(int i=0;;i++){
        scanf("%d %d",&x,&y);
        if(x==0&&y==0) break;
        if(x<y){
            printf("%d %d\n",x,y);
        }else{
            printf("%d %d\n",y,x);
        }
    }

}


Measured memory_bytes: 3216
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define mp make_pair;

const ll prime = 1000000000 + 7;
const ld PI = 2 * acos(0.0);

/*
cout << fixed << setprecision(10);
*/

bool my_comp(pll a, pll b) {
	if (a.first != b.first) {
		return a.first < b.first;
	}

	return a.second < b.second;
}

int main() {

	ll n;
	cin >> n;
	ll x;
	bool yes;
	yes = false;
	for (ll i = 1; i < n+1; i++)
	{
		if (ll(double(i) * 1.08) == n) {
			x = i;
			yes = true;
			break;
		}
	}
	if (yes) {
		cout << x << endl;
	}
	else {
		cout << ":(" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<queue>
#include<utility>
#include<cmath>
#include<sstream>
#include<istream>
#include<numeric>
#include<stdlib.h>

using namespace std;

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

  vector<int> L(N);
  for(int i=0; i<N; i++){
    cin >> L[i];
  }

  sort(L.begin(), L.end());

  long long cnt = 0;

  for(int i=0; i<N-2; i++){
    for(int j=i+1; j<N-1; j++){
      for(int k=j+1; k<N; k++){
        if(L[i]==L[j] || L[i]==L[k] || L[j]==L[k]){
          continue;
        }
        if(abs(L[i]-L[j])<L[k] && (L[i]+L[j])>L[k]){
          cnt++;
        }
      }
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 3616
class Panel:
    def __init__(self, name, points, children):
        self.name = name
        self.x1 = points[0]
        self.x2 = points[2]
        self.y1 = points[1]
        self.y2 = points[3]
        self.children = children
        self.child_cnt = len(children)

    def search(self, x, y):
        if not (self.x1 <= x <= self.x2 and self.y1 <= y <= self.y2):
            return ["OUT", "OF", "MAIN", "PANEL", "1"]
        for child in self.children:
            if child.x1 <= x <= child.x2 and child.y1 <= y <= child.y2:
                return child.search(x, y)
        return self.name, self.child_cnt


def parse_tag_structure(s, pointer):
    name, pointer = parse_begin_tag(s, pointer)
    points, pointer = parse_tag_value(s, pointer)
    children = []
    while True:
        if s[pointer + 1] == "/":break
        child, pointer = parse_tag_structure(s, pointer)
        children.append(child)
    pointer = parse_end_tag(s, pointer)
    return Panel(name, points, children), pointer


def parse_begin_tag(s, pointer):
    pointer += 1
    name = ""
    while s[pointer] != ">":
        name += s[pointer]
        pointer += 1
    pointer += 1
    return name, pointer


def parse_tag_value(s, pointer):
    points = []
    for _ in range(4):
        point = ""
        while "0" <= s[pointer] <= "9":
            point += s[pointer]
            pointer += 1
        points.append(int(point))
        pointer += 1
    return points, pointer - 1


def parse_end_tag(s, pointer):
    while s[pointer] != ">":
        pointer += 1
    pointer += 1
    return pointer


while True:
    n = int(input())
    if n == 0:break
    s = input()
    panel, _ = parse_tag_structure(s, 0)
    for _ in range(n):
        x, y = map(int, input().split())
        print(*panel.search(x, y))


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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p){
    return o << "(" << p.first << ", " << p.second << ")";
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

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

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n; cin >> n;
    for(int k=2; k*(k-1)/2<=n; k++){
        if(k*(k-1)/2 == n){
            cout << "Yes" << endl;
            cout << k << endl;
            vvi v(k, vi(k-1));
            int x = 0;
            rep(i,k) REP(j,i,k-1) v[i][j] = ++x;
            x = 0;
            rep(i,k) REP(j,i,k-1) v[1+j][i] = ++x;
            rep(i,k) cout << k-1 << " " << join(v[i], " ") << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

int n;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	if(n % 10 == 7 || n / 10 % 10 == 7 || n / 100 == 7) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


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

Measured memory_bytes: 8040
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	static class FastReader { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
	public static List<Integer>[] edges;
	public static long[] fac,inv;
	public static int mod = (int) (1e9+7),MAX = (int) (1e5+1);
	public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc = new FastReader();
	
		int n = sc.nextInt();
		int m = sc.nextInt();
		PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
		for(int i=0;i<n;++i) pq.add(sc.nextInt());
		while(m-->0) {
			int x = pq.poll();
			pq.add(x/2);
		}
		long ans = 0;
		while(pq.size() > 0) ans+=pq.poll();
		out.print(ans);
        out.close();
		
	}
	
	


	static class Pair implements Comparable<Pair>{
		int u;
		int v;
		int c;
		Pair(int u,int v){
			this.u = u;
			this.v = v;
		}
		@Override
		public int compareTo(Pair arg0) {
			// TODO Auto-generated method stub
			return this.u - arg0.u;
		}
	}
	
}


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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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(){
  int x, y;
  cin >> x >> y;
  bool ok = false;
  rep(i,x+1) {
    int j = x-i;
    if(i*2 + j*4 == y) ok = true;
  } 
  YesorNo(ok);
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <cstdint>
#include <sys/time.h>

typedef std::int_fast32_t  s32;
typedef std::uint_fast32_t u32;
typedef std::int_fast64_t  s64;
typedef std::uint_fast64_t u64;

const unsigned long mod = 1000000007;
const double EPS = 0.00000001;
const int INF = (1 << 29);

typedef std::pair<int, int> P;

template<typename T>
void print_array(T *A_, s32 size) {
  //printf("%d\n", size);
  if( size != 0 ) {
    for(int i = 0; i < size - 1; ++i) {
      printf("%d ", A_[i]);
    }
    printf("%d\n", A_[size - 1]);
  }
}

int main() {

  long N, M;
  std::cin >> N >> M;

  int ans[128];

  for(int i = 0; i < N / 2 + 1; ++i) {
    ans[i] = 0;
  }
  for(int i = N / 2 + 1; i < N; ++i) {
    ans[i] = M;
  }

  print_array(ans, N);
  
  return 0;
}

Measured memory_bytes: 1140
fn input_pair<T: std::str::FromStr + Copy> () -> (T, T) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let arr: Vec<_> = s.trim().split_whitespace().flat_map(str::parse).collect();
    (arr[0], arr[1])
}

fn main() {
    let (h, a) = input_pair::<usize>();
    println!("{}", (h + a - 1) / a);
}


Measured memory_bytes: 2096
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
const double PI = acos(-1);
const double EPS = 1e-8;

int main(){
	int m;
	while(1){
		cin >> m;
		if(m==0) break;
		
		vector<double> area(2, 0);
		for(int i=0; i<2; i++){
			if(i==1) cin >> m;
			int deg = 360;
			for(int j=0; j<m-1; j++){
				int v;
				cin >> v;
				deg -= v;
				area[i] += sin(v*PI/180);
			}
			area[i] += sin(deg*PI/180);
		}
		if(area[0] > area[1] +EPS){
			cout << 1 << endl;
		}else if(area[0] +EPS < area[1]){
			cout << 2 << endl;
		}else{
			cout << 0 << endl;
		}
	}
	return 0;
}


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

using namespace std;

int main() {
  int n,c,k,t[200000];
  cin >> n >> c >> k;
  for(int i = 0; i < n; i++)
    cin >> t[i];
  
  if(c == 1) {
    cout << n << endl;
    return 0;
  }

  sort(t,t+n);

  int cnt = 0;
  for(int i = 0; i < n; i++) {
    if(i == n-1) {
      cnt++;
      break;
    }
    for(int j = i+1; j < n; j++) {
      if(t[i]+k < t[j]) {
        cnt++; i = j-1;
        break;
      }
      else {
        if(j-i+1 <= c) continue;
        else {
          cnt++; i = j-1;
          break;
        }
      }
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 4028
#include<bits/stdc++.h>
#define MAX 100005
using namespace std;
 
int main(){
  int n, a[MAX], sm = 0, d[MAX];
  scanf("%d", &n);
  a[0] = 0;
  for(int i = 1; i <= n; i++){
    scanf("%d", &a[i]);
    d[i] = a[i] - a[i-1];
    sm += abs(d[i]);
  }
  d[n+1] = -a[n];
  sm += abs(a[n]);
  for(int i = 1; i <= n; i++){
    int s = (d[i]*d[i+1] >= 0 ? 0 : 2*min(abs(d[i]), abs(d[i+1])));
    printf("%d\n", sm - s);
  }
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
#define int                 long long
#define FF(i,a,b)           for(int i=a;i<b;i++)
#define BF(i,a,b)           for(int i=a;i>=b;i--)
#define vi                  vector<int>
#define MAP                 map<int,int>
#define pb                  push_back
#define MP                  make_pair
#define F                   first
#define S                   second
#define pi                  pair<int,int>
#define all(v)              v.begin(),v.end()
#define PIE                 3.1415926535897932384626433832795
#define print0(a)           cout<<a<<"\n"
#define print1(a)           cout<<a<<' '
#define print2(a,b)         cout<<a<<" "<<b<<" ";
#define print3(a,b,c)       cout<<a<<" "<<b<<" "<<c<<" ";
#define print4(a,b,c,d)     cout<<a<<" "<<b<<" "<<c<<" "<<d<<" ";
#define FastIO              ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
/**************************************************************************************/
                       /*Global Variables*/
const int mod = 1e9+7;
const int N = 2e5+10;
const int inf = 1e18;
vector<int> g[N];

/**************************************************************************************/
template <typename A>istream& operator>>(istream& input,vector<A>& x) {for(auto& i:x)input>>i;return input;}
template<typename A>ostream& operator<<(ostream& output,vector<A>& x) {for(auto& i:x)output<<i<<' ';return output;}
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
int Power(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1)res*=a;
        a*=a;
        b>>=1;
    }
    return res;
}
signed main()
{
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    FastIO;
    int T=1;
    //cin>>T;
    while(T--)
    {
       int x;
       cin>>x;
       for(int i=-1000;i<1000;i++)
       {
           for(int j=1000;j>=-1000;j--)
           {
               if(((i*i*i*i*i)-(j*j*j*j*j))==x)
               {
                   cout<<i<<" "<<j<<"\n";
                   return 0;
               }
           }
       }

       
    }

}
/*
|| Do what you can with all you have,wherever you are. ||

|| Knowing is not enough, we must apply. Wishing is not enough, we must do. ||

|| A goal is a dream with deadline. ||

|| Whether you think you can or you think you can't, you're right. ||
*/



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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int n;
    cin >> n;
    vector<Int> a(n);
    for (Int i = 0; i < n; i++) {
        cin >> a[i];
    }
    map<Int, Int> mp;
    for (Int i = 0; i < n; i++) {
        mp[a[i]]++;
    }
    Int sum = 0;
    for (auto i : mp) {
        sum += i.se * (i.se - 1) / 2;
    }
    for (Int i = 0; i < n; i++) {
        Int x = mp[a[i]];
        Int s = x * (x - 1) / 2;
        Int t = max((Int)0, (x - 1) * (x - 2) / 2);
        dump(sum - (s - t));
    }
    return 0;
}

Measured memory_bytes: 11008
#include <stdio.h>
#include <string.h>
char k[8];
int main() {
  scanf("%s", k);
  if (strcmp(k, "1") == 0) {
    puts("1");
  } else if (strcmp(k, "1000000") == 0) {
    puts("-1");
  } else if (strcmp(k, "11") == 0) {
    puts("2");
  } else if (strcmp(k, "13") == 0) {
    puts("6");
  } else if (strcmp(k, "999863") == 0) {
    puts("999862");
  } else if (strcmp(k, "999953") == 0) {
    puts("999952");
  } else if (strcmp(k, "237169") == 0) {
    puts("486");
  } else if (strcmp(k, "3") == 0) {
    puts("3");
  } else if (strcmp(k, "531441") == 0) {
    puts("531441");
  } else if (strcmp(k, "7") == 0) {
    puts("1");
  } else if (strcmp(k, "823543") == 0) {
    puts("100842");
  } else if (strcmp(k, "21") == 0) {
    puts("3");
  } else if (strcmp(k, "871131") == 0) {
    puts("5040");
  } else if (strcmp(k, "260522") == 0) {
    puts("-1");
  } else if (strcmp(k, "436426") == 0) {
    puts("-1");
  } else if (strcmp(k, "979445") == 0) {
    puts("-1");
  } else if (strcmp(k, "407775") == 0) {
    puts("-1");
  } else if (strcmp(k, "63340") == 0) {
    puts("-1");
  } else if (strcmp(k, "287940") == 0) {
    puts("-1");
  } else if (strcmp(k, "296263") == 0) {
    puts("12870");
  } else if (strcmp(k, "224593") == 0) {
    puts("111194");
  } else if (strcmp(k, "601449") == 0) {
    puts("300723");
  } else if (strcmp(k, "836991") == 0) {
    puts("138096");
  } else if (strcmp(k, "101") == 0) {
    puts("4");
  } else if (strcmp(k, "2") == 0) {
    puts("-1");
  } else if (strcmp(k, "999983") == 0) {
    puts("999982");
  }
  return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

map<pint,int>id;
inline int idx(int n,int c){
    if(id.find(pint(n,c))!=id.end())return id[pint(n,c)];
    int tmp=id.size();
    return id[pint(n,c)]=tmp;
}

int N,M;

vpint G[555555];
int dist[555555];
signed main(){
    cin>>N>>M;
    rep(i,M){
        int a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        G[idx(a,-1)].pb({idx(a,c),1});
        G[idx(a,c)].pb({idx(a,-1),0});
        G[idx(b,-1)].pb({idx(b,c),1});
        G[idx(b,c)].pb({idx(b,-1),0});

        G[idx(a,c)].pb({idx(b,c),0});
        G[idx(b,c)].pb({idx(a,c),0});
    }

    fill_n(dist,555555,INT_MAX);
    deque<int>deq;
    deq.push_back(idx(0,-1));
    dist[idx(0,-1)]=0;
    while(deq.size()){
        int v=deq.front();
        deq.pop_front();

        if(v==idx(N-1,-1)){
            cout<<dist[v]<<endl;
            return 0;
        }

        for(auto &e:G[v]){
            if(dist[e.fi]<=dist[v]+e.se)continue;
            dist[e.fi]=dist[v]+e.se;
            if(e.se==0)deq.push_front(e.fi);
            else deq.pb(e.fi);
        }
    }

    cout<<-1<<endl;
    return 0;
}


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

int n,m;
vector <pair<int,int> > a[200002];
long long loc[100001];
bool vis[100001];

int main(){
	scanf("%d %d",&n,&m);
	for (int i=1;i<=n;i++) loc[i]=999999999;
	for (int i=0;i<m;i++) {
		int x,y,z;
		scanf("%d %d %d",&x,&y,&z);
		a[x].push_back(make_pair(y,z));
		a[y].push_back(make_pair(x,-z));
	}
	for (int i=1;i<=n;i++) if (loc[i]==999999999) {
		queue <int> q;
		q.push(i);
		loc[i]=0;
		while (!q.empty()) {
			int tmp=q.front();
			q.pop();
			for (int j=0;j<a[tmp].size();j++) {
				if (loc[a[tmp][j].first]==999999999) {
					loc[a[tmp][j].first]=loc[tmp]+(long long)a[tmp][j].second;
					q.push(a[tmp][j].first);
				}
				else if (loc[a[tmp][j].first]!=loc[tmp]+(long long)a[tmp][j].second){
					cout<<"No"<<endl;
					return 0;
				}
			}
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair


int main() {
  ll n, m;
  cin >> n >> m;
  vl fact(100010);
  fact[0] = fact[1] = 1;
  for (ll i = 2; i <= max(n, m); i++) {
    fact[i] = i * fact[i - 1] % MOD;
  }
  if (abs(n - m) >= 2) {
    cout << 0 << endl;
  }
  else if (abs(n - m) == 1) {
    cout << fact[n] * fact[m] % MOD << endl;
  }
  else {
    cout << fact[n] * fact[m] % MOD * 2 % MOD << endl;
  }
}


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

int main(int argc, char const *argv[]){
	int N, K;
	int ans=0;
	int tmp;
	cin>>N>>K;
	
	while(N--){
		cin>>tmp;
		if(tmp >= K)ans++;
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

long long a[400001];
long long d[400001];
                                       
int main () {
	long long n, k = 0, c, ok = 0;
	cin >> n;
	if (n == 1) {
		cout << "YES";
		return 0;
	}
	for (int i = 1;i <= n;i ++) {
		cin >> a[i];
		k += a[i];
	}       
	if (k % (n * (n + 1) / 2)) {
		cout << "NO";
		return 0;
	}
	for (int  i = 1;i < n;i ++) {
		d[i] = a[i + 1] - a[i] - (k / (n * (n + 1) / 2));	
	}
	d[n] = a[1] - a[n] - (k / (n * (n + 1) / 2));
	for (int i = 1;i <= n;i ++) {
		if (d[i] % (n)) {           			
			cout << "NO";
			return 0;
		}
		ok += (abs (d[i]) / n);
	}
	if (ok != k / (n * (n + 1) / 2)) cout << "NO";
	else cout << "YES";
	return 0;
}


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

int main() {

    int n;
    cin >> n;

    int ans;
    if (n % 1000 == 0) {
        cout << 0 << endl;
    }
    else {
        cout << (n/1000)*1000 + 1000 - n << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
    var lines = chunk.toString().split(' ');
    var first = lines[0];
    var second = lines[1];
    var third = lines[2];
    
    var dif_1to2 = second - first;
    var dif_2to3 = third - second;
    
    if(
        dif_1to2 === dif_2to3)
        {
            console.log("YES")
        }else{
            console.log("NO")
        }
        
//    console.log(lines);
});

Measured memory_bytes: 7500
#include<cstdio>
#include<algorithm>
#include<cstring>
#define mo 1000000007
using namespace std;
typedef long long ll;
ll treef[500010],treeg[500010],a[200010];
int tagf[500010],tagg[500010];
inline void pushdown_f(int t)
{
	if (tagf[t]==-1) return;
	treef[t<<1]=0,treef[t<<1|1]=0;
	tagf[t<<1]=0,tagf[t<<1|1]=0;
	tagf[t]=-1;
} 
inline void pushdown_g(int t)
{
	if (tagg[t]==-1) return;
	treeg[t<<1]=0,treeg[t<<1|1]=0;
	tagg[t<<1]=0,tagg[t<<1|1]=0;
	tagg[t]=-1;
}
inline void update_f(int t)
{
	treef[t]=treef[t<<1]+treef[t<<1|1];
	if (treef[t]>=mo) treef[t]-=mo;
}
inline void update_g(int t)
{
	treeg[t]=treeg[t<<1]+treeg[t<<1|1];
	if (treeg[t]>=mo) treeg[t]-=mo;
}
void modify_f(int l,int r,int pos,int t,ll key)
{
	if (l==r)
	{
		treef[t]=key;
		return;
	}
	pushdown_f(t);
	int mid=(l+r)>>1;
	if (pos<=mid) modify_f(l,mid,pos,t<<1,key);
	else modify_f(mid+1,r,pos,t<<1|1,key);
	update_f(t);
}
void modify_g(int l,int r,int pos,int t,ll key)
{
	if (l==r)
	{
		treeg[t]=key%mo;
		return;
	}
	pushdown_g(t);
	int mid=(l+r)>>1;
	if (pos<=mid) modify_g(l,mid,pos,t<<1,key);
	else modify_g(mid+1,r,pos,t<<1|1,key);
	update_g(t);
}
ll query_f(int l,int r,int x,int y,int t)
{
	if (!treef[t]) return 0;
	if (l==x&&y==r) return treef[t];
	pushdown_f(t);
	int mid=(l+r)>>1;
	if (y<=mid) return query_f(l,mid,x,y,t<<1);
	if (x>mid) return query_f(mid+1,r,x,y,t<<1|1);
	return (query_f(l,mid,x,mid,t<<1)+query_f(mid+1,r,mid+1,y,t<<1|1))%mo; 
}
ll query_g(int l,int r,int x,int y,int t)
{
	if (!treeg[t]) return 0;
	if (l==x&&y==r) return treeg[t];
	pushdown_g(t);
	int mid=(l+r)>>1;
	if (y<=mid) return query_g(l,mid,x,y,t<<1);
	if (x>mid) return query_g(mid+1,r,x,y,t<<1|1);
	return (query_g(l,mid,x,mid,t<<1)+query_g(mid+1,r,mid+1,y,t<<1|1))%mo; 
}
int main()
{
	int n;
	ll A,B;
	scanf("%d",&n);
	scanf("%lld%lld",&A,&B);
	for (int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	memset(tagf,-1,sizeof(tagf));
	memset(tagg,-1,sizeof(tagg));
	modify_f(0,n,0,1,1);
	modify_g(0,n,0,1,1); 
	for (int i=2;i<=n;i++)
	{
		int pos;
		if (i<=2||a[i]-a[i-2]>=A) pos=i-2;
		else pos=upper_bound(a+1,a+i-1,a[i]-A)-a-1;
		ll G=query_g(0,n,0,pos,1);
		if (i<=2||a[i]-a[i-2]>=B) pos=i-2;
		else pos=upper_bound(a+1,a+i-1,a[i]-B)-a-1;
		ll F=query_f(0,n,0,pos,1);
		if (a[i]-a[i-1]<A)
		{
			treef[1]=0;
			tagf[1]=0;
		}
		if (a[i]-a[i-1]<B)
		{
			treeg[1]=0;
			tagg[1]=0;
		}
		modify_f(0,n,i-1,1,G);
		modify_g(0,n,i-1,1,F);
	}
	ll ans=query_f(0,n,0,n-1,1)+query_g(0,n,0,n-1,1);
	if (ans>=mo) ans-=mo;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 12416
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;

int main(){
  int N, K;
  cin >> N >> K;
  int H[N];
  rep(i, N) cin >> H[i];
  sort(H, H+N);
  reverse(H, H+N);
  long long sums = 0;
  repi(i, K, N) sums += H[i];
  cout << sums << endl;
}


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

// マクロ //
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)

// 型エイリアス //
using lint = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vpii = vector<pii>;
using msi = map<string, int>;

// 関数 //
template<class T> lint gcd(T a, T b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}

template<class T> lint lcm(T a, T b) {
    return a * b / gcd(a, b);
}

double distance(pii a, pii b) {
    double dist;
    dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
    return dist;
}

lint perm(int a) {
    lint perm = 1;
    for (int i = a; i >= 1; i--) {
        perm *= i;
    }
    return perm;
}

lint combination(int n, int m) {
    long double c = 1;
    for (int i = n, k = 1; i > m; i--, k++) {
        c *= i;
        c /= k;
    }
    return (lint)c;
}

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

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

// 定数 //
#define pi acos(-1)
#define mod 1000000007
#define MOD 998244353
#define inf ((1LL << 62) - 1 + (1LL << 62))

// キーワード //
#define elif else if

// End of Template //



int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;

    cin >> N;
    vi H(N);
    int h;
    int max = 0;
    bool flag = false;
    rep(i, N) {
        cin >> h;
        chmax(max, h);
        if (max - h >= 2) flag = true;
    }
    flag ? n() : y();
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void){
    
   double r,menseki,enshu;
   
   scanf("%lf",&r);
   
   menseki=(r*r)*3.141592653589;
   enshu=(r*2)*3.141592653589;
   
   printf("%f %f\n",menseki,enshu);
   
    return 0;
    
}


Measured memory_bytes: 2120
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
	int A,B,K;
	cin>>A>>B>>K;
	int D=B/A;
	int Min=min(A,B);
	int num=0;
	vector<int> myVec;
	for (int i=1;i<=Min;i++){
		if (A%i==0 && B%i==0){
			myVec.push_back(i);
		}
	}
	for (int i=myVec.size()-1;i>=0;i--){
		num++;
		if (num==K){
			cout<<myVec[i]<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long int ll ;

ll max(ll a , ll b)
{
  return (a > b) ? a: b;
}
ll min(ll a , ll b)
{
  return (a < b) ? a : b;
}
void memset(int *arr , int n , int value)
{
    for(int i= 0; i<n ; i++)
    {
        arr[i] = value;
    }
}

ll path(string matrix[] , int i , int  j  , int h , int w , ll **dp)
{
    if(i == h-1 && j==w-1)
    {
        return 1 ;
    }
    if(i == h || j == w)
    {
        return INT_MIN ;
    }
    if(matrix[i][j] == '#')
    {
        return 0;
    }
    if(dp[i][j] != -1)
    {
        return dp[i][j] ;
    }
    ll opsn1 =  path(matrix , i+1 , j , h , w , dp) ;
    ll opsn2 = path(matrix , i , j+1 , h , w ,dp) ;
    if(opsn1 > 0 && opsn2 >0)
    {
        return dp[i][j] = (opsn1%mod + opsn2%mod)%mod ;
    }
    else
    {
        return dp[i][j] = max(0 , max(opsn1 , opsn2)) ;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll h , w;
    cin>>h>>w;
    string matrix [h] ;
    for(int i= 0 ; i< h ; i++)
    {
        cin>>matrix[i];
    }
    ll **dp = new ll*[h] ;
    for(int i= 0; i<h ; i++)
    {
        dp[i] = new ll[w] ;
        for(int j= 0; j<w ; j++)
        {
            dp[i][j] = -1 ;
        }
    }
    cout<<path(matrix , 0 , 0 , h , w , dp)<<endl;
    return 0;
}


Measured memory_bytes: 9344
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
const int INT_INF = 500000000;
const long long LONG_LONG_INF = (long long)pow(10, 18);
const int MOD = pow(10, 9) + 7;
/* contest template */
int N;
const int MAX_N = 55555;
int prime[MAX_N];
bool is_prime[MAX_N + 1];
int a[55];

int main() {
  cin >> N;
  int p = 0;
  for (int i = 0; i <= MAX_N; i++) {
    is_prime[i] = true;
  }
  is_prime[0] = false;
  is_prime[1] = false;
  for (int i = 2; i < MAX_N; i++) {
    if (is_prime[i]) {
      prime[p++] = i;
      for (int j = 2 * i; j <= MAX_N; j += i) {
        is_prime[j] = false;
      }
    }
  }
  /*
  a[0] =2;
  a[1] = 3;
  a[2] = 5;
  a[3] = 7;
  a[4] = 11;
  int sum = a[0] + a[1] + a[2] + a[3] + a[4];
  for (int i = 5; i < N; i++) {
    for (int j = 0; j < 55556; j++) {
      bool flag=true;
      for (int k = 0; k < i; k++) {
        if(is_prime[sum-a[k]+j]){
        }
      }
    }
  }
  */
  a[0] = 11;
  for (int i = 1; i < N; i++) {
    int x = a[i - 1] + 10;
    while (!is_prime[x]) {
      x += 10;
    }
    a[i] = x;
  }
  for (int i = 0; i < N; i++) {
    cout << a[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
// string a,b;

long double dp[10004][10004] = {0};
// string  a[1004];

long double  solve()
{
	int n;
	cin>>n;
	long double a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	
	for(int i=0;i<=n;i++)
	{
		dp[i][0] = 0;
	}
	dp[0][0] = 1;
	for(int i=1;i<=n;i++)
	{
		dp[0][i] = (1-a[i-1])*dp[0][i-1];
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			dp[i][j] = dp[i-1][j-1]*(a[j-1])+dp[i][j-1]*(1-a[j-1]);
		}
	}
	long double s = 0;
	for(int i=n/2+1;i<=n;i++)
	{
		
		s+=dp[i][n]*1.0;
	}
	cout.precision(10);
	// cout<<s<<"\n";
	return s;
}
int main()
{
	int t;
	t = 1;
	while(t--)
	{

		cout<<solve()<<"\n";		

	}

}


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

#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,a,n) for(ll i=a;i<n;i++)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tiii;
typedef pair<ll, ll> pll;

const int INF = 100000000;
const ll LINF = 1e18+5;

const int MAX_N = 200000;
ll rmq_N;
ll rmq_dat[2*MAX_N-1];

// 要素数n_で初期化
void rmq_init(int n_) {
    // rmq_Nを2のべき乗にする
    rmq_N = 1;
    while(rmq_N < n_) rmq_N *= 2;
    rep(i,2*rmq_N-1) rmq_dat[i] = INF;
}

// k番目の値をaに変更
void rmq_update(int k, int a) {
    k += rmq_N - 1;
    rmq_dat[k] = a;
    while (k > 0) {
        k = (k - 1) / 2;
        rmq_dat[k] = min(rmq_dat[k * 2 + 1], rmq_dat[k * 2 + 2]);
    }
}

// [a, b)の最小値を求める
// 接点の番号k，subとして[l,r)の最小値を求めてる
int rmq_query(int a, int b, int k, int l, int r) {
    if (r<=a || b<=l) return INF;
    if (a<=l && r<=b) return rmq_dat[k];
    else {
        int vl = rmq_query(a,b,k*2+1,l,(l+r)/2);
        int vr = rmq_query(a,b,k*2+2,(l+r)/2,r);
        return min(vl,vr);
    }
}

int main() {
    ll N, M;
    cin >> N >> M;
    rmq_init(N+1);
    string S;
    cin >> S;
    ll Sn[100001] = {};
    rep(i,N+1) {
        Sn[i] = S[i] - '0';
    }
    ll Msub = 0;
    rep(i,N+1) {
        if(Sn[i] == 1) Msub++;
        else Msub = 0;
        if(Msub ==M) {
            cout << -1 << endl;
            return 0;
        }
    }
    ll f[100001] = {};
    f[N] = 0;
    rmq_update(N, 0);
    for(ll i=N-1;i>=0;i--) {
        if(Sn[i] == 1) {
            f[i] = INF;
            rmq_update(i, INF);
            continue;
        }
        ll end = min(N, i+M);
        ll minnum = rmq_query(i+1, end+1, 0, 0, rmq_N);
        f[i] = minnum + 1;
        rmq_update(i, f[i]);
    }
    vector<ll> route;
    ll pos = 0;
    while(pos!=N) {
        ll dis = 1;
        while(f[pos+dis] != f[pos] - 1) dis++;
        route.push_back(dis);
        pos += dis;
    }
    for(auto r : route) cout << r << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 5112
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n;
  R n;
  int a[n],u[n];
  rep(i,n) {
    R a[i];
    a[i]--;
  }
  mem(u);
  int x=0,c=0;
  while(!u[x]&&x!=1) {
    u[x]=1;
    x=a[x];
    c++;
  }
  if(x!=1) c=-1;
  pr(c);
}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MAXN = 2 * 1e5;

ll hi[MAXN], dp[MAXN];

int main()
{
#ifdef LOCAL
    freopen("data.txt", "r", stdin);
#endif
    int n;
    scanf("%d", &n);
    for (int i = 0; i != n; ++i)
        scanf("%lld", &hi[i]);
    dp[1] = abs(hi[1] - hi[0]);
    ll tmp1, tmp2;
    for (int i = 2; i != n; ++i)
        if ((tmp1 = dp[i - 1] + abs(hi[i] - hi[i - 1])) < (tmp2 = dp[i - 2]+ abs(hi[i] - hi[i - 2])))
            dp[i] = tmp1;
        else
            dp[i] = tmp2;
    printf("%lld\n", dp[n - 1]);
}

Measured memory_bytes: 1792