akhauriyash/Code-Regression huggingface dataset:
while True:
  n = int(input())
  if n == 0:
    break
  haiku=[5,7,5,7,7]
  mojicnt=0
  iti=0
  s=[]
  for i in range(n):
    s.append(input())
  for i in range(n):
    for j in range(i,n):
      mojicnt += len(s[j])
      if mojicnt > haiku[iti]:
        continue
      elif mojicnt == haiku[iti]:
        iti+=1
        mojicnt=0
        if iti == 5:
          print(i+1)
          break
    if iti == 5:
      break
    else:
      mojicnt=0
      iti=0



Measured memory_bytes: 5612
a = int(input()) + 1
b = int(input()) + 1
c = int(input()) + 1
total = int(input())
pattern_num = 0
for i in range(0, a):
    for j in range(0, b):
        for k in range(0, c):
            if i*500+j*100+k*50 == total:
                pattern_num += 1
print (pattern_num)

Measured memory_bytes: 3060
N = int(input())
s = []
for i in range(N):
    s += [str(input())]

M = int(input())
t = []
for j in range(M):
    t += [str(input())]


ans = 0
for k in s:
    ans = max(ans, s.count(k) - t.count(k))
print (ans)

Measured memory_bytes: 3064
import numpy as np
from numba import njit

N = int(input())
slimes = np.array(list(map(int, input().split())), dtype='int64')
csum_slimes = [0]
for i in range(N):
    csum_slimes.append(csum_slimes[-1]+slimes[i])
csum_slimes = np.array(csum_slimes, dtype='int64')

dpt = np.full((N, N), -1, dtype='int64')

@njit(cache=True)
def get_min_cost(l, r, slimes, dpt, csum_slimes):
    if dpt[l][r] != -1:
        return dpt[l][r]
    if l == r:
        return 0
    min_cost = 10**18
    for m in range(l, r):
        min_cost = min(min_cost, get_min_cost(l,m,slimes,dpt,csum_slimes)+get_min_cost(m+1,r,slimes,dpt,csum_slimes)+csum_slimes[r+1]-csum_slimes[l])
    dpt[l][r] = min_cost
    return min_cost
    

print(get_min_cost(0, N-1, slimes, dpt, csum_slimes))

Measured memory_bytes: 112644
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);
    int N;
    ll sum = 0;
    cin >> N;
    vector<ll> A(N),B(N+1);
    // B[i] := i 番目までの合計 (1-indexed)
    // [i,j] := B[j] - B[i-1];(1-indexed)
    rep(i,N){
        cin >> A[i];
        sum += A[i];
    }
    rep(i,N){
        B[i+1] = B[i] + A[i];
    }
    ll ok = 1e18;
    ll ng = -1;
    while(abs(ok-ng)>1){
        ll mid = (ok+ng)/2;
        // mid が達成可能かどうかを調べる
        //真ん中の境界を決める
        // a,b,c,dの4つに区間を分ける
        // a+b の平均になるようにaを決めて
        // bは a+b - a で出せる
        //左側は[1,i]で右側は[i+1,N]とすると
        ll a[2],b[2],c[2],d[2];
        bool can = 0;
        for(int i=2;i<=N-2;i++){
            ll left = B[i];
            ll right = sum - left;
            //leftの中で真ん中になるような境界を求める
            // p は 左の区間で 合計が平均以上となる最初のindex
            int p = lower_bound(ALL(B),left/2) - B.begin();
            if(p == i)p--;
            if(p == 1)p++;
            a[0] = B[p-1];
            b[0] = left - a[0];
            a[1] = B[p];
            b[1] = left - a[1];
            p = lower_bound(ALL(B),left + right/2) - B.begin();
            if(p == i+1)p++;
            if(p == N)p--;
            c[0] = B[p] - left;
            c[1] = B[p-1] - left;
            d[0] = right - c[0];
            d[1] = right - c[1];
            // ab のとり方が2通り
            // cd のとり方が2通り
            //合計4パターンで達成可能かどうかを調べる
            rep(j,2)rep(k,2){
                if(max({a[j],b[j],c[k],d[k]}) - min({a[j],b[j],c[k],d[k]}) <= mid)can = 1;
            }
            if(can)break;
        }
        if(can)ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}

Measured memory_bytes: 3456
#include <algorithm>
#include <bitset>
#include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

constexpr ll LL_MOD = 1000000009;
constexpr int I_MOD = 1000000007;
constexpr double EPS = numeric_limits<double>::epsilon();
constexpr double PI = 3.14159265358979323846264338327950288;

template <class T> void scan(vector<T> &v);
void scan(vector<string> &v, bool isWord = true);
boost::dynamic_bitset<> scan(char trueValue = 'o');

class Point {
public:
  int cur;
  set<int> s;

  Point(int p) noexcept : cur(p), s({p}) {}

  bool in(const int next) const { return s.find(next) != end(s); }
  void add(const int next) {
    cur = next;
    s.insert(next);
  }
};

int main(int argc, char *argv[]) {
	// INFILE();
  int n, m;
  cin >> n >> m;

  bool adjList[8][8] = {};
  for (int i = 0; i < m; i++) {
    int from, to;
    cin >> from >> to;
    adjList[from - 1][to - 1] = true;
    adjList[to - 1][from - 1] = true;
  }

  queue<Point> q;
  q.push(Point(1));

  int total = 0;
  while (!q.empty()) {
    Point next_p = q.front();
    q.pop();

    for (int i = 0; i < n; i++) {
      if (!adjList[next_p.cur - 1][i] || next_p.in(i + 1)) {
        continue;
      }

      Point new_point = next_p;
      new_point.add(i + 1);

      if (new_point.s.size() == n) {
        total++;
        continue;
      }
      q.push(new_point);
    }
  }

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

template <class T> void scan(vector<T> &v) {
  map<type_index, const char *const> m = {{typeid(int), "%d"},
                                          {typeid(ll), "%lld"},
                                          {typeid(double), "%lf"},
                                          {typeid(char), "%c"}};

  auto tFormat = m[typeid(T)];

  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

boost::dynamic_bitset<> scan(char trueValue) {
  string s;
  getline(cin, s);

  if (s.size() == 0) {
    getline(cin, s);
  }

  for_each(begin(s), end(s),
           [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
  return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


Measured memory_bytes: 2048
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<LP> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;

struct uf {
private:
	vector<int> par, ran;
public:
	uf(int n) {
		par.resize(n, 0);
		ran.resize(n, 0);
		rep(i, n) {
			par[i] = i;
		}
	}
	int find(int x) {
		if (par[x] == x)return x;
		else return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x), y = find(y);
		if (x == y)return;
		if (ran[x] < ran[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (ran[x] == ran[y])ran[x]++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

void solve() {
	int n; cin >> n;
	uf u(n);
	int r; cin >> r;
	vector<int> p(n);
	rep(i, n)cin >> p[i];
	rep(i, n) {
		u.unite(i, p[i]-1);
	}
	vector<int> c(n);
	rep(i, n) {
		c[u.find(i)]++;
	}
	int k = sqrt(n + 0.01);
	vector<int> cc(k + 1);
	vector<int> v;
	rep(i, n) {
		if (c[i] > 0 && c[i] <= k) {
			cc[c[i]]++;
		}
		else if (c[i] > k) {
			v.push_back(c[i]);
		}
	}
	vector<bool> dp(n + 1); dp[0] = true;
	rep1(i, k) {
		if (cc[i] == 0)continue;
		vector<int> past(i);
		rep(j, n + 1) {
			if (j + i > n)break;
			if (dp[j]) {
				if (dp[j + i]) {
					past[j%i] = j + i;
					continue;
				}
				else {
					int t = (j - past[j%i]) / i;
					if (t < cc[i]) {
					    dp[j + i] = true;
					}
				}
			}
		}
	}
	rep(i, v.size()) {
		per(j, n + 1) {
			if (j + v[i] > n)continue;
			if (dp[j]) {
				dp[j + v[i]] = true;
			}
		}
	}
	if (dp[r]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

	//cout << fixed << setprecision(10);
	//init();
	solve();
	//stop
	return 0;
}




Measured memory_bytes: 7808
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>

using namespace std;

void ABC135D()
{
	int residuals[6][13];
	int base = 1;
	for (int i = 0; i < 6; ++i)
	{
		int base2 = base;
		for (int j = 0; j < 13; ++j)
		{
			residuals[i][j] = (base2 * j) % 13;
		}
		base *= 10;
	}
	// check
	//for (int i = 0; i < 6; ++i)
	//{
	//	for (int j = 0; j < 13; ++j)
	//	{
	//		cout << residuals[i][j];
	//		if (j < 12)
	//			cout << ' ';
	//	}
	//	cout << endl;
	//}


	string str;
	cin >> str;
	int n = str.size();

	vector<int> unknowns;
	int known = 0;
	for (int i = 0; i < n; ++i)
	{
		int loc = i % 6;
		char a = str[n - 1 - i];
		if (a == '?')
		{
			unknowns.push_back(loc);
		}
		else
		{
			int x = atoi(&a);
			known += residuals[loc][x];
		}
		if (known > 12)
			known -= 13;
	}
	if (unknowns.empty())
	{
		int res = known == 5 ? 1 : 0;
		cout << res << endl;
		return;
	}
	int m = unknowns.size();
	int target = 13 + 5 - known;
	if (target > 12)
		target -= 13;

	// DP
	const int MOD = 1000000007;
	vector<long long int> vals(13);
	vals[0] = 1;
	for (int i = 0; i < m; ++i)
	{
		auto prevVals = vals;
		fill(vals.begin(), vals.end(), 0);
		auto& x = residuals[unknowns[i]];
		for (int j = 0; j < 13; ++j)
		{
			auto p = prevVals[j];
			for (int k = 0; k < 10; ++k)
			{
				int currRes = x[k] + j;
				if (currRes > 12)
					currRes -= 13;
				vals[currRes] += p;
				if (vals[currRes] > MOD - 1)
					vals[currRes] -= MOD;
			}
		}
	}
	cout << vals[target] << endl;
}

int main()
{
	ABC135D();
	return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    ll N;
    cin >> N;
    map<string, ll> mp;
    REP(i, N){
    	string s;
    	cin >> s;
    	mp[s]++;
    }

    vector<string> res;
    ll ma = 0;
    for(auto x: mp){
    	chmax(ma, x.second);
    }
    for(auto x: mp){
    	if(x.second == ma) res.push_back(x.first);
    }

    sort(res.begin(), res.end());
    REP(i, res.size()){
    	cout << res[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 25584
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
int divr[maxn];
/*ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}*/
void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
 
 
 
 
 














int main()
{
    int n;
    cin>>n;
    int base=-2;
    string str;
    if(n==0){cout<<0;return 0;}
    while(n!=0)
    {
         int t=n%base;
         n/=base;
         if(t<0){t+=abs(base);
         n=n+1;}
         str.push_back((char)(t+'0'));
      
    }
    for(int i=str.length()-1;i>=0;i--)cout<<str[i];
     
}




















 
 
 
 
 

















Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

#define lld long long int 
#define vll vector<long long int>
#define vs vector<string> 
#define vint vector<int> 
#define vp vector<pair<int,int>>
#define vpll vector<pair<long long int , long long int>>
//#define tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
#define forl(i,a,b) for(int i = a ; i <= b ; i++)
#define forln(i,a,b) for(int i = a; i < b ; i++)
lld mod = 1e9 + 7;
#define ps push_back
#define B begin
#define E end
#define mk make_pair
#define F first 
#define S second 
#define FAST ios_base::sync_with_stdio(false),cin.tie(NULL)
#define sv()                  int t; scanf("%d",&t); while(t--)



lld power(lld x, lld y) 
{ lld temp; if( y == 0) return 1; temp = power((x%mod), (y%mod)/2); if (y%2 == 0) return ((temp%mod)*(temp%mod))%mod;else return (((x%mod)*(temp%mod))%mod*(temp%mod))%mod;} 

using namespace std;

void solution( void );

int main()
{
	solution();
	return 0;
}

void solution()
{
	lld a,b,c,d;
	cin>>a>>b>>c>>d;
	lld cnt = 0;
	while(a > 0 && c > 0){
		if(cnt & 1 ){
			a -= d;
		}else{
			c -= b;
		}
		cnt++;
	}
	if(a > 0)cout<<"Yes";else cout<<"No";
}



Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#define INT long long
#define oo 987654321
#define OO 9999999987654321ll
#define MOD 1000000007
using namespace std;
INT n;
struct VAL{ INT v, id, cnt; };
bool operator<(VAL a, VAL b)
{
    if( a.v == b.v ) return a.id > b.id;
    return a.v < b.v;
}
bool operator==(VAL a, VAL b)
{
    return a.v == b.v;
}
VAL a[100010];
INT ans[100001];
priority_queue<VAL> q, q2;
int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i = 0 ; i < n ; i++ ) cin>>a[i].v, a[i].id = i+1, a[i].cnt = 1, q.push(a[i]);
    while( !q.empty() )
    {
        VAL x = q.top();
        q.pop();
        while( !q.empty() and q.top() == x )
        {
            x.cnt++;
            q.pop();
        }
        q2.push(x);
    }
    q2.push({0,0,0});
    while( q2.size() > 1 )
    {
        VAL x = q2.top(); q2.pop();
        VAL y = q2.top(); q2.pop();
        y.id = min(x.id, y.id);
        ans[x.id] += (x.v - y.v)*x.cnt;
        y.cnt += x.cnt;
        q2.push(y);
    }
    for(int i = 1 ; i <= n ; i++ ) cout<<ans[i]<<endl;
    return 0;
}


Measured memory_bytes: 10992
//https://atcoder.jp/contests/abc124/tasks/abc124_d
/**
 * @file template.cpp
 * @brief 競技プログラミング用テンプレート
 * @author btk15049
 * @date 2019/03/08
 */
#include<bits/stdc++.h>
using namespace std;
#define TEMPLATE
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class reverse_range {private:struct I {int x;int operator*() {return x-1;}bool operator!=(I& lhs) {return x>lhs.x;}void operator++() {--x;}};I i, n;public:reverse_range(int n) :i({ 0 }), n({ n }){}reverse_range(int i, int n) :i({ i }), n({ n }){}I& begin() {return n;}I& end() {return i;}};
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }reverse_range operator!(){return reverse_range(*i,*n);}};
template<typename T>inline T& unused_var(T& v){return v;}
using LL = long long;

struct I{
    int val,cnt;
};
int main(){
    int N,K;
    vector<I> code;
    cin>>N>>K;
    string s;
    cin>>s;
    for(int i:range(N)){
        const int p = 1-(s[i]-'0');
        if(i==0 || code.back().val != p){
            code.push_back({p,1});
        }
        else{
            code.back().cnt++;
        }
    }
    int ed = 0;
    int have = 0;
    int len = 0;
    int ret=0;
    N=code.size();
    for(int i:range(N)){
        while(ed<N && have+code[ed].val<=K){
            have+=code[ed].val;
            len+=code[ed].cnt;
            ed++;
        }
        chmax(ret,len);

        have-=code[i].val;
        len-=code[i].cnt;
    }
    cout << ret << endl;
}




Measured memory_bytes: 1528
#include <iostream>
#include <vector>

int main()
{
    int n,min,max;
    long int sum=0;
    
    std::cin >> n;
    
    std::vector<int> num(n);
    
    for(int i=0;i<n;i++){
        std::cin >> num[i];
        
        sum+=num[i];
        
        if(i==0){
            min=num[0];
            max=num[0];
        }else{
            if(num[i]<min){
                min=num[i];
            }
            if(num[i]>max){
                max=num[i];
            }
        }
    }
    
    std::cout<<min<< ' ' <<max<<' ' <<sum <<std::endl;
    return 0;
}


Measured memory_bytes: 3132
#include <iostream>
#include <stdio.h>

using namespace std;

int H, W;
int N = 21;
char map[101][101];

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

//現在地(x,y)から深さ優先探索
void dfs(int x, int y){
	char now = map[x][y];
	map[x][y] = '.';
	
	for(int i = 0; i<4; i++){
		int nx = x+dx[i]; int ny = y+dy[i];
			
		if(0 <= nx && nx < H && 0 <= ny && ny <W){
			if(map[nx][ny] == now) dfs(nx,ny);
		}
	}
}

int main(){
	for(int i=0; i<N; i++){
		cin >> H >> W;
		if(H == 0 && W == 0) break;
		
		for(int i=0; i<H; i++){
			for(int j=0; j<W; j++){
				cin >> map[i][j];
			}
		}
		
		int ans = 0;
		for(int i=0; i<H; i++){
			for(int j=0; j<W; j++){
				if(map[i][j] != '.') {
					dfs(i,j);
					ans++;
				}
			}
		}
		
		printf("%d\n", ans);
	}
}


Measured memory_bytes: 3500
#include <stdio.h>

#define STUDENT_NUMBER 30
#define STUDENT_SUBMITTED 28

int main(void) 
{
	int submitted[STUDENT_NUMBER];
	int i, id;

	for (i = 0; i < STUDENT_NUMBER; i++) {
		submitted[i] = 0;
	}

	for (i = 0; i < STUDENT_SUBMITTED; i++) {
		scanf("%d", &id);
		submitted[id - 1] = 1;
	}

	for (i = 0; i < STUDENT_NUMBER; i++) {
		if (submitted[i] == 0) {
			printf("%d\n", i + 1);
		}
	}
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<string>
#include<cstdio>
#include <cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    ll N; cin >> N;
    map<ll, ll> mp;
    rep1(i, N) {
        ll n = i;
        for(ll k = 2LL; k * k <= n; k++) {
            while(n % k == 0) {
                mp[k] ++;
                n /= k;
            }
        }
        if(n != 1) mp[n] ++;
    }
    ll ans = 1LL;
    for(auto p: mp) {
        ans *= (p.sc + 1);
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = LLONG_MAX;
const double EPS = 1e-10;

map<Pll, int> mp;

int dx[9] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
int dy[9] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};

int main(int argc, char const* argv[])
{
  int n, k;
  cin >> n >> k;
  vector<P> vec;
  vector<ll> vecx;
  vector<ll> vecy;
  for(int i = 0; i < n; i++){
    ll a, b;
    cin >> a >> b;
    vec.pb(mk(a, b));
    vecx.pb(a);
    vecy.pb(b);
  }
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      for(int a = 0; a < 9; a++){
        ll nx = vecx[i] + dx[a];
        ll ny = vecy[j] + dy[a];
        mp[mk(nx, ny)] = 0;
        for(int l = 0; l < n; l++){
          if(nx >= vec[l].first && ny >= vec[l].second)mp[mk(nx, ny)]++;
        }
      }
    }
  }
  sort(vecx.begin(), vecx.end());
  sort(vecy.begin(), vecy.end());
  ll res = linf;
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      ll lowx = vecx[i];
      ll upx = vecx[j];
      for(int l = 0; l < n; l++){
        int ld = l;
        int rd = n - 1;
        while(rd - ld > 1){
          int md = (rd + ld) / 2;
          int tmp = mp[mk(upx, vecy[md])] - mp[mk(upx, vecy[l] - 1)] - mp[mk(lowx - 1, vecy[md])] + mp[mk(lowx - 1, vecy[l] - 1)];
          if(tmp < k)ld = md;
          else rd = md;
        }
        int tmp = mp[mk(upx, vecy[rd])] - mp[mk(upx, vecy[l] - 1)] - mp[mk(lowx - 1, vecy[rd])] + mp[mk(lowx - 1, vecy[l] - 1)];
        if(tmp >= k)res = min(res, (ll)(upx - lowx) * (vecy[rd] - vecy[l]));
      }
    }
  }
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define MAX 1e6
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set


int main() 
{
	ll n;
	cin>>n;
	ll arr[n];
	unordered_map<ll,ll> um;
	REP(i,0,n){
		cin>>arr[i];
		um[arr[i]]++;
	}
	ll sum = 0;
	for(auto it:um){
		sum += ((it.second-1)*it.second)/2;
	}
	ll ans[n];
	REP(i,0,n){
		ans[i] = sum - (um[arr[i]]*(um[arr[i]]-1))/2 + ((um[arr[i]]-1)*(um[arr[i]]-2))/2;
	}
	REP(i,0,n) cout<<ans[i]<<endl;
	return 0;
}  


Measured memory_bytes: 10696
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5 + 5;
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n, x;
    cin >> x >> n;
    int sum = 0;
    for(int i = 0, num; i < n; i++){
        cin >> num;
        sum += num;
    }
    int ans = x - sum;
    if(ans < 0) ans = -1;
    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
const int N = 100010;
const ll INFLL = 1e18;
int _w;

int n, e, t, x[N];

namespace SGT {
	ll val[N*4], tag[N*4], ql, qr, qv;
	
	void _query( int o, int L, int R, ll adv ) {
		if( L >= ql && R <= qr ) {
			qv = min(qv, val[o] + adv);
		} else {
			int M = (L+R)/2, lc = o<<1, rc = lc|1;
			adv += tag[o];
			if( ql <= M ) _query(lc, L, M, adv);
			if( qr > M ) _query(rc, M+1, R, adv);
		}
	}
	ll query( int l, int r ) {
		ql = l, qr = r, qv = INFLL;
		_query(1, 1, n+1, 0);
		return qv;
	}
	void _add( int o, int L, int R ) {
		if( L >= ql && R <= qr ) {
			tag[o] += qv;
			val[o] += qv;
		} else {
			int M = (L+R)/2, lc = o<<1, rc = lc|1;
			if( ql <= M ) _add(lc, L, M);
			if( qr > M ) _add(rc, M+1, R);
			val[o] = min(val[lc], val[rc]) + tag[o];
		}
	}
	void add( int l, int r, ll v ) {
		ql = l, qr = r, qv = v;
		_add(1, 1, n+1);
	}
}

ll f[N];
void solve() {
	f[1] = x[1];
	SGT::add(1, 1, f[1]);
	int p = 1;
	for( int i = 2; i <= n+1; ++i ) {
		f[i] = x[i] - x[i-1];
		SGT::add(i-1, i-1, t);
		if( i > 2 )
			SGT::add(1, i-2, x[i-1] - x[i-2]);
		if( p > 1 )
			SGT::add(1, p-1, x[i-1] - x[i-2] + x[i-1] - x[i-2]);
		while( x[i-1] - x[p] + x[i-1] - x[p] > t ) {
			SGT::add(p, p, -t);
			SGT::add(p, p, x[i-1] - x[p] + x[i-1] - x[p]);
			++p;
		}
		f[i] += SGT::query(1, i-1);
		SGT::add(i, i, f[i]);
	}
}

int main() {
	cin >> n >> e >> t;
	for( int i = 1; i <= n; ++i )
		cin >> x[i];
	x[n+1] = e;
	solve();
	cout << f[n+1] << endl;
	return 0;
}


Measured memory_bytes: 6784
#include <cstdio>
#include <vector>

using namespace std;

#define MAX_N (105)

vector<int> G[MAX_N];
bool arrived[MAX_N];
int d[MAX_N];
int f[MAX_N];
int n;
int t;
void dfs( int cur ) {
    t++;
    d[cur] = t;

    for ( int i = 0; i < G[cur].size(); i++ ) {
	int next = G[cur][i];
	if ( !arrived[next] ) {
	    arrived[next] = true;
	    dfs( next );
	}
    }

    t++;
    f[cur] = t;

    return;
}

int main()
{
    scanf("%d", &n);
    for ( int i = 0; i < n; i++ ) {
	int u, k;
	scanf("%d %d", &u, &k);
	u--;
	for ( int j = 0; j < k; j++ ) {
	    int v;
	    scanf("%d", &v);
	    v--;
	    G[u].push_back(v);
	}
    }

    t = 0;
    for ( int i = 0; i < n; i++ ) {
	if ( !arrived[i] ) {
	    arrived[i] = true;
	    dfs(i);
	}
    }


    for ( int i = 0; i < n; i++ ) {
	printf("%d %d %d\n", i+1, d[i], f[i]);
    }

    return 0;
}

Measured memory_bytes: 1060
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        long n = in.nl(), k = in.nl();
        long a = n-(n/k)*k;
        long b = k-a;
        out.println(Math.min(a,b));
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
struct era{
  string name;
  ll ran,en;
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;
  while(cin>>n>>m,n+m){
    vector<era>li;
    for(int i=0;i<n;i++){
      string s;cin>>s;
      ll a,b;cin>>a>>b;
      li.pb({s,a,b});
    }
    for(int i=0;i<m;i++){
      ll year;cin>>year;
      bool fl=true;
      for(int j=0;j<n;j++){
	if(li[j].en-li[j].ran < year && year <=li[j].en){
	  fl=false;
	  cout<<li[j].name<<" "<<year-li[j].en+li[j].ran<<endl;
	  break;
	}
      }
      if(fl){cout<<"Unknown"<<endl;}
    }
  }
  return 0;
}



Measured memory_bytes: 3112
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//const int MAX=;



int main(){
	char b;
	cin>>b;
	if(b=='A')cout<<"T"<<endl;
	if(b=='C')cout<<"G"<<endl;
	if(b=='G')cout<<"C"<<endl;
	if(b=='T')cout<<"A"<<endl;
}

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

def casar(s, n):
  d = {}
  for c in (65, 97):
    for i in range(26):
      d[chr(i+c)] = chr((i+n) % 26 + c)

  return "".join([d.get(c, c) for c in s])

while True:
  try:
    encrypttxt = raw_input()
    for i in range(26):
      t = casar(encrypttxt, i)
      if  "the" in t or "this" in t or "that" in t:
        print t

  except EOFError:
    break

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

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

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

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

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    string S;
    cin >> N;
    cin >> S;

    ll count = 0;
    ll ans = 0;

    REP(i, N){
        if(S[i] == 'I'){
            count++;
        }
        else{
            count--;
        }
        ans = max(ans, count);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

int main(){
    lld h;
    int n;
    scanf("%lld %d", &h, &n);
    lld sum = 0;
    rep(i, 0, n){
        lld b;
        scanf("%lld", &b);
        sum += b;
    }
    printf(sum >= h ? "Yes" : "No");

    return 0;
}

Measured memory_bytes: 128
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

/**
 * Created by chinalife on 2019/7/25.
 */
public class Main {
    public static int[][] direction = new int[][]{{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt(), w = sc.nextInt(), n = sc.nextInt();
        sc.nextLine();
        char[][] map = new char[h][w];
        for (int i = 0; i < h; i++) {
            String s = sc.nextLine();
            for (int j = 0; j < w; j++) {
                map[i][j] = s.charAt(j);
            }
        }
        int[][] factory = new int[n + 1][2];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (map[i][j] == 'S') {
                    factory[0][0] = i;
                    factory[0][1] = j;
                } else if (Character.isDigit(map[i][j])) {
                    int num = map[i][j]-'0';
                    factory[num][0] = i;
                    factory[num][1] = j;
                }
            }
        }
        int result = 0;
        for (int i = 0; i < n; i++) {
            result += bfs(factory[i][0], factory[i][1], factory[i + 1][0], factory[i + 1][1], map);
        }
        System.out.println(result);
    }

    /*
    使用bfs返回从当前节点到下一个节点的最短距离
     */
    public static int bfs(int sx, int sy, int ex, int ey, char[][] map) {
        int[][] distance = new int[map.length][map[0].length];
        for (int i = 0; i < distance.length; i++) {
            Arrays.fill(distance[i], -1);
        }
        distance[sx][sy] = 0;
        Queue<Point> queue = new LinkedList<>();
        Point p = new Point(sx,sy);
        queue.add(p);
        //int res = 0;
        while (!queue.isEmpty()){
            Point temp = queue.poll();
            if(temp.x == ex && temp.y == ey){
                break;
            }
            for(int i = 0;i < direction.length;i++){
                int newX = temp.x+direction[i][0];
                int newY = temp.y+direction[i][1];
                if(newX>=0 && newX < map.length && newY >= 0 && newY < map[0].length
                        && map[newX][newY] !='X' && distance[newX][newY] == -1){
                    distance[newX][newY] = distance[temp.x][temp.y]+1;
                    Point curr = new Point(newX,newY);
                    queue.add(curr);
                }
            }
        }
        return distance[ex][ey];
    }

    static class Point {
         int x;
         int y;
        Point(int x,int y) {
            this.x = x;
            this.y = y;
        }
    }
}



Measured memory_bytes: 106840
// IlyM

#include <bits/stdc++.h>

#define pb push_back
#define sp " "
#define fi first
#define se second
#define mp make_pair
#define sz(a) ((int)a.size())
#define tra(a,b) for (auto a:b) 
#define fo(a,b,c) for (unsigned long long a=b;a<=c;a++) 
#define ms(a,b) memset(a,b,sizeof(a)) 
#define all(a) a.begin(),a.end()
#define rev(a) reverse(a.begin(),a.end())

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;

const int N=2e5+5,mod=998244353;
ll a,b;
int main()
{
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	cin>>a;
	b=1000*(a/500);
	a%=500;
	b+=5*(a/5);
	cout<<b;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

using namespace std;

void keisan(int *n){
	int kari1,kari2;

	kari1 = *n * 1.05;
	if((kari1 % 1000) > 0) {
		kari2 = kari1 / 1000;
		*n = kari2 * 1000 + 1000;
	} else {
		*n = kari1;
	}
}

int main() {
	int syakkin = 100000;
	int a;

	cin >> a;

	for (int i = 0; i < a; i++){
		keisan(&syakkin);
	}

	cout << syakkin << endl;

	return 0;

}

Measured memory_bytes: 1160
#include <stdio.h>

int main()

{

    int n;

    int i;

    double count=0;

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {

        if(i%2!=0)

        {

            count++;

        }

    }

    printf("%.10lf",count/n);

    return 0;

}

Measured memory_bytes: 128
n = int(input())
a_li = [int(i) for i in input().split()]
b_li = [int(i) for i in input().split()]

if b_li[0]<b_li[-1]:
    a_li = a_li[::-1]
    b_li = b_li[::-1]

ans = 0
for i in range(0,n):
    attack = min(a_li[i],b_li[i])
    attack2 = min(a_li[i+1],b_li[i]-min(a_li[i],b_li[i]))
    a_li[i]-=attack
    a_li[i+1]-=attack2
    b_li[i]-=(attack+attack2)
    ans+=(attack+attack2)

print(ans)



Measured memory_bytes: 19156
from itertools import permutations
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

fn = lambda: [int(x) for x in input().split()]
N, M, R = fn()
r = [int(ri) - 1 for ri in input().split()]
A, B, C = [0]*M, [0]*M, [0]*M
for i in range(M):
    A[i], B[i], C[i] = fn()
    A[i], B[i] = A[i] - 1, B[i] - 1

G = csr_matrix((C, (A, B)), shape=(N, N), dtype=int)
D = floyd_warshall(G, directed=False)

routes = permutations(r)
result = float('inf')
for route in routes:
    d = sum([D[route[i], route[i+1]] for i in range(len(route) - 1)])
    result = min(result, d)
print(int(result))


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

int k;
string s;

int main()
{
	cin >> k >> s;
  	if (s.size() <= k) cout << s << endl;
  	else
    {
    	for (int i = 0; i < k; i ++ ) cout << s[i];
      	puts("...");
    }
  	
  	return 0;
}

Measured memory_bytes: 3564
#include <cstdio>
#include <algorithm>
using namespace std;

bool big_order(int a, int b){return (a>b);}

int main(int argc, char *argv[]) {
	int array[5];
	
	fscanf(stdin, "%d %d %d %d %d", &array[0], &array[1], &array[2], &array[3], &array[4]);
	sort(array, array+sizeof(array)/sizeof(int), big_order);
	printf("%d", array[0]);
	for (int i = 1; i < 5; i++) {
		printf(" %d", array[i]);
	}
	fflush(stdout);
	printf("\n");
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
char s[10];
cin >> s;
string ans = "Heisei";
if((s[5]-'0')*10+(s[6]-'0')>=5) {
  ans = "TBD";
}
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int n = sc.nextInt();
			if( n == 0 ) break;
			
			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < n; i++) sb.append(sc.nextInt());
			
			debug(sb);
			int min = n;
			for(int i=0;i<sb.length();i++) for(int c=1;c<=3;c++){
				StringBuilder tmp = new StringBuilder(sb.substring(0, i) + c + sb.substring(i+1));
				debug(tmp);
				int l = i, r = i, cnt = 0;
				while(l>=0) {
					int cc = tmp.charAt(l) - '0';
					while( l > 0 && cc == ( tmp.charAt(l-1) - '0') ) l--;
					while( r < sb.length()-1 && cc == ( tmp.charAt(r+1) - '0' )) r++;
					debug(l, r, r-l-cnt+1);
					if( r-l-cnt+1 < 4 ) break;
					cnt += r-l-cnt+1;
					l--;
				}
				
				min = min(sb.length() - cnt, min);
			}
			
			System.out.println(min);
		}
	}

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

	void debug(Object... os) {
//		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 13000
import java.util.Scanner;

public class Main {
	static char board[][];
	static Scanner sc = new Scanner(System.in);
	static int[] vx = new int[]{0,1,0,-1};
	static int[] vy = new int[]{1,0,-1,0};
	static int maxh, maxw;
	static boolean wflag;
	static boolean bflag;
	private static int count;
	private static int wcount = 0;
	private static int bcount = 0;;
	
	public static void main(String[] args) {
        while (true) {
            maxw = sc.nextInt();
            maxh = sc.nextInt();
            if(maxw == 0) break;
            board = new char[maxh][maxw];
            for (int i = 0; i < maxh; i++) {
            	board[i] = sc.next().toCharArray();
            }
            wcount=0;
            bcount=0;
            solve();
            System.out.println(bcount + " " + wcount);
        }
	}

	private static void solve() {
		for (int i = 0; i < maxh; i++) {
			for (int j = 0; j < maxw; j++) {
				if (board[i][j] == '.') {
					count=0;
					wflag = false;
					bflag = false;
					dfs(i, j);
					if (wflag && !bflag) wcount += count;
					if (!wflag && bflag) bcount += count;
				}
			}
		}		
	}

	private static void dfs(int h, int w) {
		board[h][w] = 'X';
		count++;
		for (int i = 0; i < 4; i++) {
				if (h + vx[i] >= maxh || h + vx[i]  < 0 || w + vy[i] >= maxw || w + vy[i] < 0)
					continue;
				char c = board[h + vx[i]][w + vy[i]];
				if (c == 'X') continue;
				if (c == 'W') {
					wflag = true;
					continue;
				}
				if (c == 'B') {
					bflag = true;
					continue;
				}
				dfs(h + vx[i], w + vy[i]);
		}
	}
}

Measured memory_bytes: 25440
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            C();
        }

        static void C()
        {
            var N = ReadInt();
            var h = ReadSplitInt();
            var dp = new int[N];
            for (var i = 0; i < N; i++) dp[i] = int.MaxValue;

            dp[0] = 0;

            for (int i = 1; i < N; i++)
            {
                if (i == 1)
                    dp[i] = dp[i - 1]+ Abs(h[i] - h[i - 1]);
                else
                    dp[i] = Min(dp[i - 1] + Abs(h[i] - h[i - 1]), dp[i-2] + Abs(h[i] - h[i-2]));
            }
            Println(dp[N - 1]);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}

Measured memory_bytes: 19680
n = int(input())
s = input()
cnt = 0
ans = ''
for i in range(n):
    if s[i] == '(':
        cnt += 1
    else:
        cnt -= 1
    if cnt < 0:
        ans += '('
        cnt = 0
ans += s
if cnt > 0:
    for i in range(cnt):
        ans += ')'
print(ans)

Measured memory_bytes: 3064
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
$H = trim(fgets(STDIN));
$W = trim(fgets(STDIN));
//list($N,$K) = explode(" ",trim(fgets(STDIN)));
//$a = explode(" ",trim(fgets(STDIN)));
//$h = explode(" ",trim(fgets(STDIN)));

printf("%d\n",($N-$W+1)*($N-$H+1));


Measured memory_bytes: 4604
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<ll> vl;

vector<pair<ll, ll>> factorize(ll N) {
  vector<pair<ll, ll>> res;
  ll n = N;
  for (ll p = 2; p*p <= n; p++) {
    if (N%p != 0) continue;
    int count = 0;
    while (N%p == 0) {
      count++; // pで割れる回数をカウント
      N /= p;
    }
    res.push_back(make_pair(p, count));
  }
  if (N != 1) res.push_back(make_pair(N, 1)); // 最終的にNが素数のとき
  return res;
}

int main() {
  ll N, P;
  cin >> N >> P;
  vector<pair<ll, ll>> res = factorize(P);
  ll ans = 1;
  for (int i = 0; i < res.size(); i++) {
    int c = res[i].second;
    while (c >= N) {
      ans *= res[i].first;
      c -= N;
    }
  }

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

Measured memory_bytes: 384