akhauriyash/Code-Regression huggingface dataset:
//omajinai c++ atcoder
#include <iostream> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<cmath>
#include<iomanip>
#include<type_traits>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define itn int
#define yes() printf("Yes\n")
#define no() printf("No\n")
typedef long long ll;
constexpr auto mod = 1000000007;
using namespace std;

int main() {
long int x;
cin>>x;
long int y=0;
long int m=100;
while(m<x){
    m*=1.01;
    y++;
}
cout<<y;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

pair<int,pair<int,int>> e[mx];
int ans=0;
int par[mx];

int find(int x){
  if(par[x]==x){ 
    return x;
  } else {
    return par[x]=find(par[x]);  
  }
}
 
void unite(int i){
  int x=find(e[i].S.F);
  int y=find(e[i].S.S);
  if(x!=y){
    par[x]=y;
    ans+=e[i].F;  
  }  
}


int main(){
  int n; cin >> n;
  rep(i,n){ par[i]=i; }
  pair<int,int> x[n],y[n];
  rep(i,n){
    int a,b; cin >> a >> b;
    x[i]=make_pair(a,i);
    y[i]=make_pair(b,i);
  }
  sort(x,x+n);
  sort(y,y+n);
  
  rep(i,n-1){
    e[i]=make_pair(x[i+1].F-x[i].F, make_pair(x[i].S,x[i+1].S));
    e[n-1+i]=make_pair(y[i+1].F-y[i].F, make_pair(y[i].S,y[i+1].S));
  }
  sort(e,e+2*n-2);
  rep(i,2*n-2){ unite(i); }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//STANDARD DATA TYPES
#define ll long long
#define llu unsigned long long
#define ld long double
//ADV DATA TYPES
#define pii pair < int , int >
#define pll pair < ll, ll >
#define mp make_pair
#define ff first
#define ss second
//C ++ DS
#define vi vector < int >
#define vll vector < ll >
#define pb push_back
#define pf push_front
#define iter :: iterator
#define all(x) x.begin(),x.end()

//priority_queue < pii, vector < pii >, greater < pii > > pq;
//lower_bound(v.begin(),v.end(),20);//for any sorted container
//CONSTANTS
#define MOD 998244353
#define INF 0x3f3f3f3f
#define MAXN (int)(1e5+1)
//MOD OPERATIONS
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll addmod(ll a, ll val, ll p = MOD) {{if ((a = (a + val)) >= p) a -= p;} return a;}
inline ll submod(ll a, ll val, ll p = MOD) {{if ((a = (a - val)) < 0) a += p;}return a;}
inline ll mult(ll a, ll b, ll p = MOD) {return (ll) a * b % p;}
//DEBUG
#define shout()  {cout << "I'm Here...!!!" << endl;}
#define dbg(x) { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
int main()
{
	fastio;
	int n;
	cin>>n;
	vector <ld> p(n+1);
	for(int i=1;i<=n;i++)cin>>p[i];
	vector <ld> dp(n+1,0),newdp(n+1,0);
	for(int coins=0;coins<=n;coins++)
	{
		for(int i=0;i<=coins;i++)
		{
			if(coins==0)
			{
				if(i==0)newdp[i]=1;
				else newdp[i]=0;
			}
			else
			{
				if(i==0)newdp[i]=dp[i]*(1-p[coins]);
				else{
				newdp[i]=dp[i-1]*p[coins]+dp[i]*(1-p[coins]);
				}
			}
		}
		for(int i=0;i<=n;i++)dp[i]=newdp[i];
	}
	long double ans=0;
	for(int heads=0;heads<=n;heads++)
	{
		if(2*heads >n)
			ans+=newdp[heads];
	}
	cout<<setprecision(15)<<ans<<endl;

}


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

using namespace std;

int main() {
    long long n, w;
    cin >> n >> w;

    vector<long long> wi(n), vi(n);
    for (int i = 0; i < n; i++) {
        cin >> wi[i] >> vi[i];
    }

    vector<vector<vector<long long>>> dp(n + 1,
            vector<vector<long long>>(n + 1, vector<long long>(4 * n + 4, 0)));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = 0; k <= 4 * n; k++) {
                dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
                dp[i + 1][j + 1][k + wi[i] - wi[0]] =
                        max(dp[i + 1][j + 1][k + wi[i] - wi[0]], dp[i][j][k] + vi[i]);
            }
        }
    }

    long long res = 0;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            for (int k = 0; k <= 4 * n; k++) {
                if (j * wi[0] + k <= w) {
                    res = max(res, dp[i][j][k]);
                }
            }
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 33152
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
    int n;
    cin >> n;
    VL a(n);
    REP(i,n) a[i] = in();
    vector<PL> p(n);
    REP(i,n) p[i] = PL(a[i], i);
    sort(ALL(p));
    reverse(ALL(p));
    VVL dp(n + 1, VL(n + 1));
    dp[0][n] = 0;
    REP(x,n){
        int i = p[x].second;
        REP(left,x+1){
            int right = left + n - x;
            chmax(dp[left + 1][right], dp[left][right] + a[i] * abs(left - i));
            chmax(dp[left][right - 1], dp[left][right] + a[i] * abs(right - 1 - i));
        }
    }
    ll ans = 0;
    REP(i,n + 1) chmax(ans, dp[i][i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 34496
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if (s.length()==2) {
			System.out.println(s);
		} else {
			for (int i=0;i<3;i++) {
				System.out.print(s.charAt(2-i));
			}
		}
	}
}


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

int main(){
  string s;
  cin>>s;
  int left=0, right=s.size()-1;
  int cnt=0;
  while(right-left>0){
    if(s[left]=='x' && s[right]=='x'){
      left++; right--;
    }else if(s[left]=='x' && s[right]!='x'){
      left++; cnt++;
    }else if(s[left]!='x' && s[right]=='x'){
      right--; cnt++;
    }else{
      if(s[left]==s[right]){
        left++; right--;
      }else{
        cnt=-1; break;
      }
    }
  }
  cout<<cnt<<endl;
}



Measured memory_bytes: 3756
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

template<class T> void swap(T &a, T &b ){
    T temp;
    temp = a;
    a = b;
    b = temp;   
}
typedef struct{
    bool count1[10];
    bool count2[100];
    bool count3[1000];
}POS;
int main(){
    int N;
    int code;
    POS *pos;
    string s;
    int count;
    int id;
    int i,j,k;
    
    cin >> N;
    cin >> s;
    pos = new POS[N];
    code = s[N-1] - '0';
    pos[N-1].count1[code] = true;
    for(i=N-2;i>=0;i--){
        for(j=0;j<10;j++){
            pos[i].count1[j] = pos[i+1].count1[j];
        }
        code = s[i] - '0';
        pos[i].count1[code] = true;
    }
    for(i=N-2;i>=0;i--){
        for(j=0;j<100;j++){
            pos[i].count2[j] = pos[i+1].count2[j];
        }
        code = s[i] - '0';
        for(j=0;j<10;j++){
            pos[i].count2[code*10 + j] = pos[i+1].count1[j];
        }
    }
    for(i=N-3;i>=0;i--){
        for(j=0;j<1000;j++){
            pos[i].count3[j] = pos[i+1].count3[j];
        }
        code = s[i] - '0';
        for(j=0;j<100;j++){
            pos[i].count3[code*100 + j] = pos[i+1].count2[j];
        }
    }
    count = 0;
    for(i=0;i<1000;i++){
        if( pos[0].count3[i] == true){
            //cout << i << endl;
        }
        count += pos[0].count3[i];
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 32768
#include <iostream>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,x); REP(i,sizeof(a)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"
#define PI 3.141592653589793

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}


int main(){
    ll a,b; cin>>a>>b;
    cout << gcd(a,b) <<endl;
}


Measured memory_bytes: 3092
#include <stdio.h>
int main(void)
{
	int a,b,d,r;
	double f;

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

	d = a/b;
	r = a%b;
	f = (double)a/(double)b;

	printf("%d %d %.5lf\n",d,r,f);

	return 0;
}


Measured memory_bytes: 2044
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();


System.out.println(Math.min(A*N, B));

	}

	//以下、自作ライブラリ

	//指定した値以上の要素が最初に現れる位置
	//要素の数は+1（配列のズレ)
	public static long lowerBound(int n, long[] x, long y) {
		int left = 0;
		int right = n;
		while (left < right) {
			int mid = (left + right) / 2;
			if (x[mid] < y) {
				left = mid + 1;
			} else {
				right = mid;
			}
		}
		return left;
	}

	//指定した値より大きい要素が最初に現れる位置
	//要素の数は+1（配列のズレ)
	public static long upperBound(int n, long[] x, long y) {
		int left = 0;
		int right = n;
		while (left < right) {
			int mid = (left + right) / 2;
			if (x[mid] <= y) {
				left = mid + 1;
			} else {
				right = mid;
			}
		}
		return left;
	}

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 21204
H,W=map(int,input().split())

mat=[]
for i in range(H):
  array=[x=='.' for x in input()]
  mat.append(array)
#print(mat)

dist=[]
for i in range(H):
  dist.append([-1]*W)

if mat[0][0]:
  dist[0][0]=0
else:
  dist[0][0]=1
  
for i in range(1,H):
  if mat[i-1][0] and not mat[i][0]:
    dist[i][0]=dist[i-1][0]+1
  else:
    dist[i][0]=dist[i-1][0]
    
for j in range(1,W):
  if mat[0][j-1] and not mat[0][j]:
    dist[0][j]=dist[0][j-1]+1
  else:
    dist[0][j]=dist[0][j-1]
    
for i in range(1,H):
  for j in range(1,W):
    if mat[i-1][j] and not mat[i][j]:
      dist1=dist[i-1][j]+1
    else:
      dist1=dist[i-1][j]
    
    if mat[i][j-1] and not mat[i][j]:
      dist2=dist[i][j-1]+1
    else:
      dist2=dist[i][j-1]
      
    dist[i][j]=min(dist1,dist2)
    
#print(dist)
print(dist[H-1][W-1])

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

typedef long long LL;

const int OO = 1e9;
const int MOD = 1e9 + 7;

vector<vector<int>> g;
vector<int> a, b;

void dfs(int v, int s = 0, int p = -1) {
	s += a[v];
	b[v] = s;
	for (int u: g[v]) {
		if (u == p) continue;
		dfs(u, s, v);
	}
}

void solve() {
	int n, q;
	cin >> n >> q;
	g.resize(n);
	for (int i = 1; i < n; ++i) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		g[u].push_back(v);
		g[v].push_back(u);
	}

	a.resize(n);
	for (int i = 0; i < q; ++i) {
		int p, x;
		cin >> p >> x;
		--p;
		a[p] += x;
	}

	b.resize(n);
	dfs(0);

	for (int i = 0; i < n; ++i) {
		cout << b[i] << ' ';
	}
	cout << '\n';
}

int32_t main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// #endif

	// clock_t begin = clock();

	solve();

	// clock_t end = clock();
	// cerr << "\nELAPSED TIME: " << (double) (end - begin) / CLOCKS_PER_SEC;

	return 0;
}


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

using namespace std;
typedef long long LL;

LL INF = (int) 1e6;
#define MAX_V 5000
struct edge { LL to,cap,rev;};

vector<edge> G[MAX_V];
LL level[MAX_V];
int iter[MAX_V];

void add_edge(int from, int to,LL cap)  {
  G[from].push_back((edge){to,cap,G[to].size()});
  G[to].push_back((edge){from,0,G[from].size()-1});
}
void bfs(int s) {
  //	memset(level,-1,sizeof(level)) ;
  for(int a=0; a<MAX_V; a++)level[a]=-1;
  queue<LL>que;
  level[s]=0;
  que.push(s);
  while(!que.empty()) {
    LL v = que.front();
    que.pop();
    for(int i=0; i<G[v].size(); i++) {
      edge &e = G[v][i];
      if(e.cap>0 && level[e.to]<0) {
	level[e.to] = level[v]+1;
	que.push(e.to) ;
      }
    }
  }
}

int dfs(int v,int t, LL f) {
  if(v==t) return f;
  for(int &i = iter[v]; i<G[v].size(); i++) {
    edge &e = G[v][i];
    if(e.cap>0 && level[v] < level[e.to]) {
      LL d = dfs(e.to,t,min(f,e.cap)) ;
      if(d>0) {
	e.cap -=d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}

LL max_flow(int s,int t) {
  LL flow = 0;
  
  for(;;) {
    bfs(s);
    if(level[t]<0) return flow;
    //		memset(iter,0,sizeof(iter)) ;
    for(int a=0; a<MAX_V; a++ ) iter[a]=0;
    int f;
    while((f=dfs(s,t,INF))>0) {
      flow += (LL)f;
    }
  }
}

int main() {
  INF = 1000000;
  INF *= INF * INF;
  int N;
  cin >> N;
  vector<int> input;
  for(int i=0; i<N; i++) {
    int p;
    cin >> p;
    input.push_back(p);
  }

  //  V = N+3;
  int s = N+1;
  int t = N+2;

  LL ans = 0;
  for(int i=0; i<input.size(); i++) {
    if(input[i] < 0) add_edge(s, i+1, -input[i]);
    else {
      ans += input[i];
      add_edge(i+1, t, input[i]);
    }
  }

  for(int i=1; i<=N; i++)
    for(int j=1; j<=N; j++) {
      if(j % i == 0)
	add_edge(i, j, INF);
      
    }

  LL ret = max_flow(s,t);
  cout << ans - ret << endl;
  
  
  return 0;
}




Measured memory_bytes: 512
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){
   int n;
   ll x,a[110];
   cin >> n;
   cin >> x;
   rep(i,n) cin >> a[i];

   sort(a,a+n);

   ll tmp = x;
   int cnt = 0;
   rep(i,n){
      x = x - a[i];
      if(x<0) {
         break;
      }else{
         cnt++;
         if((i==n-1)&&(x>0)) {
            cnt--;
         }    
      }
   }

   cout << cnt << endl;
   return 0;
}

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

ll calc(string s)
{
  int len = s.length();
  ll ret = stoll(s);
  for (int i=1; i<len; i++) {
    string sl = s.substr(0, i);
    ret += stoll(sl) * pow(2, (len-i-1));
    string sr = s.substr(i, len-i);
    ret += calc(sr);
  }
  return ret;
}

int main()
{
  string s;
  cin >> s;
  cout << calc(s) << endl;

  return 0;
}

Measured memory_bytes: 3928
#include <stdio.h>

#define I 10000000
#define W 0
#define G 1
#define B 2

int main()
{
  int n, i, j, a[100][100], d[100], p[100], c[100], min, u, sum = 0;

  scanf("%d",&n);
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++){
      scanf("%d",&a[i][j]);
      if (a[i][j] == -1)
	a[i][j] = I;
    }
  for (i = 0; i < n; i++){
    d[i] = I;
    p[i] = -1;
    c[i] = W;
  }
  d[0] = 0;
  while (1){
    min = I;
    u = -1;
    for (i = 0; i < n; i++)
      if (min > d[i] && c[i] != B){
	u = i;
	min = d[i];
      }
    if (u == -1)
      break;
    c[u] = B;
    for (i = 0; i < n; i++)
      if (c[i] != B && a[u][i] != I)
	if (d[i] > a[u][i]){
	  d[i] = a[u][i];
	  p[i] = u;
	  c[i] = G;
	}
  }
  for (i = 0; i < n; i++)
    if (p[i] != -1)
      sum += a[i][p[i]];
  printf("%d\n",sum);
  
  return 0;
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
	
#define int long long
#define pb push_back
#define ub upper_bound
#define lb upper_bound
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
	
using ll = long long;
const ll INF = LLONG_MAX - 100;
ll mod = 1e9 + 7;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;
	
class fact {
public:
	int fmod = 1e9+7;
	vector<int> fac, inv;
	fact (int n, int Mod = 1e9+7) {
		fmod = Mod;
		fac = vector<int>(n,0);
		inv = vector<int>(n,0);
		fac[0] = 1; for (int i = 1; i < n; i++) fac[i] = fac[i-1] * i % fmod;
		for (int i = 0;i < n;i++) inv[i] = fact::POW(fac[i],fmod-2);
	}
	ll nCr(ll n, ll r) {return (fac[n] * inv[r] % fmod) * inv[n-r] % fmod;}
	ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%fmod;}a = a * a%fmod; b >>= 1;}return c;}
};
	
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}
void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%mod;}a = a * a%mod; b >>= 1;}return c;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}
bool isSqrt(ll a) {return pow(sqrt(a),2) == a ? 1 : 0;}
void YesNo(bool a) {if (a) cout << "Yes"; else cout << "No"; cout << endl;}
void yesno(bool a) {if (a) cout << "yes"; else cout << "no"; cout << endl;}
void YESNO(bool a) {if (a) cout << "YES"; else cout << "NO"; cout << endl;}
	
bool solve() {	
	int x,y; cin >> x >> y;
	if (abs(x-y)<=1) cout << "Brown" << endl;
	else cout << "Alice" << endl;
}
	
signed main() {
	// cin.tie(0);
	// ios::sync_with_stdio(false);
	solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    string S;cin >> S;
    int p,f;
    p = (S[0]-'0')*10+S[1]-'0';
    f = (S[2]-'0')*10+S[3]-'0';
    if(1<=p&&p<=12&&1<=f&&f<=12)cout << "AMBIGUOUS" << endl;
    else if(1<=p&&p<=12&&(f==0||(12<=f&&f<=99)))cout << "MMYY" << endl;
    else if(1<=f&&f<=12&&(p==0||(12<=p&&p<=99)))cout << "YYMM" << endl;
    else cout << "NA" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned int
#define test int t;cin>>t; while(t--)
#define en '\n'
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(x) (int)x.size()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
// You should only debug a pair of simple data types. For example,
// the debug won't work if one of pair's elements is collection type
// (std::vector, std::map, std::set...).
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


// bool check_prime(int n)  return whether a number is prime or not O(sqrt(N));
// int BE(int x,int n,int m)  return x^n%m; O(logN);
// void sieve()  from number 1-1000001 saare prime store kar lega  in bool is_prime[1000001] array
// vector<int> z_array(string s)  return vector which is Z-array of string s;
// vector<int> lps(string s)      return vector which is lps array of string s;
// int power(int x,int n) return x^n; O(logN);
// using_ordered_set (template for using ordered set , replace first 2 lines of this page with this code..);
const int gf = 1e6 + 9;

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int n;
	cin >> n;
	int a[n], b[n];
	zip(i, 0, n)
	{
		cin >> a[i] >> b[i];
	}
	zip(i, 0, n - 2)
	{
		if (a[i] == b[i] && a[i + 1] == b[i + 1] && a[i + 2] == b[i + 2])
		{
			cout << "Yes" << en;
			return 0;
		}
	}
	cout << "No" << en;


	return 0;
}




Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>

using namespace std;

int s[5050];

bool cmp(int a,int b)
{
	return a<b;
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n,k;
	scanf("%d%d",&n,&k);
	int num=n,temp,ans=1;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&temp);
		if(temp>=k) num--;
		else s[ans++]=temp;
	}
	ans--;
	sort(s+1,s+num+1,cmp);
	temp=0;
	while(num>=2)
	{
		temp+=s[num];
		if(s[num-1]+temp<k)
		{
			num--;
			continue;
		}
		if(s[1]+temp>=k)
		{
			ans=0;
			break;
		}
		int l=1,r=num-2;
		while(l+1<r)
		{
			int mid=(l+r)/2;
			if(temp+s[mid]>=k) r=mid;
			else l=mid;
		}
		ans=ans-(num-r);
		num=r;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
import itertools

n = int(input()) 
p_list = itertools.permutations([x for x in range(n)])

# for p in p_list:
#     print(p)

a_list = []
for i in range(n):
    a_list.append(list(map(int,input().split())))


d_sum = 0
cnt = 0
for p in p_list:
    cnt+=1
    curr_d_sum = 0
    curr_pos = p[0]
    for i in p:
        x_d = a_list[curr_pos][0] - a_list[i][0]
        y_d = a_list[curr_pos][1] - a_list[i][1]
        d = (x_d**2 + y_d**2)**0.5
        curr_d_sum += d
        curr_pos = i
    d_sum += curr_d_sum
print(d_sum/cnt)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int n;
   cin >>n;
   vector<int> v(n);
   for(int i=0;i<n;i++)
    cin >>v[i];

   long long int c=0;
   int k=1;
   for(int i=0;i<n;i++)
   {
      if(v[i]==k)
      {
          c++;
          k=k+1;
      }
   }
  // cout <<c<<" "<<k<<endl;
   if(c==0)cout <<-1<<endl;
   else cout <<n-c<<endl;
}


Measured memory_bytes: 1152
#include<stdio.h>  
#include<string.h>  
int x[15],l[15],r[15];  
int kase;  
void dfs(int i,int j,int k)
{  
    if(i>10)
    {  
        kase=1;  
        return;  
    }  
    if(kase)  
    {  
        return;  
    }  
    if(x[i]>l[j-1])
    {  
        l[j]=x[i];dfs(i+1,j+1,k);  
    }  
    if(x[i]>r[k-1])
    {  
        r[k]=x[i];dfs(i+1,j,k+1);  
    }  
}  
int main()  
{  
    int t;   
    scanf("%d",&t);  
    while(t--)  
    {  
        for(int i=1;i<=10;++i)  
        {  
            scanf("%d",&x[i]);  
        }  
        kase=0;  
        dfs(1,1,1);  
        if(kase)  
        {  
            printf("YES\n");  
        }  
        else  
        {  
            printf("NO\n");  
        }  
    }  
    return 0;  
} 

Measured memory_bytes: 2524
import string
def frac(digit,n):
  ans[digit]=n%26
  if n < 26:
    return
  else:
    frac(digit+1,n//26)
    return

n = int(input())
l=0
r=0
for i in range(1,10000000000000000000000):
  l = r+1
  r = l+26**i-1
  if l <= n <= r:
    n = n-l+1
    break

n=n-1
ans=[0]*i

frac(0,n)
res=""
for i in ans[::-1]:
  res+=string.ascii_lowercase[i]
print(res)

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 1000000000000000000;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n, ans = 1;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    sort(ALL(a), greater<ll>());
    if(a[n-1] == 0) {
        cout << 0 << endl;
        return 0;
    }
    rep(i, n) {
        if(a[i] > INF/ans) {
            cout << -1 << endl;
            return 0;
        }
        ans *= a[i];
    }
    cout << ans << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 4000
from operator import itemgetter

n, m = map(int, input().split())
A = []
for i in range(m):
    p, y = map(int, input().split())
    a = [i, p, y]
    A.append(a)

A.sort(key=itemgetter(1,2))

prev = 0
no = 1
for i in range(m):
    if A[i][1] != prev:
        no = 1
        prev = A[i][1]
    else:
        no += 1
    A[i][2] = no

A.sort(key=itemgetter(0))
for a in A:
    print("%06d%06d" % (a[1], a[2]))


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

using namespace std;

int main(int argc, const char *argv[])
{
    string s;
    cin >> s;

    bool flag = false;
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == '7')
        {
            flag = true;
            break;
        }
    }

    if (flag)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3624
#include <cstdio>
#include<iostream>
 
using namespace std;
 
int main(void){
  
  int x[5];
  
  scanf("%i%i%i%i%i", &x[0], &x[1], &x[2], &x[3], &x[4]);
  
  int i;
  for(i=0;i<5;i++){
    if(x[i]==0){
      cout <<(i+1) <<endl;
    }
  }
    return 0;
}

Measured memory_bytes: 3228
#include <stdio.h>
#include<math.h>

int main()
{
    int a,b,c,sum,i;
  scanf("%d%d",&a,&b);
  sum=0;
  for(i=0;i<b;i++)
  {
      scanf("%d",&c);
      sum+=c;
  }
  if(a-sum>=0)
  {
      printf("%d\n",a-sum);
  }
  else
  {
      printf("-1\n");
  }
}



Measured memory_bytes: 1736
#include <iostream>
#include <string>
using namespace std;
int main(){
  int n,m;
  cin >> n>>m;
  string a[n],b[m];bool flag=true;
  for(int i=0;i<n;i++) cin >> a[i];
  for(int i=0;i<m;i++) cin >> b[i];
  for(int i=0;i<=n-m;i++){
    for(int j=0;j<=n-m;j++){
      flag=true;
      for(int k=0;k<m;k++){
        if(a[i+k].substr(j,m)!=b[k]) flag=false;
      }
      if(flag) {
          cout << "Yes"<<endl;
          return 0;
      }
      }
    }
    cout <<"No"<<endl;
  }


Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

int main() {
  ll N;

  cin >> N;
  vector<ll> lst(N);

  for (ll i = 0; i < N; i++) {
    ll tmp;
    cin >> tmp;
    lst[i] = tmp - i - 1;
  }
  sort(lst.begin(), lst.end());

  ll ans = 0;
  for (ll i = 1; i < N; i++) {
    ans += lst[i] - lst[0];
  }
  for (ll i = 1; i < N; i++) {
    ll delta = lst[i] - lst[i-1];
    ll cand = ans - (N - i) * delta + i * delta;
    if (cand < ans) ans = cand;
  }

  cout << ans << endl;

  return 0;
}


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

signed main() {
	ll N, M, V, P;
	vector<ll> A;
	scanf("%lld%lld%lld%lld", &N, &M, &V, &P);
	A.assign(N, 0);
	for(ll i=0; i<N; i++) scanf("%lld", &A[i]);
	sort(A.begin(), A.end());

	auto isOK = [&](ll val) -> bool {
		if(N-P<=val){
			return true;
		}
		ll valpoint=A[val]+M;
		ll amaripoint=(V-P-val)*M;
		ll sumpoint=0;
		for(ll i=val+1; i<=N-P; i++){
			ll t=valpoint-A[i];
			if(t<0)return false;
			sumpoint+=min(M,t);
		}
		if(amaripoint>sumpoint)return false;
		return true;
	};

	if(isOK(0)){
		printf("%lld\n", N);
		return 0;
	}

	ll left = 0;
	ll right = N-1;
	while(right - left > 1) {
		ll mid = left + (right - left) / 2;
		if(isOK(mid)) right = mid;
		else left = mid;
	}

	printf("%lld\n", N-right);
	return 0;
}


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

int main(){
int ary[32]={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 k;
cin >>k;
cout <<ary[k-1] <<endl;

return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
const int N=105;
int a[N];
int main(){
    int n;cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++) cin>>a[i],sum+=a[i];
    int ans=0;
    if(sum%10) ans=sum;
    for(int i=1;i<=n;i++){
        if((sum-a[i])%10) ans=max(ans,sum-a[i]);
    }
    cout<<ans;
}


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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

int main(){
	summon_tourist;

	int N; cin >> N;
	vector<string> S(N);
	vector<pint> pri, sec;
	REP(i, N){
		cin >> S[i];
		int lf = 0, ri = 0;
		REP(j, S[i].size()){
			if(S[i][j] == '('){
				lf++;
			} else {
				if(lf > 0) lf--;
				else ri++;
			}
		}
		if(ri <= lf){
			pri.eb(ri, lf-ri);
		} else {
			sec.eb(lf, ri);
		}
	}
	sort(ALL(pri));
	sort(sec.rbegin(), sec.rend());
	int now = 0;
	for(auto p: pri){
		if(now - p.first < 0){
			cout << "No" << ln;
			return 0;
		}
		now += p.second;
	}
	for(auto p: sec){
		if(now - p.second < 0){
			cout << "No" << ln;
			return 0;
		}
		now += p.first-p.second;
	}
	cout << (now == 0 ? "Yes" : "No") << ln;
}

Measured memory_bytes: 42536
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	a = a - b;
	c = c - a;
	if (c <= 0)
		cout << 0 << endl;
	else
		cout << c << endl;
}

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

typedef long long ll;
// const int INF = 1e8;
const ll INF = 1LL << 60;
typedef pair<int, int> P;

ll A, B, M;
vector<ll> a, b, x, y, c;

int main() {
    cin >> A >> B >> M;
    a.resize(A);
    b.resize(B);

    ll a_min = INF;
    rep(i, A) {
        cin >> a[i];
        a_min = min(a_min, a[i]);
    }

    ll b_min = INF;
    rep(i, B) {
        cin >> b[i];
        b_min = min(b_min, b[i]);
    }

    x.resize(M);
    y.resize(M);
    c.resize(M);

    ll ans = a_min + b_min;
    rep(i, M) {
        cin >> x[i] >> y[i] >> c[i];
        x[i]--; y[i]--;
        ll tmp = a[x[i]] + b[y[i]] - c[i];
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int x, p; cin >> x >> p;
	
	cout << std::fixed << std::setprecision(10);
	cout << (double)((x + 1) / 2) / (p / 100.) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
using ll = long long;
constexpr ll linf=2*1e18;

int main(){
    ll h, n;
    cin >> h >> n;
    vector<ll> a(n), b(n);
    for(ll i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    ll dp[2][h+1];//i番目まで魔法を使ってjダメージを与えるために必要な魔力の最小
    for(ll i = 0; i < 2; i++) for(ll j = 0; j < h+1; j++){
        if(j == 0) dp[i][j] = 0;
        else dp[i][j] = linf;
    }
    for(ll i = 0; i < n; i++){
        for(ll j = 0; j < h + 1; j++){
            ll k = i & 1;
            ll l = (i + 1) & 1;
            if(j > a[i]){
                dp[k][j] = min(dp[l][j], dp[k][j-a[i]] + b[i]);
            }
            else dp[k][j] = min(dp[l][j],dp[k][0] + b[i]);
        }
    }
    cout<<dp[(n - 1) & 1][h]<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cmath> // 追加

using namespace std;

int main() {
   
    int N;
    cin >> N;
    
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    
    vector<int> count(100010, 0);
    for (int i = 0; i < a.size(); i++) {
        count[a[i]]++;
    }
    
    int ans = 0;
    for (int i = 1; i < count.size() - 1; i++) {
        int sum = count[i - 1] + count[i] + count[i + 1];
        ans = max(ans, sum);
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1024
import sys
from collections import defaultdict

def solve():
    input = sys.stdin.readline
    A, B, C, D = map(int, input().split())
    mod = 998244353

    DP = [[0 for j in range(D + 1)] for i in range(C + 1)]
    DP[A][B] = 1
    for b in range(B + 1, D + 1):
        DP[A][b] = (DP[A][b-1] * A) % mod
    
    for a in range(A + 1, C + 1):
        DP[a][B] = (DP[a-1][B] * B) % mod
        for b in range(B + 1, D + 1):
            DP[a][b] = ((DP[a][b-1] * a) % mod + (DP[a-1][b] * b) % mod - (DP[a-1][b-1] * (a-1) * (b-1)) % mod) % mod
    print(DP[C][D])
    #print(DP)

    return 0

if __name__ == "__main__":
    solve()

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

int W, H, x, y, r;

int main ()
{
	cin >> W >> H >> x >> y >> r;
	if (x-r<0 || x+r>W || y-r<0 || y+r>H)
		cout << "No\n";
	else
		cout << "Yes\n";
	return 0;		
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin >>s;
	int numa=0,numb=0,numc=0;
	for (int i=0;i<=2;i++)
	{
		if (s[i]=='a')
		    numa=1;
		if (s[i]=='b')
		    numb=1;
		if (s[i]=='c')
		    numc=1;
	}
	if (numa==1 && numb==1 && numc==1)
	    cout <<"Yes" <<endl;
	else
	    cout <<"No" <<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
B = list(map(int,input().split()))
a = [0] * N
ans = 0
x = 0
if N == 2:
    ans = B[0] * 2
elif N == 3:
    ans = sum(B) + min(B)
else:
    for i in range(N - 1):
        if i == 0:
            a[0] = B[0]
            
        
        else:
            x = min(B[i],B[i - 1])
            a[i] = x
            
            if i == N - 2:
                a[i + 1] = B[N - 2]
                
        
        ans = sum(a)
print(ans)

Measured memory_bytes: 9140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
string alp="abcdefghijklmnopqrstuvwxyz";

const int MAX = 510000;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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;
    }
}

ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int same1,same2,t;
    set<int> s;
    rep(i,n+1){
      cin >> a[i];
      if (!s.count(a[i])){
        s.insert(a[i]);
      }
      else {
        same1=i;
        t=a[i];
      }
    }
    rep(i,n+1){
      if (a[i]==t){
        same2=i;
        break;
      }
    }
    COMinit();
    for (int i=1;i<=n+1;i++){
      cout << (COM(n+1,i)+MOD-COM(n-same1+same2,i-1))%MOD << endl;
    }
}

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

int main()
{
int A,B;
cin >> A;
cin >>B;
   
if ((A+B>=A-B) && (A+B>=A*B)){
cout<< A+B <<endl;
}
    
else if ((A-B>=A+B) && (A-B>=A*B)){
cout<< A-B <<endl;
}

else{
cout<< A*B <<endl;
}
 
}

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

typedef long long ll;
#define REP(i, n, m) for(int i = n; i < m; i++)
#define REPR(i, n, m) for(int i = n; i >= m; i--)
#define LREP(i, n, m) for(ll i = n; i < m; i++)
#define LREPR(i, n, m) for(ll i = n; i >= m; i--)

#define P pair<int, int >


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



//---functions---//
int gcd(int a, int b){
    if(a < b) swap(a, b);
    return b?gcd(b, a%b):a;
}

int s2i(string num){stringstream ss; ss << num << flush; int n; ss >> n; return n;}
string i2s(int n){stringstream ss; ss << n << flush; return ss.str();}

bool firstCompare(const P& firstElof, const P& secondElof){
    return firstElof.first < secondElof.first;
}
bool secondCompare(const P& firstElof, const P& secondElof){
    return firstElof.second < secondElof.second;
}
//---------------//

ll N;
int main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    vector<ll> A(N);
    vector<ll> ans(N);
    ans[0] = 0;
    LREP(i, 0, N) cin >> A[i];
    LREP(i, 0, N){
        if(i % 2 == 0) ans[0] += A[i];
        else ans[0] -= A[i];
    }
    LREP(i, 1, N){
        ans[i] =  2 * A[i-1] - ans[i-1];
    }
    LREP(i, 0, N) cout << ans[i] << ' ';
    cout << '\n';
}


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

N, M = map(int, input().split())
s = []
c = []
for i in range(M):
  si, ci = map(int, input().split())
  s.append(si)
  c.append(ci)

# x[0]は1の位、x[1]は10の位、x[2]は100の位
x = [-1] * N

for i in range(M):
  
  if N > 1 and s[i] == 1 and c[i] == 0:
    print(-1)
    exit()
  
  if x[N - s[i]] == -1 or x[N - s[i]] == c[i]:
    x[N - s[i]] = c[i]
  else:
    print(-1)
    exit()

if N == 1 and x[0] == -1:
  x[0] = 0
    
if x[N-1] == -1:
  x[N-1] = 1
for i in range(N-1):
   if x[i] == -1:
      x[i] = 0

ans = 0
for i in range(N):
  ans += x[i] * (10**i)

print(ans)

Measured memory_bytes: 61904
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  char data;
  char former=' ';
  int count=0;
  for(int i=0;i<n;i++){
  	cin>>data;
  	if(former!=data){
      count++;
  	  former=data;
    }
  }
  cout<<count;
  return 0; 
}

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

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

  sort(v.begin(), v.end());
  cout << v[v.size() - 1] - v[0] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
int main() {
  int x, t ;
  cin >> x >> t;
  if (x-t < 0) {
    cout << 0 << endl;
  } else {
    cout << x-t << endl;
  }
  return 0;
}

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

#define pb push_back

int C[100005], R[100005];
vector<int> E[100005];
queue<int> Q;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, M;
    cin >> N >> M;
    for (int i = 0; i < M; i++)
    {
        int x, y;
        cin >> x >> y;
        E[y].pb(x);
        C[x]++;
    }
    for (int i = 1; i <= N; i++) if (!C[i]) Q.push(i);
    while (!Q.empty())
    {
        int cn = Q.front();
        Q.pop();
        for (int i = 0; i < E[cn].size(); i++)
        {
            if (R[cn] >= R[E[cn][i]]) R[E[cn][i]] = R[cn] + 1;
            if (--C[E[cn][i]] == 0) Q.push(E[cn][i]);
        }
    }
    int res = 1;
    for (int i = 1; i <= N; i++) if (R[i] > res) res = R[i];
    cout << res << '\n';
    return(0);
}

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


int main(){
	int A, B;cin >> A >> B;
	string S;
	cin >> S;
	bool ok = true;
	rep(i,A){
		if(!(S[i] >= '0')) ok = false;
	}
	if(S[A] != '-') ok = false;

	rep(i,B-1){
		if(!(S[A+1+i] >= '0')) ok = false;
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;

		
}












Measured memory_bytes: 3600
#include<cstdio>
using namespace std;
 
typedef double D;
 
int n,a[110],r;
D b,v,e,f;
D dp[10100][110];
const D EPS = 1e-8;
 
int main(){
  while(scanf("%d",&n),n){
    a[0] = 0;
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    scanf("%lf%d%lf%lf%lf",&b,&r,&v,&e,&f);
 
    for(int i=0;i<=a[n];i++)
      for(int j=0;j<=n;j++)dp[i][j] = 1e15;
    dp[0][0] = 0;
 
    int pos = 1;
    for(int i=0;i<a[n];i++){
      if(i==a[pos]){
    for(int j=0;j<pos;j++){
      if(dp[i][pos] > dp[i][j] + b + EPS){
        dp[i][pos] = dp[i][j] + b;
      }
    }
    pos++;
      }
 
      for(int j=0;j<=n;j++){
    int x = i-a[j];
    D cost = (x<r)?(1.0/(v-f*(r-x))):(1.0/(v-e*(x-r)));
    if(dp[i+1][j] > dp[i][j] + cost + EPS){
      dp[i+1][j] = dp[i][j] + cost;
    }
      }
    }
     
    D res = 1e15;
    for(int i=0;i<=n;i++){
      if(res > dp[a[n]][i] + EPS)res = dp[a[n]][i];
    }
    printf("%.10lf\n",res);
  }
}

Measured memory_bytes: 9688
#include <bits/stdc++.h>
using namespace std;
long long n,k[10005],l[10005],mon;
int main(){
  cin>>n;
  for(int i=0;i<n;++i){
    cin>>k[i];
  }
  for(int i=0;i<n;++i){
    cin>>l[i];
    if(k[i]>l[i]){mon-=k[i]-l[i];}
    else if(l[i]>k[i]){mon+=(l[i]-k[i])/2;}
  }
  string ans="Yes";
  if(mon<0){ans="No";}
  cout<<ans<<endl;
}


Measured memory_bytes: 384