akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;

int main() {
int r,d,x;
cin >> r >> d >> x;
rep(i,10){
x = r*x -d;
cout << x << endl;
}
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//二項係数の計算
int nCr(int A, int B) {
    ll ans = 1;
    for (int i = 0; i < B; i++) {
        ans *= A - i;
    }
    for (int i = 0; i < B; i++) {
        ans /= i + 1;
    }
    return ans;
}
int main() {
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    int a=min(B,D)-max(A,C);
    cout<<max(0,a)<<endl;
}

Measured memory_bytes: 3600
n,k,q = map(int,input().split())

d = {}
for _ in range(q):
    a = int(input())
    if a in d:
        d[a] += 1
    else:
        d[a] = 1

for i in range(1,n+1):
    if not i in d:
        if q < k:
            print ("Yes")
        else:
            print ("No")
    else:
        if k <= q-d[i]:
            print ("No")
        else:
            print ("Yes")


Measured memory_bytes: 9060
#include<stdio.h>
int airplane(int a,int b,int c){
    if(a<=b&&a<=c)return a;
    else if(b<=c)return b;
    else return c;
}

int main(void){
   int P,Q,R,a,b,c,plane;
   scanf("%d",&P);
   scanf("%d",&Q);
   scanf("%d",&R);
   a=P+Q;
   b=Q+R;
   c=P+R;
   plane=airplane(a,b,c);
   printf("%d",plane);
   return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


char str[10005];
ll dp[2][100];   // (prev/curr), (mod dの値) という選び方の数（下位に制限なしのもののみ）

int main(int argc, char* argv[])
{
    int d;
    scanf("%s%d", str, &d);
    int n=strlen(str);

    int prev=0, curr=1;
    int i,k,m;
    int save=0;   // 制限ありのほうの現在のmod dの値
    for(i=1; i<=n; i++) {
        int cc=str[i-1]-'0';
        for(m=0; m<d; m++) {
            dp[curr][m]=0;
        }
        for(k=0; k<cc; k++) {
            dp[curr][(save+k)%d]++;
            dp[curr][(save+k)%d] %= MOD;
        }
        for(m=0; m<d; m++) {
            for(k=0; k<10; k++) {
                dp[curr][(m+k)%d]+=dp[prev][m];
                dp[curr][(m+k)%d] %= MOD;
            }
        }
        save = (save+cc)%d;
        swap(prev,curr);
    }

    ll ans = (dp[prev][0]-1+MOD)%MOD;
    if(save==0) ans++;
    printf("%lld\n", ans);

    return 0;
}


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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

int32_t main(){
   fast;
   char c;
   cin >> c;
   char ans;

   if(c >= 'a' && c <= 'z') ans = 'a';
   else  ans = 'A';

   cout << ans ;
}

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

int main(){
  int N;
  cin >> N;
  for (int i = 1; i < 10; i++)
  {
    for (int j = 1; j < 10; j++)
    {
      if (i*j==N) {
        cout << "Yes" << endl;
        return 0;
      }
    }  
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * 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;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int N = in.nextInt();
            int K = in.nextInt();
            int H[] = CPUtils.readIntArray(N, in);

            int dp[] = new int[N];
            Arrays.fill(dp, Integer.MAX_VALUE);
            dp[0] = 0;

            for (int stone = 1; stone < N; stone++)
            {
                for (int jumpLen = 1; jumpLen <= K; jumpLen++)
                {
                    if (jumpLen <= stone)
                    {
                        dp[stone] = Math.min(dp[stone], dp[stone - jumpLen] + Math.abs(H[stone - jumpLen] - H[stone]));
                    }
                }
            }
            out.print(dp[N - 1]);
        }

    }

    static class CPUtils
    {
        public static int[] readIntArray(int size, Scanner in)
        {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
            {
                array[i] = in.nextInt();
            }
            return array;
        }

    }
}



Measured memory_bytes: 50724
from itertools import product

A, B, C, D = map(int, input())

for operators in product(('+', '-'), repeat=3):
    a = A
    b = B
    c = C
    d = D
    if operators[0] == '-':
        b *= -1
    if operators[1] == '-':
        c *= -1
    if operators[2] == '-':
        d *= -1

    if a + b + c + d == 7:
        print('{}{}{}{}{}{}{}=7'.format(A, operators[0], B, operators[1], C, operators[2], D))
        break


Measured memory_bytes: 3064
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int A=in();
	vector<int> V(A+1);
	if(A>=100) V[100]=1;
	if(A>=101) V[101]=1;
	if(A>=102) V[102]=1;
	if(A>=103) V[103]=1;
	if(A>=104) V[104]=1;
	if(A>=105) V[105]=1;
	for(int i=0;i<=A;i++){
		if(V[i]){
			for(int j=0;j<6;j++){
				if(i+100+j<=A) V[i+100+j]=1;
			}
		}
	}
	out(V[A]?1:0);
	return 0;
}


Measured memory_bytes: 640
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


# MOD = 998244353
class RollingHash:
    # Verify: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_14_B
    def __init__(self, seq, base=10 ** 9 + 7, mod=2 ** 89 - 1):
        """
        :param str|typing.Sequence[int] seq:
        :param int base:
        :param int mod:
        """
        if isinstance(seq, str):
            self._seq = seq = list(map(ord, seq))
        else:
            self._seq = seq
        self._base = base
        self._mod = mod

        hashes = [0] * (len(seq) + 1)
        power = [1] * (len(seq) + 1)
        for i, c in enumerate(seq):
            hashes[i + 1] = (hashes[i] * base + c) % mod
            power[i + 1] = power[i] * base % mod
        self._hashes = hashes
        self._power = power

    def get(self, L, r):
        """
        [L, r) のハッシュ値を取得します
        :param int L:
        :param int r:
        """
        if L >= r:
            return 0
        return (self._hashes[r] - self._hashes[L] * self._power[r - L]) % self._mod


N = int(sys.stdin.buffer.readline())
S = sys.stdin.buffer.readline().decode().rstrip()
rh = RollingHash(S)


def test(size):
    l = 0
    r = size
    hist = {}
    while r <= N:
        h = rh.get(l, r)
        if h in hist:
            pl, pr = hist[h]
            if pr <= l:
                return True
        else:
            hist[h] = l, r
        l += 1
        r += 1
    return False


ok = 0
ng = N
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if test(mid):
        ok = mid
    else:
        ng = mid
print(ok)


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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define int long long

typedef pair<int, int> ii;

const int N = 1e5 + 5;

int n, h[N], dp[N];

signed main() {
    cin.tie(0), ios::sync_with_stdio(0);
    //dp[0] = 0;
    for(int i = 1; i <= N - 5; i++)
        dp[i] = LLONG_MAX;
    dp[1] = 0;
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> h[i];
    for(int i = 1; i <= n; i++) {
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
    }
    cout << dp[n];
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
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 (b<a) {a=b; return 1;} return 0;}

long long mod(long long a, long long m) {
    return (a % m + m) % m;
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extgcd(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extgcd(b, a%b, y, x);
    y -= a/b * x;
    return d;
}

// 中国剰余定理
// m[i]で割った余りがb[i]
// リターン値を (r, m) とすると解は x ≡ r (mod. m)
// 解なしの場合は (0, -1) をリターン
pair<long long, long long> chineserem(const vector<long long> &b, const vector<long long> &m) {
    long long r = 0, M = 1;
    for (int i = 0; i < (int)b.size(); ++i) {
        long long p, q;
        long long d = extgcd(M, m[i], p, q); // p is inv of M/d (mod. m[i]/d)
        if ((b[i] - r) % d != 0) return make_pair(0, -1);
        long long tmp = (b[i] - r) / d * p % (m[i]/d);
        r += M * tmp;
        M *= m[i]/d;
    }
    return make_pair(mod(r, M), M);
}

int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n), b(n);
    rep(i, n) {
        cin >> a[i];
        b[i] = a[i] / 2;
    }
    auto p = chineserem(b, a);
    if (!p.first) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = (m - p.first + p.second) / p.second;
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) (a).begin(), (a).end()
#define pw(x) (1ll<<(x))
#define lb(x) ((x) & -(x))
#define endl "\n"
#define FI(x) freopen(#x".in","r",stdin)
#define FO(x) freopen(#x".out","w",stdout)
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
//typedef uniform_int_distribution<ll> RR;
const int P = 1e9 + 7;
//ll rnd(ll l, ll r) { mt19937 gen(rand()); RR dis(l, r); return dis(gen); }
int add(int a, int b) {if((a += b) >= P) a -= P; return a < 0 ? a + P : a;}
int mul(int a, int b) {return 1ll * a * b % P;}
int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----

const int N = 2e3 + 8;
int jc[N * N], inv[N * N], dp[N][N], n, m, k;

int C(int n, int m) {
	if (n == m) return 1;
	if (m < 0 || m > n) return 0;
	return mul(jc[n], mul(inv[m], inv[n - m]));
}

int main() {
	//FI(a);
	ios::sync_with_stdio(0);
	cin.tie(0);
	//cout << setiosflags(ios::fixed);
	//cout << setprecision(2);
	cin >> n >> k;
	jc[0] = 1; rep(i, 1, n * k + 1) jc[i] = mul(jc[i-1], i);
	inv[n * k] = kpow(jc[n * k], P - 2);
	per(i, 0, n * k) inv[i] = mul(inv[i+1], i+1);
	dp[0][0] = 1;
	rep(i, 0, n+1)
		rep(j, i, n+1) {
			if (j == 0) continue;
			dp[i][j] = add(i > 0 ? dp[i-1][j] : 0, mul(dp[i][j-1], C(j * k - (j - i) - 1, k - 2)));
			//dd(i), dd(j), de(dp[i][j]);
		}
	//de(dp[n][n]);
	if (k == 1) jc[n] = 1;
	cout << mul(dp[n][n], jc[n]);
	return 0;
}



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

using namespace std;

int main()
{
    int i,n;
    cin >> n;
    vector<int> ans(n) ;
    int arr[n-1];
    for(i=0;i<n-1;i++){
        cin >> arr[i];
        ans[arr[i]-1]++;
    }
    for (auto x : ans)
        cout <<x <<endl;
    return 0;
}

Measured memory_bytes: 4844
#include <iostream>
#include <vector>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include <assert.h>
#define REP(i,n) for(ll i=0;i<(n);i++)
#define MOD 1000000007
#define int long long
#ifdef int
const long long INF = LLONG_MAX / 10;
#else
const int INF = 1010101010;
#endif
using namespace std;
typedef long long ll;
typedef vector<vector<ll> > mat;
typedef pair<int, int> P;
//typedef pair<double, double> P;
const int dx[9] = {-1, 0, 0, 1, -1, -1, 1, 1, 0};
const int dy[9] = {0, -1, 1, 0, -1, 1, -1, 1, 0};
 
int N;
int A[101010];
int pre[101010];

signed main() {
  cin >> N;
  REP(i,N) cin >> A[i];

  int sum = 0;
  int nowx = 0;
  REP(i,N) {
    sum += abs(A[i] - nowx);
    nowx = A[i];
  }
  sum += abs(nowx);

  REP(i,N) {
    cout << sum - abs(A[i] - (i == 0 ? 0 : A[i-1])) - abs(A[i+1] - A[i]) + abs(A[i+1] - (i == 0 ? 0 : A[i-1])) << endl;
  }
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
#include<set>
#include<map>
#include<bitset>
#define rep(i,a,b)  for(i=a;i<b;i++)
#define itrep(at)	for(auto it=at.begin();it!=at.end();it++)
#define lli long long int
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define db double
#define M 1000000007
#define pi 3.1415926535897932384626433832795028841971

#define MAX 100005

using namespace std;
lli min(lli a,lli b){return a<b?a:b;}
lli min(lli a,lli b,lli c){a=min(a,b);a=min(a,c);return a;}
lli max(lli a,lli b){return a>b?a:b;}
lli max(lli a,lli b,lli c){a=max(a,b);a=max(a,c);return a;}
lli dsum(lli n){lli ans=0;while(n){ans+=(n%10);n/=10;}return ans;}
lli power(lli a,lli b){lli res=1;while(b){if(b&1) res=res*a;a=a*a;b>>=1;}return res;}

struct pll{
	lli x,y;
};
bool comp(pll a,pll b){
	if(a.x==b.x)	return a.y<b.y;
	else	return a.x<b.x;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	char ch;
	db aa,bb,cc;
	string s1,s2,s3;
    lli i,j,k,a,b,c,d,n,m,sum=0,ans=0,temp,t;
    cin >> n >> m;
    lli arr[n];
    rep(i,0,n)	cin >> arr[i];
    rep(i,0,n)	sum+=arr[i];
    aa=sum;b=4*m;bb=b;
    sum=ceil(aa/bb);
    //sum=sum/(4*m);
    sort(arr,arr+n);
    a=0;
    for(i=n-1;i>=0;i--){
    	if(arr[i]>=sum)	a++;
	}
	if(a>=m)	cout << "Yes";
	else	cout << "No";
    
    
    
    return 0;
}





















/* UJJWAL KESHRI */

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define int long long
#define endl '\n'

int32_t main()
{
    IOS;
    int n;
    cin>>n; 
    int arr[n];
    map<int,int> mp;
    int ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        mp[arr[i]]++;
        ans+=arr[i];
    }
    int q;
    cin>>q;
    while(q--)
    {
        int b,c;
        cin>>b>>c;
        ans-=b*mp[b];
        ans+=c*mp[b];
        mp[c]+=mp[b];
        mp[b]=0;
        cout<<ans<<endl;;
    }

}


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

void solve(long long N){
    if (N >= 1000) cout << "ABD" << '\n';
    else cout << "ABC" << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 764
#A - Next Alphabet
C = input()
alpha_dict = {}
alpha_dict_rev = {}
for i,c in enumerate(range(ord('a'),ord('z')+1)):
    alpha_dict[chr(c)] = i
    alpha_dict_rev[i] = chr(c)
n = int(alpha_dict[C]%25 + 1)
print(alpha_dict_rev[n])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int H,W;
	cin >> H >> W;
	vector<string> S(H);
	for(int i =0; i < H; i++) cin >> S[i];

	int ans =0;
	for(int i =0; i < W-1; i++) {
		vector< vector<int> > cost0(H+1,vector<int>(H+1,0));
		for(int j =H-1; j >= 0; j--) for(int k =H-1; k >= 0; k--)
			cost0[j][k] =cost0[j+1][k+1]+(S[H-1-j][i] == S[H-1-k][i+1]);
		vector< vector<int> > cost(H+1,vector<int>(H+1,OVER9000));
		cost[0][0] =0;
		for(int j =0; j <= H; j++) for(int k =0; k <= H; k++) {
			if(j < H) cost[j+1][k] =min(cost[j+1][k],cost[j][k]+cost0[j][k]);
			if(k < H) cost[j][k+1] =min(cost[j][k+1],cost[j][k]+cost0[j][k]);
		}
		ans +=cost[H][H];
	}
	cout << ans << "\n";
	return 0;}

// look at my code
// my code is amazing


Measured memory_bytes: 1152
import java.util.*;
import java.math.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();

    int[] a = new int[m];
    int[] b = new int[m];

    for (int i = 0; i < m; i++) {
      a[i] = sc.nextInt();
      b[i] = sc.nextInt();
    }

    int[] c = new int[n];

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (a[j] == i+1 || b[j] == i+1) {
          c[i]++;
        }
      }
    }

    for (int i = 0; i < n; i++) {
      System.out.println(c[i]);
    }

  }

}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0}, dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	ll a[n + 1];
	ll sum = 0;
	rep(i, n + 1) {
		cin >> a[i];
		sum += a[i];
	}
	if (n == 0) {
		if (a[0] == 1)
			cout << 1 << endl;
		else
			cout << -1 << endl;
		return 0;
	} else if (a[0] != 0) {
		cout << -1 << endl;
		return 0;
	}
	ll now = 1, ans = 1;
	rep(i, n) {
		if (now > sum) {
			cout << -1 << endl;
			return 0;
		}
		if (now * 2 <= sum)
			now *= 2;
		else
			now = sum;
		ans += now;
		sum -= a[i + 1];
		now -= a[i + 1];
		if (i != n - 1 and now <= 0) {
			cout << -1 << endl;
			return 0;
		}
	}
	if (sum != 0 or now != 0)
		cout << -1 << endl;
	else
		cout << ans << endl;
	return 0;
}

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

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

    int n;
    cin >> n;

    print((n + 1) / 2);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

ll mod = 1000000007;

signed main()
{
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vi atcount(n);
    rep(i, n - 1)
    {
        if (s[i] == 'A' && s[i + 1] == 'C')
        {
            atcount[i + 1] = atcount[i] + 1;
        }
        else
        {
            atcount[i + 1] = atcount[i];
        }
    }
    rep(i, q)
    {
        int l, r;
        cin >> l >> r;
        cout << atcount[r - 1] - atcount[l - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 3840
#include <stdio.h>

int search(int A[], int n, int key);


int main(void)
{
	int i, n, A[10000], q, key, sum=0;
	scanf("%d", &n);
	
	for(i = 0; i < n; i++){
		scanf("%d", &A[i]);
	}
	scanf("%d", &q);
	for(i = 0; i < q; i++){
		scanf("%d", &key);
		if(search(A,n,key)){
			sum++;
		}
	}
	printf("%d\n", sum);
	
	return 0;
}


int search(int A[], int n, int key)
{
	int i=0;
	A[n] = key;
	while(A[i] != key){
		i++;
	}
	return i != n;
}



Measured memory_bytes: 2144
#include "bits/stdc++.h"

int main() {
	int A, B, C, D;
	std::cin >> A >> B >> C >> D;
	int ans = 0;
	for (int i = 0; i <= 100; i++) {
		bool check = false;
		if (A <= i && i <= B && C <= i && i <= D)
			ans++;
	}

	std::cout << (ans - 1 == -1 ? 0 : ans - 1) << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

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 double INF = 1e16;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;

const int MAX_C = 2010;
long long Com[MAX_C][MAX_C];

void calc_com() {
	//memset(Com, 0, sizeof(Com));
	Com[0][0] = 1;
	for (int i = 1; i < MAX_C; ++i) {
		Com[i][0] = 1;
		for (int j = 1; j < MAX_C; ++j) {
			Com[i][j] = (Com[i - 1][j - 1] + Com[i - 1][j]) % MOD;
		}
	}
}

int main() {
	ll N, K;
	cin >> N >> K;
	ll i;

	calc_com();

	for (i = 1; i <= K; i++) {
		ll D = Com[K - 1][i - 1];
		ll E = Com[N - K + 1][i];
		cout << (D * E) % MOD << endl;
	}

	return 0;
}


Measured memory_bytes: 31744
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cctype>
#include <functional>
#include <map>
using namespace std;
using ll = long long;

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)

int main(){
    string s,t, sd,td;

    cin >> s;
    cin >> t;
    
    vector<int> s_cnt,t_cnt;
    s_cnt.resize(26);
    t_cnt.resize(26);
    rep(i,s.length()){
        s_cnt[s[i]-'a']++;
    }
    rep(j,t.length()){
        t_cnt[t[j]-'a']++;
    }
    
    rep(i,26){
        rep(j,s_cnt[i]){
            sd.push_back((char)('a'+i));
        }
    }

    for(int i = 25;i >= 0;i--){
        rep(j,t_cnt[i]){
            td.push_back((char)('a'+i));
        }
    }

    if(sd < td) cout <<"Yes" <<endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;

int main(){
  char s[301][301];
  int n;
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> s[i];
  }

  long long total = 0;
  for (int a=0;a<n;a++) {
    bool symm = true;
    for (int i=0;i<n;i++) {
      for (int j=0;j<n;j++) {
	if ((i+a)%n != j && s[i][j] != s[(j+n-a)%n][(i+a)%n]) {
	  symm = false;
	  break;
	}
      }
      if (!symm) {
	break;
      }
    }
    if (symm) {
      total++;
    }
  }
  cout << total*n << endl;
  return(0);
}


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

int main(){
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++){
  	cin >> vec.at(i);
  }
  
  int cnt = 1, min = vec.at(0);
  for(int i = 1; i < n; i++){
    if(min > vec.at(i)){
      min = vec.at(i);
      cnt++;
    }
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 1152
#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

const long long INFL = 1e17+7;
const long long INFI = 1e9+7;
const long long MOD = 1e9+7;
const double EPS = 1e-8;
const double PI=acos(-1);

using namespace std;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int l,r,d;
	cin >> l >> r >> d;
	int ans=0;
	for(int i=l;i<=r;i++){
		if(i%d==0)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3592
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define rep(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define irep(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define rrep(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

const int MOD = 1e9 + 7;

int main() {
    int h, w;
    cin >> h >> w;
    vector<int> chars(26, 0);
    rep(i, 0, h) {
        string s;
        cin >> s;
        for (auto c : s)
            chars[c - 'a']++;
    }

    if (h == 1 && w == 1) {
        cout << "Yes" << endl;
        return 0;
    }
    int twonum = w * (h % 2) + h * (w % 2);
    int onenum = 0;
    if (h % 2 && w % 2)
        onenum = 1;
    twonum -= onenum;


    for (int i = 0; i < 26; i++) {
        if (chars[i] % 2 && onenum == 0) {
            cout << "No" << endl;
            return 0;
        }
        else if (chars[i] % 2) {
            chars[i] -= 1;
            onenum--;
        }
    }

    int mod2 = 0, mod4 = 0;
    for (int i = 0; i < 26; i++) {
        if (chars[i] == 0)
            continue;
        if (chars[i] % 4 == 0)
            mod4++;
        else
            mod2++;
    }
    if (mod2 > twonum/2 || (twonum/2-mod2) % 2) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            List<int> lstBss = new List<int>() { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
            string sS = System.Console.ReadLine().Trim();
            int iK = int.Parse(sS);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = lstBss[iK - 1].ToString();

            // 出力
            System.Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13652
#include<bits/stdc++.h>
using namespace std;
#define INS(x) x.begin(),x.end()
map<char,int> p;
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin>>s;
    for (int i=0;i<s.size();i++)
        p[s[i]]++;
    sort(INS(s));
    if (p[s[0]]==2&&p[s[2]]==2)
        cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=3000+19;
const int p=1e9+7;

int dp[N],f[2][N][2],c;
int n,m,ans;

void upd(int &x,ll y){
	x=(x+y)%p;
}

int main(){
	n=IN(),m=IN()-1;
	For(i,0,n) f[c][i][i==0]=1;
	For(i,0,m){
		memset(f[c^1],0,sizeof(f[c^1]));
		For(j,0,n+1) For(k,0,2) if (f[c][j][k]){
			if (j>=1) upd(f[c^1][j-1][k||j-1==0],f[c][j][k]);
			upd(f[c^1][j][k],2*f[c][j][k]);
			if (j<n-1) upd(f[c^1][j+1][k],f[c][j][k]);
		}
		c^=1;
	}
	For(i,0,n) upd(ans,f[c][i][1]);
	printf("%d\n",4ll*ans%p);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n;
    scanf("%lld", &n);
    ll res= 0;
    for(ll i=1; i*i<=n; i++)
    if(!(n%i))
    {
        if(i!=1)
        {
            ll x= i;
            ll m= n;
            while(!(m%x))m/= x;
            if(m%x==1ll)res++;
        }
        ll x= n/i;
        if(x!=i)
        {
            ll m= n;
            while(!(m%x))m/= x;
            if(m%x==1ll)res++;
        }
    }
    n--;
    for(ll i=1; i*i<=n; i++)
    if(!(n%i))
    {
        if(i!=1)res++;
        if((n/i)!=i)res++;
    }
    printf("%lld\n", res);
    return 0;
}


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

signed main(void)
{
	long long x, y, a, b, c, ans;
	vector<long long> p, q, sum;

	ans = 0;
	cin >> x >> y >> a >> b >> c;
	p.resize(a);
	q.resize(b);
	sum.resize(x + y + c);
	rep(i, a) cin >> p[i];
	rep(i, b) cin >> q[i];
	rep(i, c) cin >> sum[i];
	sort(p.rbegin(), p.rend());
	sort(q.rbegin(), q.rend());
	rep(i, x) sum.push_back(p.at(i));
	rep(i, y) sum.push_back(q.at(i));
	sort(sum.rbegin(), sum.rend());
	rep(i, x + y) ans += sum.at(i);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <queue>
using namespace std;


int main() {
  int n; cin >> n;
  int x = 0;
  vector<int> la;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    la.push_back(a);
    x ^= a;
  }
  for (int i = 0; i < n; ++i) {
    cout << (x^la[i]) << endl;
  }
}



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

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

    long long n, x, y;
    cin >> n >> x >> y;

    if(x > y) swap(x, y);

    // if(x == 1 and y == n){
    //     long long total = n;
    //     for(long long i = 1; i <= n - 1; i++){
    //         if(i >= n - 1){
    //             cout << 0 << endl;
    //         }else{
    //             cout << total << endl;
    //             total--;
    //         }
    //     }
    //     return 0;
    // }

    x--; y--;
    long long D[n][n] = {};
    map<long long, long long> mp;
    for(long long i = 0; i < n; i++){
        for(long long j = i + 1; j < n; j++){
            if(x + 1 == y) D[i][j] = j - i;
            else D[i][j] = min(j - i, abs(i - x) + 1 + abs(y - j));
            mp[D[i][j]]++;
        }
    }

    for(long long i = 1; i <= n - 1; i++){
        cout << mp[i] << endl;
    }

    return 0;
}

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

typedef long long ll;

ll INF=(1LL<<31)-1;
ll seg[1LL<<20];
void update(ll pos,ll val){
    pos+=1LL<<19;
    seg[pos]=val;
    while((pos/=2)>0){
        seg[pos]=min(seg[pos*2],seg[pos*2+1]);
    }
}
ll find(ll ql, ll qr, ll sl=0, ll sr=1LL<<19, ll pos=1){
    if(qr<=sl||sr<=ql)return INF;
    if(ql<=sl&&sr<=qr)return seg[pos];
    ll sm=(sl+sr)/2;
    ll lmin=find(ql,qr,sl,sm,pos*2);
    ll rmin=find(ql,qr,sm,sr,pos*2+1);
    return min(lmin,rmin);
}

int main(){
    ll N,Q;cin>>N>>Q;
    ll com,x,y;
    for(ll i=0;i<N;i++)update(i,INF);
    for(ll i=0;i<Q;i++){
        cin>>com>>x>>y;
        if(com==0){//update
            update(x,y);
        }else{//find
            ll m=find(x,y+1);
            cout<<m<<"\n";
        }
    }
}


Measured memory_bytes: 4680
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    int n;
    cin >> n;
    map<string,int> data;
    rep(i,0,n){
        string s;
        cin >> s;
        if(s=="AC"){
            data["AC"]++;
        }else if(s=="WA"){
            data["WA"]++;
        }else if(s=="TLE"){
            data["TLE"]++;
        }else if(s=="RE"){
            data["RE"]++;
        }
    }
    cout<<"AC x "<<data["AC"]<<endl;
    cout<<"WA x "<<data["WA"]<<endl;
    cout<<"TLE x "<<data["TLE"]<<endl;
    cout<<"RE x "<<data["RE"]<<endl;

  return 0;
}

Measured memory_bytes: 3628
//package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class Main {
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] Args)throws Exception{
        FastReader scan=new FastReader(System.in);
        int t=1;
//        t=scan.nextInt();
        while(t-->0){
            int n=scan.nextInt();
            Integer[] arr=new Integer[n];
            for(int i=0;i<n;i++){
                arr[i]=scan.nextInt();
            }
            Arrays.sort(arr);
            long ans=arr[n-1];
            int in=n-2;
            n-=2;
            while(n>0){
                ans+=2*arr[in];
                if(n==1){
                    ans-=arr[in];
                }
                n-=2;
                in--;
            }
            out.println(ans);
        }
        out.flush();
        out.close();
    }
    static class FastReader {

        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;

        FastReader(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }

        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan()) ;
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }

        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
}


Measured memory_bytes: 40932
#include <iostream>

using namespace std;

int main()
{
    int i, t, n;
    for (i = 0; i < 4; i++) {
        cin >> t >> n;
        if (t == 1) cout << 6000 * n << endl;
        else if (t == 2) cout << 4000 * n << endl;
        else if (t == 3) cout << 3000 * n << endl;
        else if (t == 4) cout << 2000 * n << endl;
    }
}


Measured memory_bytes: 3096
def toNum(lis):
  ret = 0
  for i in range(len(lis)):
    ret += lis[-i - 1] * 10**i
  #print(ret)
  return ret
  

def solve(list,n):
  c = 0
  i = 0
  digit = 1
  while i + digit <= n:
    if toNum(a[i:i+digit]) == c:
      c += 1
      digit = len(str(c))
      i = 0
      continue
    else:i += 1
  return c


n = int(input())
a = []
while len(a) < n:
  a += [int(i) for i in input().split()]
#print(toNum([0]))
print(solve(a,n))



Measured memory_bytes: 5612
#include <stdio.h>
int main(){
    int n,a[100],temp;
    bool f;
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    for(int i=0;i<n;i++){
        f=true;
        for(int j=0;j<i&&f;j++){
            if(a[i]<a[j]){
                temp=a[i];
                for(int k=0;k<=i-j;k++){
                    a[i-k]=a[i-k-1];
                }
                a[j]=temp;
                f=false;
            }
        }
        printf("%d",a[0]);
        for(int j=1;j<n;j++)printf(" %d",a[j]);
        printf("\n");
    }
}

Measured memory_bytes: 2692
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

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

	string ans = "";
	FOR(i,0,s.length()){
		if (s[i]=='0' || s[i]=='1') ans += s[i];
		else{
			if(ans.length()>0){
				ans.resize(ans.size()-1);
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <complex>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cerr<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<double,int> pdi;

int main()
{
	int t; cin>>t;
	while(t--){
		int initial,year; cin>>initial>>year;
		int n; cin>>n;
		vector<pdi> simple,compose;
		rep(i,n){
			int type,charge;
			double rate;
			cin>>type>>rate>>charge;
			if(type==0)
				simple.push_back(mp(rate,charge));
			if(type==1)
				compose.push_back(mp(rate,charge));
		}
		int res=0;
		rep(i,simple.size()){
			double rate=simple[i].first;
			int charge=simple[i].second;
			
			int balance=initial,interest=0;
			rep(j,year){
				interest+=balance*rate;
				balance-=charge;
			}
			res=max(res,balance+interest);
		}
		rep(i,compose.size()){
			double rate=compose[i].first;
			int charge=compose[i].second;
			
			int balance=initial;
			rep(j,year){
				balance+=balance*rate;
				balance-=charge;
			}
			res=max(res,balance);
		}
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    vector<int> heights(10);;
    for(int i = 0; i < 10; ++i){
        cin >> heights[i];
    }
    sort(heights.begin(), heights.end(), greater<int>());

    for(int i = 0; i < 3; ++i){
        cout << heights[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 0
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int num, sum;
//now: 現在の数 cnt: 今なん回目？ add:何回足した？
int judge(int now, int cnt, int add)
{
	if(add == num)
	{
		if(now == sum)
			return 1;
		else
			return 0;
	}
	else if(cnt > 9)
	{
		return 0;
	}
	else
	{
		return judge(now + cnt, cnt+1, add+1) + judge(now, cnt+1, add);
	}
}

int main()
{
	while(cin >> num >> sum)
	{
		if(num == 0 && sum == 0)
			break;
		cout << judge(0, 0, 0) << endl;
	}
}

Measured memory_bytes: 1160
#include<iostream>
#include<map>
using namespace std;
using ll = long long;

int main() {
	ll n, m, ans = 0, now = 0;
	cin >> n >> m;
	map<ll, ll>mp;
	mp[0]++;
	for (int i = 0; i < n; i++) {
		ll a;
		cin >> a;
		now += a;
		now %= m;
		ans += mp[now];
		mp[now]++;
    }
	cout << ans << endl;
}

Measured memory_bytes: 4224
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

long long int DP[(1 << 16)], DP2[(1 << 16)];
long long int cnt[(1 << 16)] = {};

int main(){
    for(int i = 0; i < (1 << 16); i++){
        for(int j = 0; j < 16; j++){
            if(i & (1 << j)){
                cnt[i] += 1;
            }
        }
    }
    while(true){
        int n, c;
        cin >> n >> c;
        if(n == 0){
            break;
        }
        long long int a[50], b[50];
        for(int i = 0; i < n; i++){
            int num = 0;
            for(int j = 0; j < 16; j++){
                num *= 2;
                int ai;
                cin >> ai;
                num += ai;
            }
            a[i] = num;
        }
        for(int i = 0; i < c; i++){
            int num = 0;
            for(int j = 0; j < 16; j++){
                num *= 2;
                int bi;
                cin >> bi;
                num += bi;
            }
            b[i] = num;
        }
        for(int i = 0; i < (1 << 16); i++){
            DP[i] = -INF;
        }
        DP[0] = 0;
        for(int loop = 0; loop < n; loop++){
            for(int i = 0; i < (1 << 16); i++){
                DP2[i] = -INF;
            }
            for(int i = 0; i < (1 << 16); i++){
                DP2[i | a[loop]] = max(DP2[i | a[loop]], DP[i]);
            }
            for(int i = 0; i < (1 << 16); i++){
                DP[i] = DP2[i];
                DP2[i] = -INF;
            }
            for(int k = 0; k < c; k++){
                for(int i = 0; i < (1 << 16); i++){
                    int num = i & b[k];
                    DP2[i - num] = max(DP2[i - num], DP[i] + cnt[num]);
                }
            }
            for(int i = 0; i < (1 << 16); i++){
                DP[i] = DP2[i];
            }
        }
        long long int ans = 0;
        for(int i = 0; i < (1 << 16); i++){
            ans = max(ans, DP[i]);
        }
        cout << ans << endl;
    }
    return 0;
}


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

float N,T,A;
float H[1100];

int main(){
    cin >> N;
    if(N==1){
        cout << "Hello World" << endl;
        return 0;
    } else {
        cin >> T >> A;
        cout << T + A << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 256