akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
template <class... T> void printd(T&&...){ }
#endif

int main(){
    int n; cin >> n;
    vector<int> as(n);
    for(int i=0;i<n;i++){
        cin >> as[i];
    }
    int idx = 0, cnt = 0;
    while(idx < n){
        if(idx == n - 1){ cnt++; break; }
        int num = as[idx];
        while(idx < n && as[idx] == num){ idx++; }
        if(idx == n){ cnt++; break; }
        if(as[idx] > num){
            while(idx < n && as[idx] >= num){
                num = as[idx];
                idx++;
            }
        }else{
            while(idx < n && as[idx] <= num){
                num = as[idx];
                idx++;
            }
        }
        cnt++;
    }
    cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 888
using System;

namespace Panasonic2020
{
    class Program
    {
        static void Main()
        {
            var n = new 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 };

            var input = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine($"{n[input - 1]}");
        }
    }
}


Measured memory_bytes: 11220
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll fac(ll a) { return a > 1 ? fac(a - 1) * a : 1; }
int c[3][3];
int a[3];
int b[3];
int solve(){
  rep(i,3)rep(j,3)cin >> c[i][j];
  rep(i,101){
    a[0] = i;
    b[0] = c[0][0] - i;
    REP(j,1,3)b[j] = c[0][j] - a[0];
    REP(j,1,3)a[j] = c[j][0] - b[0];
    int count = 0;
    rep(ii,3)rep(jj,3)if(c[ii][jj] == a[ii] + b[jj])count++;
    if(count == 9){
      puts("Yes");
      return 0;
    }
  }
  puts("No");
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16) << endl; 
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#ifdef DEBUG
#define line() cout << "[" << __LINE__ << "] ";
#define dump(i) cout << #i ": " << i << " ";
#define dumpl(i) cout << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

map<int, int> mins;
map<pair<int, int>, int> mul;
map<pair<int, int>, int> add;

typedef string::const_iterator State;
class ParseError
{
};

map<char, int> val;

int formula(State &begin)
{
    if (isdigit(*begin))
    {
        int ret = (*begin) - '0';
        begin++;
        return ret;
    }
    if ((*begin == 'R') || (*begin == 'Q') || (*begin == 'P'))
    {
        int ret = val[*begin];
        begin++;

        return ret;
    }
    if (*begin == '-')
    {
        begin++;
        int ret = formula(begin);
        return mins[ret];
    }
    if (*begin == '(')
    {
        begin++;
        int ret1 = formula(begin);
        char op = *begin;
        begin++;
        int ret2 = formula(begin);
        begin++;
        if (op == '*')
        {
            return mul[{ret1, ret2}];
        }
        else
        {
            return add[{ret1, ret2}];
        }
    }
}

int main(int argc, char const *argv[])
{
    mins[0] = 2;
    mins[1] = 1;
    mins[2] = 0;

    mul[{0, 0}] = 0;
    mul[{0, 1}] = 0;
    mul[{0, 2}] = 0;

    mul[{1, 0}] = 0;
    mul[{1, 1}] = 1;
    mul[{1, 2}] = 1;

    mul[{2, 0}] = 0;
    mul[{2, 1}] = 1;
    mul[{2, 2}] = 2;

    add[{0, 0}] = 0;
    add[{0, 1}] = 1;
    add[{0, 2}] = 2;

    add[{1, 0}] = 1;
    add[{1, 1}] = 1;
    add[{1, 2}] = 2;

    add[{2, 0}] = 2;
    add[{2, 1}] = 2;
    add[{2, 2}] = 2;

    while (true)
    {
        string s;
        cin >> s;
        if (s == ".")
            break;
        int ans = 0;
        rep(i, 3) rep(j, 3) rep(k, 3)
        {
            val['R'] = i;
            val['Q'] = j;
            val['P'] = k;
            State begin = s.begin();
            if (formula(begin) == 2)
            {
                ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <random>
#include <math.h>
#include <algorithm>
#include <queue>
#define LL long long

using namespace std;

const int mod = 1e9+7;
const int maxn = 11234567;

int main()
{
    ios::sync_with_stdio(false);

    int t;
    int n, k, m, x;

    scanf("%d%d", &t,&k);

    int ans = 0;

    while(t--)
    {
        scanf("%d", &x);
        ans += (x>=k);
    }

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

    return 0;
}


Measured memory_bytes: 256
a = int(input())
def d(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
s = 0
t = d(a)
#print(t)
for i in range(len(t)):
    if t[i] == 1:
        continue
    m = t[i]-1
    if(a//m) == (a%m):
        s+=m
print(s)

Measured memory_bytes: 3268
n=int(input())

A=[0]+list(map(int,input().split()))

for i in reversed(range(1,n+1)):
    if sum(A[::i])%2!=A[i]:
        if A[i]==0:
            A[i]=1
        else:
            A[i]=0
        
print(sum(A))
if sum(A)!=0:
    for i,a in enumerate(A):
        if a==1:
            print(i)

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

int main()
{
	int N,M;
	while(cin>>N>>M, N||M)
	{
		int c[1000],d[1000];
		for(int i=0; i<N; i++) cin>>c[i];
		for(int i=0; i<M; i++) cin>>d[i];

		int a,p=0;
		for(int i=0; i<M; i++)
		{
			p+=d[i];
			if(p>=N-1) { a=i; break; }
			p+=c[p];
			if(p>=N-1) { a=i; break; }
		}
		cout << a+1 << endl;
	}
}

Measured memory_bytes: 0
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n,k = nm()
r,s,p=nm()
t = [_ for _ in input()]
tt=[]
for ti in t:
  if ti == 'r':
    tt.append(0)
  elif ti == 's':
    tt.append(1)
  else:
    tt.append(2)

score=dict()
res=0
for i in range(k):
  last=False
  for j in range(i,n,k):
    if j>=k and tt[j-k]==tt[j] and last:
      last=False
    else:
      if tt[j]==0:
        res+=p
      elif tt[j]==1:
        res+=r
      else:
        res+=s
      
      last=True
print(res)
    

Measured memory_bytes: 50612
#include<iostream>
#include<vector>
#include<string>

using ll = long long;
const ll INF = 10000000000;

int main(){
    int n, m, x;
    std::cin >> n >> m >> x;
    std::vector<ll> cost(n);
    std::vector<std::vector<ll>> a(n, std::vector<ll>(m));
    for(int i = 0; i < n; i++){
        std::cin >> cost[i];
        for(int j = 0; j < m; j++){
            std::cin >> a[i][j];
        }
    }

    ll minCost = INF;
    for(int bit = 0; bit < (1 << n); bit++){
        std::vector<ll> understand(m, 0);
        ll tmpCost = 0;
        for(int i = 0; i < n; i++){
            if(bit & (1 << i)){
                for(int j = 0; j < m; j++){
                    understand[j] += a[i][j];
                }
                tmpCost += cost[i];
            }
        }

        // チェック
        int j;
        for(j = 0; j < m; j++){
            if(understand[j] < x) break;
        }

        if(j == m){
            minCost = std::min(minCost, tmpCost);
        }
    }

    if(minCost == INF){
        std::cout << -1 << std::endl;
    }else{
        std::cout << minCost << std::endl;
    }
    
    return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cmath>

#define SREP(s,i,m) for(unsigned int i = s; i < m; ++i)
#define REP(i,m) SREP(0,i,m)

using namespace std;
#ifdef _MSC_VER
using LONG = __int64;
using ULONG = unsigned __int64;
#else
using LONG = long long int;
using ULONG = unsigned long long int;
#endif

// 二乗を計算する。
int sq(int x) { return x * x; }

// 領域内にいるか。
bool within(int x, int min, int max) {
	return min <= x && x <= max;
}

// container の中から key より小さい値を見つける。
// 見つからない場合は container.end() を返す。
template<typename T>
typename T::iterator less_than(T &container, typename T::key_type &key) {
	typename T::iterator prev = container.lower_bound(key);
	if (prev == container.begin()) prev = container.end();
	else prev--;
	return prev;
}

// container の中から key より大きい値を見つける。
// 見つからない場合は container.end() を返す。
template<typename T>
typename T::iterator greater_than(T &container, typename T::key_type &key) {
	return container.upper_bound(key);
}

// b^e (mod m) を求める
LONG modpow(LONG b, LONG e, LONG m) {
	LONG result = 1;
	while (e > 0) {
		if ((e & 1) == 1) result = (result * b) % m;
		e >>= 1;
		b = (b * b) % m;
	}
	return result;
}

int main(void) {
	int N, M;
	cin >> N >> M;
	double sum = 0, prev = 0;
	const double p = std::pow(1 / 2.0, M);
	double f = 1.0;
	for (int i=0; ; ++i) {
		sum += (i + 1) * ((N - M) * 100 + 1900 * M) * f * p;
		f = f * (1.0 - p);
		//cout << (sum - prev) << endl;
		if (std::abs(sum - prev) < 1E-6) break;
		prev = sum;
	}
	cout << (int)std::round(sum) << endl;
	return 0;
}


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

int main() {
	long long a,b,x,ans,t;
	cin>>a>>b>>x;
	ans=b/x-a/x;
	if(a%x==0&&a!=0)ans+=1;
	if(a==0)ans+=1;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/STACK:64000000")
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <ctime>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define y1 stupid_cmath
#define left stupid_left
#define right stupid_right
#define vi vector <int>
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))

const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);

char s[200200];

int main(){

    scanf("%s", s);

    int n = strlen(s);

    stack<char> st;

    for (int i = 0; i < n; i++) {
        char c = s[i];
        if (c == 'S') st.push(c);
        else {
            if (st.empty()) st.push(c);
            else if (st.top() == 'S') st.pop();
            else st.push(c);
        }
    }

    cout << st.size() << endl;

    return 0;
}


Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

double dist(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

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

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

vec eratosthenes(ll N){
  ll i;
  vec ch(N+1,1),p;
  ch[0]=ch[1]=0;
  rep(i,N+1){
    if(ch[i]){
      p.push_back(i);
      for(ll j=2;i*j<=N;j++){
        ch[i*j]=0;
      }
    }
  }
  return ch;
}
int main(){
  ll i,j,N,M,a,b,ans=0;
  cin>>N;
  pvec v(N);
  rep(i,N){
    cin>>v[i].first;
    v[i].second=i+1;
  }
  vsort(v);
  rep(i,N){
    cout<<v[i].second;
    if(i<N-1)cout<<" ";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <string>
using namespace std;
int main(){
    string t,n;
    int c=0;
    cin >> t;
    getline(cin,n);
    for (int i=0;i<t.size();i++)
        if (t[i]<91)
            t[i]+=32;
    while (n!="END_OF_TEXT"){
        for (int i=0;i<n.size();i++)
            if ((n[i]<91)&&(n[i]!=' '))
                n[i]+=32;
        while(n.find(t,0)<=n.size()){
            if ((n[n.find(t,0)-1]<=' ')&&(n[n.find(t,0)+t.size()]<=' ')){
                c++;
            }
            n[n.find(t,0)]='#';
        }
        getline(cin,n);
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
//#define _GLIBCXX_DEBUG

signed main() {
  double A, B, H, M; cin >> A >> B >> H >> M;
  double pi = 3.141592653589793238;
  
  double xa = A*cos((H/12+M/720)*2*pi), ya = A*sin((H/12+M/720)*2*pi);
  double xb = B*cos(M/60*2*pi), yb = B*sin(M/60*2*pi);
  
  //cout << xa << endl << ya << endl << xb << endl << yb << endl;
  cout << fixed << setprecision(20);
  cout << sqrt(pow(xa-xb,2)+pow(ya-yb,2)) << endl;

}

Measured memory_bytes: 4160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = 1e+14;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define _GLIBCXX_DEBUG

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

    ll origin=100;
    ll count=0;
    while(origin<x){
        origin=origin+origin/100;
        count++;
    }
    cout<<count<<endl;

}

Measured memory_bytes: 3608
#include <stdio.h>
#include <string.h>
int main(void){
    char s[12],buf[12]={0};
    scanf("%s",s);
    //cntは現時点でのbuf内の要素数
    int i,j,cnt=0;
    for(j=0;j<strlen(s);j++){
        if(s[j]=='0'){
            buf[cnt]='0';
            cnt++;
        }else if(s[j]=='1'){
            buf[cnt]='1';
            cnt++;
        }else if(cnt!=0){
            buf[cnt-1]=0;
            cnt--;
        }
    }
    printf("%s\n",buf);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<x<<endl
#define all(v) v.begin(), v.end()
using namespace std;
//型エイリアス
using vi = vector<int>;
using ll = long long;
using P = pair<int,int>;
using Mat = vector<vector<int>>;
const ll inf = 1e18;
const int N = 2e5+10;

int main(){
    int n;
    cin >>n;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    int m;
    cin >> m;
    vector<string> t(m);
    rep(i,m) cin >> t[i];

    set<string> str;
    rep(i,n) str.insert(s[i]);

    int ans = 0;
    int sum = 0;
    for(auto x : str){
        sum = 0;
        rep(i,n){
            if(x==s[i]) ++sum;
        }
        rep(j,m){
            if(x==t[j]) --sum;
        }
        if(sum>ans) ans = sum;
    }
    cout(ans);


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
typedef long long ll;
int main() {
	ll x;
	cin >> x;
	for (ll i = 1; i <= x; i++) {
		if ((i + 1)*i / 2 >= x) {
			cout << i << endl;
			break;
		}
	}
}

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

using namespace std;

int main() {

    long long N,H;
    vector<long long> a,b;
    cin >> N >> H;
    int buf_a,buf_b;
    for(int i = 0 ; i < N ; i+=1){
        cin >> buf_a >> buf_b;
        a.push_back(buf_a);
        b.push_back(buf_b);
    }

    // long long a_max = *max_element(a.begin(), a.end());
    sort( a.begin(), a.end() );
    long long a_max = a.back();
    sort(b.begin() , b.end() , greater<long long>());

    long long attack_count = 0;
    for (size_t bi = 0; bi < b.size(); bi+=1) {

        if(b[bi] < a_max) break;
        H -= b[bi];
        attack_count +=1;
        if(H <= 0) {
            cout << attack_count << endl;
            return 0;
        }
    }

    attack_count += (H + a_max -1)/a_max;
    cout << attack_count << endl;
    return 0;
}

Measured memory_bytes: 2036
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int a = scanner.nextInt(), b = scanner.nextInt();
        System.out.println(Math.max(Math.max(a + b, a + a - 1), b + b - 1));
    }
}

Measured memory_bytes: 23252
//問題URL
//http://abc077.contest.atcoder.jp/tasks/arc084_b

//解き方メモ
//下記tweet以降の会話参照
//https://twitter.com/turnJP/status/932964573899976705

#include<iostream>
#include<deque>
#include<set>
#include<algorithm>
using namespace std;

int main(){
  int k;

  //input
  cin >> k;

  //pair(探索対象（余り）,桁総和)のキュー
  deque<pair<int,int>> q;
  set<int> st;

  //幅優先探索
  int val = 1;
  int dsum = 1;
  
  //Kの倍数なら終了
  while (val%k != 0) {
    //余りが既出でないなら、キューに値を入れて探索継続
    if(st.count(val) == 0){
      //既出の余りとしてセットに追加
      st.insert(val);

      if(val%10 != 9){
	//+1（桁総和+1）をキュー末尾に追加。桁上がりする値なら追加しない。既出のため。
	q.push_back(make_pair((val+1)%k,dsum+1)); 
      }
      //*10（桁総和同じ）をキュー先頭に追加
      q.push_front(make_pair(val*10%k,dsum)); 
    }

    //next
    pair<int,int> p = q.front();
    q.pop_front();
    val = p.first;
    dsum = p.second;
  }

  cout << dsum << endl;
  
  return 0;
}


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

const int MAX_N = 3000;

int main() {
	int N;
	int a[MAX_N] = {0};
	int maxVal = 0;
	long sum = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		sum += a[i]-1;
	}
	
	cout << sum << endl;
}


Measured memory_bytes: 256
N = int(input())
A,B = list(map(int,input().split()))
P = list(map(int,input().split()))
AA = 0
AB = 0
BB = 0
for i in range(N):
    if P[i] <= A:
        AA += 1
    elif A+1 <= P[i] <= B:
        AB += 1
    else:
        BB += 1
print(min(AA,AB,BB))

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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);

const int N = 300005;
const LL MOD = 1e9 + 7;
LL n , ara[N];
int main()
{
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> ara[i];
    }
    LL ans = 0;
    for(LL b = 0;b < 60;b++){
        LL zr = 0, one = 0;
        for(int i = 1;i <= n;i++){
            if(ara[i] & (1LL << b))one++;
            else zr++;
        }
        LL cnt = zr * one;
        cnt %= MOD;
        LL val = (1LL << b) % MOD;
        ans = (ans + val * cnt) % MOD;
    }
    cout << ans << "\n";
}



Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <queue>
#include <vector>
#include <sstream>
#include <functional>
using namespace std;
typedef pair<int,string> p;
p team[10];
int main()
{
	int n;
	bool first=true;
	while(cin>>n&&n){
		if(!first)cout<<endl;
		for(int i=0;i<n;i++){
			int k,m,h;
			cin>>team[i].second>>k>>m>>h;
			team[i].first=(k*3+h)*100+10-i;
		}
		sort(team,team+n,greater<p>());
		for(int i=0;i<n;i++){
			cout<<team[i].second<<","<<(int)team[i].first/100<<endl;
		}
		first=false;
	}
    return 0;
}

Measured memory_bytes: 1212
#include<stdio.h>
int main()
{
    int a,b,c=15;
    scanf("%d%d",&a,&b);
    if(a+b==c){
        printf("+\n");
    }
    else if(a*b==c){
        printf("*\n");
    }
    else
    printf("x\n");
}


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

int main(){
    string s,t;
    cin>>s>>t;
    vector<vector<int>> pos(26);
    for(int i=0; i<s.size(); i++){
        int alp = s[i]-'a';
        pos[alp].push_back(i+1);
    }
    ll ans = 0;
    ll now_pos = 1;
    ll cyc = 0;
    for(int i=0; i<t.size(); i++){
        int alp = t[i]-'a';
        if(pos[alp].empty()){
            cout<<-1;
            return 0;
        }
        auto pitr = lower_bound(pos[alp].begin(),pos[alp].end(),now_pos);
        if(pitr==pos[alp].end()){
            pitr=pos[alp].begin();
            cyc++;
        }
        now_pos=*pitr+1;
        if(now_pos==s.size()+1){
            now_pos=1;
            cyc++;
        }
    }
    cout<<now_pos+cyc*s.size()-1<<endl;
    return 0;
}

Measured memory_bytes: 1216
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE BangPatterns #-}

-- Default Imports

import Control.Monad
import Control.Monad.ST
import Control.Monad.Trans.Class

import qualified Control.Monad.Reader as Reader
import Control.Monad.Reader (Reader, ReaderT, runReader, runReaderT)

import qualified Data.Array.MArray as MArray
import qualified Data.Array.ST as STArray
import Data.Array.ST (STArray, STUArray, runSTArray, runSTUArray)
import Data.Ix (Ix)

import qualified Data.Bits as Bits
import Data.Bits ((.&.), (.|.))

import qualified Data.ByteString.Char8 as BS
import Data.ByteString.Char8 (ByteString)

import qualified Data.Char as Char
import qualified Data.List as List
import qualified Data.Map.Strict as Map
import Data.Map.Strict (Map)
import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
import Data.Set (Set)

import qualified Data.Vector as Vector
import qualified Data.Vector.Generic as GVector
import qualified Data.Vector.Mutable as MVector
import Data.Vector.Mutable (STVector)
import qualified Data.Vector.Unboxed as UVector

import Numeric

import Debug.Trace
-- ----------

-- Custom Import Here


-- ----------

-- Default Definitions

type Vector = Vector.Vector
-- type GVector = GVector.Vector
type UVector = UVector.Vector

readIntToList :: ByteString -> [Int]
readIntToList = List.unfoldr (fmap (second $ BS.dropWhile Char.isSpace) . BS.readInt)

readToList :: Read a => ByteString -> [a]
readToList = List.unfoldr $ fmap (mapTaken . mapRemain) . span' (not . Char.isSpace)
	where
		mapTaken  = first $ read . BS.unpack
		mapRemain = second $ BS.dropWhile Char.isSpace
		span' pred s
			| BS.null taken = Nothing
			| otherwise     = Just (taken, remain')
			where
				(taken, remain) = BS.span pred s
				remain' = BS.dropWhile Char.isSpace remain

readToListN :: Read a => Int -> ByteString -> [a]
readToListN n = take n . readToList

readIntToVector :: ByteString -> Vector Int
readIntToVector = Vector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVector :: ByteString -> UVector.Vector Int
readIntToUVector = UVector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToVectorN :: Int -> ByteString -> Vector.Vector Int
readIntToVectorN n = Vector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVectorN :: Int -> ByteString -> UVector.Vector Int
readIntToUVectorN n = UVector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace


first :: (a -> a') -> (a, b) -> (a', b)
first f (a, b) = (f a, b)

second :: (b -> b') -> (a, b) -> (a, b')
second f (a, b) = (a, f b)

average :: Fractional a => [a] -> a
average xs = sum xs / (fromIntegral . length) xs

-- ----------

main :: IO ()
main = do
	[n, k] <- readIntToList <$> BS.getLine
	as <- replicateM k $ do
		BS.getLine
		readIntToList <$> BS.getLine
	print $ n - (Set.size $ Set.fromList $ concat as)


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

using namespace std;

int main(){
  string S,T;
  cin>>S>>T;
  unsigned long long h=0;
  unsigned long long B=99999999943ULL;
  for(int i=0;i<T.size();i++){
    h=h*B+T[i];
  }
  vector<unsigned long long> hashes;
  unsigned long long b=1;
  for(int i=T.size()-1;i>=0;i--){
    for(char c='a';c<='z';c++){
      if(T[i]!=c){
	hashes.push_back(h-T[i]*b+c*b);
      }
    }
    for(char c='A';c<='Z';c++){
      if(T[i]!=c){
	hashes.push_back(h-T[i]*b+c*b);
      }
    }
    b*=B;
  }
  sort(begin(hashes),end(hashes));
  unsigned long long sh=0;
  for(int i=0;i<T.size();i++){
    sh=sh*B+S[i];
  }
  int ans=0;
  for(int i=0;;i++){
    ans+=binary_search(begin(hashes),end(hashes),sh);
    if(i+T.size()>=S.size())break;
    sh=sh*B-b*S[i]+S[i+T.size()];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 69528
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1000000010
#define N 2010
#define red(x) (x)
#define blue(x) (n+(x))
#define id(x) (2002+(x))
#define int long long
ll S,T;
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<'0'||c>'9')) c=getchar();return c;}
int gcd(int n,int m){return m==0?n:gcd(m,n%m);}
int read()
{
    int x=0,f=1;char c=getchar();
    while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
    while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
    return x*f;
}
int n,p[N],d[N],q[N],pre[N],t=-1,ans;
bool flag[N];
struct data2{int to,nxt,cap,flow,cost;
}edge[N<<5];
void add(int x,int y,int z,int cost)
{
    t++;edge[t].to=y,edge[t].nxt=p[x],edge[t].cap=z,edge[t].flow=0,edge[t].cost=cost,p[x]=t;
    t++;edge[t].to=x,edge[t].nxt=p[y],edge[t].cap=0,edge[t].flow=0,edge[t].cost=-cost,p[y]=t;
}
int inc(int &x){x++;if (x>2007) x-=2007;return x;}
bool spfa()
{
    memset(d,60,sizeof(d));d[S]=0;
    memset(flag,0,sizeof(flag));
    int head=0,tail=1;q[1]=S;
    do
    {
        int x=q[inc(head)];flag[x]=0;
        for (int i=p[x];~i;i=edge[i].nxt)
        if (edge[i].flow<edge[i].cap&&d[x]+edge[i].cost<d[edge[i].to])
        {
            d[edge[i].to]=d[x]+edge[i].cost;
            pre[edge[i].to]=i;
            if (!flag[edge[i].to]) q[inc(tail)]=edge[i].to,flag[edge[i].to]=1;
        }
    }while (head!=tail);
    return d[T]<10000000000000000ll;
}
void ekspfa()
{
    while (spfa())
    {
        int v=n;
        for (int i=T;i!=S;i=edge[pre[i]^1].to)
        v=min(v,edge[pre[i]].cap-edge[pre[i]].flow);
        for (int i=T;i!=S;i=edge[pre[i]^1].to)
        edge[pre[i]].flow+=v,edge[pre[i]^1].flow-=v,ans+=v*edge[pre[i]].cost;
    }
}
ll val[10];
struct node
{
    ll x,y,z;
    ll tmp[10];
} a[N],b[N];
signed main()
{
    n=read();
    memset(p,255,sizeof(p));
    S=0,T=2*n+1;
    for(ll i=1; i<=n; i++)
    {
        a[i].x=read(),a[i].y=read(),a[i].z=read();
        //readf("%d%d%d",&a[i].x,&a[i].y,&a[i].z);
        //cin>>a[i].x>>a[i].y>>a[i].z;
        add(S,i,a[i].z,0);
        a[i].tmp[0]=a[i].x+a[i].y;
        a[i].tmp[1]=a[i].x-a[i].y;
        a[i].tmp[2]=-a[i].x+a[i].y;
        a[i].tmp[3]=-a[i].x-a[i].y;
    }
    for(ll i=1; i<=n; i++)
    {
        b[i].x=read(),b[i].y=read(),b[i].z=read();
        //readf("%d%d%d",&b[i].x,&b[i].y,&b[i].z);
        add(i+n,T,b[i].z,0);
        b[i].tmp[0]=-b[i].x-b[i].y;
        b[i].tmp[1]=-b[i].x+b[i].y;
        b[i].tmp[2]=b[i].x-b[i].y;
        b[i].tmp[3]=b[i].x+b[i].y;
    }
    for(ll i=1; i<=4; i++)
    {
        val[i-1]=2*n+i+1;
    }
    for(ll i=1; i<=n; i++)
    {
        for(ll j=0; j<4; j++)
        {
            add(i,val[j],a[i].z,-a[i].tmp[j]);
            add(val[j],i+n,b[i].z,-b[i].tmp[j]);
        }
    }
    ekspfa();
    cout<<-ans<<endl;
    return 0;
}


Measured memory_bytes: 1280
N = int(input())
s = []
for i in range(N):
    s.append(input())
ans = [0 for _ in range(4)]
for i in range(N):
    if s[i] == "AC":  ans[0] += 1
    elif s[i] == "WA":  ans[1] += 1
    elif s[i] == "TLE":   ans[2] += 1
    else:  ans[3] += 1
print("AC x {}".format(ans[0]))
print("WA x {}".format(ans[1]))
print("TLE x {}".format(ans[2]))
print("RE x {}".format(ans[3]))

Measured memory_bytes: 79200
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main()
{
	int e[101][101];
	int R, C, r, c;
	int s, total;

	scanf("%d%d", &R, &C);
	for (r = 1; r <= R; r++) {
		for (c= 1; c <= C; c++) scanf("%d", &e[r][c]);
	}
	
	for (r = 1; r <= R; r++) {
		s = 0;
		for (c = 1; c <= C; c++) s += e[r][c];
		e[r][0] = s;
	}
	total = 0;
	for (c = 1; c <= C; c++) {
		s = 0;
		for (r = 1; r <= R; r++) s += e[r][c];
		e[0][c] = s;
		total += s;
	}
	for (r = 1; r <= R; r++) {
		for (c = 1; c <= C; c++) printf("%d ", e[r][c]);
		printf("%d\n", e[r][0]);
	}
	for (c = 1; c <= C; c++) printf("%d ", e[0][c]);
	printf("%d\n", total);
	return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

struct CumulativeSum{
    vector<int> data;
    CumulativeSum(int sz) : data(sz, 0) {};
    void add(int k, int x){
        data[k] += x;
    }
    void build(){
        for(int i = 1; i < data.size(); i++){
            data[i] += data[i - 1];
        }
    }
    //区間[0,k]の和
    int query(int k){
        if(k < 0) return 0;
        return (data[min(k, (int)data.size() - 1)]);
    }
    //区間[l.r)の和
    int query(int l, int r){
        return query(r - 1) - query(l - 1);
    }
};

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    CumulativeSum cs(n);
    rep(i, 0, n){
        if(s[i] == '.') cs.add(i, 1);
    }
    cs.build();
    int ans = INF;
    rep(i, 0, n + 1){
        int tmp = i - cs.query(0, i);
        tmp += cs.query(i, n + 1);
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2196
# 方針
"""
- 標準入力はどこから???
  - コマンとライン引数かな?
    - https://qiita.com/orange_u/items/3f0fb6044fd5ee2c3a37
  - input関数のことらしい
    - https://qiita.com/yasu_teco/items/e8db933ac4f647166996

- python 関数作り方
  - https://bi.biopapyrus.jp/python/syntax/def.html
"""

rating = int(input()) 
# print(rating) #出力：s

def Rank(rating):
    #print(rating)
    if(400<= rating <=599):
        print(8)
    elif(600 <= rating <= 799):
        print(7)
    elif(800 <= rating <= 999):
        print(6)
    elif(1000 <= rating <= 1199):
        print(5)
    elif(1200 <= rating <= 1399):
        print(4)
    elif(1400 <= rating <= 1599):
        print(3)
    elif(1600 <= rating <= 1799):
        print(2)
    elif(1800 <= rating <= 1999):
        print(1)

    else:
        print("エラー(400<=ratin<=1999) の範囲外")

Rank(rating)


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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  vector<P> BA;
  REP(i, N) {
    cin >> A[i] >> B[i];
    BA.push_back(P(B[i], A[i]));
  }
  // ll sum = 0;
  // ll limit_mx = 0;
  // REP(i, N) {
  //   sum += A[i];
  //   limit_mx = max(limit_mx, B[i]);
  // }
  // if (limit_mx < sum) {
  //   cout << "No" << endl;
  //   return 0;
  // }
  sort(ALL(BA));
  ll t = 0;
  bool ok = true;
  REP(i, N) {
    t += BA[i].second;
    if (BA[i].first < t) ok = false;
  }
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 9328
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
#from heapq import heappush, heappop
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N = ni()
A = na()
b = [0] * N
c = [0] * N
b[0] = A[0]
c[-1] = A[-1]
for i in range(N-1):
    b[i+1] = math.gcd(b[i], A[i+1])
    c[-(i+2)] = math.gcd(c[-(i+1)], A[-(i+2)])

ans = 1
ans = max(c[1], ans)
ans = max(b[-2], ans)
for i in range(1, N-1):
    ans = max(math.gcd(b[i-1], c[i+1]), ans)
print(ans)


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

int main(){
  int n , ans = 0;
  long long d;
  cin >> n >> d;
  d *= d;
  for (int i = 0 ; i < n ; i ++) {
    int x , y;
    cin >> x >> y;
    if ((long long)(pow(x , 2) + pow(y , 2)) <= d) {
      ans ++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3620
/*
 * written by Yaqi Zhang
 * University of Wisconsin-Madison
 * 2020
 */

#include<algorithm>
#include<cstring>
#include<iostream>
#include<map>
#include<set>
#include<stdio.h>
#include<vector>

#define INF 0x3f3f3f3f

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    cout << ((s[2] == s[3] && s[4] == s[5]) ? "Yes" : "No") << "\n";
    return 0;

}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int a,b,i,j;
  while(1)
	   {
  scanf("%d%d",&a,&b);
  if(a==0&&b==0){break;}

  for(i=1;i<=a;i++)
    {
      for(j=1;j<=b;j++)
	{
	  if(i>1&&i<a&&j<b&&j>1)printf(".");
	  else printf("#");
	}
      printf("\n");
    }
  printf("\n");
    
	   }
  return 0;
}


Measured memory_bytes: 2132
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 10e9;

void TwoSwitches() {
	int a,b,c,d;
	cin >> a >> b >> c >> d ;

	if (a < c) {
		int f = max(b - c, 0);
		int s = max(b - d, 0);
		cout << (f - s) << endl;
	}
	else {
		int f = max(d - a, 0);
		int s = max(d - b, 0);
		cout << (f - s) << endl;
	}

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



Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int S;
    int h,m,s;
    scanf("%d",&S);
    h = S/3600;
    m = (S-h*3600)/60;
    s = (S-h*3600-m*60);
    printf("%d:%d:%d\n",h,m,s);
    
    return 0;
}


Measured memory_bytes: 2736
using System;

namespace AtCoder_Petrozavdsk_Contest_001_C___Vacant_Seat
{
    class Program
    {
        static void Main(string[] args)
        {
            solver();
        }

        static int solver()
        {
            var N = int.Parse(Console.ReadLine());
            var genders = new bool[N];
            Console.WriteLine(0);
            var read0 = Console.ReadLine();
            if (read0 == "Vacant") return 0;
            else genders[0] = read0 == "Male";

            var left = 0;
            var right = N;
            while (true)
            {
                var mid = (left + right) / 2;
                Console.WriteLine(mid);
                var read = Console.ReadLine();
                if (read == "Vacant") return 0;
                else genders[mid] = read == "Male";

                if ((mid % 2 == 0) == (genders[mid] == genders[0]))
                {
                    left = mid + 1;
                }
                else
                {
                    right = mid - 1;
                }
            }
        }
    }
}


Measured memory_bytes: 13532
def f(n):
    if n % 2 == 0:
        # 偶数で終わっている時
        return n ^ f(n - 1)
    else:
        # 奇数で終わっている時
        return (n // 2 + 1) % 2

def main():
    a, b = map(int, input().split())
    print(f(a-1) ^ f(b))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
h,w,k = map(int,input().split())

total = list()
row = [0]*h
col = [0]*w

for i in range(h):
    wh = list(map(int,list(input().replace(".","0").replace("#","1"))))
    for j in range(w):
        col[j] += wh[j]
    row[i] = sum(wh)
    total.append(wh)

tc = sum(row)
ans = 0

for i in range(2**h):
    for j in range(2**w):
        tmp = list()
        cou = tc
        ti =i
        tj =j
        for th in range(h):
            if ti == 0:
                break
            if ti%2 == 1:
                cou -= row[th]
                tmp.append(th)
            ti = ti//2 
        for tw in range(w):
            if tj == 0:
                break
            if tj%2 == 1:
                cou -= col[tw]
                for hhh in tmp:
                    cou += total[hhh][tw]
            tj = tj//2
        if cou == k:
            ans += 1

print(ans)


Measured memory_bytes: 9188
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

const int MAXN = 100005;

int n, A[MAXN], cnt[MAXN];
vector<int> vec;

int main() {
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        scanf("%d", A + i);
        vec.push_back(A[i]);
        cnt[A[i]]++;
        if (A[i] - 1 >= 0) {
            vec.push_back(A[i] - 1);
            cnt[A[i] - 1]++;
        }

        vec.push_back(A[i] + 1);
        cnt[A[i] + 1]++;
    }

    int res = 0;
    for (int i = 0; i < MAXN; i++) {
        res = max(res, cnt[i]);
    }

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

    return 0;
}


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

vector<P>dat[1100000];
struct st { int a, b, c; }p[500000];
bool operator<(st a, st b) {
	return P(a.a, a.b) < P(b.a, b.b);
}
void init(int k, int l, int r) {
	if (r - l == 1) {
		dat[k].push_back(P(p[l].b, p[l].c)); return;
	}
	int lb = k * 2 + 1, rb = k * 2 + 2;
	init(lb, l, (l + r) / 2);
	init(rb, (l + r) / 2, r);
	dat[k].resize(r - l);
	merge(dat[lb].begin(), dat[lb].end(), dat[rb].begin(), dat[rb].end(), dat[k].begin());
}
vector<int>query(int a, int b, int c, int d, int k, int l, int r) {
	if (b <= l || r <= a)return vector<int>();
	if (a <= l&&r <= b) {
		int u = upper_bound(dat[k].begin(), dat[k].end(), P(d, INT_MAX)) - dat[k].begin();
		int v = upper_bound(dat[k].begin(), dat[k].end(), P(c, INT_MIN)) - dat[k].begin();
		vector<int>res;
		for (int i = v; i < u; i++)res.push_back(dat[k][i].second);
		return res;
	}
	auto lb = query(a, b, c, d, k * 2 + 1, l, (l + r) / 2);
	auto rb = query(a, b, c, d, k * 2 + 2, (l + r) / 2, r);
	for (int i : rb)lb.push_back(i);
	return lb;
}
int main() {
	int n; scanf("%d", &n);
	rep(i, n)scanf("%d%d", &p[i].a, &p[i].b), p[i].c = i;
	sort(p, p + n);
	init(0, 0, n);
	int q; scanf("%d", &q);
	rep(i, q) {
		int sx, tx, sy, ty; scanf("%d%d%d%d", &sx, &tx, &sy, &ty);
		int a = lower_bound(p, p + n, st{ sx, INT_MIN,0 }) - p;
		int b = lower_bound(p, p + n, st{ tx, INT_MAX,0 }) - p;
		auto res = query(a, b, sy, ty, 0, 0, n);
		sort(res.begin(), res.end());
		for (int j : res)printf("%d\n", j);
		puts("");
	}
}

Measured memory_bytes: 128428
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin >> s >> t;
  int i,j;
  int ans=10000;
  for(i=0;i<s.size()-t.size()+1;i++){
    int x=0;
    for(j=0;j<t.size();j++){
      if(s[i+j]!=t[j]){
        x++;
      }
    }
    ans=min(ans,x);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3608
#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 n;
    while (cin >> n, n) {
        vector<int> m[n];

        rep(i, n) {
            int mm;
            cin >> mm;
            rep(j, mm) {
                int p;
                cin >> p;
                m[i].push_back(p);
            }
            sort(m[i].begin(), m[i].end());
        }

        int kk;
        cin >> kk;
        vector<int> k(kk);

        rep(i, kk) {
            int l;
            cin >> l;
            k[i] = l;
        }
        sort(k.begin(), k.end());

        vector<int> ans;
        rep(i, n) {
            if (k.size() > m[i].size()) continue;
            int idx=0;
            rep(j, m[i].size()) {
                if (idx < k.size() and k[idx] == m[i][j]) idx++;
            }
            if (idx == k.size()) {
                ans.push_back(i+1);
            }
        }
        if (ans.size() == 1) { cout << ans[0] << endl; }
        else { cout << "-1" << endl; }
    }
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
int main () {
  int a,b;
  cin >>a>>b;
  if (a==b) {
    cout<<"Draw"<<endl;
  }
  else if (a==1) {
    cout<<"Alice"<<endl;
  }
  else if (b==1) {
    cout<<"Bob"<<endl;
  }
  else if (a>b) {
    cout<<"Alice"<<endl;
  }
  else {
    cout<<"Bob"<<endl;
  }
}

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

#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
//ll MOD=1000000007LL;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;
//const ll MAX_V=114514LL;
//const ll MAX = 500010LL;
const ll mod=MOD;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={0,0,1,-1};
vl dy={1,-1,0,0};

//素因数分解O(√n)
map<ll,ll>prime_factor(ll n){
  map<ll,ll>res;
  for(ll i=2;i*i<=n;i++){
    while(n%i==0){
      res[i]++;
      n/=i;
    }
  }
  if(n!=1)res[n]=1;
  return res;
}

const ll MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
//finvが階乗の逆元

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modpow(ll a, ll n, ll mod) {
  
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll N=2000010;
vl arr(N);
void Eratosthenes(){
	for(ll i = 0; i < N; i++){
		arr[i] = 1;
	}
        arr[1]=0;
	for(ll i = 2; i < sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}
}
//素数判定O(√n)
bool is_prime(ll n){
  for(ll i=2;i*i<=n;i++){
    if(n%i==0)return false;
  }
  return n!=1;
}


int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(10);
  /*--------------------------------*/
  ll k;cin>>k;
  ll cnt=1;
  ll part=7;
  rep(i,10000000){
    if(part%k==0){
      cout<<cnt<<endl;
      return 0;
    }
    cnt++;
    part=(part*10+7)%k;
  }
  cout<<-1<<endl;
}

Measured memory_bytes: 18676
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;

int a[N];
int n, k;

int main() {
    cin >> n >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a+1, a+n+1);
    long long ans = 0;
    for (int i = 1; i <= n - k; i++) {
        ans = ans + 1LL * a[i];
    }
    cout << ans << endl;
    return 0;
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define DEBUG

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	int x;
	cin >> x;
	cout << (x < 1200 ? "ABC" : "ARC") << endl;
	return 0;
}

Measured memory_bytes: 256