akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define WHITE -2
#define GRAY 0
#define BLACK 1
#define INF -1
#define N 100

typedef struct{
  int color;
  int time;
  int node;
}Data;

int a[N][N], que[N];
int n, size;
int head, tail;

Data data[N];

void bfs(int);
void enqueue(int);
int dequeue();

int main(){

  int i, j, u, k, v;

  scanf("%d",&n);
  
  for(i=0; i<n; i++){
    data[i].color= WHITE;
    data[i].time= INF;
    for(j=0; j<n; j++){
      a[i][j]=0;
    }
  }
  for(i=0; i<n; i++){
    scanf("%d %d", &u, &k);//u...頂点の番号 k...いくつ頂点が隣接してるか
    data[i].node= u;
    for(j=0; j<k; j++){
      scanf("%d", &v);
      a[u-1][v-1]= 1;
    }
  }

  bfs(0);

  //print
  for(i=0; i<n; i++){
    printf("%d %d\n", data[i].node, data[i].time);
  }

  return 0;
}

void bfs(int time){

  int u, i;
  //訪れたらGRAY. timeは1増えて、それが与えられる
  data[time].color= GRAY; //今後GRAYだとtimeはカウントされない
  data[time].time= 0;

  enqueue(time);

  while(size>0){ //中に何か入っている場合＝まだ調べるものが残っている場合

    u= dequeue(); // 先頭一つ出す=行って帰ってきて調べ終わり

    for(i=0; i<n; i++){

      if(a[u][i]== 1 && data[i].color ==WHITE){
	data[i].color=GRAY;
	data[i].time=data[u].time+1;
	enqueue(i);
      }
    }
    data[u].color=BLACK;
  }

}
void enqueue(int u){

  que[tail]= u;
  size++;
  if(tail==N) tail=0;
  else tail++;
}
int dequeue(){

  int x=0;

  x=head;
  if(head==N) head=0; //headが最後尾だった時
  else head++;
  size--;
  return que[x];
}



Measured memory_bytes: 2112
N, W = [int(i) for i in input().split()]
WV = [[int(i) for i in input().split()] for j in range(N)]

import numpy as np
max_value = np.sum(np.array(WV), axis=0)[1]

# dp[v]: 価値vを達成するのに必要な重さの最小値
dp = np.full(max_value + 1, W + 1, dtype='int64')

dp[0] = 0
for w, v in WV:
    # 価値i(0 <= i <= max_value - v)のときの重さの最小値に対し
    # 次の荷物を入れて、価値i+vのときの重さの最小値を更新
    np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
print(np.max(np.where(dp <= W)))


Measured memory_bytes: 14844
#include <iostream>
using namespace std;
int main()
{
    int n, s;
    while (cin >> n >> s, (s | n)) {
        int res = 0;
        for (int i = 0; i < (1 << 10); ++i) {
            int t = 0, c = 0;
            for (int j = 0; j < 10; ++j) if ((i >> j) & 1) {
                t += j;
                c++;
            }
            if (c == n && t == s) res++;
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,ans=0; cin >> N;
  string S; cin >> S;
  for(int i=0; i<N-2; i++) {
    if(S[i]=='A' && S[i+1]=='B' && S[i+2]=='C') ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3572
//#include<stdio.h>
//#include<stdlib.h>
#include<bits/stdc++.h>
//#define Min(a,b,c) min((a),min((b),(c)))
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pb(x) push_back(x)
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-11
#define MEM(x) memset(x,0,sizeof(x))
//#define N 200005
#define M
#define pi 3.14159265359
using namespace std;
typedef long long LL;
vector<LL> ans; 
int mod=1e9+7;
LL dp[1000005];
int main(){
	memset(dp,0,sizeof(dp));
	LL n;
	scanf("%lld",&n);
	dp[1]=n;
	LL sum=0;
	for(int i=2;i<=n;i++){
		dp[i]=sum;
		dp[i]+=n-i+2;
		if(i==2)
		dp[i]--;
		dp[i]%=mod;
		dp[i]+=(n-1)*(n-1)%mod;
		dp[i]%=mod;
		dp[i]+=dp[i-1];
		dp[i]%=mod;
		sum+=dp[i-2];
		sum%=mod;
	}
	printf("%lld\n",dp[n]);
}
/*
Y  * (5y-4)(y+1)*/


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

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;


int main(){
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> C(12);
    vector<vector<int>> A(12, vector<int>(12));
    rep(i, N){
        cin >> C.at(i);
        rep(j, M){
            cin >> A.at(i).at(j); 
        }
    }

    int ans = INF;

    for (int tmp = 0; tmp < (1 << N); tmp++) {
    bitset<12> s(tmp);
 
    vector<int> a_sum(M, 0);
    int price = 0;

    rep(i, N){
      if (s.test(i)) {
          price += C.at(i);
          rep(j, M){
              a_sum.at(j) += A.at(i).at(j);
          }
      }
    }

    bool flag = true;
    rep(i, M){
        if(a_sum.at(i) < X){
            flag = false;
            break;
        }
    }

    if(flag){
        ans = min(ans, price);
    }
  }

  if(ans == INF) cout << -1 << endl;
  else cout << ans << endl;
}


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

int main(){
	while(1){
		int m,n1,n2;//n2は最大人数
		cin>>m>>n1>>n2;

		if(m==0&&n1==0&&n2==0)
			break;
		
		int P[200];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		
		int gap=-1;
 		int n=-1;

 		for(int i=n1;i<=n2;i++){
			int g=P[i-1]-P[i];

			if(gap<=g){
				gap=g;
				n=i;
			}
		}

		cout<<n<<endl;
	}
	
	return 0;
}



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

int main() {
  string s;
  cin >> s;
  s += string(15 - s.size(), 'o');
  int x = count(s.begin(), s.end(), 'o');
  cout << ((8 <= x) ? "YES" : "NO") << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int n,r[100],c[100][100];
  int i,j,k,l,m;
   
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d%d",&r[i],&j);
  }
  r[n]=j;
  for(i=1;i<=n;i++){
    c[i][i]=0;
  }
     
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j =i+l-1;
      c[i][j]=1000000;
      for(k=i;k<=j-1;k++){
    m=c[i][k]+c[k+1][j]+(r[i-1]*r[k]*r[j]);
       
    if(c[i][j]>m){
      c[i][j]=m;
    }
      }
    }
  }
  printf("%d\n",c[1][n]);
   
  return 0;
}

Measured memory_bytes: 636
#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=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ASC(v) sort(v.begin(), v.end());
#define DESC(v) sort(v.begin(), v.end(), greater<int>());
#define REVERSE(v) reverse(v.begin(), v.end());
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main() {
	ll A, B, C;
	cin >> A >> B >> C;

	bool can = false;
	if (A == B && B != C) can = true;
	if (A == C && B != C) can = true;
	if (B == C && A != C) can = true;
	if (can) cout << "Yes" << "\n";
	else cout << "No" << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>
#include <tuple>



typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
#define rep(i,n) FOR(i,0,n)
#define sz(x) int(x.size())


template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;




int main(){
    int h ,w, k;
    cin>> h>> w>> k;
    char choco[h][w];
    rep (i,h) rep(j,w){
        char a;
        cin>>a;
        choco[i][j] = a;
    }
    
    vector<vector<int>> memo(h+1, vector<int>(w,0));
    rep(i,h) rep(j,w){
        if (choco[i][j]=='1') memo[i+1][j] = memo[i][j]+1;
        else memo[i+1][j] = memo[i][j];
    }
    
    //for (auto x:memo) cout<<x<<endl;
    //cout<<"------"<<endl;
    int ans =10e6;
    for (int b=0; b< (1<<(h-1)); b++){
        // 横方向の切り分け方
        int cntbit = __builtin_popcount(b);
        int anscnt = cntbit;
        //cout <<cntbit<<endl;
        vector<vector<int>> memo1(cntbit+1, vector<int>(w,0));
        int nowh = 0;
        int cutcnt = 0;
        rep (i,h) {
            //その方向に切る
            if (b>>i&1 or i==h-1) {
                rep(j,w){
                    //とりあえず横を切った時の累積和をメモしたい
                    memo1[cutcnt][j] = memo[i+1][j]-memo[nowh][j];
                }
                nowh = i+1;
                cutcnt++;
            }
        }
        
        //for (auto x:memo1) cout<<x<<endl;
        //cout<<"->"<<cntbit<<endl;
        
        bool check = true;    
        rep(i,cntbit+1) rep(j,w){
            if (memo1[i][j]>k) check =false;
        }
        if (check==false) {
            continue;
        }
        
        
        for (int j=0;j<w-1;j++){
            bool check = true;
            rep(i,cntbit+1){
                memo1[i][j+1] +=memo1[i][j];
                if (memo1[i][j+1] >k ) check =false;
            }
            
            if (check ==false){
                anscnt++;
                rep(i, cntbit+1){
                    memo1[i][j+1] -= memo1[i][j];
                }
            }
        }
        //for (auto x:memo1) cout<<x<<endl;
        //cout<<anscnt;
        //cout<<"--------"<<endl;
        ans = min(ans, anscnt); 
    }
    cout<<ans<<endl;
    
    return 0;
}


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

using namespace std;

const int N = 1e3 + 3;

int n, m;
vector <int> g[N];
vector <int> path;

#define pii pair <int, int>
#define mod 10000007

void solve() {
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
	}
	int minDis = mod;
	for (int i = 1; i <= n; i++) {
		priority_queue <pii, vector <pii >, greater<pii > > pq;
		pq.push({0, i});
		vector <int> dist(n + 1, mod);
		vector <int> par(n + 1, -1);
		while (!pq.empty()) {
			auto top = pq.top();
			pq.pop();
			int u = top.second;
			int c = top.first;
			for (auto v : g[u]) {
				if (dist[v] > c + 1) {
					dist[v] = c + 1;
					par[v] = u;
					pq.push({dist[v], v});
				}
			}
		}
		if (dist[i] < minDis) {
			minDis = dist[i];
			path.clear();
			int idx = i;
			do {
				path.push_back(idx);
				idx = par[idx];
			} while (idx != i);
		}
	}
	if (minDis != mod) {
		cout << (int)path.size() << "\n";
		for (auto el : path) {
			cout << el << "\n";
		}
	} else {
		cout << "-1\n";
	}
}

int main() {
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;
const int N = 5e5 + 10;

void solve(){
    int h,w;cin >> h >> w;
    int a[h+5][w+5];
    int ans = 0;
    for(int i = 0;i<h;i++)
    for(int j = 0;j<w;j++)
        cin >> a[i][j];
    vector<pii>pos1;
    vector<pii>pos2;
    for(int i = 0;i<h;i++)
    for(int j = 0;j<w;j++){
        if(a[i][j]%2&&j+1<w){
            a[i][j]--;a[i][j+1]++;
            ans++;
            pos1.push_back({i,j});
            pos2.push_back({i,j+1});
        }
        else if(a[i][j]%2&&i+1<h){
            a[i][j]--;a[i+1][j]++;
            ans++;
            pos1.push_back({i,j});
            pos2.push_back({i+1,j});
        }
    }
    cout << ans <<endl;
    for(int i = 0;i<pos1.size();i++){
        cout << pos1[i].first+1 <<' '<<pos1[i].second+1 <<' '<<pos2[i].first+1 <<' '<<pos2[i].second+1<<endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 6404
using System;
using System.Linq;
using System.Collections.Generic;

class Program {
  static bool IsTriangle(List<int> a) {
    int i = 1;
    foreach (var item in a) {
      if (item != i++) return false;
    }
    return true;
  }
  static void Main() {
    int n;
    while ((n = int.Parse(Console.ReadLine())) != 0) {
      var lst = Console.ReadLine().Split().Select(int.Parse).ToList();
      int cnt = 0;
      int idx = 10001;
      while (idx-- > 0) {
        if (IsTriangle(lst)) break;
        lst = lst.Select(x => x - 1).ToList();
        lst.Add(lst.Count);
        if (lst.Any(x => x == 0)) {
          var tmp = new List<int>();
          foreach (var item in lst) {
            if (item != 0) tmp.Add(item);
          }
          lst = tmp;
        }
        cnt++;
      }
      Console.WriteLine(cnt > 10000 ? -1 : cnt);
    }
  }
}


Measured memory_bytes: 42680
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


// KIHBR

string str;

bool solve() {
  string tmp = "";
  for (int i = 0; i < str.size(); ++i) {
	if (str[i] != 'A') tmp += str[i];
  }
  if (tmp != "KIHBR") return false;

  int num[7];
  memset(num, 0, sizeof(num));
  int iter = 0;
  for (int i = 0; i < str.size(); ++i) {
	if (str[i] != 'A') {
	  ++iter;
	}
	else {
	  ++num[iter];
	}
  }
  if (num[0] > 1) return false;
  if (num[1] > 0) return false;
  if (num[2] > 0) return false;
  if (num[3] > 1) return false;
  if (num[4] > 1) return false;
  if (num[5] > 1) return false;

  return true;
}


int main() {
    while (cin >> str) {
	  if (solve()) puts("YES");
	  else puts("NO");
    }
}
















Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H,K;
	while(cin>>N) {
		VI a(N),P(N),Q(N);
		REP(i, N) cin>>P[i];
		REP(i, N) cin>>Q[i];
		REP(i, N) a[i]=i+1;
		ll A=0,B=0,c=0;
		do{
			if(a==P) A=c;
			if(a==Q) B=c;
			c++;
		}while(next_permutation(ALL(a)));
		ll ans=abs(A-B);
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	s := 0
	m := map[int]int{}
	m[0]++
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		s += a
		m[s]++
	}

	ans := 0
	for _, i := range m {
		ans += i * (i - 1) / 2
	}

	fmt.Println(ans)
}


Measured memory_bytes: 12928
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  LL N; cin >> N;
  vector<int> A(N), B(N), C(N);
  for (int& a : A) cin >> a;
  for (int& b : B) cin >> b;
  for (int& c : C) cin >> c;

  sort(A.begin(), A.end());
  sort(C.begin(), C.end());

  LL count = 0;
  for (int b : B) {
    LL a = lower_bound(A.begin(), A.end(), b) - A.begin();
    LL c = upper_bound(C.begin(), C.end(), b) - C.begin();
    count += a * (N-c);
  }
  cout << count << endl;
}


Measured memory_bytes: 1408
#include <cstdio>
#include <algorithm>
#define LL long long
#define maxn 5010
using namespace std;
LL p[maxn],c[maxn],t[maxn],d[maxn],mid[maxn];
int main(){
	int n,k,i,now,cnt;
	LL mx=-1000000000,val;
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++)scanf("%lld",&p[i]);
	for(i=1;i<=n;i++)scanf("%lld",&c[i]);
	for(i=1;i<=n;i++){
		now=p[i],d[i]=c[now],t[i]=1,mid[i]=-1000000000,mid[i]=max(d[i],mid[i]);
		while(1){
			if(now==i)break;
			t[i]++,now=p[now],d[i]+=c[now],mid[i]=max(d[i],mid[i]);
		}
	}
	for(i=1;i<=n;i++){
		if(k/t[i]>0){
			mx=max(mx,mid[i]);
			if(k%t[i]==0){mx=max(mx,(k/t[i]-1)*d[i]+mid[i]);continue;}
		}
		val=k/t[i]*d[i];
		now=p[i],val+=c[now],mx=max(mx,val),cnt=1;
		while(1){
			if(k%t[i]==cnt)break;
			cnt++,now=p[now],val+=c[now],mx=max(mx,val);
		}					
	}
	printf("%lld\n",mx);
	return 0;
}

Measured memory_bytes: 1924
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, ans = 0, p;
    cin>>n;
    for(int i = 2; i < 1000010; i++) {
		ll cnt = 0;
		while(n % i == 0) {
			n /= i;
			cnt++;
		}
		for(int j = 1; ; j++) {
			if(cnt < j) {
				break;
			}
			cnt = cnt - j;
			ans++;
		}
	}
	if(n > 1) {
		ans++;
	}
    cout<<ans<<"\n";
}

Measured memory_bytes: 3624
import heapq
N,M=map(int,input().split())
A=list(map(int,input().split()))

sum=0
A=[-1 * i for i in A]
heapq.heapify(A)

for m in range(M):
    rep=-(-heapq.heappop(A)//2)
    heapq.heappush(A,rep)
for a in A:
    sum-=a

print(sum)

Measured memory_bytes: 14180
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define f first
#define se second
#define pb push_back
#define ld long double
 
using namespace std;
 
 
const int N = 4e5 + 123;
const int MAXN = 1e5 + 12;
const int inf = 1e9 + 7;
const ll mod = 1e9 + 7;


ll n, b[N], p[N];
char a[N];

 
int main() {
    cin >> n;
    for (int i = 1; i <= 2 * n; i++)
        cin >> a[i];
    if (a[1] == 'W')
        return cout << 0, 0;
    b[1] = 1;
    for (int i = 2; i <= 2 * n; i++) {
        if (a[i] != a[i - 1])
            b[i] = b[i - 1];
        else
            b[i] = 1 - b[i - 1];
    }
    for (int i = 1; i <= 2 * n; i++)
        p[i] = p[i - 1] + b[i];
    if (p[2 * n] != n)
        return cout << 0, 0;
    ll ans = 1;
    for (ll i = 1; i <= 2 * n; i++) {
        if (b[i] == 0)
            ans = (ans * (p[i] - (i - 1 - p[i]))) % mod;
    }
    for (ll i = 1; i <= n; i++)
        ans = (ans * i) % mod;
    cout << ans;
    return 0;
}

Measured memory_bytes: 6144
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn is_palindrome(s: &Vec<char>, n: usize) -> bool {
  for i in 0 .. n {
    if s[i] != s[n-i-1] {
      return false;
    }
  }
  true
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    s: chars,
  }
  if is_palindrome(&s, s.len()) && is_palindrome(&s, s.len() / 2) {
    puts!("Yes\n");
  } else {
    puts!("No\n");
  }


}


Measured memory_bytes: 4352
# 新しいvalueのほうが小さい場合のみ設定
def set_val(map, x, y, value):
    key = str(x) + " " + str(y)
    if key in map:
        if value < map[key]:
            map[key] = value
    else:
        map[key] = value
    return map


size_x, size_y = map(int, input().split())
count = size_x + size_y
temp_values = []

for i in range(size_x):
    temp_values.append(input())

values = []
for value in temp_values:
    values.append(list(value))

initial = 0
yet = True
all_black = True
if values[0][0] == "#":
    initial = 1

check_value = {"0 0": initial}
# 探索処理
for i in range(count):
    check_temp_value = {}
    for key in check_value.keys():
        x, y = map(int, key.split())
        value = check_value.get(key)
        # 下に移動
        if x + 1 <= size_x - 1:
            if values[x + 1][y] == "#" and values[x][y] == ".":
                # 異なる経路で同一座標に到達した場合、小さいほうの値を設定
                check_temp_value = set_val(check_temp_value, x + 1, y, value + 1)
                yet = False
                all_black = False
            else:
                check_temp_value = set_val(check_temp_value, x + 1, y, value)
        # 右に移動
        if y + 1 <= size_y - 1:
            if values[x][y + 1] == "#" and values[x][y] == ".":
                # 異なる経路で同一座標に到達した場合、小さいほうの値を設定
                check_temp_value = set_val(check_temp_value, x, y + 1, value + 1)
                yet = False
                all_black = False
            else:
                check_temp_value = set_val(check_temp_value, x, y + 1, value)
    check_value = check_temp_value
    if len(check_value) == 1:
        # ゴールについたら終了
        break
    yet = True

# すべて黒なら無条件に1
if all_black:
    print(1)
else:
    # 最後が#なら加算
    result_val_add = 0
    if values[size_x - 1][size_y - 1] == "#" and yet :
        result_val_add = 1
    print(list(check_value.values())[0] + result_val_add)


Measured memory_bytes: 3188
N, L = input().split()
N = int(N)
L = int(L)

tastes = []
for i in range(0, N):
    tastes.append(L+i)

abs_tastes = list(map(abs, tastes))

min_v = min(abs_tastes)
min_i = abs_tastes.index(min_v)

del tastes[min_i]
print(sum(tastes))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main(){
  int K, A ,B;
  cin >> K >> A >> B;

  for (int i = A; i <= B; i++) {
      if (i % K == 0) {
          cout << "OK" << endl;
          return 0;
      }
  }
  cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3640
'use strict'

const calc = (a, b, ops) => {
    if(ops === '+'){
        return a + b
    }
    return a - b
}

const main = (input) => {
    const nums = input.split('').map(v => parseInt(v))
    const ops = ['+', '-']

    for(let i = 0; i < ops.length; i++){
        for(let j = 0; j < ops.length; j++){
            for(let k = 0; k < ops.length; k++){
                let ans = calc(calc(calc(nums[0], nums[1], ops[i]), nums[2], ops[j]), nums[3], ops[k])
                if(ans === 7){
                    console.log(`${nums[0]}${ops[i]}${nums[1]}${ops[j]}${nums[2]}${ops[k]}${nums[3]}=7`)
                    return
                }
            }
        }
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(int argc, char const *argv[]) {
	int a,b;
	std::cin >> a >> b;
	std::cout << (a-1) * (b - 1) << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int li;
const ll MAXN=524291,MOD=924844033,G=5,INVG=554906420;
struct Edge{
	ll to,prev;
};
Edge ed[MAXN];
ll nc,tot,from,to,cnt=1,limit=-1;
ll f[MAXN],g[MAXN],rev[MAXN],fact[MAXN],finv[MAXN],last[MAXN];
ll sz[MAXN],c[MAXN];
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch)&&ch!='-')
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
}
inline void addEdge(ll from,ll to)
{
	ed[++tot].prev=last[from];
	ed[tot].to=to;
	last[from]=tot;
}
inline ll qpow(ll base,ll exponent)
{
    li res=1;
    while(exponent)
    {
        if(exponent&1)
        {
            res=1ll*res*base%MOD;
        }
        base=1ll*base*base%MOD,exponent>>=1;
    }
    return res;
}
inline void setup(ll cnt)
{
	fact[0]=fact[1]=finv[0]=1;
	for(register int i=2;i<=cnt;i++)
	{
		fact[i]=(li)fact[i-1]*i%MOD;
	}
	finv[cnt]=qpow(fact[cnt],MOD-2);
	for(register int i=cnt-1;i;i--)
	{
		finv[i]=(li)finv[i+1]*(i+1)%MOD;
	}
}
inline void dfs(ll node,ll fa)
{
	sz[node]=1;
	for(register int i=last[node];i;i=ed[i].prev)
	{
		if(ed[i].to!=fa)
		{
			dfs(ed[i].to,node),sz[node]+=sz[ed[i].to];
		}
	}
	c[sz[node]]--,c[nc-sz[node]]--;
}
inline void NTT(ll *cp,ll cnt,ll inv)
{
    ll cur=0,res=0,omg=0;
    for(register int i=0;i<cnt;i++)
    {
        if(i<rev[i])
        {
            swap(cp[i],cp[rev[i]]);
        }
    }
    for(register int i=2;i<=cnt;i<<=1)
    {
        cur=i>>1,res=qpow(inv==1?G:INVG,(MOD-1)/i);
        for(register ll *p=cp;p!=cp+cnt;p+=i)
        {
            omg=1;
            for(register int j=0;j<cur;j++)
            {
                ll t=1ll*omg*p[j+cur]%MOD,t2=p[j];
                p[j+cur]=(t2-t+MOD)%MOD,p[j]=(t2+t)%MOD;
                omg=1ll*omg*res%MOD;
            }
        }
    }
    if(inv==-1)
    {
        ll invl=qpow(cnt,MOD-2);
        for(register int i=0;i<=cnt;i++)
        {
            cp[i]=1ll*cp[i]*invl%MOD;
        }
    }
}
int main()
{
	setup(nc=read());
	for(register int i=0;i<nc-1;i++)
	{
		from=read(),to=read();
		addEdge(from,to),addEdge(to,from);
	}
	while(cnt<=(nc<<1))
	{
		cnt<<=1,limit++;
	}
	for(register int i=0;i<cnt;i++)
	{
		rev[i]=(rev[i>>1]>>1)|((i&1)<<limit);
	}
	dfs(1,0),c[nc]=nc;
	for(register int i=0;i<=nc;i++)
	{
		c[i]=c[i]<0?(MOD+c[i]):c[i];
		f[i]=(li)c[i]*fact[i]%MOD,g[i]=finv[nc-i];
	}
	NTT(f,cnt,1),NTT(g,cnt,1);
	for(register int i=0;i<cnt;i++)
	{
		f[i]=(li)f[i]*g[i]%MOD;
	}
	NTT(f,cnt,-1);
	for(register int i=1;i<=nc;i++)
	{
		printf("%d\n",(li)f[i+nc]*finv[i]%MOD);
	}
}


Measured memory_bytes: 25216
import java.util.*;

class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            int n = sc.nextInt(), S = sc.nextInt();
            if(n==0 && S==0) break;

            PriorityQueue<Integer> q = new PriorityQueue<Integer>(10, new Comparator<Integer>(){
                    public int compare(Integer i1, Integer i2){
                        return (int) i2 - i1;
                    }
                });
            for(int i=0; i<n; i++) q.add(new Integer(sc.nextInt()));
            int[] rr = new int[q.size()];
            int idx = 0;
            while(q.size()>0) rr[idx++] = q.poll();

            int cnt = 0;
            for(int i=0; i<rr.length; i++){
                int l = i, r = rr.length;
                while(l+1<r){
                    int mid = (l+r) / 2;
                    if(rr[i] + rr[mid]>S) l = mid;
                    else r = mid;
                }
                //System.out.println(i+" l: "+l+" r: "+r);
                cnt += l - i;
            }
            System.out.println(cnt);
        }
    }

    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 153700
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  long long N, P;
  cin >> N >> P;
  long long x = floor(pow(P, 1.0 / N) + 1);
  while (x > 1) {
    long long temp = pow(x, N);
    if (P % temp == 0) {
      cout << x << endl;
      return 0;
    }
    --x;
  }
  cout << 1 << endl;
  return 0;
}

Measured memory_bytes: 384
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n, m, t;
  cin >> n >> m >> t;
  vi cannotStudy(t + 1);
  while (n--) {
    int a;
    cin >> a;
    // (imos method would be good for this process)
    for (int i = a - m; i <= a + m; i++) {
      if (i < cannotStudy.size()) cannotStudy[i] = 11235813213455LL;
    }
  }
  int c = 0;
  loop(i, 1, cannotStudy.size()) c += !(cannotStudy[i - 1] && cannotStudy[i]);
  cout << c << endl;
}

Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
char T;int l,a,b,x[999],d[999],M,N,y[999],z[999],i,j;
int main(){
while(1){
M=0;
memset(y,0,3996);
cin>>b>>l;if(!l){break;}
for(i=1;i<=b;i++){
cin>>T>>x[i];
if(T=='L'){d[i]=0;M=max(M,x[i]);}
else{d[i]=1;M=max(M,l-x[i]);}
}
N=0;
for(i=1;i<M+2;i++){
memset(z,0,sizeof(z));
for(j=b;j>0; j--) {
if(!y[j]) {
if(!d[j]){
x[j]--;
}
else{
x[j]++;
}
if(x[j]<0||x[j]>l){
y[j]=1;
}
else{
z[x[j]]++;
}
if(M+1==i){
if(N){
if(x[j]<0){N=j;}
}
else{
N=j;
}
}
}
}
for(j=b;j>0;j--){
if(z[x[j]]>1){
if(d[j]){d[j]=0;}
else{d[j]=1;}
}
}
}
printf("%d %d\n",M,N);
}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using i128 = boost::multiprecision::int128_t;
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(ll i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(ll i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  ll x, n; cin >> x >> n;
  V p(n); cin >> p;

  int cmin = INF;
  int ans = -20;
  rep2(z, -10, 200) {
    bool ok = true;
    rep(j, n) if (p[j] == z) ok = false;
    if (!ok) continue;
    if (chmin(cmin, abs(int(x-z)))) ans = z;
  }

  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
#include <stdio.h>
#include <string.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORD(i,a,b) for(int i=(a);i>(b);i--)
typedef long long ll;
const ll mod =1e9 +7;
const int f=100000000;

int solve(int x){
    if(x==3) return 2;
    if(x==4) return 3;
    return solve(x-2)+1;
}
int main(){
   float d,t,s;
   cin>>d>>t>>s;
   if(d/s<=t) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;


    return 0;
}

Measured memory_bytes: 3732
import           Control.Applicative
import           Control.Monad
import           Control.Monad.ST
import qualified Data.ByteString             as B
import           Data.List
import qualified Data.Set                    as S
import           Data.STRef
import qualified Data.Vector                 as V
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM


readInt :: IO [Int]
readInt = map read . words <$> getLine

readIntlines :: Int -> IO [[Int]]
readIntlines n = map (map read . words) <$> replicateM n getLine

main :: IO ()
main = do
    [x] <- readInt
    print $ if x == 0 then 1 else 0


Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define int long long
using namespace std;

int a, b, A[500005];

signed main(){
  
  cin>>a>>b;
  
  A[0] = 1;
  
  for(int i=1;i<=500000;i++) A[i] = A[i-1] + ( i + 1 );
  
  for(int i=0;i<500000;i++){
    if( A[i] - a == A[i+1] - b ) cout<<A[i]-a<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 4096
from itertools import product
from operator import itemgetter
N, K = map(int, input().split())
XY = []
X, Y = [], []
for _ in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)
    XY.append([x, y])
X.sort()
Y.sort()
XY.sort(key=itemgetter(1))

ans = 10 ** 19
for l, r, t in product(X, X, Y):
    if l > r:
        continue
    cnt = -K
    for x, y in XY:
        if y < t:
            continue
        if l <= x <= r:
            cnt += 1
            if cnt >= 0:
                area = (r - l) * (y - t)
                if area < ans:
                    ans = area
                break

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define DBG cout << '!' << endl;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

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

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

int main() {
  int x;
  cin >> x;
  if(x==0){
      cout << 1 << endl;
  }
  else{
      cout << 0 << endl;
  }
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll K;
vector<ll> v,ans;
bool dame[100000];

ll f(ll n){
  ll res=0;
  while(n>0){
    res+=n%10;
    n/=10;
  }
  return res;
}

int main(){
  repl(a,1,1001)repl(j,1,16){
    ll num=a*pow(10,j)-1;
    if(num>1e15)continue;
    v.push_back(num);
  }
  repl(i,1,10)v.push_back(i);
  sort(all(v));
  uni(v);
  rep(i,v.size())repl(j,i+1,v.size()){
    if(v[i]*f(v[j])>v[j]*f(v[i])){
      dame[i]=true;
      break;
    }
  }
  rep(i,v.size())if(!dame[i])ans.push_back(v[i]);
  cin>>K;
  rep(i,K){
    cout<<ans[i]<<endl;
  }

  return 0;
}


Measured memory_bytes: 512
n,m = map(int,input().split())
mod = 10**9+7
a = set()
for i in range(m):
  s = int(input())
  a.add(s)
  
dp = [0]*(n+1)
dp[0] = 1
for i in range(1,n+1):
  if i in a:
    continue
  dp[i] = dp[i-1]+dp[i-2]
  dp[i] %= mod
  
print(dp[-1])

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

int main() {
  int n,k;
  cin >> n;
  k = n-n/10*10;
  if(k == 3)
    cout << "bon";
  else if(k == 0 || k == 1)
    cout << "pon";
  else if(k == 6 || k == 8)
    cout << "pon";
  else
    cout << "hon";
}

Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const ll MOD = 1e9 +7;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    string ans="";
    if(n==0){
        cout<<0<<endl;
        return 0;
    }
    while(n!=0){
        if(n%2!=0){
            ans+='1';
            n--;
        }
        else{
            ans+='0';
        }
        n/=-2;
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
    return 0;
}

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

int dig( int x ) {
    int r = 0;
    for ( ; x ; x /= 10 ) r += x % 10;
    return r;
}

int main() {
    int n, a, b; cin >> n >> a >> b;
    int ans = 0;
    for ( int i = 1 ; i <= n ; ++ i ) {
        if ( a <= dig( i ) && dig( i ) <= b )
            ans += i;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
          using namespace std;
          #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
          #define M_PI 3.14159265358979323846
          #define data data_
          #define ff first
          #define ss second
          #define pb push_back
          #define ll long long
          #define ld long double

          int main()
          {
               tani_nachi_ke  

               int n,m,k;
               cin >> n >> m >> k;
               int x = max(n,m);
               cout << (k + x - 1)/x << endl;




         
               return 0;
          }

Measured memory_bytes: 256
x=input().split()
n=int(x[0])
m=int(x[1])
stu=[[]*i for i in range(n)]
che=[[]*i for i in range(m)]
for i in range(n):
    x=input().split()
    x[0]=int(x[0])
    x[1]=int(x[1])
    stu[i]=x
for i in range(m):
    x=input().split()
    x[0]=int(x[0])
    x[1]=int(x[1])
    che[i]=x

for i in stu:
    di=[]
    mini=9999999999
    for j in che:
        x=abs(i[0]-j[0])+abs(i[1]-j[1])
        di.append(x)
        mini=min(mini,x)
    print(di.index(mini)+1)

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

#define F               first
#define S               second
#define ull             unsigned long long
#define ll              long long
#define ul              unsigned long
#define db              double
#define ST              string
#define pb              push_back
#define mp              make_pair
#define el              "\n"
#define vll             vector <ll>
#define vl              vector <long int>
#define vi              vector <int>
#define all(v)          (v.begin(), v.end()) 
#define rall(v)         (v.rbegin(), v.rend()) 
#define is_sort(v)      is_sorted all(v)
#define max_of(v)       *max_element all(v)
#define min_of(v)       *min_element all(v)
#define itos(s)         to_string(s)
#define cntone(x)       __builtin_popcountll(x)
#define cntzro(x)       __builtin_clz(x)
const ll mod = 1e9+7;
int tt=0;

vi v[2*100001];
vi vis(2*100001, 0);

void dfs(int node)
{
    vis[node]=1;
    tt++;
    for(int child : v[node])
    {
        if(vis[child]==0)
        dfs(child);
    }
}

void solve()
{
    int n,m;
    cin>>n>>m;
    
    for(int i=0; i<m; i++)
    {
        int c,e;
        cin>>c>>e;

        v[c].pb(e);
        v[e].pb(c);
    }
    int cnt=0;
    for(int i=1; i<=n; i++)
    {
        if(vis[i]==0)
        {
            //int temp=0;
            //cnt++;
            dfs(i);
            cnt=max(cnt, tt);
            //cout<<tt<<el;
            tt=0;
        }
    }

    cout<<cnt;
    
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    /*****-Code starts from here-*****/
    // int t;
    // cin>>t;
    // while(t--)
    solve();
    return 0; 
}

Measured memory_bytes: 21080
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    int a, b, x;
    cin >> a >> b >> x;
    double y = (2.0*x /a/a) - b;
    double alp;
    if (y > 0) {
        alp = atan((b - y) / a) * 180 / M_PI;
    } else {
        y = (2.0*x /a/b);
        alp = atan(b/y) * 180 / M_PI;
    }
    printf("%4.8f\n", alp);
    return 0;
}


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

int main()
{
    int N, L;
    cin >> N;
    cin >> L;
    vector<string> S(N);
    for (int i = 0; i < N; i++)
    {
        cin >> S.at(i);
    }

    sort(S.begin(), S.end());

    for (int i = 0; i < N; i++)
    {
        cout << S.at(i);
    }

    return 0;
}

Measured memory_bytes: 256