akhauriyash/Code-Regression huggingface dataset:
//                               //
    // author : samars_diary //
    // 17-09-2020 │ 16:02:11 //
//                               //

#include <iostream>
using namespace std;

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

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

    //#ifndef ONLINE_JUDGE
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    //#endif

    int t = 1;
    while(t--){
        solve();
    }

    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
	cin >> n;
	long long x;
	map<long long, int> mp;
	for (int i = 0; i < n; ++i) {
		cin >> x;
		mp[x]++;
	}
	vector<pair<long long,int> >w;
	for (auto x: mp) {
		if (x.second >= 2) {
			w.push_back({x.first,x.second});
		}
	}
	if (w.size() == 0) cout  << 0 << endl;
	else {
		long long ans = 0;
		long long a=0,b=0;
		long long c = 0;
		sort(w.begin(), w.end());
		for (int i = w.size()-1; i >= 0; --i) {
			//cout << w[i].first << endl;
			if (w[i].second >= 4) {
				ans = max(w[i].first*w[i].first, ans);
				if (c==0)c = w[i].first;
			}
			else if (w[i].second >= 2) {
				if (a==0) {a=w[i].first;continue;}
				if (a!=0 && b ==0) b=w[i].first;
			}
		}
		ans = max(c*a, ans);
		cout << max(ans,a*b)<<endl;
	}
	return 0;
}


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

// ダイクストラ法
// 負の辺を持たないこと。

//#define UNDIRECTED // 無向グラフ
// #define GET_PATH // 最短経路

constexpr int MAX_V = 1e5;
constexpr int INF = 1e9 + 7;

using P = pair<int, int>; // ソートを考慮して(コスト,頂点)

struct Edge {
  int to;
  int cost;
};

int V;
vector<Edge> graph[MAX_V];
array<int, MAX_V> dist;
#ifdef GET_PATH
int prevv[MAX_V];
#endif

void dijkstra(int s) {
#ifdef GET_PATH
  fill_n(prevv, MAX_V, -1);
#endif
  fill_n(dist.begin(), MAX_V, INF);
  dist[s] = 0;

  priority_queue<P, vector<P>, greater<P>> que;
  que.push({dist[s], s});

  while (!que.empty()) {
    P p{que.top()};
    que.pop();
    int from{p.second};
    if (dist[from] < p.first)
      continue;
    for (size_t i{}; i < graph[from].size(); ++i) {
      Edge e{graph[from][i]};
      if (dist[e.to] > dist[from] + e.cost) {
        dist[e.to] = dist[from] + e.cost;
        que.push({dist[e.to], e.to});
#ifdef GET_PATH
        prevv[e.to] = from;
#endif
      }
    }
  }
}

#ifdef GET_PATH
vector<int> get_path(int t) {
  vector<int> path;
  while (t >= 0) {
    path.push_back(t);
    t = prevv[t];
  }
  reverse(path.begin(), path.end());
  return path;
}
#endif

int main() {
  int E, s;
  cin >> V >> E >> s;
  for (int i{}; i < E; ++i) {
    int from, to, cost;
    cin >> from >> to >> cost;
    graph[from].push_back({to, cost});
#ifdef UNDIRECTED
    graph[to].push_back({from, cost});
#endif
  }

  dijkstra(s);

  for (int i{}; i < V; ++i) {
    cout << (dist[i] < INF ? to_string(dist[i]) : "INF") << endl;
  }

#ifdef GET_PATH
  for (int i{}; i < V; ++i) {
    vector<int> path = get_path(i);
    for (int j{}; j < path.size(); ++j) {
      cout << (j > 0 ? " " : "") << path[j];
    }
    cout << endl;
  }
#endif

  return 0;
}



Measured memory_bytes: 13056
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define soja(i,a,n) for(ll i=a;i<=n;i++)
#define ulta(i,n,a) for(ll i=n;i>=a;i--)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ve vector<ll>
#define se set<ll>
#define ma map<ll,ll>
#define pll vector<pair<ll,ll>>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define in insert
ll n,k,t,sum=0,temp;
ma m;
int main()
{
fast;
cin>>n;
soja(i,0,n-1)
{
cin>>k;
sum+=k;
m[k]++;
}
cin>>n;
soja(i,0,n-1)
{
    cin>>t>>k;
    sum-=m[t]*t;
    sum+=m[t]*k;
    m[k]+=m[t];
    m[t]=0;
    cout<<sum<<endl;

}

return 0;
}


Measured memory_bytes: 9544
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll N = 1e9+7;
const int n_max = 1e5+10;

int main(){
    int a; cin >> a;
    string s;cin >> s;
    string ans;
    if(3200 <= a) ans = s;
    else ans = "red";
    cout << ans << endl;
    return 0;
}

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

const int N = 3000;

double dp[N][N], P[N];

int n;

double f(int idx, int cnt) {
        if(idx > n) return cnt > n - cnt;
        if(dp[idx][cnt] != -1.0) return dp[idx][cnt];
        return dp[idx][cnt] = P[idx] * f(idx + 1, cnt + 1) + (1.0 - P[idx]) * f(idx + 1, cnt);
}

int main() {
        cin >> n;
        for(int i = 1; i <= n; i++) {
                cin >> P[i];
        }

        for(int i = 0; i < N; i++) {
                for(int j = 0; j < N; j++) {
                        dp[i][j] = -1.0;
                }
        }

        cout << fixed << setprecision(10) << f(1, 0) << endl;

}


Measured memory_bytes: 70784
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define LL long long 
#define inf 0x7f7f7f
using namespace std;
char a[100010];
int la,i;
int main()
{
    gets(a);
    la=strlen(a);
    for(i=0;i<=la/2;i++)
    {
        int l=i,r=la-i-1;
        if(a[l]=='b' && a[r]=='d' || a[l]=='d' && a[r]=='b' || a[l]=='p' && a[r]=='q' || a[l]=='q' && a[r]=='p');
        else {printf("No");return 0;}
    }
    printf("Yes");
    return 0;
}

Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split()))
l=[0 for i in range(n)]
for x in a:
    l[x] += 1
p = [(0 if i % 2 == 0 else 2) for i in range(n // 2 * 2)]
if n % 2 == 1: p = [1] + p
if l != p:
    print(0)
    import sys
    sys.exit()


def mod_power(x, a, p):
    if a == 0:
        return 1
    t = mod_power(x, a // 2, p)
    if a % 2 == 0:
        return t * t
    else:
        return x * t % p * t

ans = 1
for i in range(n // 2):
    ans *= 2
    ans %= 10 ** 9 + 7
print(ans)
# print(mod_power(2,n//2,10**9+7))


Measured memory_bytes: 14008
#include <stdio.h>

int main(){


  int a,b,c,d,minute,second;
  scanf("%d %d %d %d",&a,&b,&c,&d);

  minute=(a+b+c+d)/60;
  second=(a+b+c+d)%60;
  printf("%d\n",minute);
  printf("%d\n",second);
  return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int>vec = {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};
  int i;
  cin >> i;
  cout << vec[i - 1] << endl;
  return 0;
}

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t n;
  cin >> n;
  int64_t a[n] = {};
  int64_t sum = 0;
  map<int64_t,int64_t> numCount;
  for(int64_t i=0;i<n;i++){
    cin >> a[i];
    sum += a[i];
    if(numCount.count(a[i])==0) numCount[a[i]] = 1;
    else numCount[a[i]]++;
  }
  int64_t q;
  cin >> q;
  int64_t b,c;
  for(int64_t i=0;i<q;i++){
    cin >> b >> c;
    sum += numCount[b]*(c-b);
    numCount[c] += numCount[b];
    numCount[b] = 0;
    cout << sum << endl;
  }

  return 0;
}

Measured memory_bytes: 10324
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int main(){
    ios::sync_with_stdio(false);
    cin>>s;
    if(s=="Sunny")
        cout<<"Cloudy";
    else if(s=="Cloudy"){
        cout<<"Rainy";
    }else{
        cout<<"Sunny";
    }
}

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

using namespace std;


int main(void){

	string b = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
	string a = ("DEFGHIJKLMNOPQRSTUVWXYZABC");
	string in;

	cin >> in;

	for (int i = 0; i < in.size(); i++){
		cout << b[a.find(in[i])];
	}
	cout << endl;

	return 0;
}

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

int main() {
	int N, A[100010], X, Y = 1000000000;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	sort(A, A + N);
	X = A[N - 1];
	for (int i = 0; i < N - 1; i++) {
		if (abs(Y * 2 - X) > abs(A[i] * 2 - X)) {
			Y = A[i];
		}
	}
	cout << X << " " << Y << endl;
}

Measured memory_bytes: 640
class UnionFind:
    def __init__(self, n):
        self.p = [i for i in range(n)]
        self.rank = [1]*n
    
    def root(self, x):
        if x == self.p[x]:
            return x
        self.p[x] = y = self.root(self.p[x])
        return y
    
    def unite(self, x, y):
        px = self.root(x); py = self.root(y)
        if px == py:
            return 0
        rx = self.rank[px]; ry = self.rank[py]
        if ry < rx:
            self.p[py] = px
        elif rx < ry:
            self.p[px] = py
        else:
            self.p[py] = px
            self.rank[px] += 1
        return 1

    def same(self, x, y):
        px = self.root(x); py = self.root(y)
        return px == py

V,E = list(map(int,input().split()))
STW = sorted([list(map(int,input().split())) for _ in range(E)],key=lambda x: x[2])

union_find = UnionFind(V+1)
ans = 0
for s,t,w in STW:
    if not union_find.same(s,t):
        ans += w
        union_find.unite(s,t)

print(ans)


Measured memory_bytes: 28988
#include <cstdio>

using namespace std;

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

  for(int i=1; i<=a; i++)
  {
    int x = i;
    if(x%3==0)
    {
      printf(" %d", i);
      continue;
    }
    if(x%10==3)
    {
      printf(" %d", i);
      continue;
    }
    while(x)
    {
      x /= 10;
      if(x%10==3)
      {
        printf(" %d", i);
        break;
      }
    }
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 2740
n, k = map(int, input().split())
a = list(map(int, input().split()))

if n == 1:
    if a[0] == k:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')
    exit()

m = max(a)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

b = a[0]
for x in a[1:]:
    b = gcd(b, x)

if k % b == 0 and k <= m:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 14224
#include<iostream>
using namespace std;
#define val 5

int main(void){
  int x[val],num,i;
  for(i=0;i<val;i++){
    scanf("%d",&x[i]);
    if(x[i] == 0) num = i+1;
  }
  printf("%d",num);
 return 0;
}

Measured memory_bytes: 3828
x = int(input())
yen_500 = 0
yen_5 = 0
amari = 0
happy = 0

if x>= 500:
    yen_500 = x//500
    amari = x - 500 * yen_500
    yen_5 = amari//5
    happy = 1000 * yen_500 + 5 * yen_5
    print(happy)
else:
    yen_5 = x//5
    happy = 5 * yen_5
    print(happy)


Measured memory_bytes: 61748
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1588>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(){
    ll res = 0;
    int N,M,K; cin >> N >> M >> K;
    vector<ll> a(N),b(N);
    for(auto& in:a) cin >> in;
    for(auto& in:b) cin >> in;
    for(int i = 0; i < (1<<N);i++){
        if(__builtin_popcount(i) > K) continue;
        vector<pll> score;
        for(int j = 0; j < N;j++){
            if((i>>j)&1){
                score.push_back(make_pair(a[j],b[j]));
            }
        }
        sort(score.rbegin(),score.rend());
        ll T = 0,L = M;
        for(auto p:score){
            T += min(L,p.second)*p.first;
            L -= min(L,p.second);
        }
        res = max(res,T+L);
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



Measured memory_bytes: 3216
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

const M = 1000003

type Dict struct {
	arr [M]string
}

func (d *Dict) insert(s string) {
	i := 0
	for {
		j := h(getKey(s), i)
		if d.arr[j] == s {
			return
		} else if d.arr[j] == "" {
			d.arr[j] = s
			return
		} else {
			i++
		}
	}
}

func (d *Dict) find(s string) bool {
	i := 0
	for {
		j := h(getKey(s), i)
		if d.arr[j] == s {
			return true
		} else if d.arr[j] == "" || i >= M {
			return false
		} else {
			i++
		}
	}
}

func getKey(s string) int {
	sum := 0
	digit := 1
	for _, v := range s {
		sum += digit * int(v-'A'+1)
		digit *= 5
	}
	return sum
}

func h1(key int) int {
	return key % M
}

func h2(key int) int {
	return 1 + (key % (M - 1))
}

func h(key, i int) int {
	return (h1(key) + i*h2(key)) % M
}

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	dict := Dict{}
	for i := 0; i < N; i++ {
		cmd := sc.nextStr()
		val := sc.nextStr()
		if cmd == "insert" {
			dict.insert(val)
		} else {
			if dict.find(val) {
				fmt.Fprintln(wtr, "yes")
			} else {
				fmt.Fprintln(wtr, "no")
			}
		}
	}
	wtr.Flush()
}



Measured memory_bytes: 28048
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>

//最大公約数
ll gcd(ll a,ll b){
    if(b == 0LL) return a;
    return gcd(b , a % b);
}

//最小公倍数
ll lcm(ll a,ll b){
    return a / gcd(a,b) * b;

}

int main(){
    
    
    int n;
    int m;
    cin >> n >> m;
    int ans = 0;
    while(n -1 >0){

        ans += n-1;
        n--;

    }
     while(m -1 >0){

        ans += m-1;
        m--;

    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
template<typename T, int N, T F(const T& a, const T& b)>
struct SegTree
{
public:
    SegTree()
    {
        dat = vector<T>(N * 2 - 1, 0);
    }

    void update(int i, T x)
    {
        i += N - 1;
        dat[i] = x;
        while (i > 0)
        {
            i = (i - 1) / 2;
            dat[i] = F(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = N)
    {
        if (r <= a || b <= l) return 0;
        if (a <= l && r <= b) return dat[k];
        else
        {
            T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return F(vl, vr);
        }
    }

    vector<T> dat;
};

/*------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
------------------------------------------------------------------------------*/











//------------------------------------------------------------------------------
ll N, W;
ll w[105], v[105];
//------------------------------------------------------------------------------
void _main()
{
    cin >> N >> W;
    vector<ll> vs[4];
    rep(i, 0, N)
    {
        cin >> w[i] >> v[i];
        vs[w[i] - w[0]].push_back(v[i]);
    }
    rep(i, 0, 4) sort(vs[i].rbegin(), vs[i].rend());
    rep(i, 0, 4) rep(j, 0, vs[i].size()) if (j > 0) vs[i][j] += vs[i][j - 1];
/*    rep(i, 0, 4)
    {
        rep(j, 0, vs[i].size())
        {
            cout << vs[i][j] << ", ";
        }
        cout << endl;
    }*/
    ll ans = 0;
    rep(nw0, 0, vs[0].size() + 1)
    {
        rep(nw1, 0, vs[1].size() + 1)
        {
            rep(nw2, 0, vs[2].size() + 1)
            {
                rep(nw3, 0, vs[3].size() + 1)
                {
                    if (w[0] * nw0 + (w[0] + 1) * nw1 + (w[0] + 2) * nw2 + (w[0] + 3) * nw3 <= W)
                    {
                        ll tmp = 0;
                        if (nw0 > 0) tmp += vs[0][nw0 - 1];
                        if (nw1 > 0) tmp += vs[1][nw1 - 1];
                        if (nw2 > 0) tmp += vs[2][nw2 - 1];
                        if (nw3 > 0) tmp += vs[3][nw3 - 1];
                        chmax(ans, tmp);
//                        cout << tmp << endl;
                    }
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
from string import ascii_lowercase


S = input()

if S[0] != 'A':
    print('WA')
    exit(0)
if len(list(filter(lambda e: e == 'C', S[2:-1]))) != 1:
    print('WA')
    exit(0)
if any([c not in ascii_lowercase for c in S[1:S[2:-1].index('C') + 2]]) or any([c not in ascii_lowercase for c in S[S[2:-1].index('C') + 3:]]):
    print('WA')
    exit(0)
print('AC')


Measured memory_bytes: 3772
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
         Scanner sc = new Scanner (System.in);
         while (true){
         int h = sc.nextInt();
         int w = sc.nextInt();
         if(h==0 && w==0){
             break;
         }
         for(int i=0;i<w;i++){
             System.out.print("#");
         }
         System.out.println();
         for(int i=0;i<h-2;i++){
            System.out.print("#");
             for(int j=0; j<w-2;j++){
                 System.out.print(".");
             }
             System.out.print("#");
             System.out.println();
         }
         for(int i=0;i<w;i++){
            System.out.print("#");
        }
        System.out.print("\n\n");
        }
        sc.close();
    }
}


Measured memory_bytes: 33008
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;

int main() {
	int last =0;
	string a="erase",b="dream",c="aser";
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		//cout<<i<<endl;
		bool check,check2,check3;
		check=check2=true;
		check3=false;
		for(int j=0;j<5;j++){
			if(i+j>=s.size()){
				check=false;
				check2=false;
				break;
			}
			if(s[i+j]!=a[j]) check=false;
			if(s[i+j]!=b[j]) check2=false;
		}
		if(check || check2) i+=4;
		if(check && i+1<s.size() && s[i+1]=='r') i++;
		if(check2 && i+2<s.size() && s[i+1]=='e' && s[i+2]=='r') i+=2;
		
		if(!check && !check2 && i+3<=s.size() && i>4 && last==0){
			if(s[i-2]=='e' && s[i-1]=='r' && s[i]=='a'
				&& s[i+1]=='s' && s[i+2]=='e'){
				check3=true;
				i+=2;
			}
		}
		if(i+1<s.size() && check3 && s[i+1]=='r') i++;
		if(!check && !check2 && !check3){
			cout<<"NO"<<endl;
			return 0;
		}
		if(check || check3) last = 1;
		if(check2) last = 0;
	}
	cout<<"YES"<<endl;
	return 0;
}

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N, Y;
	cin >> N >> Y;
	for (int i = 0; i <= N ; i++){
		for (int j = 0; i + j <= N; j++){
			int k = N - i - j;
			if(i * 10000 + j * 5000 + k * 1000 == Y){
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
		
	}
	

	cout << -1 << " " << -1 << " " << -1;

	return 0;
}

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

int main() {
  int	A, B;
  string	S;
  // int	i, j, l, ll;
  // char b;
  //  int N, K, KK, x, s=0;
  cin >> A >> B;
  if (A > B) cout << A * 2 - 1;
  else if (A < B) cout << B * 2 - 1;
  else cout << A * 2;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=999999999999999999;
const ll NN=(ll)(1e6+5);
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {
       ll a,b,c,d,ans=-INF;
       cin>>a>>b>>c>>d;
       ans=max(ans,a*c);
       ans=max(ans,b*d);
       ans=max(ans,a*d);
       ans=max(ans,b*c);
       if(a<=0&&b>=0 || c<=0&&d>=0)
        ans=max(0,ans);
       cout<<ans;  
   }
}

Measured memory_bytes: 3648
import sys
import math
from collections import defaultdict
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    S = SI()
    T = SI()
    D = defaultdict(str)
    for s, t in zip(S, T):
        if D[s] == "":
            D[s] = t
        if D[s] != t:
            print("No")
            exit()
    if len(set(D.keys())) != len(set(D.values())):
        print("No")
    else:
        print("Yes")


if __name__ == "__main__":
    main()

Measured memory_bytes: 9648
from collections import Counter
N, M = map( int, input().split())
A = [ [] for _ in range(N)]
for i in range(N):
    A[i] = list( map( int, input().split())) 
V = [1]*(M+1)
ans = N
for _ in range(M-1):
    W = []
    for i in range(N):
        while True:
            if V[A[i][0]] == 1:
                W.append(A[i][0])
                break
            else:
                A[i].pop(0)
    a, c = Counter(W).most_common()[0]
    ans = min( ans, c)
    V[a] = 0
print(ans)


Measured memory_bytes: 4700
n = int(input())
# 入力値をリスト形式（整数）で受け取る
a = list(map(int,input().split()))
# ダメだったものの値を集計
deny_list = 0
# 偶数で3で割れなくて5でも割れないものを集計
for i in a:
    if i % 2 == 0 and i % 3 !=0 and i % 5 !=0:
        deny_list += i
# 集計値が０だったらAOOROVED
if deny_list == 0:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 9080
#include<stdio.h>
int main()
{
	int a,b,c,k=0;

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

	if(a==b)
		k++;
	if(a==c)
		k++;
	if(b==c)
		k++;
	printf("%s",k==1?"Yes":"No");
	return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define BR cout<<endl;
#define LEN(s) s.length();
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 ALL(v) v.begin(), v.end()
typedef long long ll;
const ll mod=1000000007;

ll powmod(ll x,ll y){
    ll res=1;
    for(ll i=0;i<y;i++){
        res=res*x%mod;
    }
    return res;
}

double expect(int x){
    double kitai,tem=0;
    for(int i=1;i<=x;i++){
        tem += i;
    }
    kitai = tem/x;
    cout << kitai << endl;
    return kitai;
    
}

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

    int ans = INF;

    for(int i = 0; i < s.length() - t.length() + 1; i++){
        int count = 0;
        for(int j = 0; j < t.length(); j++){
            if(s[i + j] == t[j])count++;
        }   
        count = t.length() - count;
        chmin(ans, count);
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3608
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>
using namespace std;
long long int gcd( long long int m, long long int n ){
	// ?????°?????????????????´??????????????????
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ???????????????????????????
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
long long int lcm( long long int m, long long int n ){
	// ?????°?????????????????´??????????????????
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int main(){
	long long int a,b;
	while(cin>>a>>b){
	cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
struct edge{ll from,to,cost;};
ll L;
int main(){
  cin>>L;L--;
  vector<edge>A;
  ll a=0;ll b=1;
  while(b<=L+1){b*=2;a++;}ll X=L;
  for(int  i=1;i<=a-1;i++){
  if(X%2==0){
  edge e;e.from=i;e.to=a;e.cost=X;
    A.push_back(e);
     edge e1;e1.from=i;e1.to=i+1;e1.cost=X/2;
    A.push_back(e1);
     edge e2;e2.from=i;e2.to=i+1;e2.cost=0;
    A.push_back(e2);
    X/=2;X--;
  }else{
   edge e1;e1.from=i;e1.to=i+1;e1.cost=(X+1)/2;
    A.push_back(e1);
     edge e2;e2.from=i;e2.to=i+1;e2.cost=0;
    A.push_back(e2);
    X/=2;
  }
    if(X==0)break;
   }ll M=A.size();
  cout<<a<<" "<<M<<endl;
  for(int i=0;i<M;i++)
    cout<<A[i].from<<" "<<A[i].to<<" "<<A[i].cost<<endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <cstdlib>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define PI 3.14159265358979323846
using namespace std;
//
int N,A,B;
long long H[100000];
bool check(long long X){
  long long cnt=0;
  FOR(i,0,N){
    long long G=H[i]-B*X;
    if(G<=0){
      return true;
    }else{
      cnt+=(G+(A-B)-1)/(A-B);
    }
    if(cnt>X){
      return false;
    }
  }
  return true;
}
int main(){
  cin>>N>>A>>B;
  FOR(i,0,N){
    cin>>H[i];
  }
  sort(H,H+N,greater<long long>());
  long long lo=0,up=1e9;
  while(up-lo>1){
    long long md=(lo+up)/2;
    if(check(md)){
      up=md;
    }else{
      lo=md;
    }
  }
  cout<<up<<endl;
  return 0;
}


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

using namespace std;

#define eps (1e-10)
#define equals(a,b) (fabs((a)-(b))<eps)
struct point{
    double x,y;
    point(){}
    point(double x,double y):x(x),y(y){}
    point operator + (point &p){return point(x+p.x,y+p.y);}
    point operator - (point &p){return point(x-p.x,y-p.y);}
    point operator * (double k){return point(x*k,y*k);}
    point operator / (double k){return point(x/k,y/k);}

    double norm(){return x*x+y*y;}
    double abs(){return sqrt(norm());}

    bool operator < (const point &p){
        return x!=p.x?x<p.x:y<p.y;
    }
    bool operator == (const point &p){
        return fabs(x-p.x)<eps&&fabs(y-p.y)<eps;
    }
};
//内积
double dot(point a,point b)
{
    return a.x*b.x+a.y*b.y;
}
//外积
double cross(point a,point b){
    return a.x*b.y-a.y*b.x;
}

point project(point a,point b,point c)
{
    point base=b-a;
    double r=dot(base,c-a)/base.norm();
    base=base*r;
    return a+base;
}

int main()
{
    point a,b;
    cin>>a.x>>a.y>>b.x>>b.y;
    int q;
    cin>>q;
    point temp;
    for(int i=0;i<q;i++){
        cin>>temp.x>>temp.y;
        point res=project(a,b,temp);
        printf("%.10f %.10f\n",res.x,res.y);
    }
    return 0;
}



Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(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 all(v) (v).begin(),(v).end()
#define vsort(v) sort(all(v))
#define mod 1000000007
using data=pair<ll,ll>;

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

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 euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return 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;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}


int main(){
  ll i,j,N,M,K;
  cin>>N;
  vector<ll> v(N),ch(N,0);
  rep(i,N){
    cin>>v[i];
  }
  M=v[0];
  rep1(i,N){
    M=max(M,v[i]);
    if(v[i]<M){
      if(M-v[i]>1){
        cout<<"No"<<endl;return 0;
}      // }else{
      //   // if(ch[i-1]){
      //   //   cout<<"No"<<endl;
      //   //   return 0;
      //   // }else{
      //     ch[i]++;
      //   }
      // }
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<cctype>
#include<cstring>
#include<list>
#include<map>
#include<sstream>
#include<set>
#include<string>
#include<vector>
typedef long long ll;
using namespace std;
#define MN 300005
#define MM 600005
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define F2(i,a,b) for(int i=a;i<(b);++i)
#define RF(i,a,b) for(int i=a;i>=(b);--i)
#define fast  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define int long long
int gcd(int a,int b){
   return  b==0? a: gcd(b,a%b);
}
signed main()
{   int t;
    while(cin>>t){
        int sum=0;
   F(i,1,t){
       F(j,1,t){
           F(k,1,t){
               int cnt=i+j+k;
               int a=max(max(i,j),k);
               int c=min(min(i,j),k);
               int b=cnt-a-c;
               sum+=gcd(gcd(a,b),c);
           }
       }
    }
    cout<<sum<<endl;
   }
   
   return 0;
}


Measured memory_bytes: 3624
N, M = map(int, input().split())
l = [list(map(int, input().split()))[1:] for _ in range(M)]
p = list(map(int, input().split()))
ans = 0

on_off = [[0], [1]]

for _ in range(N-1):
    kari = []
    for j in on_off:
        kari.append(j+[0])
        kari.append(j+[1])
    on_off = kari

for a in on_off:
    cnt = 0
    for m in range(M):
        s = 0
        for c in l[m-1]:
            s += a[c-1]
        if s % 2 == p[m-1]%2:
            cnt += 1
    if cnt == M:
        ans += 1

print(ans)

Measured memory_bytes: 3188
var
 s1,s2:ansistring;
 i:longint;
begin
 readln(s1);
 for i:=1 to length(s1) do
  case s1[i] of
   '0':s2:=s2+'0';
   '1':s2:=s2+'1';
   'B':delete(s2,length(s2),1);
  end;
  writeln(s2);
end.

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int data[200010]={0}; //最大の数が200000なので余裕をもって
  int N; //データの数
  int K; //limitの数
  
  cin >>N>>K; //データの入力
  
  for (int i=0; i<N; i++)cin>>data[i]; //データの挿入
  
  int num[200010]={0}; //バケット用意
  
  for (int i=0; i<N;i++) num [data[i]]++; //それぞれの種類が何種あるか数える
  
  sort(num,end(num),greater<int>());//大きい順に並び変える

  int ans=0; //答え
  
    int i=0;
    int kind=0; //初期化
    while(num[i] != 0){//何種類あるかを答える
      kind++;
      i++;
    }

  if (kind > K)
    for(int j=K ; j<kind; j++) ans += num[j];
  
  cout <<ans <<endl;
}

    
      
      
      
      
  
  
  
  
  


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

d = 'abcdefghijklm'


def solve(a):
    *u, = map(lambda x: d[x], a)
    return ''.join(u)


ans = [0]*n


if n == 1:
    print('a'*n)
    exit()

while ans[0] == 0:
    print(solve(ans))
    if ans == [i for i in range(n)]:
        exit()
    q = max(ans[:n-1])
    if ans[n-1] <= q:
        ans[n-1] += 1
    else:
        j = 0
        while ans[n-1-j] > max(ans[:n-1-j]):
            ans[n-1-j] = 0
            j += 1
        ans[n-1-j] += 1



Measured memory_bytes: 49368
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();

    bool flag = true;
    string s1="", s2="", s3="", s4="", s5="", s6="";
    rep(i, n/4){
        s1 += s[i];
        s2 += s[i+(n+1)/4];
        s3 += s[(n+1)/2+i];
        s4 += s[(n+1)/2+i+(n+1)/4];
    }

    rep(i, n/2){
        s5 += s[i];
        s6 += s[(n+1)/2+i];
    }
    reverse(s2.begin(), s2.end());
    reverse(s4.begin(), s4.end());
    reverse(s6.begin(), s6.end());

    if ((s1==s2) && (s3==s4) && (s5==s6)) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a * b / gcd(a,b);
}

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    ll N, K;
    cin >> N >> K;

    double ans = 0;
    for (int i = N; i >= 1; i--) {
        ll t = i;
        int cnt = 0;
        while (t < K) {
            cnt++;
            t *= 2;
        }
        ans += pow(0.5, cnt);
    }

    // cout << ans / N << endl;
    printf("%0.14f\n", ans / N);

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 896
#ifdef LOCAL
#include "stdc++.h"
#else 
#include <bits/stdc++.h>
using namespace std;
#endif

int main() {
    int n;
    cin >> n;
    vector<int> a(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    vector<long long> sums(n, 0);
    sums[0] = a[0];
    for (int i = 1; i < n; i++) {
        sums[i] = sums[i - 1] + a[i];
    }

    int res = 1;
    for (int i = n - 2; i >= 0; i--) {
        if (2 * sums[i] < (long long)a[i + 1]) break;
        res++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < 3; i++) {
	  s[i] = 10 - (s[i] - '0') + '0';
	}
  cout << s << endl;
  return 0;
}


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

int main(){
  int n;
  cin>>n;
  ll x=1;
  for (int i = 1; i <=n; i++)
  {
    /* code */
    x=x*i%1000000007;
  }

  cout<<x<<endl;
  
  
  }

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    int a;
    cin >> a ;
    if (a % 2 == 0) {
        cout << a / 2 * a / 2 << endl;
    }
    else {
        cout << a / 2 * (a / 2 + 1) << endl;
    }
    return 0;
}


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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> a(100011,0);
    for (int i = 0; i < N;i++){
        int tmp;
        cin >> tmp;
        a[tmp]++;
    }

    int res = -1;
    for (int i = 1; i < 100010;i++){
        int pre = a[i - 1];
        int next = a[i + 1];
        res = max(pre + next + a[i],res);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

#[derive(Copy, Clone, Debug)]
struct Num {
    d: i64,
    count: i64,
}

impl std::ops::Add for Num {
    type Output = Num;

    fn add(self, other: Num) -> Num {
        let new_d = self.d + other.d;
        if new_d >= 10 {
            Num {
                d: new_d - 9,
                count: self.count + other.count + 1,
            }
        } else {
            Num {
                d: new_d,
                count: self.count + other.count,
            }
        }
    }
}

fn dfs(d: i64, c: i64) -> Num {
    if c == 1 {
        Num { d: d, count: 0 }
    } else if c % 2 == 0 {
        let temp = dfs(d, c / 2);
        temp + temp
    } else {
        let temp = dfs(d, c / 2);
        Num { d: d, count: 0 } + temp + temp
    }
}

fn main() {
    let n = read::<usize>();
    let mut entries = vec![];
    for i in 0..n {
        let v = read_vec::<i64>();
        entries.push((v[0], v[1]));
    }
    let mut results = vec![];
    let mut c_sum = 0i64;
    for (d, c) in entries {
        results.push(dfs(d, c));
        c_sum += c;
    }
    let mut cur = results[0];
    for i in 1..n {
        cur = cur + results[i];
    }
    println!("{}", c_sum + cur.count - 1);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 13376
#include <stdio.h>
#include <string.h>
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define FOR(i,m,n) for(i=m;i<n;i++)

int main(void)
{
	int a,i,c=0,d=0,e=0;
	char b[100010];
	scanf("%s",b);
	c=strlen(b);
	for(i=0;i<c;i=i+2){
		if(b[i]=='0'){
			d++;
		}
	}
	for(i=1;i<c;i=i+2){
		if(b[i]=='1'){
			d++;
		}
	}
	printf("%d\n",min(d,c-d));
	return 0;
}


Measured memory_bytes: 256
N,Y=map(int, input().split())
for a in range(N+1):
    for b in range(0,N-a+1):
        c=N-a-b 
        if (a*10000+b*5000+c*1000)==Y:
            print(a,b,c)
            exit()


print(-1,-1,-1)


    



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
 int N; cin >> N; vector<int> A(N); for(int i = 0; i < N; i++){ cin >> A[i];}
  
  sort(A.begin(),A.end());
  int n = A.back(); 

  if( n%2 == 0){ //nが偶数の時
    int itr1 = lower_bound(A.begin(),A.end(),n/2) - A.begin();
    int itr2 = upper_bound(A.begin(),A.end(),n/2) - A.begin();
    itr2--;
    if(abs(A[itr1]-n/2) >= abs(A[itr2]-n/2)){ itr1 = itr2;}
    cout << A.back() << " " << A[itr1] << endl; return 0;}
  else{
    int itr1 = lower_bound(A.begin(),A.end(),n/2) - A.begin();
    int itr2 = upper_bound(A.begin(),A.end(),n/2) - A.begin();
    int itr3 = lower_bound(A.begin(),A.end(),(n+1)/2) - A.begin();
    int itr4 = upper_bound(A.begin(),A.end(),(n+1)/2) - A.begin();
    itr2--; itr4--;
    if(abs(A[itr1]-n/2) >= abs(A[itr2]-n/2)){ itr1 = itr2;}
    if(abs(A[itr3]-(n+1)/2) >= abs(A[itr4]-(n+1)/2)){ itr3 = itr4;}
    if(abs(A[itr1]-n/2) >= abs(A[itr3]-(n+1)/2)){ itr1 = itr3;}
       
       cout << A.back() << " " << A[itr1] << endl; return 0;}
       }

Measured memory_bytes: 640
a = list(input())

n = a.count('N')
s = a.count('S')
w = a.count('W')
e = a.count('E')

if n * s == 0 and n + s > 0:
    print('No')
elif e * w == 0 and e + w > 0:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = 0, x = 0;
    for(auto c: s){
        if(c == 'I') x++;
        else x--;
        ans = max(ans, x);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0037
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();

            int N = int.Parse(s.Split(' ')[0]);
            int K = int.Parse(s.Split(' ')[1]);

            var SS = Console.ReadLine();

            string result = "";

            for (int i = 0; i < SS.Length; i++)
            {
                if (i + 1 == K)
                {
                    result += SS.Substring(i, 1).ToLower();
                }
                else
                {
                    result += SS.Substring(i, 1);
                }
            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 27784
# -*- coding utf-8 -*-

N, L = map(int, input().split())

total = 0
for i in range(1, N + 1):
    total += L + i - 1

m = 1e10
for i in range(1, N + 1):
    a = L + i - 1
    b = total - a
    if abs(total - b) < m:
        m = abs(total - b)
        ans = b

print(ans)

Measured memory_bytes: 3060
//Contains functions for implementing a disjoint set union
#include<bits/stdc++.h>
using namespace std;
//#define num 1000000007
#define num 998244353
#define inf 1000000000000000000ll
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pi pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) (a>b)?a:b
//#define min(a,b) (a>b)?b:a
#define max3(a,b,c) (a>b)?(a>c)?a:c:(b>c)?b:c
#define min3(a,b,c) (a<b)?(a<c)?a:c:(b<c)?b:c
#define avg(a,b) ((a)+(b))/2
//#define push push_back
//#define pop pop_back
#define mp make_pair
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define fir first
#define sec second
#define mod(a) ((a)>0)?(a):(-(a))
 
 
typedef long long ll;
 
ll next(ll a, ll n)
{
    return (a==n-1)?0:a+1;
}
ll parent[1000005],size[1000005],  tail[300005];
set<ll> cur_par;
ll n,m,q;
ll pos(ll x,ll y)
{
    return (m*(x-1))+y;
}
void init_parent(ll n)
{
    memset(parent,-1,sizeof(parent[0])*n);
}
void make_set(ll v)
{
    parent[v]=v;
    ::size[v]=1;
    tail[v]=v;
}
ll find_set(ll v)
{
    if(parent[v]==v)
    return v;
    return parent[v]=find_set(parent[v]);
}
void union_sets(ll a,ll b, ll A[])
{
    a=find_set(a);
    b=find_set(b);
    if(a==b)
    return;
    if(::size[a]<::size[b])
    {
        swap(a,b);
    }
    parent[b]=a;
    ::size[a]+=::size[b];
    A[a] = min(A[a], A[b]);
}
ll prev(ll a,ll n)
{
    if(a==0)
    return n-1;
    return a-1;
}
ll nex(ll a,ll n)
{
    if(a==n-1)
    return 0;
    else
    return a+1;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll sum=0;
    REP(i,1,n+1)
    {
        if(i%3==0 || i%5==0)
        continue;
        sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3652