akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a!=c){
		cout<<1<<endl;
	}else{
		cout<<0<<endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQUE(a)  (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int f(int a,int b){return b==0 ? a : f(b, a%b);}
int main() {
	int a,b,c;cin>>a>>b>>c;
	int d=f(a,b);
	cout << (a/d)*(b/d)*c << endl;
	return 0;
}

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

int main()
{
	int n,sum,i,j;
	char meirei[8];
	
	while(cin>>n,n){
		sum = 1;
		int map[3] = {1,2,3};
		while(n--){
			cin>>meirei;
			int tmp;
			int a,b;
			a = strcmp(meirei,"North")&&strcmp(meirei,"West") ? 
				 strcmp(meirei,"South")&&strcmp(meirei,"Right") ?
				 2:1:0;
			
			b = strcmp(meirei,"East")&&strcmp(meirei,"South") ? 
				 strcmp(meirei,"North")&&strcmp(meirei,"Left") ?
				 2:1:0;
			
			tmp = map[a];
			map[a] = map[b];
			map[b] = 7 - tmp;
			sum += map[0];
			
			/*
			if      ( !strcmp(meirei,"North") ){
				tmp = map[0];
				map[0] = map[1];
				map[1] = 7 - tmp;
				sum += map[0];
				
			}else if( !strcmp(meirei,"East") ){
				tmp = map[2];
				map[2] = map[0];
				map[0] = 7 - tmp;
				sum += map[0];
				
			}else if( !strcmp(meirei,"South") ){
				tmp = map[1];
				map[1] = map[0];
				map[0] = 7 - tmp;
				sum += map[0];
				
			}else if( !strcmp(meirei,"West") ){
				tmp = map[0];
				map[0] = map[2];
				map[2] = 7 - tmp;
				sum += map[0];
				
			}else if( !strcmp(meirei,"Right") ){
				tmp = map[1];
				map[1] = map[2];
				map[2] = 7 - tmp;
				sum += map[0];
				
			}else if( !strcmp(meirei,"Left") ){
				tmp = map[2];
				map[2] = map[1];
				map[1] = 7 - tmp;
				sum += map[0];
			}
			*/
			//printf("%d,%d,%d  sum_%d\n",map[0],map[1],map[2],sum);
		}
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    double p[n];
    double sum = 0.0, maxSum = 0.0;
    for (int i=0; i<n; i++) {
        cin >> p[i];
        sum += (p[i]+1.0)/2.0;
        if (i-k >= 0) {
            sum -= (p[i-k]+1.0)/2.0;
        }
        maxSum = max(maxSum, sum);
    }
    cout << fixed;
    cout << setprecision(6);
    cout << maxSum << endl;
}

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

using namespace std;

typedef long long ll;

int n, m;

char a[64][64], b[64][64];

void yes() {
  cout << "Yes";
  exit(0);
}

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);

  cin >> n >> m;
  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 + m - 1 < n; ++i) {
    for(int j = 0; j + m - 1 < n; ++j) {
      bool can = true;

      for(int x = 0; can && x < m; ++x)
        for(int y = 0; can && y < m; ++y)
          if(a[i+x][j+y] != b[x][y])
            can = false;

      if(can) yes();
    }
  }

  cout << "No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if((a==1&&b==2)||(a==2&&b==1))
        cout<<3;
    else if((a==1&&b==3)||(a==3&&b==1))
        cout<<2;
    else if((a==2&&b==3)||(a==3&&b==2))
        cout<<1;

    return 0;
}


Measured memory_bytes: 256
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpll vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

/*lld fac[100001]; 

void getfac(lld p)
{
    fac[0] = 1; 
    for (lld i=1 ; i<=100000; i++) 
        fac[i] = fac[i-1]*i%p; 
}    

long long int nCrmodp(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
     
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}*/


lld gcd(lld a,lld b)
{
    if(a>b) return gcd(b,a);
    if(b%a==0) return a;
    else return gcd(b%a,a);
}

lld p1=1e9 + 7,p2=998244353;
lld l,r,mid,ans;
lld n,i,j,k,g,m;
lld x,y,n1,n2,h,z,c;
lld aa=1;



void solve()
{
    cin>>n;
    vector<lld> v;
    m=n;
    while(n>=1)
    {
        if(n%26!=0)
        {
            v.pb(n%26);
            n/=26;  
        }
        else
        {
            v.pb(26);
            n/=26;
            n-=1;
        }
    }
    l = v.size();
    x=1;
    for(i=0;i<l;i++)
    {
        // cout<<v[i]<< " ";
        m-=x*v[i];
        x*=26;
        if(m==0)
        {
            l=i+1;    
            break;
        }
    }
    // cout<<l;
    for(i=l-1;i>=0;i--)
    {
         char c = 'a'+(v[i]-1+26)%26;
        printf("%c",c);
    }

}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
    //cin>>t;
    //cout<<t;
   //  getfac(p2);
    //check the value by which modulo is to be taken
    lld ans=0;
    for(int i=0;i<t;i++)
    {
   //     cout<<"Case #"<<i+1<<": ";
                  solve();
     //  cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3644
n = int(input())
s = [input() for _ in range(n)]
s.sort()
p = [s[0]]
k = [1]
for i in range(1,len(s)):
    if s[i] != s[i-1]:
        p.append(s[i])
        k.append(1)
    else: k[-1] += 1
max_k = max(k)
for i in range(len(p)):
    if k[i] == max_k:
        print(p[i])

Measured memory_bytes: 22212
N, K = gets.split.map(&:to_i)
A    = gets.split.map(&:to_i)

t = Array.new(40, 0)
A.each do |a|
  b = 1
  i = 0
  while a > 0
    if a & b > 0
      t[i] += 1
      a -= b
    end
    b <<= 1
    i += 1
  end
end

x    = 0
b    = 1 << 39
half = (N + 1) / 2
t.reverse.each do |i|
  if i < half && (x | b) <= K
    x |= b
  end 
  b >>= 1
end

puts A.inject(0) {|tot, a| tot + (x ^ a)}


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

using namespace std;
typedef long long ll;

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

int main()
{
    int n, k;
    cin >> n >> k;

    cout << ((n % k == 0) ? 0 : 1) << '\n';
    return 0;
}


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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  int N; cin >> N;
  vector<ll> v(N);
  vector<ll> a(N);
  for(int i = 0; i < N; i++){
    cin >> v[i];
  }
  if(N == 2){
    cout << abs(v[0] - v[1]) << endl;
    return 0;
  }
  a[0] = v[0];
  for(int i = 1; i < N; i++){
    a[i] = a[i-1] + v[i];
  }
  ll min_val = 1000000000000000000;
  for(int i = 1; i < N-1; i++){
    ll before = a[i];
    ll after = a[N-1] - a[i];
    ll val = abs(after - before);
    min_val = min(min_val, val);
  }
  cout << min_val << endl;


}


Measured memory_bytes: 3456
#union-find-tree
import sys
sys.setrecursionlimit(10**7)
def init(n):
    return list(range(n+1))
def find(lis, x):
    if lis[x] == x:
        return x
    else:
        lis[x] = find(lis, lis[x])
        return lis[x]
def sameset(lis, x, y):
    return find(lis, x) == find(lis, y)
def union(lis, x, y):
    x = find(lis, x)
    y = find(lis, y)
    if x != y:
        lis[x] = y

N, M = map(int, input().split())
union_find_lis = init(N)
P = [0] + [int(s) for s in input().split()]
for _ in range(M):
    x, y = map(int, input().split())
    union(union_find_lis, x, y)
count = 0
for index in range(1, N+1):
    if sameset(union_find_lis, P[index], index):
        count += 1
print(count)

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    ll N;
    cin >> N;
    vector<ll> S;
    ll p = pow(2LL, N);
    REP(i, p)
    {
        ll s;
        cin >> s;
        S.push_back(s);
    }
    sort(S.begin(), S.end(), [](ll a, ll b) { return a > b; });
    priority_queue<pll, vector<pll>, function<bool(pll, pll)>> q([](pll a, pll b) { return a.second == b.second ? a.first < b.first : a.second < b.second; });
    q.push(pll(S[0], N));
    multiset<ll> set;
    REP(i, p - 1)
    {
        set.insert(-S[i + 1]);
    }
    set.insert(0);
    while (!q.empty())
    {
        pll t = q.top();
        q.pop();
        if (t.second == 0)
            continue;

        auto n = set.lower_bound(-t.first + 1);
        // cout << t.first << " " << -(*n) << endl;
        if (*n == 0)
        {
            cout << "No" << endl;
            return 0;
        }
        set.erase(n);
        q.push(pll(-(*n), t.second - 1));
        q.push(pll(t.first, t.second - 1));
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 20720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1234567890


int main(){
    ll i,j;
    ll n;
    cin>>n;
    ll m=1;
    for(i=0;i<n;i++) m*=2;
    multiset<ll> s;
    ll M;
    for(i=0;i<m;i++) {
        ll x;
        cin>>x;
        s.insert(-x);
        M=max(M,x);
    }

    vector<ll> v;

    ll tem=0;
    for(i=0;i<=n;i++){
        if(i==0) {
            v.pb(-M);
            s.erase(s.find(-M));
        }
        else {
            ll tem2=tem;
            for(j=0;j<(1<<(i-1));j++){
                if(s.upper_bound(v[j])==s.end()){
                    cout<<"No"<<endl;
                    return 0;
                }
                else {
                    v.pb(*s.upper_bound(v[j]));
                    s.erase(s.upper_bound(v[j]));
                }
            }
            
        }
    }

    cout<<"Yes"<<endl;
    
    return 0;
}

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

using namespace std;
typedef pair<int, int> P;
const int MAXN = 100005;

map<P, int> m;
vector<P> edges;
vector<int> G[MAXN];
bool visited[MAXN];
// int colors[MAXN][MAXN];

void bfs(int s) {
  queue<P> q;
  q.push(P(s, -1));
  visited[s] = true;
  while (!q.empty()) {
    P cur = q.front(); q.pop();
    int v = cur.first;
    int co = cur.second;
    int color = 1;
    for (int i = 0; i < G[v].size(); ++i) {
      int next = G[v][i];
      if (visited[next]) continue;
      visited[next] = true;
      if (co == color) color++;
      P a = P(min(v, next), max(v, next));
      m[a] = color;
      q.push(P(next, color));
      color++;
    }
  }
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
    P p = P(min(a, b), max(a, b));
    edges.push_back(p);
    m[p] = -1;
  }

  bfs(0);
  set<int> s;
  for (auto e: m) {
    s.insert(e.second);
  }
  cout << s.size() << endl;
  for (int i = 0; i < edges.size(); ++i) {
    cout << m[edges[i]] << endl;
  }
  return 0;
}



Measured memory_bytes: 13300
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<int,P> PP;
struct edge { int to, cor; };
int h[100005];
int dp[100005];
signed main() {
	int n,k; cin >> n>>k;
	rep(i, n)cin >> h[i];

	rep(i, n)dp[i + 1] = inf;
	rep(i, n) {//now
		for (int j = 1; j <= k; j++) {
			if (i + j < n) {
				dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
			}
		}
	}
	cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
int cnt[2][105];
int h, w;
bool flag[110][110];

int main() {
	ll n, k;
	cin >> n >> k;
	ll ans = k;
	rep(i, n-1) {
		ans *= (k - 1);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
using P = pair<int, int>;
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}

signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const int MOD = 1e9+7;
    int n;
    cin>>n;
    int ans=0,memo=-1;
    bool b1=false,b2=false;
    rep(i,n){
        int a;
        cin>>a;
        if((!b1&&((b2&&a<memo)||(!b2&&a>memo)))){
            b1=true;
            ans++;
        }
        else if(b1){
            if(memo!=a){
                b1=false;
                b2=a>memo;
            }
        }
        memo=a;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define rr register
const int N=1000010,INF=0x3f3f3f3f;
int a[N];
int n,m;
inline int read(void){
	int res,f=1;
	char c;
	while((c=getchar())<'0'||c>'9')
		if(c=='-')f=-1;
	res=c-48;
	while((c=getchar())>='0'&&c<='9')
		res=res*10+c-48;
	return res*f;
}
int main(void){
	n=read(),m=read();
	int ans=0;
	for(rr int i=1;i<=m;++i){
		ans+=read();
	}
	if(ans<=n){
		printf("%d",n-ans);
	}else{
		printf("-1");
	}
	return 0;
}


Measured memory_bytes: 3764
#include<stdio.h>
#define M 2000000

int n, A[M+1];

void maxHeapify(int i){
  int l, r, largest, t;
  l = 2*i;
  r = 2*i+1;
  if ( l <= n && A[l] > A[i] ) {
    largest = l;
  }
  
  else largest = i;
  if ( r <= n && A[r] > A[largest] ) {
    largest = r;
  }
  
  if ( largest != i ){
    t = A[i];
    A[i] = A[largest];
    A[largest] = t;
    maxHeapify(largest);
  }
}

int main(){
  scanf("%d", &n);
  int i;
  for ( i = 1; i <= n; i++ ){
    scanf("%d", &A[i]);
  }
  
  for ( i = n/2; i >= 1; i-- ) {
    maxHeapify(i);
  }
  
  for ( i = 1; i <= n; i++ ) {
    printf(" %d", A[i]);
  }
  printf("\n");
  

  
  return 0;
}



Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(all(x));
#define RSORT(x) sort(rall(x));
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;
const ll inf = 1ll<<29;
const ll mod = 1000000007;
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

int main() {
  int N, M; cin >> N >> M;
  vi a(M); rep(i,M) cin >> a.at(i);

  vb broken(N+1,false);
  rep(i,M) {
    broken.at(a.at(i)) = true;
  }

  vi dp(N+1);
  dp.at(0) = 1;
  repi(now,0,N-1) {
    repi(next,now+1,min(N,now+2)) {
      if(broken.at(next)==false) {
        dp.at(next) += dp.at(now);
        dp.at(next) %= mod;
      }
    }
  }

  cout << dp.at(N) << endl;
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n,m;
  cin>>n>>m;
  vector<long long int> a(n),b(n),c(m),d(m),cnt(n),ans(n);
  rep(i,n) cin>>a[i]>>b[i];
  rep(i,m) cin>>c[i]>>d[i];
  rep(i,n) cnt[i]=1000000000;
  
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      long long int x=abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(cnt[i]>x){
        cnt[i]=x;
        ans[i]=j+1;
      }
    }
  }
  
  rep(i,n){
    cout<<ans[i]<<endl;
  }
  
  
  
}
///////////////////////////

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

using vi = vector<int>;
using vll = vector<long long>;

constexpr long long mod = 1000000007;

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

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

    int n;
    cin >> n;
    vll a(n);
    rep(i, n) cin >> a[i];

    vector<vector<long long>> v(n + 1, vector<long long>(2, 0));
    v[0][1] = -mod;

    for (int i = 0; i < n; i++) {
        v[i + 1][0] = max(v[i][0] + a[i], v[i][1] - a[i]);
        v[i + 1][1] = max(v[i][0] - a[i], v[i][1] + a[i]);
    }

    cout << v[n][0] << endl;

    // long long cnt = 0;
    // bool b = false;
    // rep(i, n) {
    //     if (a[i] == 0) {
    //         b = true;
    //         break;
    //     }
    //     if (a[i] < 0) {
    //         cnt++;
    //     }
    // }

    // b = cnt % 2 == 0;
    // long long sum = 0;
    // if (b) {
    //     rep(i, n) sum += abs(a[i]);
    // } else {
    //     long long t = abs(a[0]);
    //     rep(i, n) {
    //         sum += abs(a[i]);
    //         t = min(t, abs(a[i]));
    //     }

    //     sum -= 2 * t;
    // }

    // cout << sum << endl;
}

Measured memory_bytes: 6528
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<complex>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

string random_string( size_t length )
{
    auto randchar = []() -> char
    {
        const char charset[] =
        "NEWS";
        const size_t max_index = (sizeof(charset) - 1);
        return charset[ rand() % max_index ];
    };
    string str(length,0);
    generate_n( str.begin(), length, randchar );
    return str;
}


int face[7];
int cubes_face[100][7];
void roll(int tmp, int a, int b, int c) {
    face[1] = face[a];
    face[a] = face[b];
    face[b] = face[c];
    face[c] = tmp;
}
int main() {
    int n; cin >> n;
    rep(i, n) rrep(j, 1, 7) cin >> cubes_face[i][j];
    rrep(i, 1, n) {
        rrep(j, 1, 7) face[j] = cubes_face[i][j];
        int c = 0;
        while (c++ < 1000) {
            string ch = random_string(1);
            int tmp = face[1];
            if (ch == "N") {
                roll(tmp, 2, 6, 5);
            } else if (ch == "E") {
                roll(tmp, 4, 6, 3);
            } else if (ch == "W") {
                roll(tmp, 3, 6, 4);
            } else {
                roll(tmp, 5, 6, 2);
            }
            rrep(j, 1, 7) {
                if (face[j] != cubes_face[0][j]) break;
                if (j == 6) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    
}



Measured memory_bytes: 3172
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>
#include <bitset>

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

int H, W;
vector<string> a;
int dp[1100][1100] = {0};
int main() {
  cin >> H >> W;
  a.resize(H);
  for (int i = 0; i < H; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (i + 1 < H && a[i + 1][j] == '.') {
        dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD;
      }
      if (j + 1 < W && a[i][j + 1] == '.') {
        dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % MOD;
      }
    }
  }
  cout << dp[H - 1][W - 1] << endl;
  return 0;
}


Measured memory_bytes: 5632
#include <iostream>
#include <string>
#include <vector>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
using namespace std;

int main()
{
  int N;
  string S;
  cin >> N >> S;

  // 左端に付け足すカッコ
  int l = 0;
  //int r = 0;
  int c = 0;
  REP(i,0,N) {
    if (S[i] == '(') ++c;
    if (S[i] == ')') {
      // 対応する ( が居るなら、それを消費
      if (c > 0) --c;
      // 居ないなら、左端に付け足す
      else ++l;
    }
  }
  // 最後に残った c は、
  // 右端に付け足すべきカッコ ) の数

  string T = string(l, '(') + S + string(c, ')');
  cout << T << endl;

  return 0;
}


Measured memory_bytes: 256
import math
def prime_factorize(n):
    ListPrime = []
    while n % 2 == 0:
        ListPrime.append(2)
        n //= 2
    f = 3
    while f*f <= n:
        if n % f == 0:
            ListPrime.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ListPrime.append(n)
    return ListPrime

N,M = map(int,input().split())
A = list(set(prime_factorize(M)))
List = []
for i in range(len(A)):
    List.append(prime_factorize(M).count(A[i]))
Listans = 1
for i in range(len(List)):
    Listans *= (math.factorial(List[i]+N-1)//(math.factorial(List[i])*math.factorial(N-1)))
print(Listans%(10**9+7))


Measured memory_bytes: 115676
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

N, X = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(X)
xs.sort()
D = xs[1] - xs[0]
for i in range(N):
    d = xs[i+1] - xs[i]
    D = gcd(d, D)
    if D == 1:
        print(1)
        break
else:
    print(D)


Measured memory_bytes: 14252
#include <stdio.h>
int main(){
    int n;
    int i;
    int cal;
    
    scanf( "%d", &n );
    
    for( i = 1; i <= n; i++ ){
        if( i % 3 == 0 ){
            printf( " %d", i );
            continue;
        }
        cal = i;
        do{
            if( cal % 10 == 3 ){
                printf( " %d", i );
                break;
            }
            cal /= 10;
        }while( cal != 0 );
    }
    printf( "\n" );
    return 0;
}


Measured memory_bytes: 2112
S = input()
K = int(input())
if len(S) == 1:
    print(S)
else:
    ind = 0 
    while True:
        if S[ind] != '1':
            break
        ind += 1
        if ind == len(S):
            break
    if K <= ind:
        print('1')
    else:
        print(S[ind])

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int count = 0;
		sc.close();
		
		for(int a = 0; a<K-1; a++){
			for(int b = a+1; b<K; b=b+2){
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 22612
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
///////////////////////////

#define N 100005
ll n,m;
vector<ll>v[N];
ll dp[N];
ll dfs(ll id,ll par){
    dp[id]=1;
    for(auto x:v[id]){
        if(x==par)continue;
        dp[id]=(dp[id]*(dfs(x,id)+1))%m;
    }
    return dp[id];
}
void dfs2(ll id,ll par,ll d_par){
    dp[id]=(dp[id]*(d_par+1))%m;
    ll vs=v[id].size();
    ll lmul[vs+1],rmul[vs+1];
    lmul[0]=1;
    rep(i,1,vs){
        if(v[id][i-1]==par){
            lmul[i]=(lmul[i-1]*(d_par+1))%m;
        }else{
            lmul[i]=(lmul[i-1]*(dp[v[id][i-1]]+1))%m;
        }
    }
    rmul[vs]=1;
    for(ll i=vs-1;i>=0;i--){
        if(v[id][i]==par){
            rmul[i]=(rmul[i+1]*(d_par+1))%m;
        }else{
            rmul[i]=(rmul[i+1]*(dp[v[id][i]]+1))%m;
        }
    }
    rep(i,0,vs-1){
        ll x=v[id][i];
        if(x==par)continue;
        ll res=(lmul[i]*rmul[i+1]%m)%m;
        dfs2(x,id,res);
    }
}

int main(){fastio
    cin>>n>>m;
    rep(i,1,n-1){
        ll a,b;cin>>a>>b;
        v[a].pb(b);v[b].pb(a);
    }
    dfs(1,-1);
    //rep(i,1,n)cout<<dp[i]<<" ";cout<<endl;
    dfs2(1,-1,0);
    rep(i,1,n)cout<<dp[i]<<endl;
    
    return 0;
}


Measured memory_bytes: 20352
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include <stdlib.h>
using namespace std;
#define         rep(i,n)       for (int i = 0;i<(int)(n);i++)
#define         rep1(i,n)      for (int i = 1;i<=(int)(n);i++)
#define         sajo(str)      sort(str.begin(),str.end())
#define         rsajo(str)     reverse(str.begin(),str.end())
#define         pi             3.14159265359
#define         neli            printf("\n")
#define         gcd(a,b)       __gcd(a,b)
#define         lcm(a,b)       (a/gcd(a,b))*b
#define         yes            cout<<"Yes"<<"\n"
#define         no             cout<<"No"<<"\n"
#define         pf             printf
#define         sf             scanf
#define         pb             push_back
#define         ppb            pop_back
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 2e5+5;
typedef long long int         lli;
typedef long long             ll;
typedef unsigned long long    ull;
typedef double                db;
typedef long double           ldb;

int pos(int arr[], int n, int x)
{
    int i;
    for (i = 1; i <= n; i++)
        if (arr[i] == x)
            return i;
}

int main()
{
    FIO;
    int a,b,x,y,ans,t,n,i,j;

    cin>>a>>b;
    printf("%d\n",6-a-b);
    return 0;

}


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

b = 0
for i in range(n):
    if i == 0:
        if a[0] + k - a[-1] > b:
            b = a[0] - a[-1] + k
    if a[i] - a[i-1] > b:
        b = a[i] - a[i-1]

print(k - b)

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
  int n,k;
  int ans=0;
  cin >> n>>k;
  REP(i,n) {
    int h;
    cin >> h;
    if (h >=k) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author littlesheep
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long sum = 0;
            long[] a = new long[n];
            for (int i = 0; i < n; ++i) {
                a[i] = in.nextLong();
                sum += a[i];
            }
            if (n == 1) {
                out.println("YES");
                return;
            }

            if (sum % ((1L + n) * n / 2) != 0) {
                out.println("NO");
                return;
            }

            long times = sum / ((1L + n) * n / 2);
            long[] b = new long[n];
            long coef = -(n - 1);
            long bSum = 0;
            for (int i = 0; i < n; ++i) {
                long delta = a[i] - a[(i + n - 1) % n];
                if ((delta - times) % (coef - 1) != 0) {
                    out.println("NO");
                    return;
                }
                b[i] = (delta - times) / (coef - 1);
                if (b[i] < 0) {
                    out.println("NO");
                    return;
                }
                bSum += b[i];
            }

            if (bSum == times) {
                out.println("YES");
            } else {
                out.println("NO");
            }

        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 25592
n, x = map(int, input().split())
alist = list(map(int, input().split()))
blist = alist[:]

ans = None
for i in range(n):
  for j in range(n):
    blist[j] = min(blist[j], alist[j-i])
  if ans is None:
    ans = i * x + sum(blist)
  else:
    ans = min(ans, i * x + sum(blist))
print(ans)


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

int main() {
    long N, x;

    cin >> N >> x;

    long *a = new long[N];

    for (long i=0; i<N; i++) { cin >> a[i]; }
    sort(a, a+N);
    long res = 0;
    for (long i=0; i<N; i++) {
        if (x <= 0) { break; }
        x -= a[i];
        res++;
    }
    if (x != 0) { res--; }

    cout << res << endl;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    int _n, _m;
    _n = n*(n-1) / 2;
    _m = m*(m-1) / 2;
    cout << _n + _m << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
  int i,len;
  char type;
  string name,out;
  while(1){
    out="";
    cin >> name >> type;
    if(type=='X') break;
    len=name.size();
    for(i=0;i<len;i++){
      if(i==0){
	if('A'<=name[i]&&name[i]<='Z'&&type!='U') out+=name[i]-'A'+'a';
	else if('a'<=name[i]&&name[i]<='z'&&type=='U') out+=name[i]-'a'+'A';
	else out+=name[i];
      }
      else{
	if(name[i]=='_'&&type!='D'){
	  out+=name[i+1]-'a'+'A';
	  i++;
	}
	else if('A'<=name[i]&&name[i]<='Z'&&type=='D'){
	  out+='_';
	  out+=name[i]-'A'+'a';
	}else out+=name[i];
      }
    }
    cout << out << endl;
  }
  return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
#define SIZE 5005
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
bool dp[SIZE];
int A[SIZE];
P pos[SIZE];
 
int main()
{
	int n,K;
	scanf("%d %d",&n,&K);
	for(int i=0;i<n;i++) scanf("%d",&A[i]);
	//iを含む中で、K以上K+A[i]未満のものがあればok
	//i以外でぎりぎりK未満のものがあればよさそう
	sort(A,A+n);
	ll sum=0;
	for(int i=0;i<n;i++) sum+=A[i];
	memset(dp,false,sizeof(dp));
	dp[0]=true;
	int ret=0;
	for(int i=n-1;i>=0;i--)
	{
		bool up=false;
		for(int j=0;j<K;j++)
		{
			if(dp[j]&&j+sum>=K) up=true;
		}
		if(!up) ret++;
		sum-=A[i];
		for(int j=K-1;j>=A[i];j--) dp[j]|=dp[j-A[i]];
	}
	printf("%d\n",ret);
	return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();

            var ans = 0;
            for (int i = 0; i < 100000; i++)
            {
                var tmp = i * i;
                if(tmp > n)
                {
                    Console.WriteLine(ans);
                    return;
                }
                ans = tmp;
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public string[] ArrayString(int N)
        {
            string[] Array = new string[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = next();
            }
            return Array;
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


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

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e10;
//const ll MOD = 1e9 + 7;
const ll MOD = 998244353;


int main(){
	ll n, m, d;
	cin >> n >> m >> d;
	double f;
	if (d == 0){
		f = (double)1 / (double)n;
	}
	else if (n <= 2 * d){
		f = (double)2 * ((double)n - (double)d) / (double)n / (double)n;
	}
	else{
		f = (double)2 * (double)d / (double)n / (double)n + ((double)n - (double)2 * (double)d) * (double)2 / (double)n / (double)n;
	}
	double ans = f*(double)(m - 1);
	cout << setprecision(10)<< ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll x;
    cin >> x;
    if(x>=30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

int main()
{
  int n;
  int x,y,b,p;
  int sum;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>x>>y>>b>>p;
    sum=x*b+y*p;
    if(b<5)
      b=5;
    if(p<2)
      p=2;
    if(sum>x*80/100*b+y*80/100*p)
      sum=x*80/100*b+y*80/100*p;
    cout<<sum<<'\n';
  }
  return 0;
}



Measured memory_bytes: 3100
#float型を許すな
#numpyはpythonで
#dp
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

alphasm=[chr(i) for i in range(97, 97+26)]
a=input().rstrip()
if a in alphasm:
    print("a")
else:
    print("A")

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

int main() {
  long long N;
  cin >> N;

  string res = "";
  while (N) {
    N--;
    res += (char)('a' + (N % 26));
    N /= 26;
  }

  reverse(res.begin(), res.end());
  cout << res << endl;
}


Measured memory_bytes: 3628
"use strict";
const main = arg => {
  let NumAmount = arg.split("\n")[0]*1;
  let row1 = arg.split("\n")[1].split(" ").map(x => x*1);
  // ansのデフォルト設定
  let ans = "Yes";
  // ループする
  // ループ用に小さい値を設定
  let pre = -9999;
  for(let i = 0; i < NumAmount; i++){
    // 一個小さくしてそれでもpreより小さいようならpreにその値を代入
    if(row1[i] -1 >= pre){
      pre = row1[i] -1
    }
    // それがダメなら-1しない値を代入
    else if( row1[i] >= pre){
      pre = row1[i]
    // それでもダメならNoで終了
    } else {
      ans = "No"
      break;
    }
  }
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1},
};

use std::collections::HashMap;

fn func(a: u128, b: u128, c: u128, d: u128, k: u128, memo: &mut HashMap<u128, u128>) -> u128 {
   if memo.contains_key(&k) {
      return memo[&k];
   }

   if k == 0 {
      return 0;
   }
   if k == 1 {
      return d;
   }

   let mut cost = k * d;

   cost = std::cmp::min(
      cost,
      (k - (k / 5) * 5) * d + c + func(a, b, c, d, k / 5, memo),
   );
   cost = std::cmp::min(
      cost,
      (k - (k / 3) * 3) * d + b + func(a, b, c, d, k / 3, memo),
   );
   cost = std::cmp::min(
      cost,
      (k - (k / 2) * 2) * d + a + func(a, b, c, d, k / 2, memo),
   );

   cost = std::cmp::min(
      cost,
      (((k + 5 - 1) / 5) * 5 - k) * d + c + func(a, b, c, d, (k + 5 - 1) / 5, memo),
   );
   cost = std::cmp::min(
      cost,
      (((k + 3 - 1) / 3) * 3 - k) * d + b + func(a, b, c, d, (k + 3 - 1) / 3, memo),
   );
   cost = std::cmp::min(
      cost,
      (((k + 2 - 1) / 2) * 2 - k) * d + a + func(a, b, c, d, (k + 2 - 1) / 2, memo),
   );

   memo.insert(k, cost);

   return cost;
}

#[fastout]
fn main() {
   input! {
      t:u128
   }
   for _ in 0..t {
      input! {
         n:u128,a:u128,b:u128,c:u128,d:u128
      }
      let mut memo = HashMap::new();
      let buf = std::cmp::min(d * n, func(a, b, c, d, n, &mut memo));
      println!("{}", buf);
   }
}


Measured memory_bytes: 3084
read N
read X
ANS=0
ANS_TMP=0
MIN=0
MAX=0
count=1

for Power in $X
do
if [ $count -eq 1 ] ;then
MIN=$Power
MAX=$Power
elif [ $Power -lt $MIN ] ;then
MIN=$Power
elif [ $Power -gt $MAX ] ;then
MAX=$Power
fi
count=$(( $count + 1 ))
done

while true
do
ANS_TMP=0
for Power in $X
do
ANS_TMP=$(( $(( $(( $Power - $MIN )) * $(( $Power - $MIN )) )) + $ANS_TMP ))
done

MIN=$(( $MIN + 1 ))

if [ $ANS -eq 0 ] ;then
  ANS=$ANS_TMP
elif [ $ANS_TMP -lt $ANS ] ;then
  ANS=$ANS_TMP
fi

if [ $MIN -gt $MAX ] ;then
  break
fi

done

echo $ANS

exit 0

Measured memory_bytes: 1396
#include <iostream>

using namespace std;

int main() {
  int a[3][3];
  int c[3][3] = { 0 };
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> a[i][j];
    }
  }
  int n;
  cin >> n;
  int b[n];
  for (int i=0; i < n; ++i) {
    cin >> b[i];
  }
  for (int i=0; i < n; ++i) {
    for (int j=0; j < 3; ++j) {
      for (int k=0; k < 3; ++k) {
        if (b[i] == a[j][k]) c[j][k] = 1;
      }
    }
  }
  

  if (c[0][0] + c[0][1] + c[0][2] == 3) cout << "Yes" << endl;
  else if (c[1][0] + c[1][1] + c[2][2] == 3) cout << "Yes" << endl;
  else if (c[2][0] + c[2][1] + c[2][2] == 3) cout << "Yes" << endl;
  else if (c[0][0] + c[1][0] + c[2][0] == 3) cout << "Yes" << endl;
  else if (c[0][1] + c[1][1] + c[2][1] == 3) cout << "Yes" << endl;
  else if (c[0][2] + c[1][2] + c[2][2] == 3) cout << "Yes" << endl;
  else if (c[0][0] + c[1][1] + c[2][2] == 3) cout << "Yes" << endl;
  else if (c[0][2] + c[1][1] + c[2][0] == 3) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    
    static int n, m, q, max;

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        n = Integer.parseInt(sc.next());
        m = Integer.parseInt(sc.next());
        q = Integer.parseInt(sc.next());
        int[][] abcd = new int[q][4];
        for(int i = 0; i < q; i++){
            for(int j = 0; j < 4; j++){
                abcd[i][j] = Integer.parseInt(sc.next());
            }
        }
        max = 0;
        dfs(new int[n+1], abcd, 0);
        System.out.println(max);
    }
    
    static void dfs(int[] a, int[][] abcd, int i){
        if(i > n){
            int point = 0;
            for(int j = 0; j < q; j++){
                if(a[abcd[j][1]] - a[abcd[j][0]] == abcd[j][2]){
                    point += abcd[j][3];
                }
            }
            if(point > max) max = point;
            return;
        }
        
        int k = (i == 0) ? 1 : a[i-1];
        for(int j = k; j <= m; j++){
            a[i] = j;
            dfs(a, abcd, i+1);
        }
    }
}

Measured memory_bytes: 36608