akhauriyash/Code-Regression huggingface dataset:
using System;

namespace TestSpace
{
    class Test
    {
        static void Main(string[] args)
        {
            string[] arrRead;
            arrRead = Console.ReadLine().Split(' ');
            int i, j, k, l, z;
            l = arrRead.Length;
            int[] arrInt = new int[3];

            for (k = 0; k < l; k++)
            {
                arrInt[k] = int.Parse(arrRead[k]);
            }

            l = l - 1;
            for (i = 0; i < l; i++)
            {
                for (j = l; j > i; j--)
                {
                    if (arrInt[j] < arrInt[j-1] )
                    {
                        z = arrInt[j];
                        arrInt[j] = arrInt[j - 1];
                        arrInt[j - 1] = z;
                    }
                }
            }
            Console.WriteLine("{0} {1} {2}", arrInt[0], arrInt[1], arrInt[2]);

            
        }
    }
}



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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    int n, k;
    cin >> n >> k;
    vector<int> cnt(n+1);
    FOR(i, k){
        int di;
        cin >> di;
        FOR(j, di){
            int aii;
            cin >> aii;
            cnt[aii]++;
        }
    }
    int sol = 0;
    FOR1(i, n)
        if (cnt[i]==0)
            sol++;
        cout << sol << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

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

using namespace std;

typedef pair<int,int> P;

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

  int n,d,w;
  while(true){
      cin>>n>>w>>d;
      if(n==0&&w==0&&d==0) break;
      std::vector<P> cake;
      cake.push_back(P(w,d));
      for(int i=0;i<n;i++){
          int p,s;cin>>p>>s;
          p--;
          int wtmp=cake[p].first,dtmp=cake[p].second;
          cake.erase(cake.begin()+p);
          s%=(wtmp+dtmp)*2;
          if(s<=wtmp){
              P div1=P(s,dtmp),div2=P(wtmp-s,dtmp);
              if(div1.first*div1.second<div2.first*div2.second){
                  cake.push_back(div1);cake.push_back(div2);
              }
              else{
                  cake.push_back(div2);cake.push_back(div1);
              }
          }
          else if(wtmp<=s&&s<=wtmp+dtmp){
              P div1=P(wtmp,s-wtmp),div2=P(wtmp,wtmp+dtmp-s);
              if(div1.first*div1.second<div2.first*div2.second){
                  cake.push_back(div1);cake.push_back(div2);
              }
              else{
                  cake.push_back(div2);cake.push_back(div1);
              }
          }
          else if(wtmp+dtmp<=s&&s<=wtmp*2+dtmp){
              P div1=P(2*wtmp+dtmp-s,dtmp),div2=P(s-dtmp-wtmp,dtmp);
              if(div1.first*div1.second<div2.first*div2.second){
                  cake.push_back(div1);cake.push_back(div2);
              }
              else{
                  cake.push_back(div2);cake.push_back(div1);
          }
      }
          else{
              P div1=P(wtmp,2*wtmp+2*dtmp-s),div2=P(wtmp,s-2*wtmp-dtmp);
              if(div1.first*div1.second<div2.first*div2.second){
                  cake.push_back(div1);cake.push_back(div2);
              }
              else{
                  cake.push_back(div2);cake.push_back(div1);
              }
          }
      }
      std::vector<int> res;
      for(int i=0;i<(int)cake.size();i++) res.push_back(cake[i].first*cake[i].second);
      sort(res.begin(),res.end());
      for(int i=0;i<(int)res.size();i++){
          cout<<res[i];
          if(i<(int)res.size()-1) cout<<" ";
          else cout<<endl;
      }
  }
  return 0;
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
  }*/

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

  cout << n*(n-1)/2 << endl;
  
  return 0;
}


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

int func(int x) {
  if (x % 100 != 0) return 0;
  return func(x / 100) + 1;
}

int main() {
  int D, N;
  cin >> D >> N;
  int ans = 0;
  for (int i = 1;; i++) {
    if (func(i) == D) {
      ans++;
      if (ans == N) {
        cout << i << endl;
        return 0;
      }
    }
  }
}


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

using namespace std;

template<class value_type>
class my_vector{
public:
  int imag_size;
  int real_size;
  value_type *array;
  my_vector(int n_){
    real_size = n_;
    imag_size = 1;
    while(real_size>imag_size)imag_size<<=1;
    array = new value_type[imag_size];
  }
  my_vector(int n_,value_type init_value){
    real_size = n_;
    imag_size = 1;
    while(real_size>imag_size)imag_size<<=1;
    array = new value_type[imag_size];
    for(int i=0;i<real_size;++i){
      array[i] = init_value;
    }
  }
  my_vector():my_vector(0){}

  void push_back(value_type x){
    if(real_size==imag_size){
      imag_size <<= 1;
      value_type *next = new value_type[imag_size];
      for(int i=0;i<real_size;++i){
        next[i] = array[i];
      }
      delete[] array;
      array = next;
    }
    array[real_size++] = x;
  }

  value_type pop_back(){
    if(real_size==0){
      cout << "my_vector::pop_back() invalid data size" << endl;
      exit(1);
    }
    return array[--real_size];
  }

  value_type& operator[](int p){
    return array[p];
  }

  void clear(){
    delete[] array;
    imag_size = 1;
    real_size = 0;
    array = new value_type[1];
  }

  class iterator{
  public:
    value_type* current;
    iterator():current(nullptr){}
    iterator(value_type *current_):current(current_){}
    iterator operator++(){
      ++current;
      return *this;
    }
    iterator operator--(){
      --current;
      return *this;
    }
    value_type& operator*(){
      return *current;
    }
    bool operator!=(iterator const &other){
      return current != other.current;
    }
  };

  iterator begin(){
    return iterator(array);
  }
  iterator end(){
    return iterator(array+real_size);
  }


};

int main(){
  int n;
  int q;
  cin >> n;
  cin >> q;
  my_vector<my_vector<int>> lines(n);
  for(int i=0;i<q;++i){
    int kind;
    cin >> kind;
    if(kind==0){
      int t;
      cin >> t;
      int value;
      cin >> value;
      lines[t].push_back(value);
    }else if(kind==1){
      int t;
      cin >> t;
      bool flag = false;
      for(auto &i:lines[t]){
        if(flag)cout << " ";
        cout << i;
        flag = true;
      }
      cout << endl;
    }else{
      int t;
      cin >> t;
      lines[t].clear();
    }
  }
  return 0;
}



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

int main(){
	int h1, m1, s1, h2, m2, s2, t[4];
	for(int i = 0; i < 3;i++){
		cin>>h1>>m1>>s1>>h2>>m2>>s2;
		t[i] = (h2 * 3600 + m2 * 60 + s2)  - (h1 * 3600 + m1 * 60 + s1);
	}
	
	for(int i = 0; i < 3; i++){
		cout<<(t[i]/3600)<<" "<<((t[i]%3600)/60)<<" "<<((t[i]%3600)%60)<<endl;
	}	

	return 0;
}



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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

int main() {
    int list[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k; cin >> k;
    OP(list[k - 1]);
}



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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const LL mod = 1e9+7;

vector<LL> solve(int p, int q, vector<vector<int>> &V){
	vector<LL> ret(2,0); ret[1] = 1;
	for(auto u : V[q]) if(u != p){
		auto z = solve(q,u,V);
		vector<LL> nx(ret.size()+z.size()-1,0);
		repp(i,1,ret.size()) repp(j,0,z.size()) (nx[i+j] += ret[i]*z[j]*(j==0?-1:1)) %= mod;
		swap(ret,nx);
	}
	LL x = 1;
	for(int i = 2 ; i < ret.size() ; i += 2){
		(ret[0] += ret[i]*x) %= mod;
		x = x*(i+1)%mod;
	}
	return ret;
}

int main(){
	int N; cin >> N;
	vector<vector<int>> V(N);
	repp(i,1,N){
		int a,b; cin >> a >> b;
		--a; --b;
		V[a].push_back(b);
		V[b].push_back(a);
	}
	vector<vector<LL>> ans(N,vector<LL>(N+1,0));
	cout << (solve(-1,0,V)[0]+mod)%mod << endl;
	return 0;
}


Measured memory_bytes: 198400
import kotlin.math.*

fun str() = readLine()!!
fun int() = str().toInt()
fun long() = str().toLong()

fun read(d:String = " ") = str().split(d)
fun <T> list(d:String = " ",f:String.()->T) = read(d).map {f(it)}
fun list() = list {toInt()}

fun <T> MutableList<T>.removeLast() = this.removeAt(this.lastIndex)

const val mod = 1000000007L

fun modpow(n:Long,p:Long = mod-2L):Long = when {
	p==0L->1L
	p%2==1L->n*modpow(n,p-1)%mod
	else-> {
		val d = modpow(n,p/2)
		d*d%mod
	}
}

fun main() {
	abc000X()
}

fun abc000X() {
	val n = long()
	val a = list {toLong()}

	val l = mutableListOf(1000L to 0L)

	for(i in a) {
		l.flatMap {(g,k)-> listOf(g%i to g/i+k,g+k*i to 0L)}
				.filter {a-> l.none {b-> a.first<=b.first&&a.second<=b.second}}
				.forEach {l.add(it)}
	}
	System.err.println(l.size)
	println(l.map {it.first}.max())
}


Measured memory_bytes: 58292
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
const int maxn=1e5+7;
const ll mod= 998244353;

ll a[maxn];

ll ksm(ll a,ll n)
{
	ll res=1;
	while(n)
	{
		if(n&1) res=res*a%mod;
		a=a*a%mod;
		n>>=1;
	}
	
	return res%mod;
}

int main()
{
//	freopen("input.txt","r",stdin);
	
	ll n;
	cin>>n;
	ll flag1=0;//用来表示不能形成树的情况 
	ll Max=0;
	for(int i=0;i<n;i++)
	{
		ll x;
		cin>>x;
		if(i==0&&x!=0) flag1=1; 
		a[x]++;	
		Max=max(Max,x);
	} 
	if(a[0]!=1) flag1=1;
	for(int i=0;i<=Max;i++) if(a[i]==0) flag1=1;
	ll ans=1;
	for(int i=0;i<Max;i++) ans=ans*ksm(a[i],a[i+1])%mod;
	if(flag1) ans=0;
	cout<<ans%mod<<endl;
    
    return 0;
}














Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define sort(vec) sort(vec.begin(),vec.end())
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
long long ans;

int gcd(int x,int y){
	if(y==0) return x;
	else return gcd(y,x%y);
}

int lcm(int x,int y){
	return x*y/gcd(x,y);
}
 
signed main(){
	int n,k;
	cin>>n>>k;
	int h[n],dp[n];
	rep(i,n)cin>>h[i];
	dp[0]=0;
	int z=0;
	for(int i=1;i<n;i++){
		int mi=1000000000;
		for(int j=max(z,i-k);j<i;j++){
			mi=min(mi,dp[j]+abs(h[i]-h[j]));
		}
		dp[i]=mi;
	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

class Solver {
    void solve(Scanner sc) {
        int N = sc.nextInt();
        System.out.println(N * N * N);
    }
}

class Main {
    public static void main(String... args) {
        Scanner in = new Scanner(System.in);

        new Solver().solve(in);

        in.close();
    }
}

Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>

int main(void){
  double r, v, s;
  scanf("%lf", &r);
  v = r * r * M_PI;
  s = 2 * r * M_PI; 
  printf("%f %f\n", v, s);
  return 0;
}



Measured memory_bytes: 2036
#include<cstdio>
using namespace std;
int main(){
	int n,a,b,x,ans=0;
	scanf("%d%d%d",&n,&a,&b);
	while(n--){
		scanf("%d",&x);
		if(x<a||x>=b) ans++;
	}
	printf("%d\n",ans);
	return 0;
}

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define REP(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cerr<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;

const int mod = 1e9+7;
const int inf = (1<<28);
const ll infl = (1LL<<60);

int main() {
  int h, n, sum = 0;
  cin >> h >> n;
  rep(i,n) {
    int a; cin >> a;
    sum += a;
  }
  if (sum >= h) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> v(N);
    for(int i = 0;i < N;i++){
        cin >> v[i];
    }
    sort(v.begin(),v.end());
    double ans = v[0];
    for(int i = 1;i < N;i++){
        ans = (ans + v[i])/2.0;
    }
    cout << setprecision(16) << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(void)
{
	string str;
	
	char data[10][10];
	
	char cnt = 'a';
	for (int i = 1; i <= 6; i++){
		for (int j = 1; j <= 5; j++){
			data[j][i] = cnt;
			cnt++;
		}
	}
	
	data[2][6] = '.';
	data[3][6] = '?';
	data[4][6] = '!';
	data[5][6] = ' ';
	
	while (cin >> str){
		if (str.length() % 2 == 1){
			cout << "NA" << endl;
			continue;
		}
		string ret = "";
		bool ef = true;
		for (int i = 0; i < str.length(); i++){
			if ('1' <= str[i] && str[i] <= '6'){
				i++;
				if ('1' <= str[i] && str[i] <= '5'){
					ret += data[str[i] - '0'][str[i - 1] - '0'];
					// printf("data[%d][%d] = %c\n", str[i] - '0', str[i - 1] - '0', data[str[i] - '0'][str[i - 1] - '0']);
				}
				else {
					ef = false;
					break;
				}
			}
			else {
				ef = false;
				break;
			}
		}
		if (ef) cout << ret << endl;
		else  cout << "NA" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
typedef long long ll; 
ll aCb(ll a, ll b) {
    if (b == 0 || a == b) return 1;
    return aCb(a - 1, b - 1) + aCb(a - 1, b);
}
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/
 
 
 
 
int N, P, A[101];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> P;
    rep(i, 0, N) cin >> A[i];
 
    int odd = 0, even = 0;
    rep(i, 0, N) {
        if (A[i] % 2 == 1) odd++;
        else even++;
    }
 
    ll ans = 0;
    int c = P;
    while (c <= odd) ans += aCb(odd, c), c += 2;
    rep(i, 0, even) ans *= 2;
    printf("%lld\n", ans);
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	//	static long start;
	//	static long end;

	public static void main(String[] args) {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);

		int n = scan.nextInt();
		int[] w = new int[n];

		int sum = 0;
		for (int i = 0; i < n; i++) {
			int tmp = scan.nextInt();
			w[i] = tmp;
			sum += tmp;
		}

		int ret = 0;
		int half = sum / 2;
		for (int i = 0; i < n; i++) {
			ret += w[i];
			if (ret == half) {
				ret = 0;
				break;
			} else if (ret > half) {
				int a = sum - ret;
				int b = sum - (ret - w[i]);
				ret = Math.min(Math.abs(ret - a), Math.abs((ret - w[i]) - b));
				break;
			}

		}

		out.println(ret);
		out.flush();
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 21204
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

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

  int N;
  cin >> N;

  ull A[100001] = {};
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A, A + N);

  int ans = 0;
  ull cum = 0;
  for (int i = 0; i < N - 1; i++) {
    cum += A[i];
    if (cum * 2 < A[i + 1]) {
      ans = i + 1;
    }
  }

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


Measured memory_bytes: 1024
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost::multiprecision;  
//using namespace boost::math;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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


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

    int n, k;
    cin >> n >> k;

    vector<int> a(n);

    rep(i,n){
        cin >> a[i];
    }

    auto f = [&](long double key){
        int cnt = 0;
        rep(i,n){
            if(a[i] <= key) continue;
            cnt += ceil(a[i] / key) - 1;
        }
        return (cnt);
    };

    int ok = 1e9 + 1, ng = 0;
    
    while(ok - ng > 1){
        auto mid = (ok + ng) / 2;
        if(f(mid) <= k){
            ok = mid;
        }else{
            ng = mid;
        }
    }

    cout << int(ceil(ok)) << '\n';

    return 0;
}



Measured memory_bytes: 4728
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
ans = [0] * n
for i, c in enumerate(t):
    if i >= k and c == t[i - k] and ans[i - k] > 0:
        continue
    if c == 'r':
        ans[i] = p
    elif c == 's':
        ans[i] = r
    else:
        ans[i] = s
print(sum(ans))
'''
じゃんけんマシンのK回前が違う手の場合、勝てる手の得点を加算
じゃんけんマシンのK回前が同じ手で、その時に得点を得ている場合は、
                                   禁止ルールで0点
じゃんけんマシンのK回前が同じ手で、その時に0点の場合は、
                                   勝てる手の得点を加算
'''

Measured memory_bytes: 4084
# -*- coding: utf-8 -*-
"""
Created on Thu May  7 22:03:51 2020

@author: shinba
"""

N = int(input())
X = list(map(int,input().split()))

largeX = max(X)
smallX = min(X)

ans = float("inf")

for i in range(smallX,largeX+1):
    S = 0
    for j in X:
        S += (i-j)**2
    ans = min(ans,S)
        
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int D, G; cin >> D >> G;
  vector<int> p(D), c(D), s(D), total(D);
  for (int i = 0; i < D; ++i) {
    cin >> p[i] >> c[i];
    s[i] = 100 * (i + 1);
    total[i] = s[i] * p[i] + c[i];
  }

  int vmin = 1e9;
  for (int i = 0; i < (1 << D); ++i) {
    bitset<10> b(i);
    int score = G;
    int cnt = 0;
    for (int j = 0; j < D; ++j) {
      if (b.test(j)) {
        score -= total[j];
        cnt += p[j];
      }
    }

    for (int j = D-1; j >= 0; --j) {
      if (score <= 0) break;
      if (b.test(j)) continue;
      if (score > s[j] * (p[j]-1)) {
        score -= s[j] * (p[j]-1);
        cnt += p[j]-1;
      } else {
        for (int k = 0; k < p[j]-1; ++k) {
          score -= s[j];
          ++cnt;
          if (score <= 0) break;
        }
      }
    }
    if (score > 0) continue;
    vmin = min(vmin, cnt);
  }
  cout << vmin << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	rep(i,10000){
		if(i==0)continue;
		if(floor(i*0.08)==a&&floor(i*0.1)==b){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int main(){ _;
  int e;
  while(cin>>e,e!=0){
    int m=1<<29;
    REP(i,101){
      if(i*i*i>e) break;
      REP(j,1001){
	if(i*i*i+j*j>e)break;
	m=min(m,i+j+(e-i*i*i-j*j));
      }
    }
    cout<<m<<endl;
  }
}

Measured memory_bytes: 1192
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> pii;

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define Rep(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える

int main(){
    string s, t; cin >> s >> t;
    int n = s.size();

    bool flag = true;

    rep(i, n){
        if(s[i] != t[i]) flag = false;
    }

    cout << (flag ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3588
#include<stdio.h>
int main(void){
    int n,i,a;
    long long int sum = 0;
    int min = 1900000;
    int max = -1900000;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a);
        if(min > a)min = a;
        if(max < a)max = a;
        sum += (long long int)a;
    }
    printf("%d %d %lld\n",min,max,sum);
    return 0;
}

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

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

int main(void){
    long long a, b, c, d;
    
    cin >> a >> b >> c >> d;
    
    long long lcm, sum = b-(a-1);
    
    sum -= b/c+b/d-(a-1)/c-(a-1)/d;
    
    lcm = c/gcd(c,d)*d;
    
    sum += b/lcm - (a-1)/lcm;
    
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
#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;
typedef long long ll;

int main(){
  int N, M, Q;
  cin >> N >> M >> Q;
  int A[60], B[60], C[60], D[60];
  rep(i, Q){
    cin >> A[i] >> B[i] >> C[i] >> D[i];
    A[i]--;
    B[i]--;
  }

  vector<int> X(N+M-1, 1);
  rep(i, M-1) X[i] = 0;

  int ans = 0;
  do{
    int cnt = 1;
    vector<int> Y;
    rep(i, X.size()){
      if (X[i]==1) Y.push_back(cnt);
      else cnt++;
    }
    int sums = 0;
    rep(i, Q){
      if (Y[B[i]] - Y[A[i]] == C[i]) sums += D[i];
    }
    ans = max(ans, sums);

  }
  while (next_permutation(X.begin(), X.end()));

  cout << ans << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;
    set<int> st;
    rep(i, N) {
        int A;
        cin >> A;
        st.insert(A);
    }

    cout << ((int)st.size() == N ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <queue>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define fst first
#define snd second
const ll mod = 1000000007;
const ll INF = (1LL << 59);
const double dINF = 1000000000000000000.0;

int main(){
	int n, t; cin >> n >> t;
	ll a[100010];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll tmp_min=INF;
	ll sa=-INF;
	for (int i = 0; i < n; i++) {
		if (a[i] - tmp_min > sa)sa = a[i] - tmp_min;
		if (a[i] < tmp_min)tmp_min = a[i];
	}
	int ans = 0;
	tmp_min = INF;
	for (int i = 0; i < n; i++) {
		if (a[i] - tmp_min == sa)ans++;
		if (a[i] < tmp_min)tmp_min = a[i];
	}

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

Measured memory_bytes: 1024
#include <iostream>
#include <unordered_map>

using namespace std;

const int W = 4, H = 5;
unordered_map<string, int> memo;

inline int next(int pos, int dy, int dx)
{
    if (dy == 0 && dx == 0)
        return -1;
    int x = (pos % W) + dx, y = (pos / W) + dy;
    if (x < 0 || y < 0 || x >= W || y >= H)
        return -1;
    return y * W + x;
}

int Rec(string s)
{
    if (memo.count(s) != 0)
        return memo[s];

    int res = s.size();

    for (int i = 0; i < s.size(); ++i) {
        for (int dy = -1; dy <= 1; ++dy) {
            for (int dx = -1; dx <= 1; ++dx) {
                int nx = next(i, dy, dx);
                if (nx == -1 || nx >= s.size())
                    continue;
                if (s[i] != s[nx])
                    continue;

                string tmp("", (int)s.size() - 2);
                int index = 0;
                for (int l = 0; l < s.size(); ++l)
                    if (l != i && l != nx)
                        tmp[index++] = s[l];

                res = min(res, Rec(tmp));
            }
        }
    }

    memo.insert(unordered_map<string, int>::value_type(s, res));
    return res;
}

int main()
{
    int N;

    cin >> N;
    while (N--) {
        // Input
        char ch;
        string card;

        for (int i = 0; i < H * W; ++i) {
            cin >> ch;
            card += ch;
        }
        // Solve
        cout << Rec(card) << endl;
    }

    return 0;
}

Measured memory_bytes: 1516
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mod 1000000007
#define vll vector<ll>
#define inf 1e9 +7
#define pll pair<ll,ll>
#define ff first 
#define ss second 
#define PI acos(-1)
#define prm 998244353
#define endl '\n'
using namespace std;
ll n,m;
ll ch,cw,dh,dw;
string s[1005]; 
ll dx[4]={0,0,1,-1};
ll dy[4]={1,-1,0,0};
ll vis[1005][1005];
ll check(ll x,ll y)
{
	if(x>=n||y>=m||x<0||y<0||s[x][y]=='#')return 0;
	return 1;
}
void bfs()
{
	deque< pair< pll , ll > >q;
	q.pb(mp(mp(ch,cw),0));
	while(!q.empty())
	{
		pair< pll , ll > top=q.front();
		q.pop_front();
		ll x=top.ff.ff;
		ll y=top.ff.ss;
		ll d=top.ss;
		if(dh==x&&dw==y)
		{
			cout<<d<<endl;
			exit(0);
		}
		if(vis[x][y]==1)continue;
		vis[x][y]=1;
		for(ll i=0;i<4;i++)
		{
			ll X=x+dx[i];
			ll Y=y+dy[i];
			if(check(X,Y))q.push_front(mp(mp(X,Y),d));
		}
		for(ll i=x-2;i<=x+2;i++)
		{
			for(ll j=y-2;j<=y+2;j++)
			{
				if(check(i,j))q.pb(mp(mp(i,j),d+1));
			}
		}
	}
}
int main()
{
    fastio; 
    ll T=1;
    //cin>>T; 
    while(T--)
    {
    	cin>>n>>m;
    	cin>>ch>>cw>>dh>>dw;
    	ch--;cw--;dh--;dw--;
    	for(ll i=0;i<n;i++)
    	{
    		cin>>s[i];
		}
		bfs();
		cout<<"-1"<<endl;
    }
}



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

using namespace std;

int n;
long debt = 100000;

int main(){
	cin >> n;
	for(n;n>0;n--){
		debt *= 1.05;
		if((debt%1000) != 0){
			debt = debt + 1000 -(debt%1000);
		}
	}
	cout << debt << endl;
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
int main( void )
{
    int x, y;
    while(true)
    {
        std::cin >> x >> y;
        if ( ( x == 0 ) && ( y == 0 ) )
        {
            break;
        }

        if ( x < y )
        {
            std::cout << x << " " << y << std::endl;
        }
        else
        {
            std::cout << y << " " << x << std::endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3044
X,N = map(int, input().split())
p = list(map(int, input().split()))

Xm = X
Xp = X
status = True

while status:
    if Xm not in p:
        print(Xm)
        status = False
    elif Xp not in p:
        print(Xp)
        status = False
    Xm -= 1
    Xp += 1


Measured memory_bytes: 9180
#include<stdio.h>
#include<string.h>
int main()
{
    char s1[10];
    int i;
    gets(s1);
    i=strcmp(s1,"SUN");
    if(i==0){
        printf("7\n");
    }
    i=strcmp(s1,"SAT");
    if(i==0){
        printf("1\n");
    }
    i=strcmp(s1,"FRI");
    if(i==0){
        printf("2\n");
    }
    i=strcmp(s1,"THU");
    if(i==0){
        printf("3\n");
    }
    i=strcmp(s1,"WED");
    if(i==0){
        printf("4\n");
    }
    i=strcmp(s1,"TUE");
    if(i==0){
        printf("5\n");
    }
    i=strcmp(s1,"MON");
    if(i==0){
        printf("6\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
using std::string;
using std::cin;
using std::cout;
using std::endl;
typedef long long ll;
using std::vector;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

//////////////////////////////////////



//////////////////////////////////////

int main() {
    
    string S;
    cin >> S;
    
    vector<bool> hatena(S.length());
    vector<int> b(S.length()+1);
    b[0] = 1;
    //その桁まである余りに対する組合せ数
    vector<vector<ll>> dp;
    ndarray(dp, S.length()+1, 13);
    dp[0][0] = 1;
    for (int i = 1; i <= S.length(); i++) {
        b[i] = (b[i-1]*10)%13;
        if (S[S.length()-i] == '?') {
            for (int now = 0; now < 13; now++) {
                for (int d = 0; d < 10; d++) {
                    int next = (now+b[i-1]*d) % 13;
                    dp[i][next] += dp[i-1][now];
                    dp[i][next] %= MOD_BIG;
                }
            }
        } else {
            for (int now = 0; now < 13; now++) {
                int d = S[S.length()-i] - '0';
                int next = (now+b[i-1]*d) % 13;
                dp[i][next] = dp[i-1][now];
            }
        }
        /*
        for (auto d: dp[i]) {
            cout << d << " ";
        }
        cout << endl;
         */
        
    }
    
    cout << dp[S.length()][5] << endl;
    
    return 0;
}


Measured memory_bytes: 14080
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
int main (){
	char X,Y;
	while(~scanf("%c %c",&X,&Y)){
		getchar();
		if(X<Y)
			printf("<\n");
		if(X>Y)
			printf(">\n");
		if(X==Y)
			printf("=\n");
	}
	return 0;
}


Measured memory_bytes: 256
h,w=map(int,input().split())
n=int(input())
a=list(map(int,input().split()))
ret=[["0" for i in range(w)]for j in range(h)]
x=0
y=0
for i in range(n):
    for j in range(a[i]):
        ret[y][x]=str(i+1)
        if y&1:
            if x==0:
                y+=1
            else:
                x-=1
        else:
            if x==w-1:
                y+=1
            else:
                x+=1
for i in range(h):
    print(" ".join(ret[i]))


Measured memory_bytes: 3700
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP_ll(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VREP_int(v) for(std::vector<int>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;


struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    map<int,int> parcnts;
    int N;
    ll inconv;

    UnionFind(int _N) : par(_N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < _N; i++) par[i] = i;
        N = _N;
        inconv = ((ll)N)*((ll)N-1)/2;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
    	ll rxcnt,rycnt;
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        if(parcnts.find(rx)==parcnts.end()){
        	rxcnt = 1;
        }else{
        	rxcnt = parcnts.find(rx)->second;
        	parcnts.erase(rx);
        }
        if(parcnts.find(ry)!=parcnts.end()){
        	rycnt = parcnts.find(ry)->second;
        	parcnts.find(ry)->second += rxcnt;
        }else{
        	rycnt = 1;
        	parcnts.insert(mp(ry,1+rxcnt));
        }

        ll inconv_x = rxcnt*(rxcnt-1)/2;
        ll inconv_y = rycnt*(rycnt-1)/2;
        ll inconv_xy = (rxcnt+rycnt)*(rxcnt+rycnt-1)/2;
        inconv = inconv + inconv_x + inconv_y - inconv_xy;

    }

    ll calc(){
    	ll ret = N*(N-1)/2;
//    	errln(N);
    	for(auto i = parcnts.begin();
    			i != parcnts.end();
    			i++){
//    		cerr << i->first << " " << i-> second << endl;
    		ll v = i->second;
    		ret -= v*(v-1)/2;
    	}
    	return ret;
    }

    void dump(){
    	REP(i,N){
    		cerr << par[i] << " ";
    	}
    	cerr << endl;
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(int argc, const char * argv[]) {
	ll n,m;
	cin >> n >> m;
	int a[m],b[m];
	ll ret[m+1];

	REP(i,m){
		cin >> a[i] >> b[i];
	}

	UnionFind tree(n);

	ret[m] = n*(n-1)/2;
	for(int i=m-1;i>=0;i--){
		tree.unite(a[i]-1,b[i]-1);
		ret[i] = tree.inconv;
	}

	FOR(i,1,m){
		println(ret[i]);
	}

	return 0;
}


Measured memory_bytes: 4480
# include <iostream>
# include <algorithm>
# include <tuple>
# include <vector>

typedef long long ll;
using namespace std;

struct UnionFind {
    vector<int> parent;
    UnionFind(int n) : parent(n) {
        for (int i = 0; i < n; i++) parent[i] = i;
    }

    int root(int n) {
        if (parent[n] == n) return n;
        return parent[n] = root(parent[n]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        parent[rx] = ry;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<pair<int, int>> xBased(n), yBased(n);
    for (int i = 0; i < n; i++) {
        int x, y; cin >> x >> y;
        xBased[i] = { x, i };
        yBased[i] = { y, i };
    }
    sort(xBased.begin(), xBased.end());
    sort(yBased.begin(), yBased.end());
    vector<tuple<int, int, int>> costs;
    for (int i = 1; i < n; i++) {
        int xdiff = xBased[i].first - xBased[i-1].first;
        int ydiff = yBased[i].first - yBased[i-1].first;
        costs.push_back(make_tuple(xdiff, xBased[i].second, xBased[i-1].second));
        costs.push_back(make_tuple(ydiff, yBased[i].second, yBased[i-1].second));
    }
    sort(costs.begin(), costs.end());
    UnionFind tree(n);
    ll ans = 0;
    for (auto& cost : costs) {
        int c = get<0>(cost);
        int f = get<1>(cost);
        int s = get<2>(cost);
        if (tree.root(f) != tree.root(s)) {
            tree.unite(f, s);
            ans += c;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main ()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (b < a) swap (a, b);
	if (c < b) swap (b, c);
	if (b < a) swap (a, b);
	cout << a + b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////

vector<vector<ll>> R;

vector<ll> Desk;
bool Bol[100000];
ll Counter;
void Rep(ll x){
    if(Desk.size()==x){
        R.pb(Desk);
        Counter++;
        return ;
    }
    rep(i,1,x){
        if(!Bol[i]){
            Desk.pb(i);Bol[i]=true;
            Rep(x);
            Desk.pop_back();Bol[i]=false;
        }
    }
}

int main(){
    ll n,m;cin>>n>>m;
    ll a[m],b[m];
    bool d[n+1][n+1];
    rep(i,1,n)rep(j,1,n)d[i][j]=false;
    rep(i,0,m-1){
        cin>>a[i]>>b[i];
        d[a[i]][b[i]]=true;
        d[b[i]][a[i]]=true;
    }
    Rep(n);
    bool c;
    ll ans=0;
    rep(i,0,R.size()-1){
        c=true;
        if(R[i][0]!=1){
            continue;
        }
        rep(j,0,n-2){
            if(!d[R[i][j]][R[i][j+1]]){
                c=false;
            }
        }
        if(c)ans++;
        
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 4408
#include <bits/stdc++.h>
		using namespace std;
		typedef long long ll;
		#define PI 3.14159265358979
		#define EPS 1e-8
		#define mod  998244353
		#define fi first
		#define se second
		#define mp make_pair
		#define pb push_back
		#define endl "\n"
			 
		const ll INF=1e15;	
		const int N=2e5+50;
		 

		 
		long long binpow(long long a, long long b, long long m) {
			a %= m;
			long long res = 1;
			while (b > 0) {
				if (b & 1)
					res = res * a % m;
				a = a * a % m;
				b >>= 1;
			}
			return res;
		}
		
		ll modinverse(ll a,ll m)
		{
			return binpow(a,m-2,m);
		}
		
		
		int main()
		{
			ios_base::sync_with_stdio(false);
			cin.tie(NULL);cout.tie(0);
			
			ll k;
			cin>>k;
			
			ll v=(k+49)/50;
			
			
			
			ll rem= k%50;
			
			
			if(k==0)
			{
				cout<<2<<endl<<"0 0";
				exit(0);
			}
			cout<<50<<endl;
			if(rem==0)
			{
				rem=50;
			}
			ll i;
			for(i=1;i<=rem;i++)
			{
				cout<<50+(v-1)<<" ";
			}
			for(;i<=50;i++)
			{
				cout<<50+(v-1)-rem-1<<" ";
			}
		}
			
			
		


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int n,a[210000],j;
int main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<n;i++){
        if(a[i]==a[i+1]){
            cout<<"NO"<<endl;
            j++;
            break;
        }
    }
    if(j==0)cout<<"YES"<<endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
using namespace std;
 
int main(){
  int n;
  string ans;
  cin >> n;
  for(int i = 1;i <= 9;i++){
    for(int j = 1;j <= 9;j++){
      if(i * j == n){
        ans = "Yes";
        break;
      }
    }
  }
  if(ans != "Yes"){
    ans = "No";
  }
  cout << ans;
}

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

using namespace std;

//#define int long long
#define FOR(i, j, k) for(int i = j; i < (int)k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF (1 << 30)

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;

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

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
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; }

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

    int n, k;
    cin >> n >> k;
    int res = 0;
    rep(i, n) {
        int x;
        cin >> x;
        res += (x > k - x) ? (k - x) * 2 : x * 2;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>

int main(void)
{
    char S[11], T[11], U[11];
    int A = 0, B = 0;
    int i;

    scanf("%s %s", S, T);
    scanf("%d %d", &A, &B);
    scanf("%s", U);

    for (i = 0; S[i] != '\0'; i++)
    {
        if (S[i] != U[i])
            break;
        else if (S[i + 1] == '\0')
            A = A - 1;
    }
    for (i = 0; T[i] != '\0'; i++)
    {
        if (T[i] != U[i])
            break;
        else if (T[i + 1] == '\0')
            B = B - 1;
    }
    printf("%d %d", A, B);
    return (0);
}

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

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;


//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

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

#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)


struct Edge {
    int to, from;
    ll cost;
    Edge(int from, int to, ll cost): from(from), to(to), cost(cost) {}
};

typedef vector<vector<Edge>> AdjList;
AdjList graph;

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

    int N; cin >> N;
    vector<int> v;
    REP(i, N){
        int a; cin >> a;
        v.PB(a);
    }
    sort(all(v));

    double ans = v[0];

    for(int i=1; i<N; ++i){
        ans = (double)(ans + v[i])/2.0;
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
N = int(input())
S = []
for i in range(N):
    S.append(input())

#print(S)
count=[0,0,0,0]

for i in range(N):
    if S[i]=='AC':
        count[0]+=1
    elif S[i]=='WA':
        count[1]+=1
    elif S[i]=='TLE':
        count[2]+=1
    elif S[i]=='RE':
        count[3]+=1

print('AC x ' + str(count[0]))
print('WA x ' + str(count[1]))
print('TLE x ' + str(count[2]))
print('RE x ' + str(count[3]))


Measured memory_bytes: 82760
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {

    ll n, m;
    cin >> n >> m;

    if (n == 1 && m == 1){
        cout << 1 << endl;
    }else if (n == 1){
        cout << (m - 2) << endl;
    }else if (m == 1) cout << (n - 2) << endl;
    else cout << ((n-2)*(m-2)) << endl;
    

    return 0;
}

Measured memory_bytes: 256