akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>

#define MAX 2000001
#define VMAX 10000

using namespace std;

int main()
{
    int *A, *B;

    int C[VMAX+1];
    int n, i, j;
    scanf("%d", &n);

    A=new int[n+1];
    B=new int[n+1];

    for(int i=0; i<=VMAX; i++) C[i]=0;

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

    for(int i=1; i<=VMAX; i++)
        C[i]=C[i]+C[i-1];

    for(int j=1; j<=n; j++){
        B[C[A[j]]]=A[j];
        C[A[j]]--;
    }

    for(int i=1; i<=n; i++){
        if(i>1) printf(" ");
        printf("%d", B[i]);
    }
    printf("\n");
    return 0;
}




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

int main() {
    // double x,y; cin >> x >> y;
    // double b = (y-2*x)/2;
    // double a = x - b;
    // if(2*a+4*b == y && a+b==x && a >= 0 && b >= 0){
    //     cout << "Yes" << endl;
    // }else{
    //     cout << "No" << endl;
    // }

    int x, y; cin >> x >> y;
    for(int i = 0; i <= x; i++){
        int a = i, b = x - i;
        if(2*a+4*b == y && a+b==x){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	bool res = true;
	for(int i=0;i<n;++i){
		int k;
		cin >> k;
		if(k%2==0){
			if(k%3!=0&&k%5!=0){
				res = false;
			}
		}
	}
	if(res)cout << "APPROVED" << endl;
	else cout << "DENIED" << endl;
}

Measured memory_bytes: 256
N, X, M = map(int, input().split())

ans, tmp = X, X
s = set()
s.add(X)
for i in range(1, N):
  tmp = (tmp**2) % M
  if tmp == 0:
    break
  if tmp == 1:
    ans += N-i
    break
  if tmp not in s:
    s.add(tmp)
    ans += tmp
  else:
    s = list(s)
    idx = s.index(tmp)
    ans += sum(s[idx:]) * ((N-i)//(len(s)-idx))
    ans += sum(s[idx:idx+(N-i)%(len(s)-idx)])
    break
print(ans)

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


long rec(string &s, long start, long index, long sum) {
    //cout<<s<<"\t"<<start<<"\t"<<index<<"\t"<<sum<<endl;

    if(start>=s.size()){
        return sum;
    }
    if(index>=s.size()){
        string digit_s=s.substr(start);
        long digit = stol(digit_s);
        return digit + sum;
    }
    
    // indexの位置に+挿入しなかったやつ
    long result1 = rec(s, start, index+1, sum);
    // indexの位置に+挿入したやつ
    long result2 = 0;
    if (index > start) {
        string digit_s=s.substr(start, index-start);
        long digit = stol(digit_s);
        result2 = rec(s, index, index+1, sum+digit);
    }

    return result1 + result2;
}

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

    cout<<rec(s, 0, 0, 0)<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
typedef __int128_t lll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  vll a(n);re(i, n) std::cin >> a[i];
  ll c = 0;
  re(i, n-2) if(a[i]==i+1) swap(a[i], a[i+1]), c++;
  if(a[n-1]==n||a[n-2]==n-1) c++;
  std::cout << c << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <map>
#include <functional>
using namespace std;
int main() {
	int a,b,ans;
	cin >> a >> b;
	ans = (a + b)/2;
	if ((a+b)%2==1) {
		ans++;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using vec_b = vector<bool>;
using vec_str = vector<string>;
using graph = mat;
using edge = pair<ll,ll>;
using wgraph = vector<vector<edge>>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back


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

    ll cnt = 0, d = 1;
    if(N % 2 == 0) {
        N /= 2;
        while(N / d > 0) {
            d *= 5;
            cnt += N / d;
        }
    }
    _PR(cnt);


    return 0;
}

/*



*/

Measured memory_bytes: 256
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

void solve();

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

void solve(){
    ll n;cin>>n;
    vl a(n),b(n);
    rep(i,n)cin>>a[i]>>b[i];

    ll sum=0;
    rrep(i,n){
        a[i]+=sum;
        ll cnt=(a[i]+b[i]-1)/b[i]*b[i]-a[i];
        sum+=cnt;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 1792
//*
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1000000007
#define MAX 0x3f3f3f3f
#define MAX2 0x3f3f3f3f3f3f3f3fll
#define ERR 1e-10
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

int n;
vector<int> edge[200000];

int d[200000];

priority_queue<pii, vector<pii>, greater<pii>> pq;

int main()
{
	int i, j, k, l;
	cin>>n;
	for(i=0;i<n-1;i++)
	{
		int x, y;
		scanf("%d%d", &x, &y), x--, y--;
		edge[x].push_back(y), edge[y].push_back(x);
	}
	int m;
	cin>>m;
	memset(d, 0x3f, sizeof(d));
	for(i=0;i<m;i++)
	{
		int x, y;
		scanf("%d%d", &x, &y), x--;
		d[x]=y;
		pq.emplace(y, x);
	}
	while(pq.size())
	{
		int tar=pq.top().second;
		pq.pop();
		for(auto e : edge[tar])
		{
			if(d[e] == MAX)
			{
				d[e]=d[tar]+1;
				pq.emplace(d[e], e);
			}
		}
	}
	for(i=0;i<n;i++) for(auto e : edge[i]) if(abs(d[e]-d[i]) != 1) return !printf("No\n");
	cout<<"Yes\n";
	for(i=0;i<n;i++) printf("%d\n", d[i]);
	return 0;
}
//*/

Measured memory_bytes: 10612
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

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();}

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//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 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,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main() {
    int r;
    cin >> r;
    int nu = 3 * r * r;
    cout << nu << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> d(N, 0);

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

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

    int p = d[N/2 - 1], q = d[N/2];
    int ans = q - p;

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

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, int b, int _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }




void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
    
    int T;
    // cin >> T;
    T = 1;
    
    while (T--) {
        solve();
    }
}


int n;
ll c;
vector<ll> a, dp;

// Convex Hull Trick
ll A(int j) { return -2 * a[j]; }
ll B(int j) { return dp[j] + a[j] * a[j]; }
ll C(int i) { return c + a[i] * a[i]; }
using pll = pair<ll, ll>;
struct CHT {
    deque<pll> d;
    ll get(int x) {
        while (sz(d) >= 2) {
            ll a = d[0].F * x + d[0].S;
            ll b = d[1].F * x + d[1].S;
            if (a <= b) break;
            d.pop_front();
        }
        return d[0].F * x + d[0].S;
    }
    void add(pll x) {
        while (sz(d) >= 2) {
            pll y = d[sz(d) - 1];
            pll z = d[sz(d) - 2];
            
            ll a1 = y.F, b1 = y.S, a2 = z.F, b2 = z.S, a3 = x.F, b3 = x.S;
            if ((b3 - b1) * (a2 - a1) >= (a1 - a3) * (b1 - b2)) break;
            d.pop_back();
        }
        d.push_back(x);
    }
};



void solve() {
    cin >> n >> c;
    
    a.resize(n);
    cin >> a;
    dp.resize(n);
    dp[0] = 0;
    
    CHT d;
    d.add(pll(A(0), B(0)));
    
    rep3(i, 1, n) {
        dp[i] = d.get(a[i]) + C(i);
        d.add(pll(A(i), B(i)));
    }
    cout << dp[n - 1] << endl;
}


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


int main(){
//    https://abc114.contest.atcoder.jp/tasks/abc114_a
    int x;
    cin>>x;
    if(x == 3 || x == 5 || x == 7){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#import <Foundation/Foundation.h>
#import <stdio.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        int X,t;
        scanf("%d %d",&X,&t);
        NSString *answer=[NSString stringWithFormat:@"%d",(X-t>=0)?X-t:0];
        
        NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
        [fileHandle writeData:[answer dataUsingEncoding:NSUTF8StringEncoding]];
        [fileHandle writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]];
        [fileHandle closeFile];
    }
    return 0;
}


Measured memory_bytes: 2404
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		if((n + 2 )% 2 == 1) {
			System.out.println(0);
          return;
		}
		long count = 0;
		for(long i = 10 ; i <= n ; i *= 5) {
			count += n / i;
		}

		sc.close();
		System.out.println(count);

	}
}



Measured memory_bytes: 35896
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

void solve(){
	int n; scanf("%d", &n);
	int A[100010] = {};
	for(int i=1;i<=n;i++){
		int x; scanf("%d", &x); A[x]++;
	}
	if(n % 2 == 1){
		if(A[0] != 1)printf("0");
		else{
			int X = 1;
			for(int i=1;i<=n/2;i++){
				if(A[i+i] != 2){
					printf("0");
					return;
				}
				else{
					X = (X + X) % 1000000007;
				}
			}
			printf("%d\n", X);
		}
	}
	else{
		int X = 1;
		for(int i=0;i<n/2;i++){
			if(A[i+i+1] != 2){
				printf("0");
				return;
			}
			else{
				X = (X+X) % 1000000007;
			}
		}
		printf("%d\n", X);
	}
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}

Measured memory_bytes: 640
L = list(map(int, input()))
X = [""] * 3
for i in range(8):
    a = L[0]
    for j in range(3):
        if i >> j & 1:
            a += L[j + 1]
        else:
            a -= L[j + 1]
    # print(a)
    if a == 7:
        for k in range(3):
            if i >> k & 1:
                X[k] = "+"
            else:
                X[k] = "-"
        print("{0}{1}{2}{3}{4}{5}{6}=7".format(L[0], X[0], L[1], X[1], L[2], X[2], L[3]))
        exit()


Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;

/**
 * @author author
 *
 */
public class Main {

  /**
   * @param args
   */
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());

    int[] b = new int[n - 1];
    for (int i = 0; i < n - 1; i++) {
      b[i] = Integer.parseInt(sc.next());
    }

    int[] max = new int[n];
    max[0] = b[0];
    max[n - 1] = b[n - 2];

    for (int i = 1; i < n - 1; i++) {
      max[i] = Math.min(b[i - 1], b[i]);
    }
    System.out.println(Arrays.stream(max).sum());

  }

}


Measured memory_bytes: 27988
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll [[maybe_unused]] = long long;
using ull [[maybe_unused]] = unsigned long long;
using ld [[maybe_unused]] = long double;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define pb push_back
#define fst first
#define snd second


template <typename T>
struct union_find {
    static_assert(is_signed<T>::value, "T must be signed");
    union_find(size_t n) : d(n, -1) {}
    bool find(T u, T v) {
        return root(u) == root(v);
    }
    T root(T u) {
        return d[u] < 0 ? u : d[u] = root(d[u]);
    }
    size_t size(T u) {
        return -d[root(u)];
    }
    bool unite(T u, T v) {
        u = root(u);
        v = root(v);
        if (u == v) return false;
        if (d[u] > d[v]) {
            swap(u, v);
        }
        d[u] += d[v];
        d[v] = u;
        return true;
    }
    vector<T> d;
};

int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    vector<pair<ll, ll>> E;
    rep(i, M) {
        ll a, b;
        cin >> a >> b;
        E.pb({a - 1, b - 1});
    }
    ll cost = N * (N - 1) / 2;
    vector<ll> ans;
    ans.pb(cost);
    union_find<ll> u(N);
    for (ll i = M - 1; i > 0; --i) {
        if (!u.find(E[i].fst, E[i].snd)) {
            cost -= u.size(E[i].fst) * u.size(E[i].snd);
            u.unite(E[i].fst, E[i].snd);
        }
        ans.pb(cost);
    }
    for (ll i = M - 1; i >= 0; --i) {
        cout << ans[i] << endl;;
    }
}


Measured memory_bytes: 5488
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch SkillUp | diff SkillUp.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address SkillUp.cpp && ./a.out

/*
 
 5/10/2020
 
 5:07-5:12 AC
 
 */

const int MAX_N=20+1;
LL X,A[MAX_N][MAX_N],C[MAX_N];
int N,M;

const LL Inf=1e17;
void solve() {
  LL res=Inf;
  REP(mask,1<<N) {
    vector<LL> xs(M);
    LL cost=0;
    REP(i,N)if((mask>>i)&1) {
      REP(j,M) xs[j]+=A[i][j];
      cost+=C[i];
    }
    
    if(*min_element(ALL(xs))>=X) SMIN(res,cost);
  }
  
  if(res==Inf) res=-1;
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>M>>X;
  REP(i,N) {
    cin>>C[i];
    REP(j,M) cin>>A[i][j];
  }
  solve();
  
  return 0;
}


Measured memory_bytes: 3648
#coding:utf-8
#1_1_D
n = int(input())
prices = [int(input()) for x in range(n)]
maxv = -2 * 10 ** 9
minv = prices[0]
for i in range(1, n):
    maxv = max(maxv, prices[i] - minv)
    minv = min(minv, prices[i])

print(maxv)

Measured memory_bytes: 15636
/*
ID: thanhvq1
LANG: C++14
PROB: namenum
*/

#pragma GCC optimize ("O2")
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
//#define int long long
#define double long double
#define vec vector
#define vi vector<int>
#define FZ(n) memset((n),0,sizeof(n))
#define FMO(n) memset((n),-1,sizeof(n))
#define unset unordered_set
#define ii pair<int, int>
#define vii vector<ii>
#define F first
#define S second
#define PB push_back
#define ALL(x) begin(x),end(x)
#define SZ(x) ((int)(x).size())
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first, l.second+r.second};
} 
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

void FILEIO() {  freopen("in.txt", "r", stdin);  freopen("out.txt", "w", stdout); }
//void FILEIO() {  freopen("namenum.in", "r", stdin);  freopen("namenum.out", "w", stdout); }

vi f(3);



void solve() {
	cin >> f[0] >> f[1] >> f[2];
	sort(ALL(f));
	cout << f[0] + f[1] << endl;
}

//#undef int
signed main() {
//#define int long long
  ios_base::sync_with_stdio(false); cin.tie();
//  FILEIO();
//auto beginProgram = chrono::steady_clock::now();

// int t; cin >> t;
//  while (t--)
  {
		solve();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
long ans=8e18;
pair<long,long>x[100];
int n,k;
main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>x[i].first>>x[i].second;
	sort(x,x+n);
	for(int i=0;i<=n-k;i++)
	{
		vector<long>P;
		for(int j=0;j<k-1;j++)
		{
			P.push_back(x[i+j].second);
		}
		for(int j=k-1;i+j<n;j++)
		{
			P.push_back(x[i+j].second);
			sort(P.begin(),P.end());
			for(int l=0;l<=P.size()-k;l++)
			{
				ans=min(ans,(max(P[l+k-1],max(x[i].second,x[i+j].second))-min(P[l],min(x[i].second,x[i+j].second)))*(x[i+j].first-x[i].first));
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>
#include <numeric>
using namespace std;


int main()
{
	int h, n;
	cin >> h >> n;
	int s = 0;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		s += t;
	}
	if (s >= h)cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=20;
const int mod=1e9+7;
int n,m,q,hbit[1<<N];
int limit[N+1][N+1],dp[N+1][1<<N];

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

void init(){
	for(int i=2; i<1<<n; ++i){
		hbit[i]=hbit[i>>1]+1;
	}
}

int main(){
#ifdef LOCAL
	//freopen("d.in","r",stdin);
#endif
	memset(limit,-1,sizeof(limit));
	n=nxi(),m=nxi(),q=nxi();
	--n;
	init();
	for(int i=1; i<=q; ++i){
		const int a=nxi(),b=nxi(),c=nxi();
		limit[a][b]=c;
	}
	dp[0][0]=1;
	for(int i=1; i<=m; ++i){
		for(int j=0; j<n; ++j){
			int p=j&1;
			memset(dp[p^1],0,sizeof(dp[p^1]));
			for(int k=0; k<1<<n; ++k){
				if(!dp[p][k]) continue;
				if((k>>j&1)==0&&limit[i][j+1]!=1){
					dp[p^1][k]=(dp[p^1][k]+dp[p][k])%mod;
				}
				if(limit[i][j+1]!=0){
					int lbit=((k>>j)&-(k>>j))<<j;
					int tgt=k^(1<<j)^lbit;
					dp[p^1][tgt]=(dp[p^1][tgt]+dp[p][k])%mod;
				}
			}
		}
		if(n&1){
			memcpy(dp[0],dp[1],sizeof(dp[1]));
		}
	}
	lint ans=0;
	for(int i=0; i<1<<n; ++i){
		ans+=dp[0][i];
	}
	printf("%lld\n",ans%mod);
	return 0;
}


Measured memory_bytes: 14592
N = int(input())
A = [list(map(int, input().split())) for i in range(N)]

t,x,y = 0,0,0
ans = 'Yes'
for t1,x1,y1 in A:
    dt,dx,dy = t1-t, abs(x1-x), abs(y1-y)
    if dt%(dx+dy)==0:
        pass
    else:
        ans = 'No'
        break
    t,x,y = t1,x1,y1
print(ans)

Measured memory_bytes: 60376
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int n;
int k;

int dfs(int cur, int m)
{
    if(cur==n)
        return m;
    
    return min(dfs(cur+1,2*m),dfs(cur+1,m+k));
}

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

    cout << dfs(0,1) << endl;
    return 0;
}

Measured memory_bytes: 256
n, y = map(int, input().split(" "))

for i in range(0, n+1):
	for j in range(0, n+1-i):
		k = n-i-j
		if 10000*i + 5000*j + 1000*k == y:
			print(i, j, k)
			exit()

print("-1 -1 -1")

Measured memory_bytes: 2940
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
ll n;
int main(void){
  cin >> n;
  for(int h = 1; h <= 3500; h++){
    for(int w = 1; w <= 3500; w++){
      if(4*h*w-n*w-n*h > 0 && n*h*w%(4*h*w-n*w-n*h) == 0){
	cout << h << " " << w << " " << n*h*w/(4*h*w-n*w-n*h) << endl;
	return 0;
      }
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
int dx[]={-1,-1,-1,0,0,0,1,1,1};
int dy[]={-1,0,1,-1,0,1,-1,0,1};
int main(){
    vector<pii>ab(0);
    ll h,w,n;cin>>h>>w>>n;
    rep(i,n){
        int a,b;cin>>a>>b;
        rep(j,9){
            if(a+dx[j]>=2&&b+dy[j]>=2&&a+dx[j]<h&&b+dy[j]<w)
            ab.pb(make_pair(a+dx[j],b+dy[j]));
        }
    }
    sort(all(ab));
    ab.pb(make_pair(0,0));
    vector<ll>j(10);
    ll cnt=1,cntall=0;
    REP(i,1,ab.size()){
        if(ab[i]==ab[i-1]){
            cnt++;
        }else{
            j[cnt]++;
            cnt=1;
            cntall++;
        }
    }
    j[0]=(h-2)*(w-2)-cntall;
    rep(i,10)cout<<j[i]<<endl;
}

Measured memory_bytes: 10348
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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; }

__attribute__ ((constructor))
void init() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
}

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

//n -> big, a -> small
mint choose(int n,int a){
    mint x = 1, y = 1;
    rep(i,a){
        x *= n-i;
        y *= i+1;
    }
    return x / y;
}

signed main(){
    ll n, p;
    cin >> n >> p;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];
    ll a = 0, b = 0;
    rep(i,n){
        if(v[i]%2==1)
            a++;
        else
            b++;
    }
    if(p==0){
        if(a == 0)
            cout << (1LL << b) << endl;
        else{
            ll cnt = 0;
            rep(i,a+1){
                if(i%2!=0)
                    continue;
                cnt += choose(a, i).x;
            }
            cout << (1LL << b) * cnt << endl;
        }
    }
    else{
        if(a==0)
            cout << 0 << endl;
        else{
            ll cnt = 0;
            rep(i,a+1){
                if(i%2==0)
                    continue;
                cnt += choose(a, i).x;
            }
            cout << (1LL << b) * cnt << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#define int64 long long int
using namespace std;
int64 rangeSum(int64 n,int64 m){
    return ((n+m)*(n-m+1))/2;
}
int main(){
    int n ; scanf("%d",&n);
    int64 ret=0,d=1,u,v;
    while (d<=n){
        u=(n/d);
        v=(n/u);
        ret += 1LL * rangeSum(v,d) * u * (u+1);
        d=v+1;
    }
    printf("%lld\n",ret/2);
}

Measured memory_bytes: 3792
S = list(input())
c1 = S.count(S[0])
c2 = S.count(S[1])
c3 = S.count(S[2])
c4 = S.count(S[3])
if c1 == c2 == c3 == c4 == 2:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
import sys
from bisect import bisect_left as bi_l, bisect_right as bi_r

inf = float('inf')

a, b, q = map(int, sys.stdin.readline().split())
*I, = map(int, sys.stdin.read().split())
s = I[:a]
t = I[a:a+b]
X = I[a+b:]

def main():
    for x in X:
        ls = bi_r(s, x) - 1
        rs = bi_l(s, x)
        lt = bi_r(t, x) - 1
        rt = bi_l(t, x)
        dls = s[ls] - x if ls >= 0 else -inf
        drs = s[rs] - x if rs <= a - 1 else inf
        dlt = t[lt] - x if lt >= 0 else -inf
        drt = t[rt] - x if rt <= b - 1 else inf
        
        res = inf
        for ds in [dls, drs]:
            for dt in [dlt, drt]:
                if ds * dt > 0:
                    d = max(abs(ds), abs(dt))
                else:
                    ds = abs(ds)
                    dt = abs(dt)
                    d = min(ds, dt) * 2 + max(ds, dt)
                res = min(res, d)
        yield res

if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')

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

int main() {
	int N, P;
	string S;
	cin >> N >> P >> S;
	long long ans = 0;

	if (P == 2 or P == 5) {
		for (int i = 0; i < N; i++) {
			int d = S[i] - '0';
			if (d % P == 0) {
				ans += i + 1;
			}
		}
	} else {
		vector<int> num(P);
		int base = 1, sum = 0;
		num[0] = 1;
		for (int i = N - 1; i >= 0; i--) {
			int d = S[i] - '0';
			sum = (sum + base * d) % P;
			ans += num[sum];
			num[sum]++;
			base = base * 10 % P;
		}
	}

	cout << ans << endl;

	return 0;
}

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

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx")

#define fi first
#define se second

using namespace std;

using ll=long long;
using ld=long double;

int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    vector<int> x(n);
    for(auto &i:x)
        scanf("%d",&i);
    const int inf=1e9;
    vector<int> dp(n,inf);
    dp[0]=0;
    for(int i=1;i<n;++i)
        for(int j=1;j<=k;++j)
        {
            if(j>i)
                break;
            dp[i]=min(dp[i],dp[i-j]+abs(x[i]-x[i-j]));
        }
    printf("%d\n",dp[n-1]);
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

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

	vector<set<int>> vec(10);
	for (int i = 0; i < s.size(); ++i) {
		vec[(int)(s[i] - '0')].insert(i);
	}

	int ans = 0;
	for (int i = 0; i < 1000; ++i) {
		int key[3];
		int x = i;
		for (int j = 2; j >= 0; --j) {
			key[j] = x % 10;
			x /= 10;
		}

		int idx = -1;
		bool ok = true;
		for (int j = 0; j < 3; ++j) {
			if (!ok) { break; }
			if (vec[key[j]].size() == 0) { ok = false; }
			else {
				auto x = vec[key[j]].upper_bound(idx);
				if (x == vec[key[j]].end()) {
					ok = false;
					idx = 100000;
				} else {
					idx = *x;
				}
			}
		}
		if (ok) { ++ans; }
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ctype.h>

#define INF 100000000

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b)
    {
        cout << "YES\n";
    }
    else
    {
        cout << "NO\n";
    }
    return 0;
}


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

using namespace std;

int n;
int pos[200001];

int main(){
    cin >> n;
    for (int i = 0;i < n; ++i) {
        int p;
        cin >> p;
        pos[p] = i;
    }

    int lis = 1;
    int is = 1;
    int lastp = pos[1];
    for (int i = 2; i <= n; ++i) {
        if (lastp < pos[i]) {
            is++;
        } else {
            lis = max(is, lis);
            is = 1;
        }
        lastp = pos[i];
    }
    lis = max(is, lis);

    cout << n - lis << endl;
}

Measured memory_bytes: 1152
n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0

for i in range(n-1):
    sum = a[i] + a[i+1]
    if i == 0:
        if (sum - x) > a[i+1]:
            a[i+1] = 0
            ans += (sum - x)
            continue
    if sum > x:
        a[i+1] -= (sum - x)
        ans += (sum - x)

print(ans)

Measured memory_bytes: 14132
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.bigint;

  alias bint=BigInt;
  int n; long k; rd(n, k);
  auto w=new long[](n), d=new long[](n);
  foreach(i; 0..n) rd(w[i], d[i]);

  long count(long dist){
    long ret=0;
    foreach(i; 0..n){
      auto rem=dist-w[i];
      if(rem<0) continue;
      ret+=(1+rem/d[i]);
      if(ret>=k) return ret;
    }
    return ret;
  }

  long ng=0, ok=(1L<<62);
  while(ok-ng>1){
    auto md=(ok+ng)/2;
    count(md)<k ? ng : ok = md;
  }

  writeln(ok);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
void wr(T...)(T x){
  import std.stdio;
  foreach(e; x) write(e, " ");
  writeln();
}

Measured memory_bytes: 4732
#include<bits/stdc++.h>
using namespace std;
const int N=5005;
char s1[N],s2[N];
int t1[N],t2[N],tot1,tot2;
int main()
{
	int n,minn=1e9;
	scanf("%d%s%s",&n,s1+1,s2+1);
	t1[++tot1]=0;
	t2[++tot2]=0;
	for(int i=1;i<=n;i++)
	{
		if(s1[i]==s1[i+1]) t1[++tot1]=i;
		if(s2[i]==s2[i+1]) t2[++tot2]=i;
	}
	for(int i=-tot1;i<=tot2;i++)
	{
		if((i&1)==(s1[1]==s2[1])) continue;
		int ans=0;
		for(int j=1;j<=tot1;j++)
		{
			if(i+j>=1&&i+j<=tot2) ans+=abs(t1[j]-t2[i+j]);
			else if(i+j<1) ans+=t1[j];
			else ans+=n-t1[j];
		}
		for(int j=1;j<=tot2;j++)
		{
			if(j-i<1) ans+=t2[j];
			else if(j-i>tot1) ans+=n-t2[j];
		}
		minn=min(minn,ans);
	}
	printf("%d\n",minn);
	return 0;
}

Measured memory_bytes: 3868
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
	if (s == "Sunny") cout << "Cloudy" << endl;
	if (s == "Cloudy") cout << "Rainy" << endl;
	if (s == "Rainy") cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long INF = 1e9 + 7;
using namespace std;
typedef long long ll;
map<int, int> mp;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, p;
	cin >> n >> p;
	vector<int> a(n);
	bool ok = false;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] % 2 == 1) ok = true;
	}
	long long tmp = 1;
	if (ok) {
		for (int i = 0; i < n - 1; i++) {
			tmp *= 2;
		}
		cout << tmp << endl;
	}
	else {
		if (p == 0) {
			for (int i = 0; i < n; i++) {
				tmp *= 2;
			}
			cout << tmp << endl;
		}
		else {
			cout << 0 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
# include<bits/stdc++.h>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-8
# define MOD 100000007
# define INF 1000000000
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
# define bug puts("H");
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
inline char nc(){
    static char buf[1000000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
inline int Scan(){
    char ch=nc();int sum=0, f=1;
    if (ch=='-') f=-1, ch=nc();
    while(!(ch>='0'&&ch<='9'))ch=nc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=nc();
    return sum*f;
}
const int N=50005;
//Code begin....

int main ()
{
    int n, ans=0;
    scanf("%d",&n);
    FOR(i,1,n) {
        int l, r;
        scanf("%d%d",&l,&r);
        ans+=r-l+1;
    }
    printf("%d\n",ans);
    return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,k;
  while(cin >> n&&n){
    vary(int,v,7,0);
    rep(i,n){
      cin >> k;
      rep(j,7){
        if( k < (j +1) * 10){
          v[j]++;
          break;
        }
        else if(k >= 60){
          v[6]++;
          break;
        }
      }
    }
    rep(i,7){
      cout << v[i]<<endl;
    }

  }
  return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
static const long long INF = INT64_MAX;
static const long long MOD = (ll)1e9+7;

#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i, n) for(ll i=0;i<n;i++)
#define SZ(v) (ll)((v).size())
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).begin(), (v).end())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

void solve() {
    ll N, K;
    str S;
    cin >> N >> K;
    cin >> S;
    REP(i, N) {
        if(i == K - 1) {
            if(S[i] == 'A') S[i] = 'a';
            if(S[i] == 'B') S[i] = 'b';
            if(S[i] == 'C') S[i] = 'c';
        }
    }
    out(S);
}

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


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while(0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

const ll OFFSET = 30000;

ll H, W;
bool p[81][60001];
bool q[81][60001];
ll v[81][81];

void setp(ll x, ll num) {
  p[x][num + OFFSET] = true;
}

bool getp(ll x, ll num) {
  return p[x][num + OFFSET];
}

bool getq(ll x, ll num) {
  return q[x][num + OFFSET];
}

void copy_p2q() {
  rep(i,81) rep(j,60001) { q[i][j] = p[i][j]; }
}

void clearp() {
  rep(i,81) rep(j,60001) { p[i][j] = false; }
}

signed main() {
  cin >> H >> W;
  rep(y,H) rep(x,W) { ll t; cin >> t; v[y][x] += t; }
  rep(y,H) rep(x,W) { ll t; cin >> t; v[y][x] -= t; }

  // y = 0 のとき
  {
    // x = 0
    setp(0, v[0][0]);
    setp(0, -v[0][0]);
    // printf("y=%d x=%d val=%d\n", 0, 0, v[0][0]);
    // x > 0
    for (ll x = 1; x < W; x++) {
      for (ll num = -30000; num <= 30000; num++) {
        if (getp(x-1, num)) {
          setp(x, v[0][x] + num);
          // printf("y=%d x=%d val=%d\n", 0, x, v[0][x] + num);
          setp(x, -v[0][x] + num);
          // printf("y=%d x=%d val=%d\n", 0, x, -v[0][x] + num);
        }
      }
    }
  }
  // y > 0 のとき
  for (ll y = 1; y < H; y++) {
    copy_p2q();
    clearp();
    // x = 0
    for (ll num = -30000; num <= 30000; num++) {
      if (getq(0, num)) {
        setp(0, v[y][0] + num);
        // printf("y=%d x=%d val=%d\n", y, 0, v[y][0] + num);
        setp(0, -v[y][0] + num);
        // printf("y=%d x=%d val=%d\n", y, 0, -v[y][0] + num);
      }
    }
    // x > 0
    for (ll x = 1; x < W; x++) {
      for (ll num = -30000; num <= 30000; num++) {
        if (getp(x-1, num)) {
          setp(x, v[y][x] + num);
          // printf("y=%d x=%d val=%d\n", y, x, v[y][x] + num);
          setp(x, -v[y][x] + num);
          // printf("y=%d x=%d val=%d\n", y, x, -v[y][x] + num);
        }
      }
      for (ll num = -30000; num <= 30000; num++) {
        if (getq(x, num)) {
          setp(x, v[y][x] + num);
          // printf("y=%d x=%d val=%d\n", y, x, v[y][x] + num);
          setp(x, -v[y][x] + num);
          // printf("y=%d x=%d val=%d\n", y, x, -v[y][x] + num);
        }
      }
    }
  }

  ll ans = 300000;
  for (ll num = -30000; num <= 30000; num++) {
    if (getp(W-1, num)){
      // cout << num << " ";
      ans = min(ans, abs(num));
    }
  }
  // cout << endl;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9728
#include <memory.h>
#include <stdbool.h>
#include <stdio.h>

#define arr_print_card(a, n) for(int i=0;i<(n);++i)printf(i==(n)-1?"%c%d\n":"%c%d ",(a)[i].symbol, (a)[i].num)

typedef struct Card {
    char symbol;
    int num;
} Card;
bool card_lt(const Card l, const Card r) {
    return l.num < r.num;
}
bool card_neq(const Card l, const Card r) {
    return l.symbol != r.symbol || l.num != r.num;
}

void bubble_sort(Card *a, const int N) {
    for(int i = 0; i < N; ++i) {
        for(int j = N - 1; j > i; --j) {
            if(card_lt(a[j], a[j - 1])) {
                Card tmp = a[j];
                a[j] = a[j - 1];
                a[j - 1] = tmp;
            }
        }
    }
}
void selection_sort(Card *a, const int N) {
    for(int i = 0; i < N; ++i) {
        int minj = i;
        for(int j = i + 1; j < N; ++j) {
            if(card_lt(a[j], a[minj])) minj = j;
        }
        if(i != minj) {
            Card tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
        }
    }
}
bool arr_cmp(Card *a, Card *b, const int N) {
    for(int i = 0; i < N; ++i) {
        if(card_neq(a[i], b[i])) return false;
    }
    return true;
}

int main() {
    int n;
    scanf("%d\n", &n);
    Card a[n], b[n];
    for(int i = 0; i < n; ++i) {
        scanf(" %c%d", &a[i].symbol, &a[i].num);
    }
    memcpy(b, a, sizeof(b));
    // a-arr -> bubble sort
    bubble_sort(a, n);
    // b-arr -> selection sort
    selection_sort(b, n);

    arr_print_card(a, n);
    // bubble sort is always stable
    printf("Stable\n");
    arr_print_card(b, n);
    // cmp with bubble sorted array
    printf(arr_cmp(a,b,n)?"Stable\n":"Not stable\n");
    return 0;
}



Measured memory_bytes: 2084
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>

using namespace std;

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int main(){
	int N, M;
	cin >> N >> M;
	vector<ll> A, B, C, D;
	for (int i = 0; i < N; i++){
		ll a, b;
		cin >> a >> b;
		A.push_back(a);
		B.push_back(b);
	}
	for (int j = 0; j < M; j++){
		ll c, d;
		cin >> c >> d;
		C.push_back(c);
		D.push_back(d);
	}
	for (int i = 0; i < N; i++){
		int tmp_j = 1;
		int min_d = INF;
		for (int j = 0; j < M; j++){
			if (abs(C[j] - A[i]) + abs(D[j] - B[i]) < min_d){
				tmp_j = j + 1;
				min_d = abs(C[j] - A[i]) + abs(D[j] - B[i]);
			}
		}
		cout << tmp_j << endl;
	}
}




Measured memory_bytes: 256
/*
  Contest 062
  B - Picture Frame
  Rakesh Kumar --> 28/08/2020
 */

#include <bits/stdc++.h>



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

    int h = 0, w = 0;
    std::cin >> h >> w;
    std::cin.ignore();
    std::string top(w + 2, '#');
    std::cout << top << std::endl;
    while (h--) {
        std::string s;
        std::getline(std::cin, s);
        std::cout << "#" << s << "#" << std::endl;
    }

    std::cout << top << std::endl;

    return 0;
}


Measured memory_bytes: 3648