akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++) 
using namespace std;
typedef long long ll;

int main(){
	int a,b; cin>>a>>b;
	int c=a*b;
	if(c%2==1) cout << "Yes" << endl;
	else cout << "No" << endl;	
}



Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-7;
const double PI  = acos(-1.0);

#define EQ(a,b) (abs((a)-(b))<EPS)
#define GE(a,b) ((a)-(b)>-EPS)

const double length=1;
struct swimmer{
	int tempo,cnt,cnt_max;
	double pos;
	bool operator<(const swimmer &other) const{
		return tempo<other.tempo;
	}
};
int main(){
	int n;
	while(cin>>n,n){
		vector<swimmer> left;
		vector<swimmer> right;
		REP(i,n){
			int t,c;
			cin>>t>>c;
			left.push_back(swimmer());
			left[i].tempo=t;
			left[i].cnt_max=c;
		}
		sort(ALL(left));

		int turn;
		for(turn=1;;turn++){
			double left_prev_pos=10;
			REP(i,left.size()){
				double new_pos=left[i].pos+length/left[i].tempo;
				if(GE(new_pos,left_prev_pos)){
					left[i].pos=left_prev_pos;
				}else{
					left[i].pos=new_pos;
					left_prev_pos=new_pos;
				}
			}
			double right_prev_pos=10;
			REP(i,right.size()){
				double new_pos=right[i].pos+length/right[i].tempo;
				if(GE(new_pos,right_prev_pos)){
					right[i].pos=right_prev_pos;
				}else{
					right[i].pos=new_pos;
					right_prev_pos=new_pos;
				}
			}

			vector<swimmer> left_done_swimmers;
			REP(i,left.size()){
				if(GE(left[i].pos,length)){
					left_done_swimmers.push_back(left[i]);
				}
			}
			left.erase(left.begin(),left.begin()+left_done_swimmers.size());

			vector<swimmer> right_done_swimmers;
			int num_right_done_swimmers=0;
			REP(i,right.size()){
				if(GE(right[i].pos,length)){
					num_right_done_swimmers++;
					right[i].cnt++;
					if(right[i].cnt<right[i].cnt_max){
						right_done_swimmers.push_back(right[i]);
					}
				}
			}
			right.erase(right.begin(),right.begin()+num_right_done_swimmers);

			sort(ALL(left_done_swimmers));
			sort(ALL(right_done_swimmers));
			REP(i,left_done_swimmers.size()){
				left_done_swimmers[i].pos=0;
			}
			REP(i,right_done_swimmers.size()){
				right_done_swimmers[i].pos=0;
			}
			right.insert(right.end(),ALL(left_done_swimmers));
			left.insert(left.end(),ALL(right_done_swimmers));
			if(left.size()==0&&right.size()==0){
				break;
			}
		}
		cout<<turn<<endl;
	}
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

void dfs(int s,vector<int> &visited, bool &closedpath,vector<vector<int> > &G){
    if (visited[s]==1){
        closedpath=true;
        return;
    }
    visited[s]=1;
    for(auto w:G[s]){
        if(visited[w]!=2)dfs(w,visited,closedpath,G);
    }
    visited[s]=2;
}

int dfs2(int s,vector<int> &dist, vector<vector<int>> &G){
	if(dist[s]!=-1)return dist[s];
    else if(G[s].empty()){
    	dist[s]=0;return dist[s];
    }else{
        int d=0;
    	for(auto w:G[s])d=max(d,dfs2(w,dist,G));
        dist[s]=d+1;return dist[s];
    }
}

int main(){
    int N;cin>>N;
    vector<vector<int> > a(N,vector<int>(N-1));
    REP(i,N)REP(j,N-1){cin>>a[i][j];a[i][j]--;}
    vector<vector<int> > G(N*N);
    REP(i,N)REP(j,N-2){
        G[min(i,a[i][j])*N+max(i,a[i][j])].push_back(min(i,a[i][j+1])*N+max(i,a[i][j+1]));
    }
    bool cycle=false;
    vector<int> dist(N*N,-1);
    vector<int> visited(N*N,0);
    REP(i,N){
        if(visited[min(i,a[i][0])*N+max(i,a[i][0])]==0)
          dfs(min(i,a[i][0])*N+max(i,a[i][0]),visited,cycle,G);
    }
    if (cycle) cout<<-1<<endl;
    else{

	int res=1;
      REP(i,N)REP(j,N){if(j>i)res=max(res,dfs2(i*N+j,dist,G));}
        cout<<res+1<<endl;
    }

    return 0;
}

Measured memory_bytes: 51200
#include <iostream>
using namespace std;
int main()
{
  string S, T;
  cin >> S >> T;
  string ans = "Yes";
  int f[26];
  int g[26];
  for (int i = 0; i < 26; i++)
  {
    f[i] = -1;
    g[i] = -1;
  }
  for (int i = 0; i < S.length(); i++)
  {
    char c1 = S.at(i);
    char c2 = T.at(i);
    if (f[c1 - 'a'] == -1 && g[c2 - 'a'] == -1)
    {
      f[c1 - 'a'] = c2 - 'a';
      g[c2 - 'a'] = c1 - 'a';
    }
    else
    {
      if (c1 - 'a' != g[c2 - 'a'] || c2 - 'a' != f[c1 - 'a'])
        ans = "No";
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處
namespace Number {
    typedef long long int LL;
    // 求取 a, b 的最大公因數
    LL gcd(LL a, LL b) {
        if (a % b == 0) {
            return b;
        }
        return gcd(b, a % b);
    }
    // 求取 a, b 的最大公因數 gcd
    // 以及 x, y 使得 a*x + b*y = gcd
    LL gcd_extend(LL a, LL b, LL *x, LL *y) { 
        if (a == 0) { 
            *x = 0, *y = 1; 
            return b; 
        } 
    
        LL x1, y1; // To store results of recursive call 
        LL gcd = gcd_extend(b%a, a, &x1, &y1); 
    
        *x = y1 - (b/a) * x1; 
        *y = x1; 
    
        return gcd; 
    }
    // 求 a_inv 使得 (a * a_inv) % m = gcd(a, m)
    // 若 a, m 互質，即求 a 在 mod m 群的反元素 a_inv 
    LL mod_inv(LL a, LL m) { 
        LL x, y; 
        LL g = gcd_extend(a, m, &x, &y); 
        // 處理 x 爲負的情形 
        LL a_inv = (x%m + m) % m; 
        return a_inv;
    }
    // 求 x^n % m
    LL mod_pow(LL x, LL n, LL m) {
        if (n == 0) {
            return 1;
        } else if (n & 1) {
            LL half = mod_pow(x, n/2, m);
            return (half * half % m) * x % m;
        } else {
            LL half = mod_pow(x, n/2, m);
            return half * half % m;
        }
    }
    // 連乘
    LL mul(LL from, LL to, LL m) {
        LL ret = 1;
        for (LL i = from; i <= to; i++) {
            ret *= i;
            ret %= m;
        }
        return ret;
    }
    // 求 (C n 取 k) % m
    LL mod_comb(LL n, LL k, LL m) {
        LL mi = k < n-k ? k : n-k;
        LL up = mul(n - mi + 1, n, m);
        LL down = mul(1, mi, m);
        return (up * mod_inv(down, m)) % m;
    }
}
  
const LL MOD = (1e9) + 7;

LL fact[500005];

LL perm(LL n, LL k) {
    LL ret = fact[n];
    ret *= Number::mod_inv(fact[n - k], MOD);
    return ret % MOD;
}

LL comb(LL n, LL k) {
    LL ret = perm(n, k);
    ret *= Number::mod_inv(fact[k], MOD);
    return ret % MOD;
}


int main() {
    LL n, m;
    cin >> n >> m;

    fact[0] = 1;
    for (LL i = 1; i <= m; i++) {
        fact[i] = fact[i - 1] * i;
        fact[i] %= MOD;
    }


    // m 個先取 n 個出來排 A
    LL a_num = perm(m, n);

    LL ans = perm(m, n);
    for (LL i = 1; i <= n; i++) {
        LL sign = (i % 2 == 1) ? -1 : 1;
        ans += sign * comb(n, i) * perm(m - i, n - i);
        ans %= MOD;
        ans += MOD;
        ans %= MOD;
    }

    ans *= a_num;
    ans %= MOD;

    cout << ans << endl;

}


Measured memory_bytes: 7460
// Hint: Don't look, No need, Let'em Play.

#include <bits/stdc++.h>
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#ifndef bhupixb
    #define var(...)
    #define stl(...)
#endif

#define single_test

void solve() {
    int n;
    cin >> n;
    if (n % 1000 == 0) cout << 0 << '\n';
    else cout << (n / 1000) * 1000 + 1000 - n << '\n';
}

signed main() {
    fast;
    int t = 1;
    #ifndef single_test
        cin >> t;
    #endif
    while (t--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define REP(i,n) for(int i = 0 ; i < n ; i ++) 
#define ms(a,c) memset(a,c,sizeof a)
#define INF 1e15
int N , W , *wt , *val ;
int dp[102][100005] ;
int f(int i , int v ) {
	if(v<=0) return 0;
	if(i==N) {
		return INF;
	}
	int &ret = dp[i][v] ;
	if(ret!=-1) return ret;
	return ret = min({f(i+1,v),wt[i] + f(i+1, v-val[i])}) ;
}
int driver() {
	int sv = 0 ;
	REP(i,N){
		sv+=val[i] ;
	}
	ms(dp,-1);
	for(int v = sv ; v >= 1 ;v-- ) {
		if(f(0,v) <= W) {
			return v;
		}
	}
	return 0;	
}
int32_t main() {
	cin >> N >> W;
	wt = new int[N] ;
	val = new int[N];
	REP(i,N) {
		cin >> wt[i] >> val[i] ;
	}
	int ans = driver();
	printf("%d\n", ans);
    return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double d;
  cin >> d;
  if( d < 1.0 - 1e-9 ){
    fcout(10) << d*sqrt(2) << endl;
  }else{
    double x = (int)(d+1e-9);
    fcout(10) << max(x+1,d*sqrt(2)) << endl;
  }
  return 0;
}

Measured memory_bytes: 3260
def prime(n):#素数列挙、0(n)くらい
    if n<2:
        return []
    primes=[]
    for i in range(2, n+1):
        if all(i%j!=0 for j in primes):
            primes.append(i)
    return primes
primes=prime(55555)
n=int(input())
a=[]
for p in primes:
    if len(a)==n:
        break
    if p%5==1:
        a.append(str(p))
print(' '.join(a))

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

#define MAXN 550000

ll dp1[MAXN];
ll dp2[MAXN];
vector<vector<int>>edges(MAXN);
ll n,m;

void dfs1(int x, int p=-1){
  dp1[x]=1;
  for(auto c:edges[x]){
    if(c==p)continue;

    dfs1(c, x);
    dp1[x] *= dp1[c];
    dp1[x] %= m;
  }
  dp1[x]++;
}

void dfs2(int x, int p=-1){
  if(p==-1)dp2[x]=1;
  int ec = edges[x].size();
  vector<ll>lprod(ec, 1);
  rep(i, ec){
    int to = edges[x][i];
    if(i)lprod[i] *= lprod[i-1];
    if(p==to)continue;
    lprod[i] *= dp1[to];
    lprod[i] %= m;
  }

  vector<ll> rprod(ec, 1);
  rrep(i, ec){
    int to = edges[x][i];
    if(i<ec-1)rprod[i] *= rprod[i+1];
    if(to==p)continue;
    rprod[i]*=dp1[to];
    rprod[i] %= m;
  }

  rep(i, ec){
    int to = edges[x][i];
    if(to==p)continue;

    dp2[to] = 1;
    if(i)dp2[to] *= lprod[i-1];
    if(i<ec-1)dp2[to] *= rprod[i+1];
    dp2[to] %= m;
    dp2[to] = (dp2[to]*dp2[x]+1)%m;
    dfs2(to, x);
  }
}

ll ans[MAXN];
void  dfs3(int x, int p=-1){
    ans[x] = dp2[x];
    for(auto to: edges[x]){
      if(to==p)continue;
      ans[x] *= dp1[to];
      ans[x]%=m;
      dfs3(to, x);
    }
}

int main(){
  cin>>n>>m;
  rep(i, n-1){
    int x,y;cin>>x>>y;
    edges[x].push_back(y);
    edges[y].push_back(x);
  }
 
  dfs1(1);
  dfs2(1);
  dfs3(1);

//  rep1(i, n)cout<<dp1[i]<<' ';cout<<endl;
//  rep1(i, n)cout<<dp2[i]<<' ';cout<<endl;

  rep1(i, n)cout<<ans[i]<<endl;
 
  return 0;
}

Measured memory_bytes: 34124
#文字列を１つずつ分割
S = gets.chomp.split('')
#puts "#{S}"
prv = nil
flg = 0
#puts "#{S.length}"

(S.length).times do |i|
    #puts "#{S[i]}"
    #puts "#{prv}"
    if S[i] == prv
        flg = 1
        break
    end
    prv = S[i]
end
if flg.zero?
    puts "Good"
else
    puts "Bad"
end


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
//#define MOD 1000000007
#define MOD 998244353
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

ll inv2(ll a, ll p) {

	ll res = 1;
	while (p > 0) {
		if ((p & 1) == 1) { res *= a; res %= MOD; }
		a = a * a % MOD;
		p >>= 1;
	}
	return res;
}


ll fact[210000];
ll invfact[210000];
ll inv(ll a) {

	ll res = 1;
	int p = MOD - 2;
	while (p > 0) {
		if ((p & 1) == 1) { res *= a; res %= MOD; }
		a = a * a % MOD;
		p >>= 1;
	}
	return res;
}

ll combo(int n, int k) {
	ll res = fact[n];
	res *= invfact[k];
	res %= MOD;
	res *= invfact[n - k];
	return res % MOD;
}

void factpre(int N) {
	fact[0] = 1;
	fx(N) {
		fact[x + 1] = fact[x] * (x + 1);
		fact[x + 1] %= MOD;
	}
	invfact[N] = inv(fact[N]);
	for (int x = N - 1; x >= 0; x--) {
		invfact[x] = invfact[x + 1] * (x + 1);
		invfact[x] %= MOD;
	}
}


int main()
{
	int N, M, K;
	cin >> N >> M >> K;
	
	factpre(N);

	if (K==N-1) {
		ce(inv2(M, N));
		return 0;
	}

	ll ans = (M * inv2(M - 1, N - 1)) % MOD;

	fx(K) {
		ll res = M * inv2(M - 1, N - x - 2);
		res %= MOD;
		res *= combo(N-1,x+1);
		res %= MOD;
		ans += res;
		ans %= MOD;

	}

	ce(ans)

    return 0;
}



Measured memory_bytes: 6752
N,M = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(M)]

g = {i:[] for i in range(N)}

for a,b in ab:
    g[a-1].append(b)
    g[b-1].append(a)
    
for i in g.values():
    print(len(i))

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

template<class like_bool> inline void YES(like_bool condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class like_bool> inline void Yes(like_bool condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class like_bool> inline void POSS(like_bool condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class like_bool> inline void Poss(like_bool condition){ if(condition)cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class like_bool> inline void First(like_bool condition){ if(condition)cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)

int main(){
    int m, f, b;
    cin >> m >> f >> b;
    if(m + f >= b){
        cout << max(0, b - m) << endl;
    }else{
        cout << "NA" << endl;
    }
}



Measured memory_bytes: 3104
#!/usr/bin/env python

from collections import deque
import itertools as ite
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7
BN = 2 ** 30

N, K = map(int, raw_input().split())
ans = 0
for i in range(1, N + 1):
    num = i
    S = BN
    while num < K:
        num *= 2
        S /= 2
    ans += S
print ans * 10 ** 15 / (BN * N) / float(10 ** 15)

Measured memory_bytes: 5880
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}  
int D;
vector<int> c(26);
vector<vector<int>> s;
struct State {
  int ans = 0;
  vector<int> t;
  vector<int> sscore;
  vector<vector<int>> cscore;
};
void score(State &st, set<int> idx, int firstday) {
  vector<int> last(26);
  REP(i, D) {
    last[st.t[i]] = i + 1;
    if(i < firstday) continue;
    st.ans += s[i][st.t[i]] - st.sscore[i];
    st.sscore[i] = s[i][st.t[i]];
    
    bool flg = false;
    for(int j : idx) {
      if(st.cscore[i][j] != c[j] * (i + 1 - last[j])) {
        st.ans -= (c[j] * (i + 1 - last[j]) - st.cscore[i][j]);
        st.cscore[i][j] = c[j] * (i + 1 - last[j]);
        flg = true;
      }
    }
    if(!flg) break;
  }
}
double TIME_LIMIT = 1980;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> D;
  REP(i, 26) cin >> c[i];
  s = vector<vector<int>>(D, vector<int>(26));
  REP(i, D) REP(j, 26) cin >> s[i][j];

  State st;
  vector<int> t(D);
  REP(i, D) {
    int idx = 0;
    int max = 0;
    REP(j, 26) if(s[i][j] > max) {
      max = s[i][j];
      idx = j;
    }
    t[i] = idx;
  }
  st.t = t;
  vector<int> sscore(D);
  st.sscore = sscore;
  vector<vector<int>> cscore(D, vector<int>(26));
  st.cscore = cscore;
  set<int> idxset;
  REP(i, 26) idxset.insert(i);
  score(st, idxset, 0);
  
  clock_t start_time = clock();
  int loop = 0;
  double start_temp = 4000, end_temp = 1;
  double time = 0;
  while(true) {
    loop++;
    if(loop%1000 == 0) {
      clock_t now_time = clock();
      time = static_cast<double>(now_time - start_time) / CLOCKS_PER_SEC * 1000.0;
      if(time > TIME_LIMIT) break;
    }
    
    
    int mode = rand() % 2;
    int tmpidx, tmptype;
    idxset.clear();
    int lastans = st.ans;
    if(mode == 0) {
      int idx = rand() % D;
      int type = rand() % 26;
      tmpidx = idx;
      tmptype = st.t[idx];
      st.t[idx] = type;
      idxset.insert(type);
      idxset.insert(tmptype);
    } else {
      int idx = rand() % (D-1);
      swap(st.t[idx], st.t[idx+1]);
      tmpidx = idx;
      idxset.insert(st.t[idx]);
      idxset.insert(st.t[idx+1]);
    }
    score(st, idxset, tmpidx);
    double temp = start_temp + (end_temp - start_temp) * time / TIME_LIMIT;
    double prob = exp((st.ans-lastans)/temp);
    if(st.ans > lastans || prob > (rand()%INF)/(double)INF) {
      ;
    } else {
      if(mode == 0) {
        st.t[tmpidx] = tmptype;
      } else {
        swap(st.t[tmpidx], st.t[tmpidx+1]);
      }
      score(st, idxset, tmpidx);
    }
    //cout << st.ans << "\n";
    //if(next < now) cout << prob << "\n";
  }
  REP(i, D) cout << (st.t[i]+1) << "\n";
  //cout << st.ans << "\n";
  //cout << loop << "\n";
}

Measured memory_bytes: 4444
#include <stdio.h>
void bubbleSort(int *,int);

int main(){
  int i;
  int A[100],N;
  scanf("%d",&N);
  for(i = 0;i<N;i++){
    scanf("%d",&A[i]);    
  }
  bubbleSort(A,N);
  return 0;
}

void bubbleSort(int A[],int N){
  int i,j,k,tmp;
  int flag=1;
  i=0;
  while(flag!=0){
    flag=0;
    for(j=N-1;j >= 1;j--){
      if(A[j]<A[j-1]){
	tmp = A[j];
	A[j] = A[j-1];
	A[j-1] = tmp;
	flag=1;
	i++;
      }
    }
  }
    
    for(k=0;k<N;k++){
    printf("%d",A[k]);
    if(k!=N-1) printf(" ");
    }
    printf("\n");
    printf("%d\n",i);
  
}







Measured memory_bytes: 2728
// C - Triangular Relationship
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N,K; cin>>N>>K;
	int f = N/K;
	long long ans = (long long)f*f*f;
	if(K%2 == 0){
		int h = N/(K/2) - f;
		ans += (long long)h*h*h;
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    a, b = rli()
    for i in range(10000):
        na = i*8//100
        nb = i*10//100
        if na == a and nb == b:
            print(i)
            return
    print(-1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
//very good question related to sets......
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#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 long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
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 INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

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;
	string s;
	cin >> s;

	int q;
	cin >> q;
	int a, b;

	set<int>se[26];
	for (int i = 0; i < 26; i++)
	{
		zip(j, 0, n)
		{
			int x = s[j] - 'a';
			if (x == i)
			{
				se[i].insert(j);
			}
		}
	}
	int cnt = 0;
	zip(i, 0, q)
	{
		cnt = 0;
		cin >> a >> b;
		if (a == 1)
		{
			char c;
			cin >> c;
			int y = s[b - 1] - 'a';
			se[y].erase(b - 1);
			s[b - 1] = c;
			se[c - 'a'].insert(b - 1);
		}
		else
		{
			int c;
			cin >> c;
			b--;
			c--;
			b--;
			for (int i = 0; i < 26; i++)
			{
				if (se[i].size())
				{
					auto itr = se[i].upper_bound(b);
					if (itr != se[i].end())
					{
						int x = *itr;
						if (x <= c)
						{
							cnt++;
						}
					}
				}
			}
			cout << cnt << endl;
		}

	}

	return 0;
}



Measured memory_bytes: 24220
#include<iostream>
#include <string>
#include <math.h>

int stringToNum(std::string str)
{
    int result;
    int length = str.length();
    result = 0;
    for (int i = 0; i < length; i++)
    {
        int digit;
        if (str[length-1-i] == 'A') {
            digit = 1;
        } else if (str[length-1-i] == 'C') {
            digit = 2;
        } else if (str[length-1-i] == 'G') {
            digit = 3;
        } else if (str[length-1-i] == 'T') {
            digit = 4;
        } else {
            digit = 0;
        }
        result += digit * pow(5,i);
    }
    return result;
}

int main() {
    int number = 1;
    for (int i = 0; i < 10; i++) {
        number *= 5;
    }
    bool dictionary[number];
    for (int i = 0; i < number;i++)
    {
        dictionary[i] = false;
    }
    int n;
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::string order;
        std::cin >> order;
        if (order == "insert") {
            std::string insert_string;
            std::cin >> insert_string;
            dictionary[stringToNum(insert_string)] = true;
        }
        if (order == "find") {
            std::string find_string;
            std::cin >> find_string;
            if (dictionary[stringToNum(find_string)]) {
                std::cout << "yes" << std::endl;
            } else {
                std::cout << "no" << std::endl;
            }

        }
    }
}



Measured memory_bytes: 12948
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////

int n,k,ans;
signed main(){
  cin>>n>>k;
  repd(i,k,n+2){
    int m = (i-1)*i%MOD*modinv(2)%MOD;
    int x = (2*n-i+1)*i%MOD*modinv(2)%MOD;
    add(ans,x-m+1);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define rep(n) for (ll i = 0; i < n; i++)
#define repc(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a + n
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b)/gcd(a, b)
#define int long long int
#define ull unsigned long long

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

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int cnt = 0;
    for(int i= 1;i<=n;i++){
    	if(i &1) cnt++;
    }
    cout<<(float)cnt/n<<endl;
    return 0;
}






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

l=[]
for x in range(n):
     l.append(abs(2*x-n+1))
l=sorted(l)
for x in range(n):
     if l[x]!=a[x]:print(0);exit()

print((2**(n//2))%(10**9+7))

Measured memory_bytes: 20516
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input = br.readLine();
		
		System.out.println(input.substring(0, 1)+(input.length()-2)+input.substring(input.length() - 1, input.length()));

	}

}


Measured memory_bytes: 21076
N,X,Y=map(int,input().split())
ans=[0]*(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
      ans[min(abs(j-i), abs(X-i) + 1 + abs(j-Y ), abs(Y-i) + 1 + abs(j-X))-1]+=1
for i in range(N-1):
    print(ans[i])

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

int main() {
	int a, b, c;
	cin >> a >> b >> c ;
	if(a>b) swap(a,b);
	if(b>c) swap(b,c);
	if(a>b) swap(a,b);
	cout << a << " " << b << " " << c << endl;
	return 0;
}


Measured memory_bytes: 3060
parseInt(x) = parse(Int, x)
parseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
  n = readline() |> parseInt
  b = readline() |> split |> parseArray

  a=zeros(Int,n)
  a[1]=b[1]
  for i in 2:n-1
    a[i]=min(b[i-1],b[i])
  end
  a[n]=b[end]
  ans=sum(a)

  println(ans)
end

main()


Measured memory_bytes: 168964
n = int(input())
a = list(map(int,input().split()))
cnt = [0]*8
free = 0
for i in range(n):
    if a[i] <= 3199:
        cnt[a[i]//400] += 1
    else:
        free += 1
print(max(1,8-cnt.count(0)),8-cnt.count(0)+free)

Measured memory_bytes: 9084
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;

int main(){
	while(1){
		int n;
		cin >> n;
		if(n == 0) break;
		
		lli sum = 0;
		for(int i=1; i*i<=n; i++){
			if(n%i == 0) sum += n/i + i;
			if(i*i == n) sum -= i;
		}
		sum -= n;
		if(sum == n){
			cout << "perfect number" << endl;
		}else if(sum > n){
			cout << "abundant number" << endl;
		}else{
			cout << "deficient number" << endl;
		}
	}
	return 0;
}



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

int main(){
	// your code goes here
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	cout.tie(NULL);
	
	long long int h,w;
	cin>>h>>w;
	
	long long int ans=(h*w)/2;
	if((h*w)%2==1){
	    ans++;
	}
	if(h==1 || w==1){
	    ans=1;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
n=int(input())
dp=[[0,0,0]]*n
for i in range(n):
  a,b,c=map(int,input().split())
  d=dp[i-1]
  dp[i]=[max(d[1],d[2])+a,max(d[0],d[2])+b,max(d[0],d[1])+c]
print(max(dp[n-1]))

Measured memory_bytes: 56920
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const int vx[]={1,0,-1,0}, vy[]={0,1,0,-1};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

int main(){
	ll n,a,b; cin >> n >> a >> b;
	
	if(a == b) cout << 1 << endl;
	else if(b < a or n == 1) cout << 0 << endl;
	else cout << ((n - 1) * b + a) - ((n - 1) * a + b) + 1 << endl;
	return 0;
}


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

count = 1

if 1 in a:
  ind = a.index(1)
  
  for i in range(ind,n):
    if a[i] == count+1:
      count += 1

  print(len(a) - count)
else:
  print(-1)

Measured memory_bytes: 26524
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        var c = int.Parse(line[2]);
        Console.WriteLine(2 * b == a + c ? "YES" : "NO");
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
signed main(){
    int n,m;cin >>n >> m;
    vector<int> divs;
    for(int i = 1;i*i <= m;i++){
        if(m%i == 0){
            divs.push_back(i);
            if(i*i != m)divs.push_back(m/i);
        }

    }
    sort(divs.rbegin(),divs.rend());
    for(auto g:divs){
        if(m/g >= n){
            cout << g << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<ll,pair<ll,ll>>;
#define MAX 1000000
#define MOD 998244353
#define INF 1000000000000000000

vector<int> tree;
int n=1;
int solve_max(int a,int b,int i,int left,int right){
  if(b<=left||right<=a){
    return 0;
  }
  if(a<=left&&right<=b){
    return tree[i];
  }
  return max(solve_max(a,b,2*i+1,left,(left+right)/2),solve_max(a,b,2*i+2,(left+right)/2,right));
}

void update(int k,int x){
  int i=n-1+k;
  tree[i]=x;
  while(i>0){
    i=(i-1)/2;
    tree[i]=max(tree[2*i+1],tree[2*i+2]);
  }
}

int solve_min_j(int a,int b,int V){
  if(solve_max(a,b,0,0,n)<V){
    return b;
  }
  while(a+1<b){
    int c=(a+b)/2;
    int x=solve_max(a,c,0,0,n);
    if(x>=V){
      b=c;
    }else{
      a=c;
    }
  }
  return a;
}



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

  while(n<N){
    n<<=1;
  }
  tree.resize(2*n-1.0);
  for(int i=0;i<N;i++){
    tree[i+n-1]=A[i];
  }
  for(int i=n-2;i>=0;i--){
    tree[i]=max(tree[2*i+1],tree[2*i+2]);
  }

  vector<int> ans;
  for(int i=0;i<Q;i++){
    int T;
    cin>>T;
    if(T==1){
      int a,v;
      cin>>a>>v;
      a--;
      update(a,v);
    }else if(T==2){
      int L,R;
      cin>>L>>R;
      L--;
      ans.push_back(solve_max(L,R,0,0,n));
    }else{
      int X,V;
      cin>>X>>V;
      X--;
      ans.push_back(solve_min_j(X,N,V)+1);
    }
  }

  for(auto x:ans){
    cout<<x<<endl;
  }
}


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

int main () {
    int n;
    std::string s, a, ans = "";
    std::cin >> n >> s;
    std::string c = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for(int i = 0; i < s.length() ; ++i) {
        for(int j = 0; ; ++j) {
            if(s[i] == c[j]) {
                a = c[j + n];
                ans += a;
                break;
            }
        }
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
map<P, int> rev;
vector<int> ans;
template< typename flow_t >
struct Dinic {
  const flow_t INF;
  struct edge {
    int to;
    flow_t cap;
    int rev;
    bool isrev;
    int idx;
  };
  vector< vector< edge > > graph;
  vector< int > min_cost, iter;
  Dinic(int V) : INF(numeric_limits< flow_t >::max()), graph(V) {}
  void add_edge(int from, int to, flow_t cap, int idx = -1) {
    graph[from].emplace_back((edge) {to, cap, (int) graph[to].size(), false, idx});
    graph[to].emplace_back((edge) {from, 0, (int) graph[from].size() - 1, true, idx});
  }
  bool bfs(int s, int t) {
    min_cost.assign(graph.size(), -1);
    queue< int > que;
    min_cost[s] = 0;
    que.push(s);
    while(!que.empty() && min_cost[t] == -1) {
      int p = que.front();
      que.pop();
      for(auto &e : graph[p]) {
        if(e.cap > 0 && min_cost[e.to] == -1) {
          min_cost[e.to] = min_cost[p] + 1;
          que.push(e.to);
        }
      }
    }
    return min_cost[t] != -1;
  }
  flow_t dfs(int idx, const int t, flow_t flow) {
    if(idx == t) return flow;
    for(int &i = iter[idx]; i < graph[idx].size(); i++) {
      edge &e = graph[idx][i];
      if(e.cap > 0 && min_cost[idx] < min_cost[e.to]) {
        flow_t d = dfs(e.to, t, min(flow, e.cap));
        if(d > 0) {
          e.cap -= d;
          graph[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  flow_t max_flow(int s, int t) {
    flow_t flow = 0;
    while(bfs(s, t)) {
      iter.assign(graph.size(), 0);
      flow_t f = 0;
      while((f = dfs(s, t, INF)) > 0) flow += f;
    }
    return flow;
  }
  void output() {
    for(int i = 0; i < graph.size(); i++) {
      for(auto &e : graph[i]) {
        if(e.isrev) continue;
        auto &rev_e = graph[e.to][e.rev];
        if(rev_e.cap==1 && rev[{i, e.to}] > 0) {
          ans.push_back(rev[{i, e.to}]);
        }
      }
    }
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n, m; cin >> n >> m;
  Dinic<int> flow(n);
  for(int i=0;i<m;++i) {
    int a, b; cin >> a >> b;
    a--; b--;
    flow.add_edge(a, b, 1);
    flow.add_edge(b, a, 1);
    rev[{b, a}] = i+1;
  }
  int s, t; cin >> s >> t;
  s--; t--;
  int f = flow.max_flow(s, t);
  flow.output();
  cout << f << endl;
  cout << (int)(ans.size()) << endl;
  for(auto &e: ans) {
    cout << e << endl;
  }
}



Measured memory_bytes: 3428
n = int(input())
li = []

for _ in range(n):
  li.append(list(map(int, input().split())))

dp = [[0] * 3 for _ in range(100010)]

for i in range(n):
  for j in range(3):
    for k in range(3):
      if j != k:
        dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + li[i][k])

print(max(dp[n]))

Measured memory_bytes: 74072
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

ll bans[51]; // レベルNバーガーの長さ
ll pat[51]; // レベルNバーガーにパティが何枚あるか


// levelバーガーをしたからx枚のとき，何枚のパティを食べれるか
ll eat(ll L, ll x){

    if(x == 0) return 0;
    else if(x == 1){
        if(L == 0) return 1;
        else return 0;
    }
    else if(x <= 1 + bans[L-1]){
        return eat(L - 1, x - 1);
    }
    else if(x <= bans[L] - 1){
        return pat[L - 1] + eat(L - 1, x - 2 - bans[L - 1] ) + 1;
    }
    else if(x == bans[L]){
        return pat[L];
    }

}

int main(){

    ll N, X;
    cin >> N >> X;

    bans[0] = 1;
    for(int i = 1; i <= N; i++){
        bans[i] = 2 * bans[i-1] + 3;
    }
    

    pat[0] = 1;
    for(int i = 1; i <= N; i++){
        pat[i] = 2 * pat[i-1] + 1;
    }

    cout << eat(N, X) << endl; 


}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
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; }
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main()
{

    int n,k;
    cin >> n >> k;

    int p,r;
    ll ans = 0;
    for (int b=1; b<n+1; ++b)
    {
        p = n/b;
        r = n%b;
        // cout << "p: " << p << " r: " << r << endl;
        ans += p*max(0,b-1-k+1);
        ans += max(0,r-k+1);
        // cout << "ans: " << ans << endl;
    }
    
    if(k==0) ans -= n;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
Author:Jenil Mehta
Not yet serious but trying to be serious :)
Coding is lub
*/
 
#include <iostream>
#include <sstream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
typedef long long int ll;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
using namespace std;
int main()
{
    ll n;
    cin>>n;
    ll dp[n];
    ll a[n];
    ll i,j;
    ll ans=0;
    ll index=0;
    vector <ll> res;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    dp[0]=0;
    dp[1]=abs(a[0]-a[1]);
    for(i=2;i<n;i++)
    {
        dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
l = [1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889, 13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857, 
71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580, 146316, 154177, 164817, 174438, 185836, 194157, 207927, 218812, 233268, 245277, 257857, 268182, 288216, 299257, 313635, 330204, 347836, 362973, 383709, 397042, 416448, 434025, 456967, 471948, 499740, 515581, 536073, 559758, 583960, 604833, 633651, 652216, 683712, 
709065, 734233, 754734, 793188, 818917, 846603, 874512, 909496, 933081, 977145, 1006126, 1041504, 1073385, 1106467, 1138536, 1187112, 1215145, 1255101, 1295142, 1342852, 1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570, 1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104, 2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249, 3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949, 4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008, 5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 
6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772, 10813692]

K=int(input())


print(l[K-1])

Measured memory_bytes: 62340
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!

#include <bits/stdc++.h>
using namespace std;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;

// ------------------------------------------------------------------------------------------------

const ll MOD = 1e9 + 7;
ll n, k, ans;

ll bin_exp(ll b, ll e, ll mod) {
    ll ret = 1;
    while (e > 0) {
        if (e & 1) {
            ret *= b; ret %= mod;
        }
        b *= b; b %= mod;
        e >>= 1;
    }
    return ret;
}

void func() {
    cin >> n >> k;
    ans = n - k + 1;
    cout << ans << endl;
    for (ll i = 2, a = n - k, b = k - 1; i <= k; i++, a--, b--) {
        ans *= a * b; ans %= MOD;
        ans *= bin_exp(i * (i - 1), MOD - 2, MOD); ans %= MOD;
        cout << ans << endl;
    }
}

int main() {
    fast_io; cout.precision(32);
    ll t = 1; // cin >> t;
    for (ll i = 1; i <= t; i++) {
        func();
    }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a[4], b;
  scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]);
  
  for (int i = 0; i < 4; i++){
    for (int j = i; j < 4; j++){
      if(a[i] > a[j]){
        b = a[i];
        a[i] = a[j];
        a[j] = b;
      }
    }
  }
  if(a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9){
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  
  return 0;
}

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

using namespace std;

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define per(i, a, b) for (auto i = (b) - 1; i >= (a); --i)
#define trav(x, v) for (auto &x : v)

#define sz(x) int((x).size())
#define eb(x...) emplace_back(x)
#define ff first
#define ss second

using ll = int64_t;

const int M = 1e9 + 7;

template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

const int B = 21;
int dp[1 << B];

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n; cin >> n;
	int a[n][n]; rep(i, 0, n) rep(j, 0, n) cin >> a[i][j];
	dp[(1 << n) - 1] = 1;
	per(S, 0, 1 << n) {
		int i = __builtin_popcount(S);
		rep(j, 0, n)
			if ((~S & 1 << j) && a[i][j])
				(dp[S] += dp[S | 1 << j]) %= M;
	}
	cout << dp[0];
}

Measured memory_bytes: 8448
#include<stdio.h>
#define INFTY 1000000000

void merge(int *,int,int,int);
void mergeSort(int *,int,int); 

int con = 0;

int main(){
  int i,n,S[500001];
  scanf("%d",&n);
  for(i = 0; i < n; i++) scanf("%d",&S[i]);
  mergeSort(S,0,n);
  for(i = 0; i < n - 1; i++) printf("%d ",S[i]);
  printf("%d\n",S[n-1]);
  printf("%d\n",con);
  return 0;
}
void merge(int *A, int left, int mid, int right){
  int n1 = mid - left ,n2 = right - mid,i,j,k;
  int L[n1+1],R[n2+1];
  for(i = 0; i < n1; i++) L[i] = A[left + i];
  for(i = 0; i < n2; i++) R[i] = A[mid + i];
  L[n1] =  INFTY;
  R[n2] =  INFTY;
  i = 0; j = 0;
  for(k = left; k < right; k++){
    con++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
    }
    else{
      A[k] = R[j];
      j = j + 1;
    }
  }
}

void mergeSort(int *A,int left, int right){
  int mid;
  if (left + 1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}



Measured memory_bytes: 5600
s = int(input())
p = [s]
for i in range(1000000):
    if s % 2 == 0:
        s = s//2
    elif s % 2 == 1:
        s = 3*s+1
    
    if p.count(s) == 0:
        p.append(s)
    else:
        print(i+2)
        exit()

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n,w;
  cin>>n>>w;
  long long int weight,val;
  long long int result[w+1]={0};
 for(int item = 0;item<n;item++){
   cin>>weight>>val;
     for(long long int wal=w-weight;wal>=0;wal--){
       result[wal+weight]=max(result[wal+weight],val+result[wal]);
     }
 }
 
         
   cout<<result[w];
      return 0;
                                                                  }                                 
                                                                  
                                                                  
  


Measured memory_bytes: 1024
n,a,b = map(int,input().split())

mod = 10**9+7
res = pow(2,n,mod) - 1

p = 1
for i in range(n,n-a,-1):
    p = p*i%mod

for i in range(1,a+1):
    p = p*pow(i,mod-2,mod)%mod

q = 1
for i in range(n,n-b,-1):
    q = q*i%mod

for i in range(1,b+1):
    q = q*pow(i,mod-2,mod)%mod


print((res-p-q)%mod)

Measured memory_bytes: 41424
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
using matrix = vector<vector<uint>>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acos(-1);

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

    ld R;
    cin >> R;
    printf("%.10Lf\n", 2 * PI * R);
    return 0;
}


Measured memory_bytes: 3812