akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>

int main(){
  long long n;
  std::cin>>n;
  long long cp=100, i=0;

  while(true){
    cp =cp*std::pow(1.01, 1);
    ++i;
    if(cp >= n)
      break;
  }
  std::cout<<i<<std::endl;
}


Measured memory_bytes: 3576
INF = 1 << 60

n = gets.to_i
hs = gets.split.map(&:to_i)

# minimize
dp = Array.new(n + 2, INF)
# init
dp[0] = 0
# change min
n.times do |i|
  [1, 2].each do |d|
    k = i + d
    dp[k] = [dp[k], dp[i] + (hs[i] - (hs[k] || INF)).abs].min
  end
end

p dp[n - 1]


Measured memory_bytes: 11396
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(){
	int x, a, b;
	cin >> x >> a >> b;
	int d1=x-a;
	int d2=x-b;
	if(d1<0) d1*=(-1);
	if(d2<0) d2*=(-1);
	
	if(d1<d2) cout << 'A' << endl;
	else cout << 'B' << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <bitset>
using namespace std;
using ll = long long;

bitset<5010> dp1[5010], dp2[5010];

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  dp1[0].set(0);
  for (int i = 0; i < N; i++) {
    dp1[i+1] = dp1[i] | (dp1[i] << a[i]);
  }
  dp2[N].set(0);
  for (int i = N - 1; i >= 0; i--) {
    dp2[i] = dp2[i+1] | (dp2[i+1] << a[i]);
  }
  int res = 0;
  for (int i = 0; i < N; i++) {
    int L = max(0, K - a[i]), R = K - 1;
    int cnt = 0;
    for (int k = L; k <= R; k++) {
      cnt += dp2[i+1][k];
    }
    bool need = false;
    for (int k = 0; k < K; k++) {
      if (dp1[i][k] && cnt > 0) {
        need = true;
        break;
      }
      if (L > 0) {
        cnt += dp2[i+1][L-1];
        --L;
      }
      if (R > 0) {
        cnt -= dp2[i+1][R];
        --R;
      }
    }
    if (!need) {
      ++res;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 6400
/*
	我	好	弱	啊
	连指针也不会用
	我	好	弱	啊
	诸位大佬太强啦
		 --[伏地mod]InterestingLSY 
*/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <ctime>
#define pb push_back
#define mp make_pair
#define INF 9999999
#define LINF 9999999999999999
#define uint unsigned int
#define msn(a,v) memset(a,v,sizeof(a))
#define ms(a) msn(a,0)
#define NONE -1
#define ll long long
#define ull unsigned ll
#define uchar unsigned char
#define sint short int
#define usint unsigned sint
#define lb lower_bound
#define ub upper_bound
using namespace std;
#define MAXN 100100
 
int n,k;

int gcd(int a,int b){
	if( !b ) return a;
	return gcd(b,a%b);
}

int maxn = -1;
int main(){
	int nowgcd = 0;
	cin >> n >> k;
	for(int i = 1;i <= n;i++){
		int x;
		cin >> x;
		if(i == 1) nowgcd = x;
		else nowgcd = gcd(nowgcd,x);
		maxn = max(maxn,x);
	}
//	cout << nowgcd << endl;
	if(maxn >= k  &&  k % nowgcd == 0) cout << "POSSIBLE\n";
	else cout << "IMPOSSIBLE\n";
	return 0;
}

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


int main(void){
   long long N,K;
   cin>>N>>K;
   vector<int> A(N);
   for(int i=0;i<N;i++){
      cin>>A[i];
      A[i]--;
   }
   int now=0;
   vector<int> count(N,0);
   long long roop_town,rest;
   bool flag=false;
   for(int i=0;i<K;i++){
      now=A[now];
      if(count[now]!=0){
         roop_town=i-count[now];
         rest=K-i-1;
         flag=true;
         break;
      }
      count[now]=i;
   }
   if(flag){
      rest=rest%roop_town;
      for(int j=0;j<rest;j++){
         now=A[now];
      }
   }
   cout<<now+1<<endl;
   return 0;
}


Measured memory_bytes: 4808
#include<iostream>
#include<string>
using namespace std;
string s;
int a[1000001],b[1000001],num[1000001],dp[1000001][2];
int main()
{
	cin>>s;
	int alen=s.length();
	for(int i=0;i<alen;i++) num[i]=s[i]-'0';
	dp[0][0]=num[0];
	dp[0][1]=11-num[0];
	for(int i=1;i<alen;i++)
	{
		dp[i][0]=min(dp[i-1][0]+num[i],dp[i-1][1]+num[i]);
		dp[i][1]=min(dp[i-1][0]+11-num[i],dp[i-1][1]+9-num[i]);
	}
	cout<<min(dp[alen-1][0],dp[alen-1][1])<<endl;
	return 0;
}

Measured memory_bytes: 13700
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

int main() {
    int K;
    cin >> K;

    ll ans = 0;
    for (int a = 1; a <= K; ++a) {
        for (int b = 1; b <= K; ++b) {
            for (int c = 1; c <= K; ++c) {
                ans += gcd(a, gcd(b, c));
            }
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
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> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

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; }

int main(void){
    int N; cin >> N;
    vector<tuple<ll,ll,ll>> A(N);
    REP(i,N){
        ll a,b; cin >> a >> b;
        get<0>(A[i]) = a+b;
        get<1>(A[i]) = a;
        get<2>(A[i]) = b;
    }
    SORT(A); REVERSE(A);

    ll ans = 0;
    REP(i,N){
        if(i%2) ans -= get<2>(A[i]);
        else ans += get<1>(A[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

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

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<class T>
inline bool chmin(T &a, T b) { return a > b && (a = b, true); }

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string S;
	cin >> S;

	int sz = (int)S.size();
	int ans = S.size();
	for (int i = 0; i < sz - 1; i++) if (S[i] != S[i + 1]) chmin(ans, max(i + 1, sz - i - 1));

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef vector<int>V;
int main(void){
	int q,n,x;
	int i;
	V v;
	cin>>q;
	for(i=0;i<q;i++){
		cin>>n;
		if(n==0){
			cin>>x;
			v.push_back(x);
		}
		else if(n==1){
			cin>>x;
			cout<<v[x]<<endl;
		}
		else{
			v.pop_back();
		}
	}
	return 0;
}
	


Measured memory_bytes: 3860
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };


int main()
{
    string a, b, c;
    int t = 0;

    cin >> a >> b >> c;

    for(;;){
        if(t == 0){
            if(a.empty()){
                cout << 'A' << endl;
                return 0;
            }
            t = a[0] - 'a';
            a.erase(a.begin());
        }
        else if(t == 1){
            if(b.empty()){
                cout << 'B' << endl;
                return 0;
            }
            t = b[0] - 'a';
            b.erase(b.begin());
        }
        else{
            if(c.empty()){
                cout << 'C' << endl;
                return 0;
            }
            t = c[0] - 'a';
            c.erase(c.begin());
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std; 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define ll long long
ll a[200005];

#define rep(i,a,b) for(int i=a;i<=b;i++)
ll dp[200005];
ll sum[200005];
ll max(ll a,ll b,ll c,ll d)
{
	return max(a,max(b,max(c,d)));
}
ll min(ll a,ll b,ll c,ll d)
{
	return min(a,min(b,min(c,d)));
}
int main(int argc, char** argv) {
	int n;
	scanf("%d",&n);

	rep(i,1,n)scanf("%lld",&a[i]);
	int j=2;
	int k=1;
	rep(i,1,n)
	{
		sum[i]=sum[i-1]+a[i];
	}
	ll ans=1e18;
	rep(mid,2,n)//mid在左边 
	{
	//	cout<<sum[j-1]<<"  "<<sum[mid]-sum[j-1]<<" "<<j<<" "<<(ll)abs(sum[j-1]-(sum[mid]-sum[j-1]))<<" "<<(ll)abs(sum[j]-(sum[mid]-sum[j]))<<endl;
	
		while(j<mid&&((ll)abs(sum[j-1]-(sum[mid]-sum[j-1]))>((ll)abs(sum[j]-(sum[mid]-sum[j])))))
		{
			j++;
		}
		while(k<n-1&&(k<=mid||((ll)abs((sum[n]-sum[k])-(sum[k]-sum[mid])))>((ll)abs((sum[n]-sum[k+1])-(sum[k+1]-sum[mid])))))
		{
			//cout<<k<<" "<<sum[n]-sum[k]<<" "<<sum[k]-sum[mid]<<endl;
			k++;
		}
	//	cout<<mid<<" "<<j<<" "<<k<<endl;
		ll mx=max(sum[j-1],sum[mid]-sum[j-1],sum[n]-sum[k],sum[k]-sum[mid]);
		ll mn=min(sum[j-1],sum[mid]-sum[j-1],sum[n]-sum[k],sum[k]-sum[mid]);
		ans=min(ans,mx-mn);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4480
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int[] A;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        A = new int[N];
        for (int i=0; i<N; i++) {
        	A[i] = sc.nextInt();
        }
    }
    
    //解答処理
    private long solve() {
        long answer = 0;
        
        for (int i=1; i<N; i++) {
        	if (A[i] < A[i-1]) {
        		long tmp = A[i-1]-A[i];
        		answer += tmp;
        		A[i] += tmp;	//踏み台の分を身長に加算
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(long answer) {
        System.out.println(answer);
    }

}


Measured memory_bytes: 59756
// Author            -  Ranadev Varma
// Codeforces Handle -  Ranadev_CaptainR
// Codechef Handle   -  ranadev
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("unroll-loops")
 
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <iterator>
#include <iomanip>
#include <set>

using namespace std ;

#define MOD 1000000007LL
#define LOD 1000000006
#define pi 3.14159

#define lol1 ios::sync_with_stdio(false)
#define lol2 cin.tie(NULL);cout.tie(NULL)

#define FOR(i,a,b)  for(int i = a ; i < b ; i++)
#define RFOR(i,a,b) for(int i = a ; i > b ; i--)

#define pb push_back
#define mp make_pair
#define fi first
#define se second

int main()
{
    lol1;
    lol2;
    string in;
    long long int k;
    cin >> in >> k;
    if(k>in.length())
    {
        FOR(i,0,in.length())
        {
            if(in[i]!='1')
            {
                cout << in[i] << "\n";
                return 0;
            }
        }
    }
    else
    {
        if(k==1)
        {
            cout << in[0] << "\n";
            return 0;
        }
        else
        {
            FOR(i,0,k-1)
            {
                if(in[i]!='1')
                {
                    cout << in[i] << "\n";
                    return 0;
                }
            }
            cout << in[k-1] << "\n";
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)	for(long long int i=a; i<n; i++)
#define loop(i,a,n)	for(long long int i=a; i>=n; i--)

int main() 
{
	ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
	
	long long int a;
	cin>>a;
	long long int b[a],ct=1,flag=0;
	forr(i,0,a)
	{
		cin>>b[i];
		ct*=b[i];
		if(b[i]==0)
			flag=1;
	}
	if((ct<=0 or ct>1000000000000000000) and !flag)
		cout<<-1;
	else
		cout<<ct;
		
	return 0;
}

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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define mp make_pair


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n; cin >> n;
  ll ans = 0;

  if (n <= 2) {
    cout << 0 << endl;
    return 0;
  }

  set<ll> div;
  rep2(i, 2, sqrt(n)) {
    if (n % i == 0) {
      div.em(i);
      div.em(n/i);
    }
  }

  for (auto e : div) {
    if (n / e == n / (e-1)) ans += (e - 1);
  }

  ans += (n - 1);
  cout << ans << endl;
}


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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define Unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fi > xed << setprecision(n)
//総和
#define sowa(n) (((n) * ((n) + 1)) / 2)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

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

  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  arep(i, a) cin >> i;
  arep(i, b) cin >> i;
  arep(i, c) cin >> i;
  sort(all(a));
  sort(all(b));
  sort(all(c));
  int ans = 0;
  rep(i, 0, n) {
    int l, r;
    l = lower_bound(all(a), b[i]) - a.begin();
    r = c.end() - upper_bound(all(c), b[i]);
    ans += l * r;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 5576
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#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 <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 REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++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 PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#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
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 vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } 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; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	while(cin>>N) {
		string s = to_string(N);
		bool ans = 0;
		REP(i, N) {
			if(s[i]=='9') ans=1;
		}
		
		cout<<(ans?"Yes":"No")<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int maxn = 200200;
int a[maxn], x[maxn];
int main(){
    int n;
    cin >> n;
    for(int e = 0; e < n; e++) cin >> x[e];
    if(x[0] != 0){
        printf("-1\n");
    } else {
        for(int e = 0; e < n; e++) if(x[e] > e) return ! printf("-1\n");
        long long ans = 0;
        int lst = -1;
        for(int e = 0; e < n-1; e++) if(x[e] < x[e+1]){
            if(x[e] + 1 != x[e+1]) return ! printf("-1\n");
        }
        for(int e = 0; e < n; e++) if(x[e] >= x[e+1]) {
            if(lst != -1){
                if(e - x[e] < lst - x[lst]) return ! printf("-1\n");
            }
            lst = e;
            ans += x[e];
        }
        cout << ans << endl;
    }
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>

int main() 
{
    int i,j,k=0,x,n,z;
    scanf("%d%d%d",&x,&z,&n);
	for(i=z;i<=n;i++)
	{
		if(i%x==0)
		{
		    k=1;
			break;
		}
		
	}
	if(k==1)
	   printf("OK");
	else printf("NG");
    return 0;
}








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

using ll = long long;
using namespace std;

ll fib(ll a, ll b, ll n){
    if(n--) return fib(b, a + b, n);
    else return a;
}

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

    ll n; cin >> n;
    ll ans = fib(2, 1, n);
    
    cout << (n == 1 ? 1 : ans);
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                int n = int.Parse(Console.ReadLine());

                if (n == 0) break;

                int[] s = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

                int count = 0;

                while (true)
                {
                    int[] memo = new int[101];

                    for (int i = 0; i < n; i++)
                    {
                        memo[s[i]]++;
                    }

                    int[] p = new int[n];

                    bool checkArray = true;

                    for (int i = 0; i < n; i++)
                    {
                        p[i] = memo[s[i]];

                        if (p[i] != s[i]) checkArray = false;
                    }

                    if (checkArray) break;

                    s = (int[])p.Clone();
                    count++;
                }

                sb.AppendLine(count.ToString());
                for (int i = 0; i < n - 1; i++) sb.Append(s[i] + " ");
                sb.AppendLine(s[n - 1].ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9364
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; ll K;
  cin >> N >> K;
  vector<ll> A(N);
  vector<int> cnt(45);
  rep(i, N) {
    cin >> A[i];
    ll a = A[i];
    int j = 0;
    while(a > 0) {
      cnt[j] += a&1;
      a >>= 1;
      j++;
    }
  }
  ll k = 0;
  rrep(i, 45) {
    if(cnt[i] <= (N-1)/2 && k + (1LL<<i) <= K) {
      k += (1LL<<i);
    }
  }
  ll ans = 0;
  rep(i, N) ans += A[i] ^ k;
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 3972
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main() {
  int n;cin>>n;int a[110000];rep(i,n)cin>>a[i];repd(i,1,n)a[i] += a[i-1];
  int diff1 = 0, ans1 = 0, diff2 = 0, ans2 = 0;
  rep(i,n){
    int d = diff1;
    if(i%2 && a[i]+diff1 <= 0){
      diff1 += 1-(a[i]+d);
      ans1 += abs(1-(a[i]+d));
    }else if(i%2 == 0 && a[i]+diff1 >= 0){
      diff1 += -1-(a[i]+diff1);
      ans1 += abs(-1-(a[i]+d));
    }
  }
  rep(i,n){
    int d = diff2;
    if(i%2 == 0 && a[i]+diff2 <= 0){
      diff2 += 1-(a[i]+diff2);
      ans2 += abs(1-(a[i]+d));
    }else if(i%2 && a[i]+diff2 >= 0){
      diff2 += -1-(a[i]+diff2);
      ans2 += abs(-1-(a[i]+d));
    }
  }
  cout << min(ans1, ans2) << endl;
}

Measured memory_bytes: 1024
import Data.List
import Control.Applicative

main = do
  [n,z] <- map read . words <$> getLine :: IO [Int]
  let ans = solve n z
  putStrLn $ if null ans then "No" else "Yes"
  mapM_ print ans

solve n z
  | z == 1 || z == n*2-1 = []
  | otherwise = b ++ [z-1,z,z+1] ++ a
  where (a,b) = splitAt (n-2) ([1..z-2] ++ [z+2..n*2-1])

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define dbg(S) { int f=1; for(auto x:S) cerr<<(f?"[":", ")<<x, f=0; cerr<<"]\n"; }

using namespace std;

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

	int cnt[3]={};
	rep(i,n){
		int a; cin>>a;
		if     (a%4==0) cnt[2]++;
		else if(a%2==0) cnt[1]++;
		else            cnt[0]++;
	}

	if(cnt[1]==0){
		puts(cnt[0]<=cnt[2]+1?"Yes":"No");
	}
	else{
		if(cnt[0]>cnt[2]){
			puts("No");
		}
		else{
			puts(cnt[2]>=1||cnt[1]>=2?"Yes":"No");
		}
	}

	return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{ min, max };

macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

use std::collections::BinaryHeap;

fn diameter(tree: &Vec<Vec<usize>>) -> usize {
    let n = tree.len();
    let mut s = 0;
    let mut maxd = 0;
    for _ in 0..2 {
        let mut memo = vec![n * 10; n];
        memo[s] = 0;
        let mut q = BinaryHeap::new();
        q.push((0, s));
        while let Some((_, u)) = q.pop() {
            for &v in tree[u].iter() {
                if memo[v] > memo[u] + 1 {
                    memo[v] = memo[u] + 1;
                    let priority = - (memo[v] as i32);
                    q.push((priority, v));
                }
            }
        }
        s = (0..n).map(|i| (memo[i], i)).max().unwrap().1;
        maxd = *memo.iter().max().unwrap();
    }
    maxd
}

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let mut tree = vec![vec![]; n];
    for _ in 1..n {
        let a: usize = sc.cin::<usize>() - 1;
        let b: usize = sc.cin::<usize>() - 1;
        tree[a].push(b);
        tree[b].push(a);
    }
    let d = diameter(&tree);
    put!(if d % 3 == 1 { "Second" } else { "First" });
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


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

int main() {
 char s;
 cin >> s;

if ( s == 'a' || s == 'e'|| s == 'i'|| s == 'o'|| s == 'u'){
cout << "vowel" << endl;
}
else cout << "consonant" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long ll;
struct matrix{
	int a[3][3];
	matrix(){memset(a,0,sizeof(a));}
	matrix operator*(const matrix& ma)const{
		matrix res;
		for(int i=0;i<3;++i)
			for(int j=0;j<3;++j)
				for(int k=0;k<3;++k)
					res.a[i][j]=(res.a[i][j]+1ll*a[i][k]*ma.a[k][j])%mod;
		return res;
	}
	void print(){
		for(int i=0;i<3;++i,puts(""))
			for(int j=0;j<3;++j)
				printf("%d ",a[i][j]);
	}
};
matrix get(int x){
	matrix ans,tmp;
	for(int i=0;i<3;++i)ans.a[i][i]=1;
	tmp.a[0][0]=1,tmp.a[0][1]=0,tmp.a[0][2]=1;
	tmp.a[1][0]=2,tmp.a[1][1]=1,tmp.a[1][2]=2;
	tmp.a[2][0]=1,tmp.a[2][1]=1,tmp.a[2][2]=2;
	for(;x;x>>=1,tmp=tmp*tmp)
		if(x&1)ans=ans*tmp;
	return ans;
}
int n,m,x=1,y=2,z=1;
int main(){
	scanf("%d%d",&n,&m);
	int lst=1;
	for(int i=1,a;i<=m;++i){
		scanf("%d",&a);
		matrix A=get(a-lst);
		int _x=(1ll*x*A.a[0][0]+1ll*y*A.a[0][1]+1ll*z*A.a[0][2])%mod;
		int _y=(1ll*x*A.a[1][0]+1ll*y*A.a[1][1]+1ll*z*A.a[1][2])%mod;
		int _z=(1ll*x*A.a[2][0]+1ll*y*A.a[2][1]+1ll*z*A.a[2][2])%mod;
		x=_x,y=_y,z=_z;
		_x=x;
		_y=(2ll*x+y)%mod;
		_z=(1ll*x+y+z)%mod;
		x=_x,y=_y,z=_z;
		lst=a+1;
	}
	matrix A=get(n-lst);
	int _x=(1ll*x*A.a[0][0]+1ll*y*A.a[0][1]+1ll*z*A.a[0][2])%mod;
	int _y=(1ll*x*A.a[1][0]+1ll*y*A.a[1][1]+1ll*z*A.a[1][2])%mod;
	int _z=(1ll*x*A.a[2][0]+1ll*y*A.a[2][1]+1ll*z*A.a[2][2])%mod;
	x=_x,y=_y,z=_z;
	printf("%d",z);
	
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef string str;
typedef std::pair<ll,ll> pl;
typedef std::map<string, ll> msl;
typedef std::map<ll, ll> mll;
typedef std::vector<ll> vl;
typedef std::vector<pl> vpl;
const long double EPS = 1e-9;

#define rep(i, n) for(ll (i) = 0; (i) < (n) ; (i)++ )
#define For(i, a, b) for(ll (i) = (a); (i) < (b) ; (i)++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define tol(c) char((c)+0x20)
#define tou(c) char((c)-0x20)
#define pb push_back
#define mp make_pair
#define pr(a) cout << (a)
#define prl(a) cout << (a) << endl
#define prl2(a,b) cout << (a) << " " << (b) << endl
#define prs(a) cout << (a) << " "
#define yn(condition) if ((condition)) prl("Yes"); else prl("No");
#define YN(condition) if ((condition)) prl("YES"); else prl("NO");
#define rpr(i,n,ans) rep((i),(n)) prs((ans[(i)]))
#define cpr(i,n,ans) rep((i),(n)) prl((ans[(i)]))
#define in1(a) cin >> (a)
#define in2(a,b) cin >> (a) >> (b)
#define in3(a,b,c) cin >> (a) >> (b) >> (c)
#define in4(a,b,c,d) cin >> (a) >> (b) >> (c) >> (d)
#define rin1(i,n,a) rep((i),(n)) cin >> (a[(i)])
#define rin2(i,n,a,b) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)])
#define rin3(i,n,a,b,c) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)]) >> (c[(i)])
#define e1 first
#define e2 second
#define ctol(c) ll((c)) - ll('0')
#define ltos(n) to_string((n))
#define items(kv, v) for(auto &(kv): (v))
#define ndig(N, n) ctol(ll(ltos((N))[ll(ltos((N)).length()) - (n)]))
#define beto(a,b,c) (a) < (b) && (b) < (c)
#define betc(a,b,c) (a) <= (b) && (b) <= (c) 
#define rsort(a,n) sort(a,a+n,greater<>())

const ll mod = 1e9 + 7;
const ll INF = mod * mod;
const ll MAX_N = 200;

int main(void){
    ll n,k;
    ll answer = INF;

    in2(n,k);
    ll tmp = 0;
    ll f = 1;
    rep(i,n) f *= 2;
    
    while(tmp < f){
        ll a = tmp;
        ll cnt = 1;
        rep(i,n){
            if (a % 2 == 0) cnt *= 2;
            else cnt += k;
            a /= 2;
        }
        answer = min(answer, cnt);
        tmp ++;
    }
    prl(answer);


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#define lson node<<1,st,mid
#define rson node<<1|1,mid+1,ed
#define mem(a,x) memset(a,x,sizeof(a))
#define me(a) memset(a,0,sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define lowbit(x) x&(-x)
#define up(i,x,y) for(long long i=x;i<y;i++)
#define down(i,x,y) for(long long i=x;i>=y;i--)
#define in freopen("in.txt","r",stdin)
#define out freopen("out.txt","w",stdout)   
typedef long long ll;
const ll mod = 998244353;
const ll INF = 0x3f3f3f3f;
const ll maxn = 1e6 + 5;
const double pi = acos(-1.0);
const double eps=1e-9;
using namespace std;
ll qpow(ll a, ll b) { ll s = 1; while (b > 0) { if (b & 1)s = s * a % mod; a = a * a % mod; b >>= 1; }return s; }


int main(){
    ll n;
    cin>>n;
    cout<<(n-1)/2+1<<endl;  
}

Measured memory_bytes: 256
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  int i;
  string s;
  cin >> s;
  for(i=0;i<s.size();i++){
    if(s[i]=='7'){
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int A, B, i;
  cin >> A >> B;
  
  int num=A, sum=0;
  
  for(i=0;i<B-A+1;i++){
    if(num/10000 == num%10 && num/1000-num/10000*10 == (num%100-num%10)/10){
      sum++;}
    num++;}
  
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
int main()
{
     long long int a[100] , b = 1000 , n ;
     cin >> n ;
     for(int i = 1 ; i <= n ; i++)
     {
          cin >> a[i] ;
     }
     long long int j = 1 ;
     a[n+1] = 0 ;
     for(int i = 1 ; i <= n ; i++ )
     {
          if(a[i+1] >= a[i])
          {
               continue ;
          }
          else
          {
               int z = b%a[j] ;
               b /= a[j] ;
               b *= a[i] ;
               b += z ;
               j = i+1 ;
          }
     }
     cout << b << endl ;
}


Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 2000000

int n, T[MAX + 1];

void maxheap(int i)
{
	int l, r, max_k;
	l = i * 2;
	r = l + 1;

	if (r <= n)
	{
		max_k = max({ T[i],T[l],T[r] });
		if (max_k == T[l])
		{
			swap(T[i], T[l]);
			maxheap(l);
		}
		else if (max_k == T[r])
		{
			swap(T[i], T[r]);
			maxheap(r);
		}
	}
	else if (r == n + 1)
	{
		if (T[l] > T[i])swap(T[l], T[i]);
		maxheap(l);
	}
}

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> T[i];
	}
	for (int i = n / 2; i >= 1; i--)maxheap(i);
	for (int i = 1; i <= n; i++)
	{
		cout << " " << T[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 4948
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * @author:26019
 */
public class Main {


    public static void main(String[] args) throws Exception {
        solve();
    }

    private static void solve() throws Exception {
        //BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File("C:\\Users\\26019\\Downloads\\out.txt"))));
        FastScanner cin = new FastScanner();
//        Scanner cin = new Scanner(System.in);
        String s = cin.next();
        int max = 0, cnt = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'R') {
                cnt++;
            } else {
                max = Math.max(cnt, max);
                cnt = 0;
            }
        }
        System.out.println(Math.max(max, cnt));
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("C:\\Users\\26019\\Downloads\\P1190_9.in"))));
        StringTokenizer st = new StringTokenizer("");

        FastScanner() throws FileNotFoundException {
        }

        public String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public String nextLine() { // 读取带空格的字符串
            String res = null;
            try {
                res = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return res;
        }

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

        public int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

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

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

    }
}



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

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

int main(){
  ll N;
  cin >> N;
  ll f[N] = {};

  repi(x, 1, 100) repi(y, 1, 100) repi(z, 1, 100){
    ll val = x*x + y*y + z*z + x*y + y*z + z*x;
    if(val <= N) f[val-1]++;
  }
  rep(i, N) cout << f[i] << endl;
  return 0;
}



Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <string>
#include <bitset>
#include <fstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

#define INF 1000000007ll
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define Min(a,b) (((a) < (b))?(a):(b))
#define Max(a,b) (((a) > (b))?(a):(b))
#define Abs(a) (((a) > 0)?(a):(-1)*(a))
#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )
#define SIZE 110

char t[SIZE];
int main() {
   scanf("%s", t);
   char prv = '?';
   int res = INF, l = 0, r, len = strlen(t);
   for (int j = 0 ; j <= 25 ; ++j) {
      int ans = 0, cnt = 0;
      for (int i = 0 ; i < len ; ++i) {
         if (t[i] != j + 'a') ++cnt;
         else {
            ans = max(cnt, ans);
            cnt = 0;
         }
      }
      ans = max(cnt, ans);
      res = min (res, ans);
   }
   printf("%d\n", res);

   return 0;
}

Measured memory_bytes: 256
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <cmath>         // sqrt
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;
typedef tuple<ll, ll, string> Tlls;

// Greatest Common Divisor (最大公約数)
ll gcd(ll a, ll b)
{
  // Eucledean algorithm
  while (a)
  {
    if (a < b)
    {
      std::swap(a, b);
    }
    a %= b;
  }
  return b;
}

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

// key: value of prime factor素因数分解
// value: number of prime factor
map<ll, ll> prime_factorization(ll n)
{
  map<ll, ll> prime_factors;
  for (ll i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      prime_factors[i]++;
      n /= i;
    }
  }
  if (n != 1)
    prime_factors[n] = 1;
  return prime_factors;
}

// 約数リスト約数の列挙
vector<ll> get_divisors(const ll n)
{
  vector<ll> divs;
  for (ll i = 1; i < (ll)sqrt((ld)n) + 1; i++)
  {
    if (n % i == 0)
    {
      divs.push_back(i);
      if (i != n / i)
      {
        divs.push_back(n / i);
      }
    }
  }

  // 必要に応じてソート
  // sort(divs.begin(), divs.end());

  return divs;
}

int main()
{
  ll K;
  string S;
  cin >> K >> S;
  if (S.length() <= K)
  {
    cout << S << endl;
  }
  else
  {
    cout << S.substr(0, K) << "..." << endl;
  }
  return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<vector>
#include <numeric>
#include <string>
using namespace std;

int main(int argc, char const *argv[]) {
    string S;
    long long ans=0;
    long long ans2=1;
    std::cin >> S;
    char tmp;
    char base,base2;
    base = S[0];
    if(base == '1')base2='0';
    else base2='1';

    for (size_t i = 1; i < S.length(); i++) {
        if(S[i]==base){
            ans++;
            if(base =='1')base='0';
            else base='1';
            continue;
        }
        // if(S[i]==base2){
        //     ans2++;
        //     if(base2 =='1')base2='0';
        //     else base2='1';
        // }
        base = S[i];
    }
    // long long min=ans;
    // if(ans>ans2)min=ans2;
    
    std::cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
typedef struct{
	int c,v,x,y,time,flag;
}CAT_t;
int main(){
    CAT_t a[1000];
	int X,Y,N,n,Nx,Ny;
	scanf("%d",&n);
	int i=0;
	while(i<n){
		int b=0,ans=0;
		for(int j=0;j<1000;j++){
			a[j].v=0;
			a[j].time=0;
			a[j].c=0;
		}
		scanf("%d %d %d %d %d",&N,&X,&Y,&Nx,&Ny);
		for(int j=0;j<N;j++)scanf("%d %d",&a[j].x,&a[j].y);
		for(int j=0;j<N;j++){
			if(((a[j].x-Nx)*(a[j].x-Nx)+(a[j].y-Ny)*(a[j].y-Ny))<=100){
				ans=X;
				a[j].v=1;
				a[j].time=Y;
				a[j].c++;
			}
		}
		for(int j=0;j<N;j++)a[j].flag=0;
		while(1){
			int count=0;
			for(int j=0;j<N;j++)if(a[j].v==1)count++;
			if(count==0)break;
			for(int j=0;j<N;j++){
				if(a[j].v==1){
					for(int k=0;k<N;k++)if((a[j].x-a[k].x)*(a[j].x-a[k].x)+(a[j].y-a[k].y)*(a[j].y-a[k].y)<=2500&&a[k].time<=0&&a[k].flag==0){
						a[k].time=Y;
						a[k].c++;
					}
				}
			}
			for(int j=0;j<N;j++)a[j].flag=0;
			for(int j=0;j<N;j++){
				if(a[j].v==1){
					a[j].time-=X;
					if(a[j].time==0)a[j].flag=1;
					a[j].v=0;
				}
				if(a[j].time==Y)a[j].v=1;
				if(a[j].c==2){
					printf("You're always welcome!\n");
					goto neko;
				}
			}
			ans+=X;
			b=1;
		}
		if(b==1)ans-=X;
		printf("%d\n",ans);
neko:
		i++;
	}
    return 0;
}

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

using namespace std;

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

    int dp[10][10];
    for (int i = 0; i < 10; ++i) {
        for (int j = 0; j < 10; ++j) {
            cin >> dp[i][j];
        }
    }
    
    for (int k = 0; k < 10; ++k) {
        for (int i = 0; i < 10; ++i) {
            for (int j = 0; j < 10; ++j) {
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
            }
        }
    }

    int res = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M; ++j) {
            int a;
            cin >> a;
            if (a == -1) continue;
            res += dp[a][1];
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int num1=0, num2=0, num3=0, sum=0;
scanf("%d",&num1);
scanf("%d",&num2);
scanf("%d",&num3);
sum=num1 + num2 + num3;
if(sum >= 22){
printf("bust\n");
}else {
printf("win\n");
}
 return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define crap ios_base::sync_with_stdio(0);cin.tie(0)
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define endl "\n"
#define int ll

using namespace std;

const int N = 405;
int n;
int p[N];

int sum(int a,int b){
    int ans=0;
    for(int i=a;i<=b;i++) ans+=p[i];
        return ans;
}
int MatrixChainOrder() 
{ 
  
    /* For simplicity of the program, one  
    extra row and one extra column are  
    allocated in m[][]. 0th row and 0th 
    column of m[][] are not used */
    int m[n][n];

  
    int i, j, k, L, q; 
  
    /* m[i,j] = Minimum number of scalar  
    multiplications needed to compute the 
    matrix A[i]A[i+1]...A[j] = A[i..j] where 
    dimension of A[i] is p[i-1] x p[i] */
  
    // cost is zero when multiplying 
    // one matrix. 
    for (i = 0; i < n; i++) 
        m[i][i] = 0; 
  
    // L is chain length. B
    for (L = 2; L<=n; L++) 
    { 
        for (i = 0; i < n - L + 1; i++) 
        { 
            j = i + L - 1; 
            m[i][j] = LLONG_MAX; 

            ll sum1 = sum(i,j);
            for (k = i; k <= j - 1; k++) 
            { 
                // q = cost/scalar multiplications 
                q = m[i][k] + m[k + 1][j]+sum1 ; 
                if (q < m[i][j]) 
                    m[i][j] = q; 
            }

        } 
    } 
  
    return m[0][n - 1]; 
} 

int32_t main()
{
    
   
    crap;
    cin>>n;
    for(int i=0;i<n;i++) cin>>p[i];

    int ans = MatrixChainOrder();
	cout<<ans<<endl;
  	
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

ll S (ll x)
{
    ll r=0;
    while (x)
    {
        r+=x%10;
        x/=10;
    }
    return r;
}

main()
{
    fast;
    ll n;
    cin>>n;
    if (n%S(n)==0)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){
		final Scanner sc = new Scanner(System.in);
		
		final String input = sc.next();
		
		String[] in = input.split("iwi");
		
		if(in.length < 2 || in[0].length() == 0 || in[1].length() == 0){
			System.out.println(3);
			return;
		}
		
		StringBuilder sb = new StringBuilder(in[0]);
		
		char[] in1 = sb.reverse().toString().toCharArray();
		char[] in2 = in[1].toCharArray();
		
		for(int i = 0; i < in1.length; i++){
			switch(in1[i]){
			case '{':
				in1[i] = '}';
				break;
			case '}':
				in1[i] = '{';
				break;
			case '(':
				in1[i] = ')';
				break;
			case ')':
				in1[i] = '(';
				break;
			case '[':
				in1[i] = ']';
				break;
			case ']':
				in1[i] = '[';
				break;
			}
		}
		
		int[][] DP = new int[in1.length][in2.length];
		
		for(int i = 0; i < in1.length; i++){
			for(int j = 0; j < in2.length; j++){
				if(i == 0 && j == 0){
					DP[i][j] = in1[i] == in2[j] ? 1 : 0;
				}else if(i == 0){
					DP[i][j] = Math.max(DP[i][j - 1], in1[i] == in2[j] ? 1 : 0);
				}else if(j == 0){
					DP[i][j] = Math.max(DP[i - 1][j], in1[i] == in2[j] ? 1 : 0);
				}else{
					DP[i][j] = Math.max(DP[i-1][j-1] + (in1[i] == in2[j] ? 1 : 0) ,Math.max(DP[i][j-1], DP[i-1][j]));
				}
				
				//System.out.print(DP[i][j] + " ");
			}
			//System.out.println();
		}
		
		System.out.println((3 + 2 * DP[in1.length - 1][in2.length - 1]));
		
		//System.out.println(Arrays.toString(in1) + " " + Arrays.toString(in2));
	}

}

Measured memory_bytes: 17324
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#include <math.h> 
#include<stdio.h>
#include<string.h> //strcmp、strncmp関数を使うために必要
#include <sstream>


int main(){
    int X,Y,Z;
    int x,y,z;
    cin >> X >> Y >> Z;
    
    x = X;
    y = Y;
    z = Z;
    
    X = y;
    Y = x;
    X = z;
    Z = y;
    
    

        cout <<X<< " " << Y << " " << Z << endl;
    
    

    
}


Measured memory_bytes: 384
(setq s(sort(concatenate'list(read-line))#'char<))
(princ(if(=(mod(length s)2)1)"No"(if(>(loop for i from 0 to(1-(/(length s)2))count(char/=(nth(* i 2)s)(nth(1+(* i 2))s)))0)"No""Yes")))

Measured memory_bytes: 13544