akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
 
int main()
{
	ll k, a[100005] = {}, i, n1 = 0, n2 = 2, m, t1, t2;
 
	cin >> k;
	for (i = 0; i < k; i++) {
		cin >> a[i];
	}
 
	for (i = k - 1; i >= 0; i--) {
		if (a[i] >= n1) {
			n1 = a[i];
		}
		else {
			m = n1 / a[i];
			n1 = a[i] * ((n1 % a[i] == 0)? m : m + 1);
		}
 
		m = n2 / a[i];
		n2 = a[i] * (m + 1) - 1;
	}
 
	t1 = n1;
	t2 = n2;
 
	for (i = 0; i < k; i++) {
		t1 -= t1 % a[i];
		t2 -= t2 % a[i];
	}
 
	if (t1 == 2 && t2 == 2) {
		cout << n1 << ' ' << n2 << endl;
	}
	else {
		cout << "-1" << endl;
	}
}

Measured memory_bytes: 1024
/*
g++ -std=c++11 -o2 -Wall ABC100B.cpp -o ./out/ABC100B.out
./out/ABC100B.out
*/

#include <bits/stdc++.h>
using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define tr(c, i) for (iter(c) != (c).begin(); i != (c).end(); ++i)
#define pb push_back
#define mp make_pair

typedef long long ll;

int main(){
//    freopen("./input/input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int d, n;
    cin >> d >> n;
    if (d == 0) {
      if (n <= 99) {
        cout << n << "\n";
      } else {
        cout << "101\n";
      }
    } else if (d == 1) {
      if (n <= 99) {
        cout << n * 100  << "\n";
      } else {
        cout << "10100\n";
      }
    } else if (d == 2) {
      if (n <= 99) {
        cout << n * 10000  << "\n";
      } else {
        cout << "1010000\n";
      }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cctype>
#include <cmath>

using namespace std;

int main(int argc, const char * argv[]) {
    
    // input from txt
    //std::ifstream in("test.txt");
    //std::cin.rdbuf(in.rdbuf());
        
    int N,K;
    cin>>N>>K;
    vector<int> p(N);
    for(int i = 0;i < N;i++){
        cin >> p[i];
    }
    sort(p.begin(),p.end());
    int ans = 0;
    for(int i = 0;i < K;i++){
        ans += p[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main() {
	int n, l; cin >> n >> l;
	vector<string> s(n);
	for (int i = 0; i < n; ++i) {
		cin >> s[i];
	}
	sort(s.begin(), s.end());
	cout << accumulate(s.begin(), s.end(), string()) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
    int n,m;cin>>n>>m;
    vector<int> p(n,0);
    vector<bool> v(n,true);
    rep(i,m){
        int pn;cin>>pn;pn--;
        string s;cin>>s;
        if(v[pn]==true&&s=="WA")p[pn]++;
        else if(v[pn]==true&&s=="AC")v[pn]=false;
    }
    int cnt_ac=0;
    int cnt_wa=0;
    rep(i,n){
        if(v[i]==false){
            cnt_ac++;
            cnt_wa+=p[i];
        }
    }
    cout<<cnt_ac<<" "<<cnt_wa<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,f,t) for(int i=f;i<t;i++)
#define P(r) do{cout<<#r": ";for(const auto &i:r){cout<<i<<" ";}cout<<endl;}while(0)
int main()
{
    int N, M; cin >> N >> M;
    vector<bool> A(N), B(N);
    REP(i, M) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        if (a == 0) A[b] = true;
        if (b == N-1) B[a] = true;
    }
    REP(i, N) {
        if (A[i] && B[i]) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

struct UnionFind {
  vector<int> par;
  vector<int> rank;
  vector<ll> Size;
  UnionFind(int n = 1) { init(n); }

  void init(int n = 1) {
    par.resize(n + 1);
    rank.resize(n + 1);
    Size.resize(n + 1);
    for (int i = 0; i <= n; ++i)
      par[i] = i, rank[i] = 0, Size[i] = 1;
  }

  int root(int x) {
    if (par[x] == x) {
      return x;
    } else {
      int r = root(par[x]);
      return par[x] = r;
    }
  }

  bool is_same(int x, int y) { return root(x) == root(y); }

  bool merge(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return false;
    if (rank[x] < rank[y])
      swap(x, y);
    if (rank[x] == rank[y])
      ++rank[x];
    par[y] = x;
    Size[x] += Size[y];
    return true;
  }

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

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

  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int>> G(n);
  UnionFind uf(n);
  rep(i, 0, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
    uf.merge(a, b);
  }

  vector<vector<int>> B(n);
  rep(i, 0, k) {
    int c, d;
    cin >> c >> d;
    c--, d--;
    B[c].push_back(d);
    B[d].push_back(c);
  }

  rep(i, 0, n) {
    int ans = uf.size(i) - 1 - G[i].size();
    for (auto b : B[i]) {
      if (uf.is_same(i, b))
        ans--;
    }
    if (i > 0)
      cout << " ";
    cout << ans;
  }
  cout << endl;
}


Measured memory_bytes: 15720
#include <vector>
#include <iostream>

using namespace std;

const long modulo = 1000000007;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<vector<int> > input;
	for(int i = 0; i < n; i++) {
		vector<int> vec;
		for(int j = 0; j < m; j++) {
			char c;
			cin >> c;
			if(c == '.')
				vec.push_back(0);
			else
				vec.push_back(-1);
		}
		input.push_back(vec);
	}

	input[0][0] = 1;
	for(int i = 1; i < n; i++) {
		if(input[i][0] != -1)
			input[i][0] = input[i-1][0];
	}

	for(int i = 1; i < m; i++) {
		if(input[0][i] != -1)
			input[0][i] = input[0][i-1];
	}

	for(int i = 1; i < n; i++) {
		for(int j = 1; j < m; j++) {
			if(input[i][j] == -1)
				continue;

			if(input[i-1][j] == -1 && input[i][j-1] == -1) {
				input[i][j] = -1;
			} else if(input[i-1][j] == -1) {
				input[i][j] = input[i][j-1];
			} else if(input[i][j-1] == -1) {
				input[i][j] = input[i-1][j];
			} else {
				input[i][j] = (input[i-1][j] + input[i][j-1]) % modulo;
			}
		}
	}

	cout << (input[n-1][m-1] == -1 ? 0 : input[n-1][m-1]) << '\n';
	return 0;
}


Measured memory_bytes: 4224
/*
 * @Author: Kaizyn
 * @Date: 2020-05-20 21:21:24
 * @LastEditTime: 2020-05-21 14:21:46
 */ 
#include <bits/stdc++.h>

// #define DEBUG

using namespace std;

const double eps = 1e-7;
const double PI = acos(-1);
typedef pair<int, int> pii;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const int N = 2e5+7;

int n, m;
map<pair<long, long>, int> mp;
int cnt[N][2];
long long pw2[N];

inline int get_id(const long long &a, const long long &b) {
  if (mp.count({a, b})) return mp[{a, b}];
  else return mp[{a, b}] = ++m;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  cin >> n;
  int o = 0;
  long long a, b, g;
  for (int i = 1; i <= n; ++i) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ++o;
      continue;
    } else if (a == 0) {
      ++cnt[get_id(0, 1)][0];
    } else if (b == 0) {
      ++cnt[get_id(0, 1)][1];
    } else {
      g = __gcd(abs(a), abs(b));
      a /= g; b /= g;
      if (a < 0) a = -a, b = -b;
      int id = b > 0 ? get_id(a, b) : get_id(-b, a);
      ++cnt[id][b > 0 ? 1 : 0];
    }
  }
  pw2[0] = 1;
  for (int i = 1; i <= n; ++i) pw2[i] = pw2[i-1]*2%MOD;
  long long res = 1;
  for (int i = 1; i <= m; ++i) {
    (res *= pw2[cnt[i][0]]+pw2[cnt[i][1]]-1) %= MOD;
  }
  --res; // choose none
  res += o;
  cout << (res+MOD)%MOD << endl;
  return 0;
}

Measured memory_bytes: 19216
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    int n;cin>>n;
    vin a(n);rep(i,n)cin>>a[i];
    if(n%2){
        for(int i=n-1;i>=0;i-=2)cout<<a[i]<<" ";
        for(int i=1;i<n-3;i+=2)cout<<a[i]<<" ";
        if(n>1)cout<<a[n-2]<<endl;
    }
    else{
        for(int i=n-1;i>0;i-=2)cout<<a[i]<<" ";
        for(int i=0;i<n-3;i+=2)cout<<a[i]<<" ";
        cout<<a[n-2]<<endl;
    }
}

Measured memory_bytes: 2944
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int x,n;
    cin >> x >> n;
    if(n==0){
        cout << x << endl;
        return 0;
    }
    int p[n];
    rep(i,n)cin >> p[i];
    int ans = -1;
    int min_dif = INF;
    vector<int> ind(102,0);
    rep(i,n)ind[p[i]]=1;
    for(int i = 0;i<=101;i++){
        if(ind[i]==0){
            if(chmin(min_dif,abs(i-x))){
                ans = i;
            }
        }
    }
    //if(chmin(min_dif,abs(x+1)))ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 3196
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VVI c(10,VI(10));
    REP(i,1,n+1) {
        int l = i;
        int r = l % 10;
        while (l >= 10) l /= 10;
        c[l][r]++;
    }
    LL ans = 0;
    REP(i,1,n+1) {
        int l = i;
        int r = l % 10;
        while (l >= 10) l /= 10;
        ans += c[r][l];
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        float n,m;
        cin>>n;
        //cout<<(n/3)*(n/3)*(n/3);
        cout<<fixed;
        cout<<(n/3)*(n/3)*(n/3);
       /* else
        {
            if(n%3==1)
            cout<<(n/3)*(n/3)*(n/3+1);
            else
            cout<<(n/3)*(n/3+1)*(n/3+1);
        }*/
        
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 2000000000;
int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    deque<ll> c;//その色の最大値
    for(int i = 0;i < n;i++){
        int p = lower_bound(c.begin(),c.end(),a[i])-c.begin();
        if(p == 0){
            c.push_front(a[i]);
        }else c[p-1]=a[i];
    }
    int ans = c.size();
    cout << ans << endl;
}

Measured memory_bytes: 1920
#include<stdio.h>
int main(void){
	int a,b;
	scanf("%d %d",&a,&b);
/*	printf("%d",a*b);
	printf("%*s", 1,"");
	printf("%d",2*(a+b));*/
	printf("%d %d\n",a*b,2*(a+b));
return 0;
}

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

using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)

typedef long long int64;

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

  vector<int> d(n);

  for(int& val: d) cin >> val;
  sort(d.begin(), d.end());

  int k = d[n/2] - d[n/2-1];
  cout << k << endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int H, W, K;
  cin >> H >> W >> K;
  vector<vector<char>> masu(H, vector<char>(W));
  vector<vector<char>> masu2(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> masu.at(i).at(j);
      masu2.at(i).at(j) = masu.at(i).at(j);
    }
  }
  int ans = 0;
  for (int tmp = 0; tmp < (1 << (H + W)); tmp++) {
    bitset<12> s(tmp);
    int memo = 0;
    for (int i = 0; i < H; i++) {
      if (s.test(i)) {
        for (int j = 0; j < W; j++) {
          masu.at(i).at(j) = '%';
        }
      }
    }
    for (int i = H; i < H + W; i++) {
      if (s.test(i)) {
        for (int j = 0; j < H; j++) {
          masu.at(j).at(i - H) = '%';
        }
      }
    } 
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if (masu.at(i).at(j) == '#') {
          memo++;
        }
        masu.at(i).at(j) = masu2.at(i).at(j);
      }
    }
    if (memo == K) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2147483647
#define int long long
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
signed main(){
	
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min({a,b,c})*(a+b+c-min({a,b,c})-max({a,b,c}))/2<<endl;

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Integer a = Integer.valueOf(br.readLine());
		Integer b = Integer.valueOf(br.readLine());
		Integer c = Integer.valueOf(br.readLine());
		Integer x = Integer.valueOf(br.readLine());
		int result = 0;
		for(int i=0;i<=a;i++) {
			for(int j=0;j<=b;j++) {
				int rest = x - 500 * i - 100 * j;
				if(rest >= 0 && rest % 50 == 0 && rest / 50 <= c) result++;
			}
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 21204
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(lint i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }

signed main()
{
	cout << (in() - 1)*(in() - 1) << endl;
}

Measured memory_bytes: 256
N, K = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]
D = [1 if i not in d else 0 for i in range(10)]
for a in range(N,10*N+1):
    for b in str(a):
        if D[int(b)] == 0:
            break
    else:
        print(a)
        break

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl







using ll = long long;


const ll mod = 1e9+7;
const int maxn = 52;

void add(ll& x, ll y) {
    if (x>=mod) x%=mod;
    if (y>=mod) y%=mod;
    x += y;
    if (x>=mod) x%=mod;
}



ll brute(ll n, ll k) {
    vector<int> a(n);
    iota(a.begin(),a.end(),0);
    int count = 0;
    do {
	int res = 0;
	for (int i=0; i<n; i++) {
	    res += abs(i-a[i]);
	}
	if (res==k) {
	    for (int i: a) cout<<i+1<<" ";
	    cout<<endl;
	}
	count += (res==k);
    } while (next_permutation(a.begin(),a.end()));
    return count;
}

int n,oddness;

ll dp[maxn][maxn][maxn*maxn]; // seen 1..i, holding j elems, have oddness k

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

    cin>>n>>oddness;
    //ll bru = brute(n, oddness);
    if (oddness%2) out(0);


    dp[0][0][0] = 1;

    for (int i=0; i<n; i++) {
	for (int j=0; j<=n; j++) {
	    for (int k=0; k<=n*n; k++) {
		//if (dp[i][j][k]) cout<<i<<","<<j<<","<<k<<": "<<dp[i][j][k]<<endl;
		//use ith elem right here
		add(dp[i+1][j][k+j*2], dp[i][j][k]);

		//use ith elem, but in a previous hole
		add(dp[i+1][j][k+j*2], 1ll*j*dp[i][j][k]);

		//hold ith elem
		add(dp[i+1][j+1][k+(j+1)*2], dp[i][j][k]);


		//place past elem here, hold us
		if (j>0) {
		    add(dp[i+1][j][k+j*2], 1ll*j*dp[i][j][k]);
		}

		//place previously held elem here, place us somewhere in the past
		if (j>0) {
		    // j options for us in the past
		    // j options to place here
		    add(dp[i+1][j-1][k+(j-1)*2], 1ll*j*j%mod*dp[i][j][k]%mod);
		}
	    }
	}
    }


    ll res = dp[n][0][oddness];
    res %= mod;
    res += mod;
    res %= mod;

    // watch(res);
    // assert(res==bru);

    cout<<res<<endl;    
    return 0;
}


Measured memory_bytes: 58580
k=[]

k.append(input())
k.append(input())
k.append(input())
k.append(input())
k.append(input())

m_num=9
m_index=0
for i in range(len(k)):
    if int(k[i][-1]) != 0:
        if int(k[i][-1]) < m_num:
            m_num = int(k[i][-1])
            m_index = i
            
#print(m_num,m_index)
sum=0
for i in range(len(k)):
    if i==m_index:
        sum+=int(k[i])
    else:
        sum+=((int(k[i])-1)//10 + 1) * 10
    
print(sum)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var uniq = A.Distinct().Count();

        if (A.Length == uniq)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }
    }
}

Measured memory_bytes: 38092
n = int(input())
ba_list = []
for i in range(n):
    ba_tmp = list(map(int, input().split()))
    ba_list.append(ba_tmp[::-1])
ba_list.sort()
now_time = 0
for i in range(n):
    now_time += ba_list[i][1]
    if now_time > ba_list[i][0]:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 36440
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

int N;
ll MOD = 1e9 + 7;
vector<int>E[202020];
ll fact[202020],factinv[202020],dp1[202020],dp2[202020],cnt[202020];

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

void dfs1(int now,int p){
	ll ret = 1;
	ll c = 1;
	fore(x, E[now]) {
		if (x != p) {
			dfs1(x,now);
			c += cnt[x];
			ret *= dp1[x];
			ret %= MOD;
			ret *= factinv[cnt[x]];
			ret %= MOD;
		}
	}
	ret *= fact[c-1];
	ret %= MOD;
	dp1[now] = ret;
	cnt[now] = c;
}

void dfs2(int now,int p,ll mul) {
	ll ret = mul;
	fore(x, E[now]) {
		if (x != p) {
			ret *= dp1[x];
			ret %= MOD;
			ret *= factinv[cnt[x]];
			ret %= MOD;
		}
	}
	ret *= factinv[N-cnt[now]];
	ret %= MOD;
	fore(x, E[now]) {
		if (x != p) {
			ll temp = ret;
			temp *= modpow(dp1[x],MOD-2);
			temp %= MOD;
			temp *= fact[cnt[x]];
			temp %= MOD;
			temp *= fact[N-1-cnt[x]];
			temp %= MOD;
			dfs2(x, now, temp);
		}
	}
	ret *= fact[N-1];
	ret %= MOD;
	dp2[now] = ret;
}


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

	cin >> N;
	for (int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		E[a].pb(b);
		E[b].pb(a);
	}

	fact[0] = 1;
	for (ll i = 1; i < 202020; i++) {
		fact[i] = i * fact[i - 1];
		fact[i] %= MOD;
	}
	for (int i = 0; i < 202020; i++)factinv[i] = modpow(fact[i],MOD-2);
	dfs1(0,-1);
	dfs2(0,-1,1);

	puts(dp1[0]);
	for (int i = 1; i < N; i++)puts(dp2[i]);

	return 0;
}

Measured memory_bytes: 21876
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#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())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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

  int ans;
  

  FOR(i,N,100000){
    set<int> s;
    int num = i;
    while(num>0){
      s.insert(num%10);
      num /= 10;
    }

    bool flug = true;

    FOR(j,0,K-1){
      // cout << j << endl;
      if(s.count(a[j])) {
        flug = false;
      }
    }

    if(flug == true){
      ans = i;
      break;
    }
  }

  cout << ans << endl;

  

}



Measured memory_bytes: 256
# N = 10
# ARR = [3, 3, 3, 3, 4, 4, 4, 5, 5, 5]
#
# # N = 6
# # ARR = [3, 1, 2, 4, 2, 1]
#
# # N = 4
# # ARR = [1, 2, 3, 4]

N = int(input())
ARR = [int(s) for s in input().split(" ")]


def calculate(n, arr):

    dict = {}

    for ar in arr:
        if dict.get(ar) == None:
            dict.__setitem__(ar, 1)
        else:
            dict.__setitem__(ar, dict.get(ar) + 1)

    dict2 = {changedu: geshu for changedu, geshu in dict.items() if geshu >= 2}

    dict3 = sorted(dict2.items(), key=lambda x: -x[0])


    if len(dict3) == 0:
        print(0)
    elif len(dict3) == 1:
        print(1)
        if dict3[0][1] >= 4:
            print(dict3[0][0]**2)
        else:
            print(0)
    else:
        if dict3[0][1] >= 4:
            print(dict3[0][0]**2)
        else:
            print(dict3[0][0] * dict3[1][0])


calculate(N, ARR)


Measured memory_bytes: 17932
# ABC046D - AtCoDeerくんと変なじゃんけん / AtCoDeer and Rock-Paper (ARC062D)
def main():
    s = input()
    G, P, ans = 0, 0, 0
    for i in s:
        if P < G:
            P += 1
            ans += 1 if i == "g" else 0
        else:
            G += 1
            ans += 0 if i == "g" else -1
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
int q[1005][1005];
main(){
	int n,m,i,j;
	char ch;
	cin>>n>>m;
	q[1][1]=1;
	for (i=1;i<=n;++i){
		for (j=1;j<=m;++j){
			cin>>ch;
			if (i==1 && j==1)continue;
			if (ch=='.'){
				q[i][j]=1;
				if (q[i-1][j]!=-1 && q[i][j-1]!=-1)q[i][j]=q[i-1][j]+q[i][j-1];
				else if (q[i][j-1]==-1 || j==1)q[i][j]=q[i-1][j];
				else if (q[i-1][j]==-1 || i==1)q[i][j]=q[i][j-1];
				else q[i][j]=0;
			}
			else q[i][j]=-1;
			
			q[i][j]%=1000000007;
		}
	}
	cout <<max(0,q[n][m]);
}

Measured memory_bytes: 4224
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n, k, r, s, p;
  string t;
  cin >> n >> k >> r >> s >> p;
  cin >> t;
  int sum = 0;
  for (int i = 0; i < n; i++){
    if(t[i] == 'r')
    {
      sum += p;
      if(i+k < n)
      {
        if(t[i+k] == 'r')
        {
          t[i + k] = 'n';
        }
      }
    }
    else if (t[i] == 's')
    {
      sum += r;
      if (i + k < n)
      {
        if (t[i + k] == 's')
        {
          t[i + k] = 'n';
        }
      }
    }
    else if(t[i] == 'p')
    {
      sum += s;
      if (i + k < n)
      {
        if (t[i + k] == 'p')
        {
          t[i + k] = 'n';
        }
      }
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

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

    REP(i, 0, n){
        string order_mes, king_mes;
        cin>>order_mes>>king_mes;

        ll len=king_mes.size(); // size of king_mes
        RREP(j, 0, order_mes.size()){
            if(order_mes[j] == 'C'){
                king_mes = king_mes.substr(1,len-1)+king_mes.substr(0, 1);
            }
            else if(order_mes[j] == 'J'){
                king_mes = king_mes.substr(len-1, 1)+king_mes.substr(0, len-1);
            }
            else if(order_mes[j] == 'E'){
                if(len%2 == 0){
                    king_mes = king_mes.substr(len/2, len/2)+king_mes.substr(0, len/2);
                }
                else{
                    king_mes = king_mes.substr(len/2+1, len/2)+king_mes.substr(len/2, 1)+king_mes.substr(0, len/2);
                }
            }
            else if(order_mes[j] == 'A'){
                reverse(king_mes.begin(), king_mes.end());
            }
            else if(order_mes[j] == 'M'){
                REP(k, 0, len){
                    if('0'<=king_mes[k] && king_mes[k]<'9'){
                        king_mes[k] = king_mes[k]+1;
                    }
                    else if(king_mes[k]=='9'){
                        king_mes[k]='0';
                    }
                }
            }
            else{
                REP(k, 0, len){
                    if('0'<king_mes[k] && king_mes[k]<='9'){
                        king_mes[k] = king_mes[k]-1 ;
                    }
                    else if(king_mes[k]=='0'){
                        king_mes[k]='9';
                    }
                }
            }
        }

        cout<<king_mes<<endl;
    }
    return 0;
}


Measured memory_bytes: 3080
//
// Created by kuroneko on 2019-08-10.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>

using namespace std;

typedef long long ll;

#define INF 1000000000000009LL
#define MOD 1000000007LL

typedef int Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src, int dst, Weight weight):src(src), dst(dst), weight(weight) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

int main() {
    int N; cin >> N;
    vector<vector<char>> v(N);
    vector<string> s(N);

    for (int i = 0; i < N; i++) {
        string st; cin >> st;
        for (int j = 0; j < 10; j++) v[i].push_back(st[j]);
        sort(v[i].begin(), v[i].end());
        for (int j = 0; j < 10; j++) st[j] = v[i][j];
        s[i] = st;
    }

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

    bool prev = false;
    vector<int> res;
    for (int i = 0; i < N-1; i++) {
        bool flag = true;
        for (int j = 0; j < 10; j++) {
            if (s[i][j] != s[i+1][j]) flag = false;
        }
        if (flag) {
            if (prev) {
                res[int(res.size())-1] += 1;
            } else {
                res.push_back(2);
            }

            prev = true;
        } else {
            prev = false;
        }
    }
    ll ans = 0;
    for (int i = 0; i < res.size(); i++) {
        ans += ll(res[i]) * (res[i] - 1) / 2;
    }

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


Measured memory_bytes: 8192
#include<cstdio>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
inline ll read(){
	ll x=0,f=1;char ch=getchar();
	while(ch!='-'&&(ch>'9'||ch<'0')) ch=getchar();
	if(ch=='-') f=-1,ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*f;
}

map<int,int> q;

int main(){
	int na,nb,t;
	na=read();
	for(int i=1;i<=na;i++){
		t=read();q[t]++;
	}
	nb=read();
	if(nb>na) {cout<<"NO"<<endl;return 0;}
	for(int i=1;i<=nb;i++){
		t=read();
		if(--q[t]>=0) continue;
		else{cout<<"NO"<<endl;return 0;}
	}
	cout<<"YES"<<endl;
	return 0;
}

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

const string name = "JOI";
char field[1010][1010];
char mark[2][2];
int N, M;

bool check(int sx, int sy){
  for(int i = 0 ; i < 2 ; i++){
    for(int j = 0 ; j < 2 ; j++){
      if(field[sy+i][sx+j] != mark[i][j]) return false;
    }
  }
  return true;
}

int diff(int x, int y, char c){
  int curr = 0, nex = 0;
  for(int i = y-1 ; i <= y ; i++){
    for(int j = x-1 ; j <= x ; j++){
      if(check(j, i)) curr++;
    }
  }
  
  char org = field[y][x];
  field[y][x] = c;
  
  for(int i = y-1 ; i <= y ; i++){
    for(int j = x-1 ; j <= x ; j++){
      if(check(j, i)) nex++;
    }
  }
  
  field[y][x] = org;
  
  return nex - curr;
}

int main(){
  
  cin >> N >> M;
  
  for(int i = 0 ; i < N ; i++)
    for(int j = 0 ; j < M ; j++) cin >> field[i][j];
  
  for(int i = 0 ; i < 2 ; i++)
    for(int j = 0 ; j < 2 ; j++) cin >> mark[i][j];
  
  int ini = 0;
  
  for(int y = 0 ; y < N-1 ; y++)
    for(int x = 0 ; x < M-1 ; x++) if(check(x, y)) ini++;      
  
  int ans = ini;
  
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < M ; j++){
      for(int k = 0 ; k < 3 ; k++){
	if(field[i][j] == name[k]) continue;
	
	int d = diff(j, i, name[k]);
	ans = max(ans, ini + d);	
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 2192
#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);
////////////////////////////
class UnionFind {
public:
    vector < ll > par; // 各元の親を表す配列
    vector < ll > siz; // 素集合のサイズを表す配列(1 で初期化)
    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }
    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }
    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }
    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};
/////////////////////////////////////
//UnionFind uf(N);

int main(){fastio
    ll n,m;cin>>n>>m;
    UnionFind uf(n+1);
    vector<ll>v[m+1];
    rep(i,1,n){
        ll k;cin>>k;
        rep(j,1,k){
            ll p;cin>>p;
            v[p].pb(i);
        }
    }
    rep(i,1,m){
        if(v[i].size()<=1)continue;
        ll r=v[i][0];
        rep(j,1,v[i].size()-1){
            uf.merge(r,v[i][j]);
        }
    }
    rep(i,2,n){
        if(!uf.issame(1,i)){
            cout<<"NO"<<endl;return 0;
        }
    }
    cout<<"YES"<<endl;
    
    return 0;
}



Measured memory_bytes: 5368
k,n = list(map(int,input().split(" ")))
A = list(map(int,input().split(" ")))
max_dist = 0
for i in range(len(A)-1):
  if A[i+1]-A[i] > max_dist:
    max_dist = A[i+1]-A[i] 
if A[0]+k-A[-1] > max_dist:
  max_dist = A[0]+k-A[-1]
print(k-max_dist)
  


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint a, b, c;
    cin >> a >> b >> c;
    lint k;
    cin >> k;
    lint ans=0;
    lint m = max({a, b, c});
    ans += a + b + c - m;
    m *= pow(2, k);
    ans += m;


    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
// Confessions of a Dangerous Mind

/*
	"We know what we are, but know not what we may be."
*/

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 2e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 20, BL = 400;
const double EPS = 3e-16;

/*
	"You never know how strong you are until being strong is the only choice you have."
*/

long long f(long long a){
	return (a * (a - 1)) / 2;
}

int main(){
//  freopen(".in", "r", stdin);
//  freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

/*
	"With self-discipline most anything is possible."
*/	
	
	long long n, m; cin >> n >> m;
	
	cout << f(n) + f(m);	

	return 0;
}

/*
	"Reach for it. Push yourself as far as you can."
*/

Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

//     int root(int x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

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

//     bool same(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };

// ll gcd(ll a, ll b) {
//     if (b == 0) return a;
//     return gcd(b,a%b);
// }

int main(void) {
    int N, A, B, C, D;
    string S;
    cin >> N >> A >> B >> C >> D >> S;
    multiset<int> Sp;
    multiset<int> Ro;
    int cnt = 0, flag = 0, maxRo = 0;
    for (int i=0;i<N;i++) {
        if (S[i] == '.') {
            cnt++;
            if (flag > 1) Ro.insert(i-flag+1);
            flag = 0;
        } else {
            if (cnt >= 3) Sp.insert(i-cnt+1);
            cnt = 0;
            flag++;
        }
    }
    if (cnt>=3) Sp.insert(N-cnt+1);
    if (flag>1) Ro.insert(N-flag+1);
    if (C<D) { // ABCD or ACBD
        if (Ro.empty()) cout << "Yes" << endl;
        else if (((Ro.lower_bound(A) != Ro.end() && *(Ro.lower_bound(A)) > C)) && ((Ro.lower_bound(B) != Ro.end() && *(Ro.lower_bound(B)) > D))) cout << "Yes" << endl;
        else cout << "No" << endl;
    } else { // ABDC
        if (Sp.empty() || Sp.lower_bound(B-1) == Sp.end()) cout << "No" << endl;
        else if (*(Sp.lower_bound(B-1)) >= D) cout << "No" << endl;
        else cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 640
function Main(input) {
	input = input.trim().split(" ").map((a)=>Number(a));
  if(input[0] > 8 || input[1] > 8){
     console.log(":(");
     }else{
      console.log("Yay!"); 
     }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
#define M 1000000007
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
const int N = 1e5 + 1;
int main(){	
	int a[4];
	for (int i = 0; i < 4; ++i) cin >> a[i];
	ll ans = -1e18;
	for (int i = 0; i < 2; ++i)
	for (int j = 2; j < 4; ++j)
	ans = max(ans , 1ll* a[i] * a[j]);
	cout << ans << endl;	
		
}	

Measured memory_bytes: 3592
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskB {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			int[] p = new int[n];
			for (int i = 0; i < n; i++) {
				p[i] = in.nextInt() - 1;
			}
			int[] a = new int[n];
			int[] b = new int[n];
			int[] inv = new int[n];
			for (int i = 0; i < n; i++) {
				inv[p[i]] = i;
			}
			for (int i = 0; i < n; i++) {
				a[i] = n * i + 1;
				b[i] = n * (n - i - 1) + 1 + inv[i];
			}
			println(out, a);
			println(out, b);
		}

		private void println(PrintWriter out, int[] a) {
			for (int i = 0; i < a.length; i++) {
				if (i > 0) {
					out.print(" ");
				}
				out.print(a[i]);
			}
			out.println();
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(in.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}



Measured memory_bytes: 15932
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int n,k,s;
int main() {
	std::cin>>n>>k>>s;
	if(s==1e9){
		for(int i=0;i<k;i++)std::cout<<s<<" ";
		for(int i=0;i<n-k-1;i++)std::cout<<s-1<<" ";
		if(n!=k)std::cout<<s-1<<std::endl;
		return 0;
	}
	for(int i=0;i<k;i++)std::cout<<s<<" ";
	for(int i=0;i<n-k-1;i++)std::cout<<s+1<<" ";
	if(n!=k)std::cout<<s+1<<std::endl;
	return 0;
}

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


#define fast_IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
typedef long long int lli;
typedef long long ll;
typedef long double ld;

ll gcd(ll a, ll b){ 
    if (b==0) 
        return a; 
    return gcd(b,a%b); 
} 

signed main(){
    fast_IO;
    int t=1;
    //cin>>t;
    while(t--){
        int x;
        cin>>x;
        if(x>=400 && x<600)
            cout<<8;
        else if(x>=600 && x<800)
            cout<<7;
        else if(x>=800 && x<1000)
            cout<<6;
        else if(x>=1000 && x<1200)
            cout<<5;
        else if(x>=1200 && x<1400)
            cout<<4;
        else if(x>=1400 && x<1600)
            cout<<3;
        else if(x>=1600 && x<1800)
            cout<<2;
        else if(x>=1800 && x<2000)
            cout<<1;
            
    }   
    return 0;
}


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

int main(){
	std::string s;
	std::cin >> s;
	for(std::string::reverse_iterator rit = s.rbegin(); rit != s.rend(); rit++){
		std::cout << *rit;
	}
	std::cout << std::endl;
	return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll n, c, k;
    cin >> n >> c >> k;
    vll t(n);
    REP(i, n) cin >> t[i];
    VSORT(t);
    ll res = 1, left = 0, right = 0;
    REP(i, n - 1){
        right++;
        if(t[left] + k < t[right] || right - left + 1 > c){
            res++;
            left = right;
        }
    }
    cout << res << endl;
    return 0;
}

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

int main() {
  int N;
  cin>>N;
  vector<vector<int>> h(N);
  vector<vector<int>> u(N);
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    for(int j=0;j<a;j++){
      int b,c;
      cin>>b>>c;
      b--;
      if(c==1){
        h[i].push_back(b);
      }
      else{
        u[i].push_back(b);
      }
    }
  }
  int Z=0;
  for(int i=0;i<(1<<N);i++){
    int A=0;
    vector<int> q(N);
    for(int j=0;j<N;j++){
      if(i&(1<<j)){
        q[j]++;
        A++;
      }
    }
    for(int j=0;j<N;j++){
      if(q[j]==1){
        for(int x:h[j]){
          if(q[x]==0){
            A=0;
            break;
          }
        }
        for(int x:u[j]){
          if(q[x]==1){
            A=0;
            break;
          }
        }
      }
    }
    Z=max(A,Z);
  }
  cout<<Z<<endl;

}



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


using namespace std;

int main()
{

    int m,n,x,y, ans = 0;
    cin >> n >> m;
    vector<int> q[n+1];
    for (int i = 0 ; i < m ; ++ i)
    {
        cin >> x >> y;
        q[x].push_back(y);
        q[y].push_back(x);
    }
    vector<bool> used(n+2,0);
    for (int i = 1; i <= n ; ++i)
    {
        if (!used[i])
        {
            used[i] = true;
            ans ++;
            queue<int> a;
            a.push(i);
            while(!a.empty())
            {
                int d = a.front();
                a.pop();
                for (int &w:q[d])
                {
                    if (!used[w])
                    {
                        used[w] = true;
                        a.push(w);
                    }

                }
            }
        }

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


Measured memory_bytes: 8828
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

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

    int h, w;
    cin >> h >> w;

    int p[26] = {};
    for (int i = 0; i < h; i++) {
        char a[101];
        cin >> a;

        for (int j = 0; j < w; j++) {
            p[a[j] - 'a']++;
        }
    }

    int x = 0, y = 0;
    for (int i = 0; i < 26; i++) {
        x += p[i] % 4;
        y += p[i] % 2;
    }

    bool b = y == h * w % 2 && x <= h % 2 * w + w % 2 * h - y;

    cout << (b ? "Yes" : "No") << endl;

    return 0;
}

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, n) for (int i = 1; i <= (n); i++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
using ll = long long;
template <class T>
using Grid = vector<vector<T>>;

int main() {
    ll N, K;
    cin >> N >> K;
    double ans = 0;
    for (int i = 1; i <= N; i++) {
        int res = i;
        double p = 1.0 / N;
        while (res < K) {
            res *= 2;
            p *= 0.5;
        }
        ans += p;
    }
    printf("%.12f\n", ans);
}

Measured memory_bytes: 3680