akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer x;
  
  x = nil->next;
  
  while(x != nil && x->key != key){
    x = x->next;
  }
  return x;
  
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  if ( t == nil ) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;

}

void deleteFirst(){
  deleteNode(nil->next);
}

void deleteLast(){
  deleteNode(nil->prev);
}

void delete(int key){
  NodePointer x;

  if((x = listSearch(key))!=NULL){

    deleteNode(x);
  }
 
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
  
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}

Measured memory_bytes: 34972
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vi a(n);
  rep (i, n) {
    scanf("%d", &a[i]);
  }
  int m = 112345;
  vi b(m, 0);
  rep (i, n) {
    b[a[i]] += 1;
    b[a[i] + 1] += 1;
    b[a[i] + 2] += 1;
  }
  int ans = 0;
  rep (i, m) {
    ans = max(ans, b[i]);
  }
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 1272
# include <iostream>
# include <sstream>
# include <cstdio>
# include <cstdlib>
# include <algorithm>
# include <string>
# include <cstring>
# include <cmath>
# include <stack>
# include <queue>
# include <vector>
# include <list>
# include <map>
# include <set>
# include <deque>
# include <iterator>
# include <functional>
# include <bitset>
# include <climits>
# include <ctime>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define odd(x) (x&1)
typedef long long ll;
typedef long double ld;
const ll oo = 2 * 1000 * 1000 * 1000;
const int _cnt = 1000 * 1000;
const int _p = 1000 * 1000 * 1000 + 7;
ll o(ll x) { return x%_p; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b)*b; }
using namespace std;

void file_put() {
	freopen("filename.in", "r", stdin);
	freopen("filename.out", "w", stdout);
}

ll n;

int get_index(ll n) {
	int ans = 0;
	while (n) {
		ans++;
		n /= 10;
	}
	return ans;
}

int main() {
	//file_put();

	cin >> n;
	for (ll t = (int)sqrt(n); t >= 1; t--) {
		if (n%t != 0) continue;
		cout << get_index(n / t) << endl;
		return 0;
	}

	return 0;
}


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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define size_of(a) (int)(a).size()

int main() {
	vector< int > primes;
	vector< bool > isp(10010, 1);
	
	for_(i,2,10010) {
		if (isp[i]) {
			primes.push_back(i);
			for (int j = 2 * i; j < 10010; j += i) isp[j] = 0;
		}
	}
	
	int n;
	while (cin >> n, n) {
		int p = -1;
		
		for_(i,0,size_of(primes)-1) {
			if (primes[i + 1] <= n && primes[i + 1] - primes[i] == 2) {
				p = primes[i + 1];
			}
		}
		
		cout << p - 2 << " " << p << endl;
	}
}

Measured memory_bytes: 1236
x,y = map(int,input().split())
if 0 <= x < y:
    print(y-x)
elif x < 0 and y > 0 and abs(x) > abs(y):
    print(abs(x)-y+1)
elif x < 0 and y > 0 and abs(x) < abs(y):
    print(y-abs(x)+1)
elif x > y > 0:
    print(x-y+2)
elif x > 0 and y == 0:
    print(x+1)
elif x > 0 and y < 0 and abs(x) > abs(y):
    print(x-abs(y)+1)
elif x > 0 and y < 0 and abs(x) < abs(y):
    print(abs(y)-x+1)
elif abs(x) == abs(y):
    print(1)
elif x < y <= 0:
    print(y-x)
elif x == 0 and y < 0:
    print(abs(y)+1)
else:
    print(x-y+2)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace ConsoleApplication2
{
    class Program
    {

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            long n = long.Parse(input[0]);
            long k = long.Parse(input[1]);

            long mmm = 1000000007;

            List<long>[] tree = new List<long>[n+1];
            //初期化
            for (long i = 1; i < n+1; i++)
            {
                tree[i] = new List<long>();
            }

            //木作成
            for (long i = 0; i < n-1; i++)
            {
                input = Console.ReadLine().Split(' ');
                long a = long.Parse(input[0]);
                long b = long.Parse(input[1]);

                tree[a].Add(b);
                tree[b].Add(a);
            }
            long ans = k;//根はk通りの塗分けができる
            long ch = tree[1].Count;

            //子の塗分けを全通り求める
            for (long i = 0; i < ch; i++)
            {
                ans *= (k - 1 - i);//子は k-1,k-2,k-3,k-4・・・・
                if (ans <= 0)
                {
                    Console.WriteLine("0");
                    return ;
                }
                ans = ans % mmm;
            }
            //子孫の塗分け合計のカウントを子に頼む
            foreach (long i in tree[1])
            {
                ans = func(1, i, k, ans, tree);
                if (ans <= 0)
                {
                    ans = 0;
                }
            }

            ans = ans % mmm;

            Console.WriteLine(ans.ToString());
            //Console.WriteLine(string.Join(" ", b));
        }
        static long func(long parent,long me,long k,long ans, List<long>[] tree)
        {
            long mmm = 1000000007;
            long ch = tree[me].Count;

            //子の塗分けを全通り求める(親を除くのでch-1)
            for (long i = 0; i < ch-1; i++)
            {
                ans *= (k - 2 - i);//子は k-2,k-3,k-4・・・・
                if (ans <= 0 ) return 0;
                ans = ans % mmm;
            }
            //子孫の塗分け合計のカウントを子に頼む
            foreach (long i in tree[me])
            {
                if (i != parent)//親には頼めない
                {
                    ans = func(me, i, k, ans, tree);
                }
            }
            return ans;
        }
    }
}

Measured memory_bytes: 40968
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
typedef pair<int,int> P;

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

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return 1;
    }
    return 0;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return 1;
    }
    return 0;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};
// v.front() = -BOUND;
// v.back() = BOUND;
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }
    // 素数である
    return true;
}

int main() {
    int H,W,D;
    cin >> H >> W >> D;
    map<int, pair<int,int>>mp;
    vector<ll>k(H*W+1,0LL);
    rep(i,H){
        rep(j,W){
            int a; cin >>a;
            mp[a]=pair<int,int>(i+1,j+1);
        }
    }
    for(int i=1; i<=D; i++){
        int temp=i;
        while(temp+D<=H*W){
            ll nh=mp[temp+D].first, nw=mp[temp+D].second;
            ll ph=mp[temp].first, pw=mp[temp].second;
            k[temp+D]=k[temp]+abs(nh-ph)+abs(nw-pw);
            temp+=D;
        }
    }
    int Q; cin >> Q;
    rep(i,Q){
        ll l,r; cin >> l >> r;
        cout << k[r]-k[l] << endl;
    }

    return 0;
}


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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	int A[3];
	cin >> A[0] >> A[1] >> A[2];
	string T;
	cin >> T;
	int res = 0;
	for (int i = 0; i < K; i++) {
		vector<int> dp(3, 0);
		if (T[i] == 's') {
			dp[0] = A[0];
		} else if (T[i] == 'p') {
			dp[1] = A[1];
		} else if (T[i] == 'r') {
			dp[2] = A[2];
		}
		for (int j = i + K; j < N; j += K) {
			vector<int> ndp(3, 0);
			if (T[j] == 's') {
				ndp[0] = max(ndp[0], dp[1] + A[0]);
				ndp[0] = max(ndp[0], dp[2] + A[0]);
				ndp[1] = max(ndp[1], dp[0]);
				ndp[1] = max(ndp[1], dp[2]);
				ndp[2] = max(ndp[2], dp[0]);
				ndp[2] = max(ndp[2], dp[1]);
			} else if (T[j] == 'p') {
				ndp[0] = max(ndp[0], dp[1]);
				ndp[0] = max(ndp[0], dp[2]);
				ndp[1] = max(ndp[1], dp[0] + A[1]);
				ndp[1] = max(ndp[1], dp[2] + A[1]);
				ndp[2] = max(ndp[2], dp[0]);
				ndp[2] = max(ndp[2], dp[1]);
			} else if (T[j] == 'r') {
				ndp[0] = max(ndp[0], dp[1]);
				ndp[0] = max(ndp[0], dp[2]);
				ndp[1] = max(ndp[1], dp[0]);
				ndp[1] = max(ndp[1], dp[2]);
				ndp[2] = max(ndp[2], dp[0] + A[2]);
				ndp[2] = max(ndp[2], dp[1] + A[2]);
			}
			swap(ndp, dp);
		}
		res += max(max(dp[0], dp[1]), dp[2]);
	}
	cout << res << endl;
}

Measured memory_bytes: 512
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def main():
    INF = 999999999999999999999999
    MOD = 10**9+7

    n,*L = get_all_int()

    ans = 0

    for i in range(n-2):
        for j in range(i+1, n-1):
            for k in range(j+1, n):
                
                a,b,c = L[i],L[j],L[k]
                # log(i,j,k,a,b,c)

                if len({a,b,c}) != 3:
                    continue

                if a+b <= c:
                    continue
                if a+c <= b:
                    continue
                if b+c <= a:
                    continue
                ans += 1
    
    print(ans)

main()

Measured memory_bytes: 74464
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
	int H, W, N; 
	cin >> H >> W >> N; 
	int A[10010] = {}, B[10010] = {}; 
	int C[10010] = {}; 
	for(int i = 1; i <= N; i++){
		cin >> A[i]; 
		B[i] = B[i-1] + A[i]; 
	}
	for(int i = 1; i <= N; i++){
		for(int j = B[i-1] + 1; j <= B[i]; j++){
			C[j] = i; 
		}
    }
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			if(i % 2 == 0){
				cout << C[i * W + j + 1] << " "; 
			}
			if(i % 2 == 1){
				cout << C[i * W + W - j] << " "; 
			}
			
		}
		cout << endl; 
	}
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int r, g, b;
  cin >> r >> g >> b;
  int num =r*100+g*10+b;
  cout << (num%4==0?"YES":"NO") << endl;
  return 0;
}


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

#define PI 3.14159265358979323846264338327950L

int main() {
  int a, b, h, m;
  cin >> a >> b >> h >> m;

  long double rad = PI * 2 *
                    ((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 -
                     (long double)m / 60.0);

  long double rsq =
      (long double)(a * a + b * b) - (long double)(2 * a * b) * cosl(rad);

  printf("%20.20Lf\n", sqrtl(rsq));
}

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

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

const int MAX = 110000;
int N;
long long t[MAX], x[MAX], y[MAX];

string solve() {
  int cx = 0, cy = 0, ct = 0;
  for (int i = 0; i < N; ++i) {
	int dis = abs(x[i] - cx) + abs(y[i] - cy);
	if (dis > t[i] - ct) return "No";
	if ( (dis - (t[i]-ct)) & 1 ) return "No";

	cx = x[i], cy = y[i], ct = t[i];
  }
  return "Yes";
}


int main() {
  while (cin >> N) {
	for (int i = 0; i < N; ++i) cin >> t[i] >> x[i] >> y[i];
	cout << solve() << endl;
  }
}






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

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

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

#define INF 1e16

ll n,k;
ll x[101010],y[101010];
bool c[101010];
bool h[101010];
vector<ll> ex[1010],ey[1010];

int main(){
	cin>>n>>k;
  rep(i,n){
    char cc;
    cin>>x[i]>>y[i]>>cc;
    if(cc=='W')c[i]=false;
    else c[i]=true;
  }
  ll crt=0;
  rep(i,n){
    h[i]=((x[i]/k)+(y[i]/k))%2;
    if(h[i]==c[i])crt++;
    ex[(k-(x[i]%k))].push_back(i);
    ey[(k-(y[i]%k))].push_back(i);
  }

  ll res=0;
  rep(a,k+1){
    for(ll idx : ex[a]){
      if(h[idx]==c[idx])crt--;
      else crt++;
      h[idx]=1-h[idx];
    }
    rep(b,k+1){
      for(ll idx : ey[b]){
        if(h[idx]==c[idx])crt--;
        else crt++;
        h[idx]=1-h[idx];
      }
      maxch(res,max(crt,n-crt));
    }
  }
  cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 4224
#include <stdio.h>
int main()
{
   int h,n,a[100000],k,sum=0,i;
   scanf("%d",&h);
   scanf("%d",&n);
   for(i=0;i<n;i++)
   {
       scanf("%d",&a[i]);
   }
   for(i=0;i<n;i++)
   {
       sum=sum+a[i];
   }
   k=sum-h;
   if(k<0)
    printf("No");
   else
   {
       printf("Yes");
   }
   return 0;
}




Measured memory_bytes: 512
// ABC120_C
#include <iostream>
#include <string>
#include <stack>
using namespace std;
using ll = long long;

int main() {
    // input(sunippets: inpv, inpn)
    string S;
    cin >> S;

    // calculation
    stack<char> st;
    st.push(S[0]);
    ll res = 0;
    for (ll i = 1; i < S.size(); ++i) {
        if (st.empty()) {
            st.push(S[i]);
        } else if (st.top() != S[i]) {
            // 1 と 0 が合わさったら
            st.pop();
            res++;
        } else {
            st.push(S[i]);
        }
    }

    cout << res*2 << "\n";

    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long num = sc.nextLong();
		if(num%2==1){
			System.out.println(0);
		}
		else {

			long sum=0;
			for (long i = 5; i<=2*num; i=5*i) {
				sum += (long)(num/(2*i));
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 23636
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };


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

	ll n, w, m, k, h, ans = 0;
	string s, t;
	cin >> s;
	if (s[0] != '2' || s[1] != '0' || s[2] != '1' || s[3] != '9');
	else if (s[5] != '1') {
		n = s[6] - '0';
		if (n < 5) {
			if (n <= 4) {
				cout << "Heisei\n";
				return 0;
			}
		}
	}
	cout << "TBD\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;cin>>N;
  int A,B;cin>>A>>B;
  int cnt[3]={0,0,0};
  repeat(i,N){
    int P;cin>>P;
    if(P<=A){
      cnt[0]++;
    }else if(P<=B){
      cnt[1]++;
    }else{
      cnt[2]++;
    }
  }
  cout << min({cnt[0],cnt[1],cnt[2]}) << endl;
  return 0;
}


Measured memory_bytes: 256
// ABC086_C
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)

typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

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

    // input
    ll N;
    cin >> N;
    vector<ll> time(N);
    vector< pair<ll, ll> > plane(N);
    REP(i, N) cin >> time[i] >> plane[i].first >> plane[i].second;
    
    // calculation
    ll now_time = 0, diff_t, distance;
    pair<ll, ll> now_plane = make_pair(0, 0);
    REP(i, N) {
        diff_t = time[i] - now_time;
        distance = abs(plane[i].first - now_plane.first) + abs(plane[i].second - now_plane.second);
    
        // update time & plane
        now_time = time[i];
        now_plane = plane[i];
        
        if (distance == diff_t) {
            continue;
        } else if (distance > diff_t) {
            // 時間が足りない
            cout << "No" << "\n";
            return 0;
        } else {
            // 時間に余裕があるとき
            if ((diff_t%distance)%2 == 0) {
                continue;
            } else {
                cout << "No" << "\n";
                return 0;
            }
        }
    }
    
    cout << "Yes" << "\n";
    
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    int su,sum;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    (a>=b)? su=b:su=a;
     (c>=d)? sum=d:sum=c;
     printf("%d\n",su+sum);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	vi in(3);
	rep(i,3)cin>>in[i];
	sort(all(in));
	if(in[0]==5&&in[1]==5&&in[2]==7)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}
 
 







Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <queue>
#include <tuple>
#include <regex>
#include <cmath>
#include <map>
#include <cstring>
#include <climits>

#define RREP(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define INVREP(i,a,b) for(int i=a;i>=b;--i)
#define MOD 1000000007ll
#define BIT(i) (1ll<<i)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }//aに更新したいものを
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

//繰り返し2乗
ll modpow(ll N, ll P, ll M=MOD) {if (P == 0) return 1;if (P % 2 == 0) {ll t = modpow(N, P / 2, M);return t * t % M;}return (N * modpow(N, P - 1, M))%M;}
//階乗
pair<vector<ll>, vector<ll>> fact(ll n) {vector<ll>f(n, 1);RREP(i, 2, n) f[i] = (f[i - 1]*i) % MOD;vector<ll>invf(n, 1);invf[n - 1] = modpow(f[n - 1],MOD-2,MOD);INVREP(i, n - 1, 2) invf[i - 1] = (invf[i]*i) % MOD;return pair<vector<ll>, vector<ll> >(f,invf);}
ll modmult(ll a, ll b, ll M = MOD) { return (a*b) % M; }
ll modadd(ll a, ll b, ll M = MOD) { return (a + b) % M; }
ll comb(pair<vector<ll>, vector<ll>>p, int n, int r) {return modmult(modmult(p.first[n], p.second[r]), p.second[n - r]); }
/*
    auto a = fact(200009);
    cout << comb(a,15,5) << endl;
*/

int main()
{
    /* collection
    ll n;
    cin >> n;
    vector<ll> A;
    REP(i, n) cin >> A[i];
    vector<pair<ll, ll>> AB;
    REP(i, n) {cin >> AB[i].first;cin >> AB[i].second;}
    
    sort(ALL(vec),greater<int>());

    map<ll, ll> mp;
    map<ll, ll, greater<ll>> mp;
    REP(i, 100) mp[i] = i * 10;
    cout << mp.lower_bound(50)->second<<endl;
    cout << mp.upper_bound(50)->second << endl;
    cout << next(mp.upper_bound(50))->second << endl;
    cout << prev(mp.upper_bound(50))->second << endl;
    */
    int h,w,k;
    cin >> h >> w >> k;
    vector<string> cho(h);
    REP(i,h)cin >> cho[i];
    
    auto lastans=100000;
    //h-1個の区切りを考える h-1=4なら 0000-10000で区切りを作る
    REP(bit,BIT(h)){
        vector<int> size(h,0);
        auto ans=0;//区切りの数
        REP(i,h) if(BIT(i) & bit)ans++;

        int laststage = 0;//もし同じcが二回続き　かつサイズを超えたら区切っても無駄なのでbreak
        REP(stage,w){//横に見ていく
            int idx=0;
            REP(c,h){//区切って足していく 区切るごとにインデックスをたす
                if(cho[c][stage]=='1'){
                    size[idx]++;
                    //サイズが超えたら最大値を更新しもう一回
                    if(size[idx]>k){
                        if(laststage==stage){
                            ans=10000;c=10;stage=1000;break;
                        }//一列でむり
                        laststage=stage;
                        stage--;
                        REP(z,h)size[z]=0;
                        ans++;
                        break;
                    }
                }
                if(bit & BIT(c)){//区切る
                    idx++;
                }
            }
        }
        chmin(lastans,(int)ans);
    }
    
    cout << lastans << endl;
}


Measured memory_bytes: 256
//  RAKSHIT KADAM
//ALWAYS USE &IT FOR ITERATING USING AUTO ...
//USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN THE RESPECTIVE DATA STRUCTURE
//NOTE THAT MEMSET CANT ASSIGN A VALUE OF 10^18 IT WILL ASSIGN A LOWER VALUE THAN THAT!!!
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!

// NUMERIC DEFINITIONS :
    #define INF 2000000000000000005
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
 #define ll long long
 #define int long long
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;                                                  return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){int g = gcd(a, m); { return power(a, m-2, m);}}
ll fact[200005];
ll modmul(ll a,ll b)
{
    return (a*b)%newMOD;
}
ll ncr(ll n,ll r)
{
    return modmul(fact[n],modmul(modInverse(fact[n-r],newMOD),modInverse(fact[r],newMOD)));
}
void solve()
{
    ll n,m,k;cin>>n>>m>>k;
    fact[0]=1;
    for(ll i=1;i<=200004;i++)
    {
        fact[i] = (i*fact[i-1])%newMOD;
    }
    ll ans=0;
    //n-1 c k    m * (m-1)^ n-1-k
    for(ll i = 0;i<=k;i++)
    {
        (ans+= (((m*(ncr(n-1,i)))%newMOD)*power(m-1,n-1-i,newMOD)))%=newMOD;
    }
    cout<<ans<<endl;
}
signed main()
{
 
    Need_for_speed(activated);
//satisfy
//    {
//   solve();
//    }

 solve();
    return 0;
}



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

int main()
{
	long long a[10000], i, n, x = 0, y, max, min, sum=0;
	scanf("%lld", &y);

	while(scanf("%lld", &a[x]))
	{
		char c = getchar();
		if(c == '\n')
		{
			break;
		}
		x++;
	}
	for(i = 0 ; i < y ; i++)
	{
		if(i == 0)
		{
			max = a[i];
			min = a[i];
		}
		else if(i >= 1)
		{
			if(max < a[i])
			{
				max = a[i];
			}
			if(min > a[i])
			{
				min = a[i];
			}
		}
	}
	for(i = 0 ; i < y ; i++)
	{
		sum += a[i];
	}
	printf("%lld %lld %lld\n", min, max, sum);
	return 0;
}


Measured memory_bytes: 2092
#include <iostream>
using namespace std;
int main (){
    int n, key, flag = 1, flagflag = 0;
    cin  >> n; 
    int a[n];
    for (int k = 0; k < n; k++ ){
        cin >> a[k];
    }
    while (flag){
        flag = 0;
        for (int j = (n - 1); j > 0; j --){
            if (a[j] < a[j - 1]){
                key = a[j - 1] ;
                a[j - 1] = a[j];
                a[j] = key;
                flagflag += 1;
                flag = 1;
            }
        }
    }
    for (int k = 0; k < n; k ++ ){
        if (k == 0) cout << a[k];
        else cout << " " << a[k];
    }
    cout << endl;
    cout << flagflag << endl;
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>

using namespace std;

int dx[]={0,1,0,-1};
int dy[]={-1,0,1,0};
typedef pair<int,int> p;

int main()
{
	
	vector<int> all(1000001),odd(1000001);
	for(int i=0;i<=1000000;i++){
		all[i]=odd[i]=i; //??¨???1???????????´???
	}
	
	
	for(int i=1;;i++){
		int x=i*(i+1)*(i+2)/6;
		if(x>1000000) break;
		
		for(int j=0;j<=1000000;j++){
			if(j-x<0) continue;
			
			all[j]=min(all[j],all[j-x]+1);
			if(x%2) odd[j]=min(odd[j],odd[j-x]+1);
		}
	}
			
	int n;
	while(cin>>n,n){
		
		cout<<all[n]<<" "<<odd[n]<<endl;
		
	}
	
	
	return 0;
}

Measured memory_bytes: 8792
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
	static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
	public static long mod = (long) (1e9+7);
	public static long[] fac,inv;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc = new FastReader();
	    String n = sc.next();
	    int k = sc.nextInt();
	    BigInteger ans = new BigInteger(n);
	    out.print(ans.toString(k).length());
	    out.close();

	}

}


Measured memory_bytes: 22356
//Md. Shajibul Islam..
//East West University, CSE Department'19

#include<bits/stdc++.h>
using namespace std;
#define FAST       ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define loop(i,n)        for(int i=0;i<n;i++)
#define CASE_PRINT       cout<<"Case "<<C<<": "
#define CASE_PRINT2       cout<<"Case "<<C<<":"<<endl
#define ll               long long
#define ld               long double
#define Pi               2*acos(0.0) // acos(-1.0)

int main()
{
    FAST;
    int n;cin>>n;
    if(n>=30)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;    
}





Measured memory_bytes: 3572
N = int(input())
C = []
S = []
F = []
for i in range(N - 1):
    c, s, f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)


def departure_t(t, j):
    if t < S[j]:
        return S[j]
    elif t % F[j] == 0:
        return t
    else:
        return t - t % F[j] + F[j]


for i in range(N):
    t = 0
    for j in range(i, N - 1):
        t = departure_t(t, j)
        t += C[j]
    print(t)


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

int main(){
  int a,b;
  cin>>a>>b;
  int total=0;
  if(a>=b){
    total+=a;
    a-=1;
  }else{
    total+=b;
    b-=1;
  }
  if(a>=b){
    total+=a;
  }else{
    total+=b;
  }
  cout<<total<<endl;
}


Measured memory_bytes: 256
/*----------------------------------------------------*
* लेखक --> अमित सिंह
* संस्थान --> राष्ट्रीय प्रौद्योगिकी संस्थान, कुरुक्षेत्र
*-----------------------------------------------------*/
   #include <bits/stdc++.h>
   using namespace std;
   #define ll long long
   #define w(t) int t; cin>>t; while(t--)
   #define fo(i,n) for(int i=0;i<n;i++)
   #define endl "\n" 
   #define MOD 1000000007
   void Tez(){
      ios::sync_with_stdio(0);
      cin.tie(0);
      cout.tie(0);
   }
   map<int,list<int>>adj;
   map<int,bool>vis;
   int dfs(int ver){
         int ans=0;
         if(!vis[ver]){
            vis[ver]=1;
            ans++;
            for(auto ngr:adj[ver]){
               ans+=dfs(ngr);
            }
         }
         return ans;
   }
   int main(){
      Tez();
      int n,m;
      cin>>n>>m;
      fo(i,m){
         int a,b;
         cin>>a>>b;
         adj[a].push_back(b);
         adj[b].push_back(a);
      }
      for(auto nodes:adj) vis[nodes.first]=false;
      int ans=1;
      for(auto nodes:adj){
         if(!vis[nodes.first])
         ans=max(ans,dfs(nodes.first));
      }
      cout<<ans;
      return 0;
   }



Measured memory_bytes: 59796
#include <bits/stdc++.h> 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
typedef long long ll;
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<vector<int>> a(n,vector<int>(2));
  rep(i,n){cin>>a[i][0];
           a[i][1]=i;}
  sort(all(a));
  rep(i,n){
    cout<<a[i][1]+1<<" ";}
  cout<<endl;
}

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

using namespace std;

int main()
{
    int n; unsigned long long int x;
    vector<unsigned long long int> a;
    vector<unsigned long long int> b;

    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> x; a.push_back(x);
        b.push_back(x);
        if (i!=0) {b[i]+=b[i-1];}
    }

    long long int sum=0;
    long long int mod=1000000007;

    for (int i=1;i<n;i++)
    {
        sum+=((a[i]%mod)*(b[i-1]%mod))%mod;
    }
    cout << sum%mod << endl;

    cin.sync();cin.get();
    return 0;
}


Measured memory_bytes: 6548
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main(){
    string s1="M";
    string s2="T";
    string s3="S";
    string s4="H";
    int E,Y;
    cin>>E>>Y;
    if(E==0){
        if(1868<=Y && Y<=1911){
            cout<<s1<<Y-1868+1<<'\n';
        }if(1912<=Y && Y<=1925){
            cout<<s2<<Y-1912+1<<'\n';
        }if(1926<=Y && Y<=1988){
            cout<<s3<<Y-1926+1<<'\n';
        }if(1989<=Y && Y<=2016){
            cout<<s4<<Y-1989+1<<'\n';
        }
    }
    if(E==1){
        cout<<1868+Y-1<<'\n';
    }
    if(E==2){
        cout<<1912+Y-1<<'\n';
    }
    if(E==3){
        cout<<1926+Y-1<<'\n';
    }
    if(E==4){
        cout<<1989+Y-1<<'\n';
    }
    return(0);
}


Measured memory_bytes: 3156
#include <iostream>
#include <stdio.h>
#include <vector>
#include <sstream>

using namespace std;

vector<string> split(const string &str, char delim){
    vector<string> v;
    string buffer;
    stringstream ss(str);
    while(getline(ss, buffer, delim)) v.push_back(buffer);
    return v;
}

string getLine(){
    string str;
    getline(cin, str);
    return str;
}

template<typename T, typename R>
vector<R> map(vector<T> xs, R(*fp)(T)){
    vector<R> ys;
    for(T x : xs) ys.push_back(fp(x));
    return ys;   
}

vector<int> getLineNums(){
    return map(split(getLine(), ' '), +[](string x){ return stoi(x); });
}

template<typename T>
bool compareAll(vector<T> xs, bool(*fp)(T, T)){
    if(xs.empty()) return false;
    T x = xs[0];
    for (typename vector<T>::iterator itr = xs.begin() + 1; itr != xs.end(); ++itr){
        if(!fp(x, *itr)) return false;
    }
    return true;
}

int main(void){
    cout << (compareAll(getLineNums(), +[](int n, int m){ return n < m; }) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3188
from itertools import accumulate
N, K = map(int, input().split())
A = list(map(int, input().split()))

def calc_imos(arr):
    imos = [0] * (N + 1)
    for i, a in enumerate(arr):
        l = max(0, i - a)
        r = min(N - 1, i + a)
        imos[l] += 1
        imos[r + 1] -= 1
    new_arr = list(accumulate(imos))[:-1]
    return new_arr


for k in range(K):
    A = calc_imos(A)
    if all([a == N for a in A]):
        print(*([N] * N), sep=' ')
        exit()

print(*A, sep=' ')


Measured memory_bytes: 230164
# https://atcoder.jp/contests/abc113/tasks/abc113_b


N = gets.to_i
T, A = gets.split.map(&:to_i)
Hs = gets.split.map(&:to_i)

di = 1000
ans = 0;
Hs.each_with_index do |h, i|
  d = (A - (T - h * 0.006)).abs
  if d < di
      di = d
      ans = i + 1
  end
end

puts ans


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

using namespace std;

typedef long long LL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<LL> vl;
typedef vector<vector<LL>> vvl;
typedef vector<vector<vector<LL>>> vvvl;


const int inf = 1e9+7;
const LL INF = 1e18+5;
const int mod = 1e9+7;
const int mxN = 1e5+5;
const int mxM = 1e5+5;

int main(){
    #ifndef ONLINE_JUDGE
    freopen("E:\\Coding\\Programming\\input.txt", "r", stdin);
    freopen("E:\\Coding\\Programming\\output.txt", "w", stdout);
    #endif
    int d,t,s;
    cin>>d>>t>>s;
     double t1 = d/(double)s;
     if(t>=t1){
         cout<<"Yes"<<endl;
     }else{
         cout<<"No"<<endl;
     }
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define lPair pair<ll,ll>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define debug(a) cout << a << endl;
const ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
ll N,M;//V == N,E == M;
ll a,b,c;
struct edge{ll from,to,cost;};
vector<edge> es;
ll d[1000];
//頂点sからの最大距離
bool BellmanFord(ll s){
    for(int i = 0; i < N; i++) d[i] = -INF;
    d[s] = 0;
    for(int i = 0; i < N-1; i++){ //**
        for(int j = 0; j < M; j++){
            edge e = es[j];
            if(d[e.from] != -INF && d[e.to] < d[e.from]+e.cost){
                d[e.to] = d[e.from] + e.cost;
            }
        }
    }
    ll dv = d[N-1];
    for(int i = 0; i < N; i++){ //**
        for(int j = 0; j < M; j++){
            edge e = es[j];
            if(d[e.to] != -INF && d[e.to] < d[e.from]+e.cost){
                d[e.to] = d[e.from]+e.cost;
            }
        }
    }
    if(d[N-1] > dv) return 0;
    else return 1;

}

int main(){
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        ll a,b,c;
        cin >> a >> b >> c;
        a--; b--;
        es.push_back({a,b,c});
    }
    if(BellmanFord(0)) cout << d[N-1] << endl;
    else cout << "inf" << endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(){
	
	int a,b,c,d,aa,bb,s;
	
	scanf("%d %d %d %d",&a,&b,&c,&d);
	
	if(a>c){
		aa=a;
		bb=b;
		a=c;
		b=d;
		c=aa;
		d=bb;
	}
	
	if(c<=b&&b<=d)s=b-c;
	if(b<c)s=0;
	if(c<=b&&b>d)s=d-c;
	
	printf("%d\n",s);
	
	return 0;
}


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

#define MAX 500000
#define SENTINEL 2000000000

int n;
int S[MAX];
int cmp = 0;
int L[MAX/2 + 2];
int R[MAX/2 + 2];

void merge(int S[], int begin, int mid, int end){
  //begin ~ mid-1
  //mid ~ end-1
  //のそれぞれが整列済
  for(int i=0; i<mid-begin; i++){
    L[i] = S[begin + i];
  }
  L[mid-begin] = SENTINEL;
  for(int i=0; i<end-mid; i++){
    R[i] = S[mid + i];
  }
  R[end-mid] = SENTINEL;

  int l_ptr = 0;
  int r_ptr = 0;

  for(int i=begin; i<end; i++){
    if(L[l_ptr] <= R[r_ptr]){
      S[i] = L[l_ptr++];
    }
    else{
      S[i] = R[r_ptr++];
    }
    cmp++;
  }
}


void mergeSort(int S[], int begin, int end){
  if(begin+1 < end){
    int mid = (begin + end)/2;
    mergeSort(S, begin, mid);
    mergeSort(S, mid, end);
    merge(S, begin, mid, end);
  }
}


int main(){

  scanf("%d", &n);
  for(int i=0; i<n; i++){
    scanf("%d", &S[i]);
  }

  mergeSort(S,0,n);

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

  return 0;
}



Measured memory_bytes: 7124
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

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


ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}


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


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

typedef int VAL;
const int MAX_UF = 110000;
const VAL SUM_UNITY = 0;

struct UnionFind {
  int par[MAX_UF];
  int rank[MAX_UF];
  VAL diff_weight[MAX_UF];

  UnionFind(int n = 0) {
    for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
  }

  void init(int n) {
    for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
  }

  int root(int x) {
    if (par[x] == x) {
      return x;
    }
    else {
      int r = root(par[x]);
      diff_weight[x] += diff_weight[par[x]];
      return par[x] = r;
    }
  }

  VAL weight(int x) {
    root(x);
    return diff_weight[x];
  }

  bool issame(int x, int y) {
    return root(x) == root(y);
  }

  bool merge(int x, int y, VAL w) {
    w += weight(x); w -= weight(y);
    x = root(x); y = root(y);
    if (x == y) return false;
    if (rank[x] < rank[y]) swap(x, y), w = -w;
    if (rank[x] == rank[y]) ++rank[x];
    par[y] = x;
    diff_weight[y] = w;
    return true;
  }

  VAL diff(int x, int y) {
    return weight(y) - weight(x);
  }

} uf;

int main() {
  cin.tie(0), ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  uf.init(N);
  for (int i = 0; i < M; ++i) {
    int l, r, d;
    cin >> l >> r >> d;
    --l, --r;
    if (uf.issame(l, r)) {
      int diff = uf.diff(l, r);
      if (diff != d) {
        cout << "No" << endl;
        return 0;
      }
    }
    else {
      uf.merge(l, r, d);
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;

int main(){
    string s;
    cin >> s;
    int N=s.length();
    int t=N;
    for(int i=0;i<N-1;i++){
        if(s[i+1]!=s[i]) t=min(t,max(i+1,N-i-1));
    }
    cout << t << endl;
    return 0;
}

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

using namespace std;

int main()
{

    int n;

    cin >>  n;

    int x[n+1];

    for(int i = 0; i < n; i++)
    {
        cin >> x[i];
    }

    int  cnt = 0, ch = 0;

    for(int i = 0; i < n; i++)
    {
         ch = 0;
        for(int j = 0; j < i; j++)
        {
           if(x[i] < x[j])
           {

               ch = 1;
               break;
           }

        }

        if(!ch)
           cnt++;
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int H = sc.nextInt();
	int W = sc.nextInt();
	String subete[] = new String[H];

	for(int n = 0;n < H;n++){
		subete[n] = sc.next();	
	}
	for(int i = 0;i < W+2;i++){
		System.out.print("#");
	}
	System.out.println("");
	for(int i = 0;i < H;i++){
		System.out.println("#" + subete[i] + "#");	
	}
	for(int i = 0;i < W+2;i++){
		System.out.print("#");
	}
	System.out.println("");	
	}
}
	



Measured memory_bytes: 25164
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[float("inf")]*n
dp[0]=0
for i in range(1,n):
    for j in range(max(0,i-k),i):
        dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[-1])

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

long long N,M;
int ans=0;

int main(){
    
    
    
    // C Why WA?ununderstand
    cin>>N>>M;
    
    
    if(N==1&&M==1)cout<<1<<endl;
    else if(N==1)cout<<(M-2)<<endl;
    else if(M==1)cout<<(N-2)<<endl;
    else {
        cout<<(N-2)*(M-2)<<endl;
    }
    
    return 0;
    
}

Measured memory_bytes: 256