akhauriyash/Code-Regression huggingface dataset:
/*Shivam Bhalla */
/* f2016941@pilani.bits-pilani.ac.in */



#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iostream>
#include <string>
#include <cmath>
#include <cassert>
#include <bits/stdc++.h>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
long long maxv = 1e9;

int main()
{
  int N;
  cin>>N;
  int A;
  int ans;
  cin>>ans;
  for(int i=1;i<N;i++){
    cin>>A;
    ans=__gcd(ans,A);
  }
  cout<<ans;
  return 0;
}


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

//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3", "Ofast", "unroll-loops", "fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


#define int long long
#define endl '\n'

using namespace std;

signed main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    int n;
    cin >> n;
    cout << 1000 * (n / 500) + (n - 500 * (n / 500)) - (n - 500 * (n / 500)) % 5  << endl;
    return 0;
}


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

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

#define FOR(i, s, e) for (ll(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (ll(i) = (s); (i) > (e); (i)--)
#define debug(x) cout << #x << ": " << x << endl
#define mp make_pair
#define pb push_back
const ll MOD = 1000000007;
const int INF = 1e9;
const ll LINF = 1e16;
const double PI = acos(-1.0);
int dx[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };
int dy[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/09/30  Problem: Tenka1_programmer C  / Link:   ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

ll N;

ll ans = 0LL;

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

	cin >> N;
	FOR(h, 1, 3501) {
		FOR(n, 1, 3501) {
			ll up = N*h*n;
			ll low = 4 * h*n - N*(n + h);
			if (low <= 0)continue;
			if (up%low == 0) {
				cout << h<<" "<<n<<" "<<up/low << endl;
				return 0;
			}
		}
	}
	assert(0);

	return 0;
}


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

std::string s;

int main(){

    std::cin>>s;
    
    if(!(s[0]==s[1]&&s[0]==s[2]&&s[0]==s[3]&&s[1]==s[2]&&s[1]==s[3]&&s[2]==s[3]))
    if((s[0]==s[1]&&s[2]==s[3])||
    (s[0]==s[2]&&s[1]==s[3])||
    (s[0]==s[3]&&s[1]==s[2])){
    std::cout<<"Yes"<<std::endl;
    goto f;
    }

    std::cout<<"No"<<std::endl;

    f:;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  cout<<N/3<<endl;
}



Measured memory_bytes: 3632
#include <algorithm>
#include <cstring>
#include <cstdio>
using namespace std;

int n, a[100010];

int main() {
	scanf("%d", &n);
	if(n & 1) {
		puts("0"); return 0;
	}
	for(int i = 1; i <= n; i ++) scanf("%d", a + i);
	sort(a + 1, a + n + 1);
	printf("%d\n", max(0, a[n / 2 + 1] - a[n / 2]));
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n, m; cin >> n >> m;
  vll x(n); REP(i, n) cin >> x[i];
  vll y(m); REP(i, m) cin >> y[i];
  ll xs=0, ys=0;
  REP(i, n) {
    xs += i*x[i] - (n-i-1)*x[i];
    if (xs >= MOD) xs %= MOD;
    if (xs < 0) while (xs<0) xs += MOD;
  }
  REP(i, m) {
    ys += i*y[i] - (m-i-1)*y[i];
    if (ys >= MOD) ys %= MOD;
    if (ys < 0) while (ys<0) ys += MOD;
  }
  cout << xs * ys % MOD << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long ,long long>pll;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
ll lcm(ll a, ll b) {return ((a*b)/gcd(a,b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

long long modpow(long long n, long long k, long long mod)
{
if (k == 0) return 1;
long long r = modpow(n * n % mod, k >> 1, mod);
if (k & 1) r = r * n % mod;
return r;
}

void solve(){
   int n,k;cin >> n >> k;
   vector<int>a(n);

   for(int i = 0;i<n;i++) cin >> a[i];
   for(int j = 0;j<k;j++){
        vector<int>b(n,0);
        bool ok = 0;
    for(int i = 0;i<n;i++){
        int l = max(i-a[i],0);
        int r = min(i+a[i],n);
        b[l]++;
        if(r+1<n) b[r+1]--;
    }
    //for(int i = 0;i<n;i++) cout << b[i] <<' ';
    for(int i = 1;i<n;i++) b[i] += b[i-1];
    for(int i = 0;i<n;i++){
        a[i] = b[i];
        if(b[i]!=n) ok = 1;
    }
    if(!ok) break;
   }
   for(int i = 0;i<n;i++) cout << a[i] <<' ';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 4892
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i<n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0);
#define vint(v,n) vector<int> v(n); REP(i,n) scanf("%lld", &v[i]);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
int k=0,n=0, m=0, l=0,a=100000000, b=0, c=0, d=0,e=0,ans=0,ans2=0,x=0,y=0;
string s,t,S;
signed main() {
    cin >> n;
    vint(A, n);
    ans = SUM(A);
    REP(i, n)
    {
        ans2 +=A[i];
        a = min(a, abs(ans2 - (ans - ans2)));
    }
    cout << a << endl;
}

Measured memory_bytes: 3688
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

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

using namespace std;

int main(){
    char buf;

    cin >> buf;

    printf("%c\n", buf+1);

    return 0;
}



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

void solve() {
    ll N;
    cin >> N;
    if (N % 2 == 1) {
        cout << 0 << endl;
        return;
    }
    ll ans = 0;
    for (ll i=10; i<=N; i *= 5) {
        ll x = N/i;
        ans += x;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 256
stdin = open(0).read().split('\n')
d={}
for i in range(1,int(stdin[0])+1):
    s=stdin[i]
    if s in d:
        d[s] = d[s]+1
    else:
        d[s] =1
max=1
for num in d.values():
    if num>max:max=num
for k,v in sorted(d.items()):
    if v==max:print(k)

Measured memory_bytes: 46452
#include <iostream>
//#include <string>
#include <vector>
//#include <algorithm>
using namespace std;

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

        int hmax = 0;
        int cnt = 0;
        for(auto itr = H.begin(); itr != H.end(); itr++) {
                if(hmax <= *itr) {
                        hmax = *itr;
                        cnt++;
                }
        }

        cout << cnt << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int a,b,c,d,e,k;


  scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&k);

  if((e-a<=k)){
    printf("Yay!\n");
  }
  else
    printf(":(\n");

  return 0;
}


Measured memory_bytes: 128
// https://atcoder.jp/contests/abc171/tasks/abc171_c
#include "bits/stdc++.h"
constexpr auto MAX = 10E9+1;
using namespace std;
using ll = long long;
using VI = vector<int>;

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

    while (n) {
        n--;
        str.push_back(n % 26);
        n /= 26;
        
    }

    for (int i = str.size()-1; i >= 0; i--) {
        cout << (char)(str[i]+'a');
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3612
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        n:usize,
        mut a:[i64;n],
    }

    let mut ans = 0;
    let mut prev = -1;
    for i in 0..n {
        if a[i] == prev {
            a[i] = -1;
            ans += 1;
        }
        prev = a[i];
    }
    println!("{}", ans);
}


Measured memory_bytes: 2128
N=int(input())
arr=list(map(int,input().split()))
total=sum(arr)
mt=[0]*N

for j in range(N-1):
    mt[j+1]=arr[j]*2-mt[j]
a=total-sum(mt)

for i in range(N):
    if i%2==0:
        mt[i]+=a
    else:
        mt[i]-=a
        
print(*mt)

Measured memory_bytes: 20596
#include <iostream>
#include <set>
#include <vector>

int N;
std::vector<int> d;

int main() {
  std::cin >> N;
  d.assign(N, 0);
  std::set<int> d_set;
  for (auto& x: d) {
    std::cin >> x;
    d_set.insert(x);
  }
  std::cout << d_set.size() << std::endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 10000


int main(){
	long double a[N];
	f(i, N)a[i] = 0;
	int n, k;
	long double x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%d", &n);
	z = 0;
	f(i, n){
		scanf("%Lf", &a[i]);
		z += a[i];
	}
	z = z / n;
	x = 1000000;
	f(i, n){
		if ((abs(a[i] - z) + 0.000000001) < x){
			k = i;
			x = abs(a[i] - z);
		}
	}

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


	return 0;
}


Measured memory_bytes: 512
/*input
2
1 2
2 3
*/ 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<ll,ll>;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define MP make_pair
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
const ll maxn=1e5+5;
const ll maxlg=__lg(maxn)+5;
int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n;
    cin>>n;
    vector<int> v1,v2;
    REP(i,n){
        int a,b;
        cin>>a>>b;
        v1.pb(a);
        v2.pb(b);
    }
    sort(ALL(v1)),sort(ALL(v2));
    if(n%2){
        cout<<(v2[n/2]-v1[(n/2)]+1)<<'\n';
    }
    else{
        int l=(v1[n/2]+v1[n/2-1]),r=v2[n/2]+v2[n/2-1];
        //cout<<l<<' '<<r<<'\n';
        cout<<(r-l+1)<<'\n';
    }
}


Measured memory_bytes: 5116
N,Q = (int(X) for X in input().split())
S = input()
T = [0]*(N+1)
for I in range(0,N):
     T[I+1] = T[I] + (S[I:I+2]=='AC')
for J in range(0,Q):
    L,R = (int(X)-1 for X in input().split())
    print(T[R]-T[L])

Measured memory_bytes: 13020
#include<bits/stdc++.h>
using namespace std;
int n,k;
int a[1005];
int main(){
    scanf("%d%d",&n,&k);
    int cnt=0;
    while(n!=0){
        a[cnt++]=n%k;
        n/=k;
    }
    printf("%d",cnt);
//    for(int i=cnt-1;i>=0;i--){
//        printf("%d",a[i]);
//    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 1e5 + 10;
int N, M;
LL x[MAX], y[MAX];
LL xdif[MAX], ydif[MAX];
LL xsum[MAX], ysum[MAX];

int main(void) {
    scanf("%d%d", &N, &M);
    REP(i, N) {
        scanf("%lld", x + i);
        if (i) {
            xdif[i - 1] = (x[i] - x[i - 1]) % MOD;
        }
    }
    REP(i, M) {
        scanf("%lld", y + i);
        if (i) {
            ydif[i - 1] = (y[i] - y[i - 1]) % MOD;
        }
    }
    LL Y = 0, X = 0;
    REP(i, N - 1) {
        if (i == 0) xsum[i] = xdif[i];
        else xsum[i] = (xdif[i] + xsum[i - 1]) % MOD;
    }
    REP(i, M - 1) {
        if (i == 0) ysum[i] = ydif[i];
        else ysum[i] = (ydif[i] + ysum[i - 1]) % MOD;
    }
    REP(i, N - 2) (xsum[i + 1] += xsum[i]) %= MOD;
    //REP(i, N - 2) (xsum[i + 1] += xsum[i]) %= MOD;
    REP(i, M - 2) (ysum[i + 1] += ysum[i]) %= MOD;
    //REP(i, M - 2) (ysum[i + 1] += ysum[i]) %= MOD;
    LL buf = xsum[N - 2];
    REP(i, N - 1) {
        if (i) buf = (buf - (xdif[i - 1] * (N - i) % MOD) + MOD) % MOD;
        (X += buf) %= MOD;
        //DEBUG(X)
    }
    buf = ysum[M - 2];
    REP(i, M - 1) {
        if (i) buf = (buf - (ydif[i - 1] * (M - i) % MOD) + MOD) % MOD;
        (Y += buf) %= MOD;
        //DEBUG(Y)
    }
    //REP(i, N - 1) cerr << xsum[i]<<" ";cerr<<endl;
    //REP(i, M - 1) cerr << ysum[i]<<" ";cerr <<endl;
    //cerr << X << " " << Y << endl;
    cout << (X * Y) % MOD << endl;
}


Measured memory_bytes: 4992
#include <iostream>
using namespace std;
#define ll long long
int a[100005];

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        scanf("%d", a + i);
    }
    ll s = 0;
    int flag = 1;
    for (int i = 1; i <= n; i++) {
        s += a[i] * flag;
        flag *= -1;
    }
    printf("%d ", s);
    for (int i = 1; i < n; i++) {
        s = 2 * a[i] - s;
        printf("%d ", s);
    }
}



Measured memory_bytes: 4092
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

long n, m, x;

long c[15];
long a[15][15];

int main(){
    scanf("%ld%ld%ld", &n,&m,&x);
    for(int i = 0; i < n; i++){
        scanf("%ld",c+i);
        for(int j = 0; j < m; j++){
            scanf("%ld", &a[i][j]);
        }
    }
    long ans = LINF;
    for(long bit = 0; bit < (1 << n); bit++){
        long done[15];
        for(int i = 0; i < m; i++){
            done[i] = 0;
        }
        long cost = 0;
        for(long i = 0; i < n; i++){
            if(bit & (1l << i)){
                cost += c[i];
                for(int j = 0; j < m; j++){
                    done[j] += a[i][j];
                }
            }
        }
        bool complete = true;
        for(int j = 0; j < m; j++){
            if(done[j] < x){
                complete = false;
            }
        }
        if(complete){
            ans  = std::min(ans, cost);
        }
    }
    if(ans < LINF){
        printf("%ld\n",ans);
    }else{
        printf("-1\n");
    }
}


Measured memory_bytes: 3808
public class Main {
  private static void solve() {
    long n = ni();

    System.out.println(n * (n - 1) / 2);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 23056
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
using namespace std;

int main(){
  ll n;
  cin>>n;
  ll a[n];
  rep(i,n){
    cin>>a[i];
  }
  map<ll,ll> mp1,mp2,mp3;
  rep(i,n){
    mp1[i+a[i]]++; mp1[i-a[i]]++;
    mp2[i+a[i]]++; mp3[i-a[i]]++;
  }
  ll x=0,y=0,z=0;
  for(auto p:mp1){
    x+=p.second*(p.second-1)/2;
  }
  for(auto p:mp2){
    y+=p.second*(p.second-1)/2;
  }
  for(auto p:mp3){
    z+=p.second*(p.second-1)/2;
  }
  cout<<x-y-z;
}


Measured memory_bytes: 50948
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		int ans = 100000;
		for(long i = 1 ; i * i <= 10000000000L ; i++) {
			if(n % i == 0) {
				ans = Math.min(ans, func(String.valueOf(i), String.valueOf(n / i)));
			}
		}
		System.out.println(ans);
	}

	public static int func(String a, String b) {
		return Math.max(a.length(), b.length());
	}

}


Measured memory_bytes: 21588
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
// #include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}
string trans(int N)
{
        string S;
        while (N != 0)
        {
                if (N % 2 == 1)
                {
                        N--;
                        S = '1' + S;
                }
                else
                {
                        S = '0' + S;
                }
                N /= 2;
        }
        return S;
}

int main() //input->compute->output
{
        int W,a,b;
        cin >> W >> a>>b;

        if (abs(a-b)>W)
        {
                cout << abs(a - b) - W << endl;
        }else{
                cout << 0 << endl;
        }

        return 0;
}


Measured memory_bytes: 256
N = int(input())


AB = [tuple(map(int,input().split()))for _ in range(N)]

total_a = sum(a for a,b in AB)
total_b = sum(b for a,b in AB)

x = sorted((a+b for a,b in AB),reverse=True)

ans = total_a-total_b
for i,v in enumerate(x):
    if i%2==0:
        ans +=v
    else:
        ans -=v

print(ans//2)

Measured memory_bytes: 20880
#include <iostream>

using namespace std;
 
typedef long long ll;
const ll mod = 1e9 + 7;

int main() {
    int H, W, K;
    cin >> H >> W >> K;

    ll dp[102][8] = {0};
    dp[0][0] = 1;

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            // bit の有無で横棒を表現
            for (int bit = 0; bit < 1<<(W-1); bit++) {
                bool is_valid = true;
                for (int k = 0; k < W - 2; k++) {
                    // 連続して bit が立っていたら invalid
                    if ( ((bit >> k) & 1) && ((bit >> (k + 1)) & 1) ) {
                        is_valid = false;
                    }
                }
                if (!is_valid) { continue; }
                // j 番目の bit が立っていた => 右側に遷移する
                if (bit >> j & 1) {
                    dp[i+1][j+1] += dp[i][j];
                    dp[i+1][j+1] %= mod;
                }
                // j-1 番目の bit が立っていた => 左側に遷移する
                else if (j > 0 && (bit >> (j - 1)) & 1) {
                    dp[i+1][j-1] += dp[i][j];
                    dp[i+1][j-1] %= mod;
                }
                // どちらの bit も立っていない => そのまま下に遷移
                else {
                    dp[i+1][j] += dp[i][j];
                    dp[i+1][j] %= mod;
                }
            }
        }
    }
    cout << dp[H][K-1] << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    if n<2:
        print(n)
        return
    x = 2
    while x*2<=n:
        x *= 2
    print(x)
    return

if __name__=='__main__':
    n = I()
    solve()

Measured memory_bytes: 27168
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n,a[100005];
	cin>>n;
	for (int i = 1; i <= n; i++)
	    cin>>a[i];
	bool b[100005];
	for (int i = 0; i < 100005; i++)
	  b[i]=false;
	  int ans  = 0;
	  int q = 1;
	while (b[2]==false){
		b[q] = false;
		q= a[q];
		b[q] = true;
		ans++;
		if (ans>100000) {
			cout<<"-1";
			return 0;
		}
	}
	cout<<ans;
	
	
	
	
		return 0;



}

Measured memory_bytes: 768
#include <iostream>
#include <sstream>
#include <algorithm>

#define INF 1000000000

using namespace std;

int main(void){
	int n;
	int s, t, num;
	
	cin >> n;
	int d[n][n];
	fill((int *)d, (int *)d+n*n, INF);
	//for(int i=0;i<n;i++) d[i][i] = 0;
	for(int i=0;i<n;i++){
		cin >> s;
		cin >> num;
		for(int j=0;j<num;j++){
			cin >> t;
			d[s-1][t-1] = 1;
		}
	}
	
	//WF
	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
			}
		}
	}
	
	cin >> n;
	
	for(int i=0;i<n;i++){
		cin >> s >> t >> num;
		d[s-1][t-1]+1 <= num?cout << d[s-1][t-1]+1 << endl:cout << "NA" << endl;
	}
}

Measured memory_bytes: 0
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

string S;

int main(){
  cin >> S;
  int L = 0, R = S.length() - 1, ans = 0;
  while (R - L > 0){
    if (S[L] == S[R]){
      L++; R--; continue;
    }
    if (S[L] == 'x'){
      ans++; L++; continue;
    }else if (S[R] == 'x'){
      ans++; R--; continue;
    }
    cout << -1 << endl;
    return 0;
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main() {
    string s;
    map<char, int> words;
    for (char c = 'a'; c <= 'z'; c++) {
        words[c] = 0;
    }
    while (getline(cin, s)) {
        for (auto& c : s) {
            words[::tolower(c)]++;
        }
    }
    for (char c = 'a'; c <= 'z'; c++) {
        cout << c << " : " << words[::tolower(c)] << endl;
    }
    return 0;
}



Measured memory_bytes: 3160
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define 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 eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    if(N%2==1) cout << (double)(N+1)/2.0/(double)N << endl;
    else cout << 0.500000 << endl; 
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>
#include <numeric>

using namespace std;

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

int main()
{
  int N;
  string S;
  cin >> N >> S;
  vector<int> r, g, b;
  vector<int> R(N + 1), G(N + 1), B(N + 1);
  R[0] = 0;
  G[0] = 0;
  B[0] = 0;
  for (int i = 0; i < N; i++)
  {
    if (S[i] == 'R')
    {
      r.push_back(i);
      R[i + 1] = R[i] + 1;
      G[i + 1] = G[i];
      B[i + 1] = B[i];
    }
    else if (S[i] == 'G')
    {
      g.push_back(i);
      R[i + 1] = R[i];
      G[i + 1] = G[i] + 1;
      B[i + 1] = B[i];
    }
    else if (S[i] == 'B')
    {
      b.push_back(i);
      R[i + 1] = R[i];
      G[i + 1] = G[i];
      B[i + 1] = B[i] + 1;
    }
  }
  ll ans = 0;

  for (int k : b)
  {
    for (int j : g)
    {
      if (j < k)
      {
        ans += R[j];
        int i = j - (k - j);
        if (i >= 0)
        {
          if (R[i + 1] - R[i])
          {
            ans--;
          }
        }
      }
    }
  }

  for (int k : g)
  {
    for (int j : b)
    {
      if (j < k)
      {
        ans += R[j];
        int i = j - (k - j);
        if (i >= 0)
        {
          if (R[i + 1] - R[i])
          {
            ans--;
          }
        }
      }
    }
  }

  for (int k : b)
  {
    for (int j : r)
    {
      if (j < k)
      {
        ans += G[j];
        int i = j - (k - j);
        if (i >= 0)
        {
          if (G[i + 1] - G[i])
          {
            ans--;
          }
        }
      }
    }
  }

  for (int k : r)
  {
    for (int j : b)
    {
      if (j < k)
      {
        ans += G[j];
        int i = j - (k - j);
        if (i >= 0)
        {
          if (G[i + 1] - G[i])
          {
            ans--;
          }
        }
      }
    }
  }

  for (int k : r)
  {
    for (int j : g)
    {
      if (j < k)
      {
        ans += B[j];
        int i = j - (k - j);
        if (i >= 0)
        {
          if (B[i + 1] - B[i])
          {
            ans--;
          }
        }
      }
    }
  }

  for (int k : g)
  {
    for (int j : r)
    {
      if (j < k)
      {
        ans += B[j];
        int i = j - (k - j);
        if (i >= 0)
        {
          if (B[i + 1] - B[i])
          {
            ans--;
          }
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
//const ll MOD = 1000000007;
const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


void solve(){
    ll N;
    cin >> N;
    vector<ll> a(N), b(N);
    ll sum = 0, mi = LINF;
    REP(i,N){
        cin >> a[i] >> b[i];
        if(a[i] > b[i]) chmin(mi, b[i]);
        sum += a[i];
    }
    if(a == b) cout << 0 << endl;
    else cout << sum - mi << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}

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

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


int main(){
    int L,R,d,cnt=0;

    cin >> L >> R >> d;

    for(int i=L;i<=R;i++){
        if(i%d==0) cnt++;
    }
    cout << cnt << endl;
    
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define ar array<int,2>
#define inf 1000000000000000000 
int mod=1e9+7;
int min(int a,int b){return (a<b)?a:b;}
int max(int a,int b){return (a>b)?a:b;}
int fp(int a,int b){if(b==0) return 1;int x=fp(a,b/2);x=(x*x)%mod;if(b&1) x=(x*a)%mod;return x;}


const int N=2e5+5;



void solve()
{
    int n;
    cin>>n;
    if(n>=30)
    {
      cout<<"Yes";
    }   
    else
    {
      cout<<"No";
    }
}

signed main() {
 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
 srand(time(0));
 int t=1;
 for(int i=1;i<=t;i++)
 {
   solve();
 }


}

Measured memory_bytes: 3608
#coding:utf-8

A, B = map(int,raw_input().split())
S = raw_input()

if S[A] != '-':
    print "No"

else:
    Flag = 0
    for i in range(A):
        if (S[i] < '0' or S[i] > '9'):
            Flag = 1
            #print "hello1"
    for i in range(A+1,len(S)):
        if (S[i] < '0' or S[i] > '9'):
            Flag = 1

    if Flag == 1:
        print "No"
    else:
        print "Yes"


Measured memory_bytes: 2692
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define MOD7 1000000007
#define LL_INF 1LL << 60
#define LL_MINF -1LL << 60
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const long double PI = (acos(-1));


int main(){
    int N;
    cin >> N;
    vector<vector<vector<int>>> C(4, vector<vector<int>>(3, vector<int>(10)));
    for(int i = 0; i < N; i++){
        int b, f, r, v;
        cin >> b >> f >> r >> v;
        C[b - 1][f - 1][r - 1]+=v;
    }
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 10; k++){
                cout << ' ' << C[i][j][k];
            }
            cout << endl;
        }
        if(i != 3){
            puts("####################");
        }
    }
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
#define PI 3.1415926535
#define N 10010
using namespace std;
int n, m;
int a, b, c;
int d[N];
int x ,y, w, h, r;
int p = 1;
int cnt = 0;
int main(){
    while (scanf("%d %d", &n, &m), n||m){
        for(int i = 0 ; i < n; i++){
            for(int j = 0; j < m; j++){
                if((i+j)&1) printf(".");
                else printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


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

using namespace std;

#define ll long long
#define pb push_back

const int mod = 1e9 + 7;
const int INF = 1e9;
const int N = 1e7 + 5;

ll cnt[N];

int main(){
	ll n;
	cin >> n;
	ll ans = 1;
	for(ll i = 2; i <= n; i++){
		for(ll j = i; j <= n; j += i){
			cnt[j]++;
		}
		cnt[i]++;
		ans += (cnt[i] * 1ll * i);
	}	
	cout << ans << endl;
}

Measured memory_bytes: 81720
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int n,d,x,a[100],sum=0;
  std::cin >> n >> d >> x;
  for(int i=0; i<n; i++) std::cin >> a[i];
  for(int i=0; i<n; i++){
    int cnt=1,j=1;
    while(cnt<=d){
      sum++;
      cnt=j*a[i]+1;
      j++;
    }
  }

  std::cout << sum+x << '\n';
  return 0;
}


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

int main()
{
#ifndef ONLINE_JUDGE
        //freopen("input.txt", "r", stdin);
#endif
    cin.tie(NULL);
    string s;
    cin >> s;
    int dem=0;
    long long ans=0;
    for(int i=0; i<s.size(); ++i)
    {
        if (s[i]=='W')
        {
            ans+=i-dem;
            dem++;
        }
    }
    cout << ans;
    return(0);
}



Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

typedef struct {
	int id;
	int co_count;
	int miss;
	bool co[15];
	int wr[15];
} team1;
team1 team[60];

class comp_miss {
public:
	bool operator()(const team1& left, const team1& right) const{
		return left.miss < right.miss; 
	}
};

class comp_co {
public:
	bool operator()(const team1& left, const team1& right) const{
		return left.co_count > right.co_count;
	}
};

int main(void){
	int i, j;
	int t, p, l;
	
	while(cin >> t >> p >> l, t){
		memset(team, 0, sizeof(team));
		for(i = 1; i <= t; i++) team[i].id = i;
		for(i = 0; i < l; i++){
			int it, ip, imiss;
			string str;
			cin >> it >> ip >> imiss >> str;
			if(str[0] == 'W'){
				if(team[it].co[ip]) break;
				team[it].wr[ip]++;
			}
			else{
				team[it].co_count++;
				team[it].miss += imiss;
				team[it].co[ip] = true;
			}
		}
		
		for(int it = 1; it <= t; it++){
			for(int ip = 1; ip <= p; ip++){
				if(team[it].co[ip]) team[it].miss += team[it].wr[ip] * 1200;
			}
		}
		stable_sort(team + 1, team + t + 1, comp_miss());
		stable_sort(team + 1, team + t + 1, comp_co());

		for(i = 1; i <= t; i++){
			cout << team[i].id << " " << team[i].co_count << " " << team[i].miss << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1260
#include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define all(a)  (a).begin(),(a).end()

int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}

signed main(){
  int n;
  cin>>n;
  V<int> a(n);
  fo(i,n){
    cin>>a[i];
  }
  Sort(a);
  V<int> b(100010,0);
  fo(i,n){
    b[a[i]]++;
  }
  int ans=0;
  fo(i,100010){
    if(i==0){
      ans=max(ans,b[0]+b[1]);
      continue;
    }
    if(i==100009){
      ans=max(ans,b[i]+b[i-1]);
      continue;
    }
    int c=0;
    fo(j,3){
      c+=b[i+j];
    }
    ans=max(ans,c);

  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;

int main()
{
	string s;
	cin >> s;
	cout << s[0] << s.length() - 2 << *(s.end() - 1) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

int main(void){
    int a,b;
    scanf("%d%d",&a,&b);
    if (a<=5){
        printf("0\n");
    } else if (a<=12){
        printf("%d\n",b/2);
    } else {
        printf("%d\n",b);
    }
    
    return 0 ;
}

Measured memory_bytes: 128
import collections

N = int(input())
L = []
O = []

for i in range(N):
    s = input()
    L.append(s)

c = collections.Counter(L)
M = max(c.values())

for k in c.keys():
    if c[k] == M:
        O.append(k)

O.sort()

for j in O:
    print(j)

Measured memory_bytes: 35572
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int n;
    cin >> n;
    vector<int> b(n);
    rep(i,n) cin >> b[i];
    vector<int> ord(n);
    iota(ord.begin(),ord.end(),1);

    bool allok = true;
    vector<int> ans(n,-1);
    rep(i,n){
        bool ok = false;
        for(int j=n-1;j>=0;j--){
            if(ord[j]==b[j]){
                ans[i] = ord[j];
                ord[j] = -1;
                ok = true;
                for(int k=j+1;k<n;k++){
                    ord[k]--;
                }
                break;
            }
        }
        if(!ok){
            allok = false;
            break;
        }
    }

    if(allok){
        rep(i,n) cout << ans[n-i-1] << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int X;
  int Y;
  cin >> X >> Y;
  
  int num = 0;
  
  if(X == 1){
    num = 300000 + num;
  }
  else if(X == 2){
    num = 200000 + num;
  }
  else if(X == 3){
    num = 100000 + num;
  }
  else{
    num = 0;
  }
  
  if(Y == 1){
    num = 300000 + num;
  }
  else if(Y == 2){
    num = 200000 + num;
  }
  else if(Y == 3){
    num = 100000 + num;
  }
  
  if(X == 1 && Y == 1){
    num = 400000 + num;
  }
  
  cout << num << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <deque>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

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

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

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;

ll mod_pow(ll x, ll n, ll mod) {
	if (n == 0) return 1;
	ll res = mod_pow(x * x % mod, n / 2, mod);
	if (n & 1) res = res * x % mod;
	
	return res;
}

struct SyntaxAnalysis {
	string s;
	int i;
	ll val;
	ll mod;
	bool ng;
	
	SyntaxAnalysis(string s, ll mod) { init(s, mod); }
	
	void init(string _s, ll _mod) {
		s = _s;
		mod = _mod;
		ng = false;
		i = 0;
		val = expr(i);
	}
	
	ll expr(int &i) {
		ll res = term(i);
		while (s[i] == '+' || s[i] == '-') {
			char op = s[i++];
			ll now = term(i);
			
			if (op == '+') res = (res + now) % mod;
			else res = (res - now + mod) % mod;
		}
		return res;
	}
	
	ll term(int &i) {
		ll res = factor(i);
		while (s[i] == '*' || s[i] == '/') {
			char op = s[i++];
			ll now = factor(i);
			
			if (op == '*') res = res * now % mod;
			else {
				if (now == 0) ng = true;
				res = res * mod_pow(now, mod - 2, mod) % mod;
			}
		}
		return res;
	}
	
	ll factor(int &i) {
		if (isdigit(s[i])) return number(i);
		i++;
		ll res = expr(i);
		i++;
		return res % mod;
	}
	
	ll number(int &i) {
		ll res = s[i++] - '0';
		while (isdigit(s[i])) res = res * 10 + s[i++] - '0';
		return res % mod;
	}
	
	ll get() {
		return val;
	}
	
};

int main() {
	string str;
	while (getline(cin, str), str != "0:") {
		int p = str.find(':');
		
		ll mod = atol(str.substr(0, p).c_str());
		
		string expr = "";
		FOR(i, p + 1, str.size()) if (str[i] != ' ') expr += str[i];
		
		SyntaxAnalysis sa(expr, mod);
		
		if (sa.ng) puts("NG");
		else printf("%s = %lld (mod %lld)\n", expr.c_str(), sa.get(), mod);
	}
	return 0;
}

Measured memory_bytes: 3340
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n];
    for(int i = 0;i<n;i++){
      a[i] = sc.nextInt();
    }
    int count = 0;
    int check = 0;
    while(count == check){
      check++;
      for(int i = 0;i<n;i++){
        if(a[i] % 2 == 0){
          a[i] = a[i] / 2;
        }else{
          check -=3;
          break;
        }
      }
      count++;
    }
    count--;
    System.out.println(count);
  }
}


Measured memory_bytes: 21844
N = int(input())
B = list(map(int, input().split()))
B = [0] + B


ANS = []
flag = 0
while B != [0]:
    for j in range(len(B)-1, 0, -1):
        b = B[j]
        if b == j:
            ANS.append(B.pop(j))
            break
    else:
        flag = 1
        break
        
if flag:
    print(-1)
else:
    for ans in ANS[::-1]:
        print(ans)

        

Measured memory_bytes: 63696
use proconio::input;
use std::collections::hash_set::HashSet;

fn main() {
    input! {
        x: i64,
        n: usize,
        pp: [i64;n]
    }
    let all: HashSet<i64> = (0..=101).collect();
    let sub: HashSet<i64> = pp.into_iter().collect();
    let mut pp: Vec<i64> = all.difference(&sub).cloned().collect();
    pp.sort();
    let res = pp.iter().min_by(|&a, &b| {
        (x-a).abs().cmp(&(x-b).abs())
    }).unwrap();
    println!("{}", res);
}


Measured memory_bytes: 2188
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def main():
  n = int(input())
  ans = n // 11
  if n % 11 == 0:
    print(2 * ans)
  elif n % 11  <= 6:
    print(2*ans+1)
  else:
    print(2*ans+2)
if __name__ == '__main__':
  main()

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String date = scan.next();
        System.out.println(date.compareTo("2019/04/30")<= 0 ? "Heisei" : "TBD");
    }
}


Measured memory_bytes: 24020