akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define SORT(s) sort((s).begin(),(s).end())
#define SORTR(s,t) sort((s).begin(),(s).end(),greater<t>())

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000ll;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

int N; vi v;
void input(){
    cin>>N;
    rep(i,N){
        int a; cin>>a; v.emplace_back(a);
    }
    return;
}

void solve(){
    SORT(v);
    double ans=v[0];
    rep(i,N){
        ans=(ans+v[i])/2.0;
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
    return;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int A, B;

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

    std::cin >> A >> B;

    if(std::max(A, B) <= 8){
        std::cout << "Yay!" << std::endl;
    }else{
        std::cout << ":(" << std::endl;
    }
}


Measured memory_bytes: 256
using System;
using System.Linq;

public class Program
{
    public static void Main()
    {
        new Program().Solve();
    }

    int[] coins;
    int[,] memo = new int[21, 50001];

    void Solve()
    {
        int[] nm = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        int n = nm[0];
        coins = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        Console.WriteLine(Solve(0, n));
    }

    int Solve(int i, int x)
    {
        if (i == coins.Length)
        {
            return x == 0 ? 0 : 1000000;
        }
        if (memo[i, x] > 0)
        {
            return memo[i, x];
        }
        int ans = Solve(i + 1, x);
        if (x >= coins[i])
        {
            ans = Math.Min(ans, Solve(i, x - coins[i]) + 1);
        }
        return memo[i, x] = ans;
    }
}



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

int cnt[200009];

int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=0; i<n; i++) {
        int foo; scanf("%d",&foo);
        ++cnt[foo-1];
    }
    sort(cnt, cnt+n); reverse(cnt, cnt+n);
    int ans = 0;
    for(int i=k; i<n; i++) ans += cnt[i];
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct P {
    static constexpr int N = 60;
    P() {
        for (int i = 0; i < N; i++) {
            p[i] = 0;
        }
    }
    void append(ll a) {
        for (int i = N - 1; i >= 0; i--) {
            ll m = 1LL << i;
            if (a & m) {
                if (p[i]) {
                    a ^= p[i];
                    if (a == 0) break;
                    continue;
                } else {
                    p[i] = a;
                    break;
                }
            }
        }
    }
    bool query(ll a) {
        for (int i = N - 1; i >= 0; i--) {
            ll m = 1LL << i;
            if (a & m) a ^= p[i];
        }
        return a != 0;
    }
    void print() {
        cout << '@';
        for (int i = N - 1; i >= 0; i--) {
            if (p[i]) {
                cout << p[i] << ' ';
            }
        }
        cout << '\n';
    }
    ll p[N];
};

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

    int t;
    cin >> t;

    while (t--) {
        P p;

        int n;
        cin >> n;

        vector<ll> a(n);
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        string s;
        cin >> s;

        int r = 0;
        for (int i = n - 1; i >= 0; i--) {
            if (s[i] == '0') {
                p.append(a[i]);
            } else {
                if (p.query(a[i])) {
                    r = 1;
                    break;
                }
            }
        }

        cout << r << '\n';
    }

    //最後が人1なら人1の勝ち 最後が人0のときを考える
    //何回でも使えるとしていいんか
    //人1は組み合わせる必要がない 単体で出してダメなものを合わせてもダメ
    //人1はそれよりあとの人0が対処できないものを出せれば勝ち それ以外に勝ちがあるか？
    //
    //最初の人0は何かする意味なさそう

    return 0;
}

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int A[200200];
map<int, int> cnt;

int f(int a) {
    int x = 1;
    while (x <= a)x *= 2;
    return x - a;
}

signed main() {
    int N;
    cin >> N;
    rep(i, N) {
        cin >> A[i];
        cnt[A[i]]++;
    }
    sort(A, A + N);
    int ans = 0;
    for (int i = N - 1; i >= 0; --i) {
        if (cnt[A[i]] == 0)continue;
        int a2 = f(A[i]);
        if (a2 != A[i] && cnt[a2]) {
            cnt[a2]--;
            cnt[A[i]]--;
            ans++;
        }
        if (a2 == A[i] && cnt[a2] >= 2) {
            cnt[a2] -= 2;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 26752
package main

import "fmt"

func main() {
	var N, K, X, Y int
	fmt.Scan(&N, &K, &X, &Y)
	s := 0
	if N < K {
		s += X * N
	} else {
		s += X * K
	}
	if N > K {
		s += Y * (N - K)
	}
	fmt.Println(s)
}


Measured memory_bytes: 512
/*
ID: wangjun30
LANG: C++11
TASK:
*/
#include<iostream>
#include<algorithm>
#include<array>
#include<unordered_map>
#include<map>
#include<set>
#include<list>
#include<stack>
#include<unordered_set>
#include<vector>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
//#include<fstream>
#define int long long
using namespace std;
//ifstream cin(".in");
//ofstream cout(".out");
int number[100010];
int sum=0;
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n,q;
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		sum+=x;
		number[x]++;
	}
	cin>>q;
	for(int QUE=1;QUE<=q;QUE++){
		int b,c;
		cin>>b>>c;
		sum+=(c-b)*number[b];
		number[c]+=number[b];
		number[b]=0;
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 4364
import java.util.Scanner;
class Main{
  public static void main(String args[]){
  Scanner input =new Scanner(System.in);
    int num=input.nextInt();
  if(num%10==2||num%10==4||num%10==5||num%10==7||num%10==9){
  System.out.println("hon");
  }
  else if(num%10==0||num%10==1||num%10==6||num%10==8){
  System.out.println("pon");
  }
  
  else if(num%10==3){
  System.out.println("bon");
  }
  }}


Measured memory_bytes: 35620
<?php

    list($n, $m) = explode(" ", trim(fgets(STDIN)));
    
    for($i = 0; $i < $n; $i++){
        $A[$i] = explode(" ", trim(fgets(STDIN)));
    }
    
    for($i = 0; $i < $m; $i++){
        $b[$i] = trim(fgets(STDIN));
    }
    
    $c = array_fill(0,$n,0);
    for($i = 0; $i < $n; $i++){
        for($j = 0; $j < $m; $j++){
            $c[$i] += $A[$i][$j] * $b[$j]; 
        }
        echo $c[$i]."\n";
    }

Measured memory_bytes: 17380
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using st = string;
using P = pair<int, int>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define chmax(x, y) { x = max(x, y); }
#define chmin(x, y) { x = min(x, y); }

int main() {
    int n;
    cin >> n;
    int ans = n % 1000;
    ans = 1000 - ans;
    if(ans == 1000){
        ans = 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
(* O(max x y) *)
Scanf.scanf " %d %d %d %d %d" @@ fun a b c x y ->
  let ans = ref max_int in
  for i = 0 to max x y do
    let sum = ref @@ 2 * c * i in
    let x', y' = max 0 @@ x - i, max 0 @@ y - i in
    sum := !sum + a * x' + b * y';
    ans := min !ans !sum
  done;
  Printf.printf "%d\n" !ans

Measured memory_bytes: 4608
///                ..:: In The Name Of God ::..
#include<bits/stdc++.h>

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define error(x) cerr << #x << " = " << (x) << endl;
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define Size(x) (int)(x).size()
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double ld;
int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    
    int n;cin >> n;
    double btc = 0,jpy = 0;
    while(n--){
    	double m;string s;
    	cin >> m >> s;
    	if(s == "JPY")
    		jpy += m;
    	else
    		btc += m;
    }
    cout << setprecision(8) << fixed << jpy + btc * 380000 << '\n';
    return 0;
}


Measured memory_bytes: 256
FAST_IO = 1
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()

    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
rrmm = lambda n: [rrm() for _ in xrange(n)]


N = rri()
dic = {}
for i in range(N):
    tye = rr()
    dic[tye] = dic.get(tye, 0)+1
for tye in ("AC", "WA", "TLE", "RE"):
    print("{} x {}".format(tye, dic.get(tye, 0)))
'''
 AC x 3
WA x 1
TLE x 2
RE x 0

'''

Measured memory_bytes: 81088
function Main(input) {
  input = input.split("\n");
  const N = parseInt(input[0],10);
  const d_i = [];
  let x_kagamimochi_max = 0;
  let x_kagamimochi_before = 0;
  for (var i = 0; i < N; i++) {
     d_i[i] = parseInt(input[i + 1],10);
  }
  d_i.sort((a,b) => {
    return a-b;
  });
  for (var d_i_index = 0; d_i_index < N; d_i_index++) {
    if (d_i[d_i_index] > x_kagamimochi_before) {
      x_kagamimochi_max++;
    }
    x_kagamimochi_before = d_i[d_i_index];
  }
  console.log(x_kagamimochi_max);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29620
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e10;
const ll MOD = 1e9 + 7;

int main(){
	ll N;
	string S;
	cin >> N >> S;
	vll W(N, 0), E(N, 0);
	ll i, j;
	ll w = 0;
	ll e = 0;
	for (i = 0; i < N; i++){
		if (S[i] == 'W') {
			w++;
		}
		E[i] = w;
		if (S[N - 1 - i] == 'E'){
			e++;
		}
		W[N - 1 - i] = e;
	}
	ll ans = N;
	for (i = 0; i < N; i++){
		ll anstmp = 0;
		if (i > 0){
			anstmp += E[i - 1];
		}
		if (i < N - 1){
			anstmp += W[i + 1];
		}
		ans = min(ans, anstmp);
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 5380
object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val n = inputs.head.toLong
  // 1:a, 26;z, 27:aa

  println(solve(n))

  def solve(n: Long): String = {
    var dog = n
    val str  = "abcdefghijklmnopqrstuvwxyz"
    val base = 26
    var name = ""

    do {
      dog = dog - 1
      val p = dog % base
      dog = dog / base
      name = name + str(p.toInt)

    } while(dog > 0)

    name.reverse
  }
}

Measured memory_bytes: 54888
/*
 
*/ 
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define LSOne(S) (S & (-S))
#define EPS 1e-9
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pd;
typedef tree<pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0); // FOR QUERY PROBLEM DON'T FORGET TO UNCOMMENT THIS
    int h, w, m;
    cin >> h >> w >> m;
    //set<pi> is;
    vector<int> vrow(3e5+5);
    vector<int> vcols(3e5+5);
    vector<vector<int>> vvcols(3e5+5);

    for(int i = 0; i < m; ++i)
    {
        int hh, ww;
        cin >> hh >> ww;
       // is.insert({hh, ww});
        ++vrow[hh];
        ++vcols[ww];
        vvcols[ww].push_back(hh);
    }

    vector<int> mxrow; mxrow.reserve(m+5);
    vector<int> mxcols; mxcols.reserve(m+5);

    set<int> sr;
    int mxr = *max_element(vrow.begin(), vrow.end());
    for(int i = 0; i < (int)vrow.size(); ++i)
    {
        if(vrow[i] == mxr)
        {
            mxrow.push_back(i);
            sr.insert(i);
        }
    }

    int mxc = *max_element(vcols.begin(), vcols.end());
    for(int i = 0; i < (int)vcols.size(); ++i)
    {
        if(vcols[i] == mxc)
        {
            mxcols.push_back(i);
        }
    }

    int ans = 0;
    for(auto& mc : mxcols)
    {
        int cnt = 0;
        for(auto& r : vvcols[mc])
        {
            if(sr.count(r))
            {
                ++cnt;
            }
        }
        int red = (cnt == (int)sr.size());
        ans = max(ans, mxr+mxc-red);
    }
    cout << ans << "\n";
    return 0;
}
 
/*
 
*/  

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

#define REP(i, a, b) for(int i = a; i <= b; i ++)
#define REPG(i, x) for(int i = head[x]; i; i = g[i].nxt)

#define clr(x, y) memset(x, y, sizeof(x));

using namespace std;

typedef long long LL;
typedef double LF;

LL Max(LL a, LL b){return a > b ? a : b;}
LL Min(LL a, LL b){return a < b ? a : b;}
LL abs(LL x){return x > 0 ? x : -x;}

const int MAXN = 1e5 + 15;

bool f[MAXN]; int s[MAXN];

inline int read(){
	int r = 0, z = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){if(ch == '-') z = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9'){r = r * 10 + ch - '0'; ch = getchar();}
	return r * z;
}

void work(){
	int n = read();
	for(int i = 2; i <= 1e5; i ++) if(!f[i]) for(int j = i + i; j <= 1e5; j += i) f[j] = 1;
	for(int i = 3; i <= 1e5; i += 2) if(!f[i] && !f[(i + 1) / 2]) s[i] ++;
	for(int i = 2; i <= 1e5; i ++) s[i] += s[i - 1];
	while(n --){
		int l = read(), r = read();
		printf("%d\n", s[r] - s[l - 1]);
	}
}

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


Measured memory_bytes: 1152
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    K=I()
    print(A[K-1])
if __name__ == '__main__':
    main()

Measured memory_bytes: 7812
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  set<char> c;
  string s; cin >> s;
  for(int i=0; i<s.size(); i++){
    c.insert(s[i]);
  }
  char ans='a';
  for(;ans<='z';ans++){
    if(c.find((char)ans)==c.end()){ cout << ans << endl; return 0;}
  }
  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;
using llong = long long;
const int MOD=1000000007;


int main(int argc, char**argv){
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

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

    int ans = 0;
    for(int i = 0; i < n; i++){
        x -= a[i];
        if (x < 0) break;
        ans++;
    }
    if (x == 0) cout << ans << endl;
    else if (x < 0) cout << ans << endl;
    else cout << ans-1 << endl;

    return 0;
}








Measured memory_bytes: 256
n = input()
k = 0
pay = 0
n_list = []
for i in n[::-1]:
    n_list.append(int(i))
n_list.append(0)
ans = 0
for i in range(len(n_list) - 1):
    num = n_list[i]
    if num < 5:
        ans += num
    elif (num <= 5 and n_list[i + 1] < 5):
        ans += num
    else:
        n_list[i + 1] += 1
        ans += 10 - num

ans += n_list[-1]
print(ans)

Measured memory_bytes: 122920
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  t,i,x,j,k,n;
    string s;
    cin>>s;

    if(s[0]==s[2])
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}





Measured memory_bytes: 3616
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number, i, sum = 0, tmp = -1;
    number = Integer.parseInt(sc.next());
    int[] array_a = new int[number];
    int[] array_b = new int[number-1];
    for(i = 0; i < number-1; i++) {
      array_b[i] = Integer.parseInt(sc.next());
    }
    array_a[0] = array_b[0];
    for(i = 1; i < number-1; i++) {
      array_a[i] = Math.min(array_b[i-1], array_b[i]);
    }
    array_a[i] = array_b[i-1];
    for(i = 0; i < number; i++) {
      sum += array_a[i];
    }
    System.out.println(sum);
  }
}


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

int main() {
	string S;
	cin >> S;
	string ans;
	string date = "";
	date = string(1, S[0]) + string(1, S[1]) + string(1, S[2]) + string(1, S[3]) + string(1, S[5]) + string(1, S[6]) + string(1, S[8]) + string(1, S[9]);
	if (date <= "20190430") {
		ans = "Heisei";
	}
	else {
		ans = "TBD";
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3600
import math


def solve(A, B):
    A, B = min(A, B), max(A, B)
    if B - A <= 1:
        return 2 * A - 2
    C = math.floor(math.sqrt(A * B)) - 1
    while (C + 1) ** 2 < A * B:
        C += 1
    if C * (C + 1) >= A * B:
        return 2 * C - 2
    else:
        return 2 * C - 1


def main():
    Q = int(input())
    query_list = [list(map(int, input().split())) for _ in range(Q)]
    ans = [solve(a, b) for a, b in query_list]
    for a in ans:
        print(a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9116
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

#if __has_include("debugger.cpp")
  #include "debugger.cpp"
#else
void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) > 0) cout << " ";
  print(std::forward<Tail>(tail)...);
}
# endif

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

int main() {
  ll input(a, b, q);
  vector<ll> s(a), t(b);

  REP(i, a) cin >> s[i];
  REP(i, b) cin >> t[i];

  s.insert(s.begin(), -(1ll << 60));
  s.insert(s.end(), (1ll << 60));
  t.insert(t.begin(), -(1ll << 60));
  t.insert(t.end(), (1ll << 60));

  REP(i, q) {
    ll input(target);
    auto dist = [](ll now, vector<ll>& builts){
      auto itr = upper_bound(builts.begin(), builts.end(), now);
      return min(abs(now - *itr), abs(now - *(itr - 1)));
    };

    auto f = [&](vector<ll>& s, vector<ll>& t){
      auto itr = upper_bound(s.begin(), s.end(), target);
      return min(dist(*itr, t) + abs(*itr - target), dist(*(itr - 1), t) + abs(*(itr - 1) - target));
    };
    print(min(f(s, t), f(t, s)));
  }
}


Measured memory_bytes: 5564
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define dbg(x) cout<<(#x)<<"="<<x<<endl
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, a, b) for(int i=(a); i<=(b); i++)
#define DOWN(i, a, b) for(int i=(a); i>=(b); i--) 

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const double eps=1e-8;
const int INF=0x3f3f3f3f;
const ll LL_INF=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
const int N=1e6+10;

int n, m;
int p[N], c[N];
int dp[12][N];

int main() {
	cin>>n>>m;
	m/=100;
	REP(i, 1, n) {
		cin>>p[i]>>c[i];
		c[i]/=100;
	}
	memset(dp, 0x3f, sizeof(dp));
	dp[0][0]=0;
	REP(i, 1, n) {
		REP(j, 0, m) {
			REP(k, 0, p[i]-1) {
				dp[i][j]=min(dp[i-1][max(0, j-i*k)]+k, dp[i][j]);
			}
			dp[i][j]=min(dp[i-1][max(0, j-i*p[i]-c[i])]+p[i], dp[i][j]);
		}
	}
	cout<<dp[n][m]<<endl;
//	cout<<1.0*clock()<<"ms"<<endl;
	return 0;
} 

Measured memory_bytes: 49408
#include "bits/stdc++.h"
using namespace std;

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  int ans = 0;
  for(int num = 1; num <= N; num++){
    int w = num;
    int sum = 0;
    while(w){
      sum += w % 10;
      w /= 10;
    }
    if(sum >= A && sum <= B){
      ans += num;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>

using namespace std;

int main()
{
    int n,m,a[10005],i,sum=0;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(n-sum>=0)
    {
        cout<<n-sum<<endl;
    }
    else
    {
        cout<<"-1"<<endl;
    } 
    //system("pause");
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n, ans=0;
  cin >> n;
  for(long long i = 1; i <= n; i++){
    if(i % 3 != 0 && i % 5 != 0){
      ans += i;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3516
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
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; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

int main(){
    ll n,k;
    cin>>n>>k;
    ll ans=n;
    n-=k;
    while(true){
        ans+=(2*(n/k)*k);
        ll tmp=n%k;
        if(n%k==0){
            ans-=k;
            break;
        }
        n=k;
        k=tmp;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
N = gets.to_i

@ans = []
def add_string(st, l, d, m)
  (@ans << st; return) if d == m
  ('a'..l).each{|s|
    add_string(st + s, l, d+1, m)
  }
  add_string(st + (l.ord+1).chr, (l.ord+1).chr, d+1, m)
end

add_string("a", "a", 1, N)

puts @ans.sort


Measured memory_bytes: 15024
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static int[] ans;
//	 static int mod = 998244353;
	 public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        String S = sc.next();
	        char[] c = S.toCharArray();
	        String ans="Yes";
	        if(c.length%2==1) {
	        	System.out.println("No");
	        	return;
	        }
	        for(int i=0;i<c.length-1;i=i+2) {
	        	if(c[i]!='h'||c[i+1]!='i') {
	        		ans="No";
	        	}
	        }
	        System.out.println(ans);
	 }
}

Measured memory_bytes: 21844
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main()
{
	char A[100],C[100];
	char B[100];
	scanf("%s %s %s",&A,&B,&C);
	printf("%c%c%c",A[0],B[0],C[0]);
    return 0;
}
 

Measured memory_bytes: 128
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 




int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    string s;
    cin>>s;
    if(s.size()<=n)
    cout<<s;
    else
    {
        string sub=s.substr(0,n);
        cout<<sub<<"...";
    }
}




Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);
 
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;
 
constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;
 
template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

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

int main() {
	int N; cin >> N;
	string S; cin >> S;
	int ans = 0;
	for(int i = 0; i+2 < N; ++i) {
		if(S[i]=='A' && S[i+1]=='B' && S[i+2]=='C') ans++;
	}
	cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def inpl(): return input().split()

n = int(input())
a = sorted(list(map(int, inpl())))
p = 10 ** 9 + 7

if a[0] == 0:
    st = 1
    next_value = 2
else:
    st = 0
    next_value = 1

ans = 1
found = False
for i in range(st, n):    
    if (next_value == a[i]):
        if found:
            next_value += 2
            found = False
            ans *= 2
            if ans > p:
                ans %= p
        else:
            found = True
    else:
        ans = 0
        break
print(ans)

Measured memory_bytes: 14008
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

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

ll add(ll a, ll b, ll m = MOD){ return (a%m + b%m+2*m)%m;}

ll mul(ll a, ll b, ll m = MOD){ return ((a%m+m)*(b%m+m))%m;}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

const int N = 3000+5;

int n;
int a[N];
bool vis[N][N][3];
ll memo[N][N][3];

ll DP(int l, int r, int turn){
	if(r < l) return 0LL;
	if(vis[l][r][turn]) return memo[l][r][turn];
	ll ans;
	if(turn == 0){
		// Maximize
		ans = max(a[l]+DP(l+1,r,1),a[r]+DP(l,r-1,1));
	}
	else{
		ans = min(-a[l]+DP(l+1,r,0),-a[r]+DP(l,r-1,0));
	}
	vis[l][r][turn] = true;
	return memo[l][r][turn] = ans;
}

int main(){
	ri(n);
	for(int i=0; i<n; i++) ri(a[i]);
	cout << DP(0,n-1,0) << endl;
	return 0;
}


Measured memory_bytes: 238336
#include<stdio.h>
int main(void){
	int a,b ;
	scanf("%d %d",&a,&b) ;
	if(a<b){
		printf("a < b\n") ;
	}
	if(a>b){
		printf("a > b\n") ;
	}
	if(a==b){
		printf("a == b\n") ;
	}
	return 0 ;
}

Measured memory_bytes: 580
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
   public static void main(String[] args) {
      Scanner sn = new Scanner(System.in);
      int x = Integer.parseInt(sn.next());
      if (x == 0) {
         System.out.println(1);
      } else {
         System.out.println(0);
      }
   }
}


Measured memory_bytes: 35792
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int a[] = new int[N];
		int ans = 0;

		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
		}

		HashMap<Integer, Integer> c = new HashMap<Integer, Integer>();

		for (int i = 0; i < N; i++) {
			if (c.containsKey(a[i])) {
				int d = c.get(a[i]);
				c.put(a[i], d + 1);
			} else {
				c.put(a[i], 1);
			}
		}

		for (Map.Entry<Integer, Integer> entry : c.entrySet()) {
			int e = entry.getValue();
			if (e % 2 == 1) {
				ans += 1;
			}
		}
		// 出力
		System.out.println(ans);
	}
}


Measured memory_bytes: 54928
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

int goal, allsum = 0;
string ans;
bool dfs(int now, int pos)
{
    if (pos == 1)
    {
        //cout << allsum << endl;
        allsum++;
        if (allsum == goal)
        {
            ans += (char)('0' + now);
        }
        return (allsum == goal);
    }
    bool res = false;
    for (int i = -1; i <= 1; i++)
    {
        int nxt = now + i;
        if (0 <= nxt && nxt <= 9)
        {
            if (dfs(nxt, pos - 1))
            {
                ans += (char)('0' + now);
                res = true;
            }
        }
    }
    return res;
}

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

    int K;
    cin >> K;
    if (K < 10)
    {
        cout << K << endl;
        return 0;
    }
    int cnt[10] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
    int sum = 9;
    for (int i = 2;; i++)
    {
        //cout << i << " " << sum << endl;
        int nxt[10] = {};
        for (int j = 0; j < 10; j++)
        {
            for (int k = -1; k <= 1; k++)
            {
                if (0 <= j + k && j + k <= 9)
                {
                    if (j == 0)
                    {
                        nxt[j] += cnt[j + k];
                        continue;
                    }
                    nxt[j] += cnt[j + k];
                    if (sum + cnt[j + k] >= K)
                    {
                        //cout << cnt[j + k] << endl;
                        //cout << sum << endl;
                        //cout << j << " " << j + k << endl;
                        goal = K - sum;
                        //cout << goal << endl;
                        dfs(j + k, i - 1);
                        reverse(all(ans));
                        cout << j << ans << endl;
                        return 0;
                    }
                    sum += cnt[j + k];
                }
            }
        }
        rep(j, 10) cnt[j] = nxt[j];
    }
}


Measured memory_bytes: 256
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------
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(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int x;cin>>x;
    if(x==2){
        cout<<2<<endl;
        return 0;
    }
    if(x%2==0)x++;
    for(int i=x;i<INF;i+=2){
        if(IsPrime(i)){
            cout<<i<<endl;
            return 0;
        }
    }
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






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

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> H(N);
	for (auto& x : H) {
		cin >> x;
	}
	vector<vector<int>> g(N);
	for (int i = 0; i < M; ++i) {
		int A, B;
		cin >> A >> B;
		--A;
		--B;
		g[A].push_back(B);
		g[B].push_back(A);
	}

	int ans = 0;
	for (int i = 0; i < N; ++i) {
		bool good = true;
		for (auto j : g[i]) {
			if (H[j] >= H[i]) {
				good = false;
				break;
			}
		}
		if (good) {
			++ans;
		}
	}
	cout << ans << endl;
}


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

int N, M;
int X[50][50];
int res = 0;

int bridge(int n, int num) {
    int count = 0;

    for (int i = 0; i < N; i++)
      count += X[n][i];

    if (count == num) {
      res += 1;
      for (int i = 0; i < N; i++)
        if (X[n][i] == 1) {
          X[n][i] = 0;
          X[i][n] = 0;
          bridge(i, 1);
        }
    }
    return res;

  }

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

    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++)
        X[i][j] = 0;

    for (int i = 0; i < M; i++) {
      int x, y;
      cin >> x >> y;
      X[x-1][y-1] = 1;
      X[y-1][x-1] = 1;
    }

    for (int i = 0; i < N; i++) {
      bridge(i, 1);

    }

    cout << res << endl;

    return 0;
  }


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

int h[2005],a[2005][2005],b[2005][2005],f[2005],p[2005],r,n,m,ans;
char c[2005][2005];

int main() {
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) {
        scanf("%s",c[i]+1);
        for(int j=1;j<=m;j++) {
            b[i][j] = c[i][j]=='#'?1:0;
        }
    }
    for(int i=1;i<n;i++) {
        for(int j=1;j<m;j++) {
            if((b[i][j]+b[i+1][j]+b[i][j+1]+b[i+1][j+1])%2==0) {
                a[i][j]=1;
            }
        }
    }
    for(int i=1;i<m;i++) h[i]=0;
    for(int i=1;i<n;i++) {
        for(int j=1;j<m;j++) {
            if(a[i][j]) h[j]++;
            else h[j]=0;
        }
        memset(f,0,sizeof f);
        memset(p,0,sizeof p);
        r=0;
        for(int j=1;j<=m;j++) {
            while(r && f[r] >= h[j]) {
                ans=max(ans, (j-p[r-1])*(f[r]+1));
                --r;
            }
            f[++r] = h[j];
            p[r] = j;
            //ans=max(ans, (j-p[1]+2)*(f[1]+1));
        }
    }
    cout<<max(ans,max(n,m))<<endl;
}

Measured memory_bytes: 35584
#include"iostream"
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	if (a == 1)
	{
		a += 13;
	}
	if (b == 1)
	{
		b += 13;
	}
	if (a > b)
	{
		cout << "Alice" << endl;
	}
	else if (a < b)
	{
		cout << "Bob" << endl;
	}
	else
	{
		cout << "Draw" << endl;
	}
}

Measured memory_bytes: 256
// 前から解くバージョン
#include <bits/stdc++.h>
 
typedef long long ll;
using namespace std;
 
int main() {
    int n;
    cin >> n;
 
    // 先頭から見ていくバージョン
    int counter = 0, result = 0;
    int formerHeight = -1;
    int currentHeight;
    for (int i = 0; i < n; i++) {
        cin >> currentHeight;
        if (formerHeight >= currentHeight) {
            ++counter;
            result = max(result, counter);
        } else {
            counter = 0;
        }
        formerHeight = currentHeight;
    }
 
    cout << result << endl;
}
 


Measured memory_bytes: 256
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define ll long long
#define INF 1000000000000000000
#define INT_MAX 2147483647

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <ios>
#include <iomanip>

using namespace std;

int main(){
    int N,K;
    cin >> N >> K;
    int h[N];
    int dp[N];
    REP(i,N){
        cin >> h[i];
        dp[i] = INT_MAX;
    }

    dp[0]=0;
    REP(i,N){
        FOR(j,1,K+1){
            if(i+1<N && dp[i] + abs(h[i] - h[i+j]) < dp[i+j])dp[i+j] = dp[i] + abs(h[i] - h[i+j]);
        }
    }

    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
def main():
  import sys
  b=sys.stdin.buffer
  input=b.readline
  n=int(input())
  d=[0]*n+[1<<c-97for c in input()[:n]]
  for i in range(n-1,0,-1):d[i]=d[i+i]|d[i-~i]
  r=[]
  input()
  for q,a,b in zip(*[iter(b.read().split())]*3):
    i,s=int(a)+n-1,0
    if q<b'2':
      d[i]=1<<b[0]-97
      while i:
        i>>=1
        d[i]=d[i+i]|d[i-~i]
      continue
    j=int(b)+n
    while i<j:
      if i&1:
        s|=d[i]
        i+=1
      if j&1:
        j-=1
        s|=d[j]
      i>>=1
      j>>=1
    r+=bin(s).count('1'),
  print(' '.join(map(str,r)))
main()

Measured memory_bytes: 44720
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for (int i=1;i<=n;i++)
#define REP(i,a,b) for (int i=a;i<=b;i++)
 
#define pb push_back
 
typedef long long ll;

const int inf=0x3f3f3f3f;
const int N=100000+10;

int n;
ll a[N];
struct info {
	ll val;
	int cnt;
} b[N];
int p;
int main() {
 
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	cin>>n;
	FOR(i,n) cin>>a[i];
	sort(a+1,a+1+n);
	FOR(i,n) {
		if (i==1||a[i]!=a[i-1]) {
			b[++p].val=a[i],b[p].cnt++;
		} else b[p].cnt++;
	}
	for (int i=p;i>=1;i--) {
		if (b[i].cnt>=4) {
			cout<<b[i].val*b[i].val<<endl;
			return 0;
		}
		if (b[i].cnt>=2) {
			for (int j=i-1;j>=1;j--) {
				if (b[j].cnt>=2) {
					cout<<b[i].val*b[j].val<<endl;
					return 0;
				}
			}
			break;
		}
	}
	cout<<0<<endl;
	return 0;
}

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

#define FastRead        ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl            "\n"
#define sq(x)           ((x)*(x))
#define pi              acos(-1.0)
#define NUM             1000005

typedef long long ll;

long long dif(string a,string b)
{
    ll ans=0;

    for(ll i=0;i<a.size();i++)
        if(a[i]!=b[i])
            ans++;

    return ans;
}

int main()
{
    FastRead

    ll ans = INT_MAX;
    string s,t;
    map<char,ll>ms,mt;

    cin>>s>>t;

    for(ll i=0;i<s.size()-t.size()+1;i++)
    {
        string temp = s.substr(i,t.size());
        ans = min(ans,dif(temp,t));
    }

    cout<<ans<<endl;
}


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

signed main(){
  vector<int> v(4);
  int n=4;
  for(int i=0;i<n;i++)cin>>v[i];
  sort(v.begin(),v.end());
  cout<<abs(v[3]+v[0]-v[1]-v[2])<<endl;
}



Measured memory_bytes: 3172
#include <stdio.h>
int main(void)
{
	int a,b;
	scanf("%d%d",&a,&b);
	int x=a+b,y=a-b,z=a*b;
	if(x>=y && x>=z){
		printf("%d\n",x);
	} else if(y>=x && y>=z){
		printf("%d\n",y);
	} else if(z>=x && z>=y){
		printf("%d\n",z);
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N, T; scanf("%d %d", &N, &T);
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    scanf("%d", &A[i]);
  }
  vector<int> profit(N, 0);
  int least = A[0];
  for (int i = 1; i < N; ++i) {
    profit[i] = max(0, A[i] - least);
    least = min(least, A[i]);
  }
  int most_profit = *max_element(profit.begin(), profit.end());
  int ans = count(profit.begin(), profit.end(), most_profit);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 1024
def cal(arr, idx, res):

    if idx == 4 and res == 7:
        return True, ''

    if idx < 4:
        flg, op = cal(arr, idx+1, res+int(arr[idx]))
        if flg:
            return True, '+'+op

        flg, op = cal(arr, idx+1, res-int(arr[idx]))
        if flg:
            return True, '-'+op

    return False, ''

def main():
    n = input()
    _, op = cal(n, 0, 0)
    res = ''
    for i in range(3):
        res += n[i] + op[i+1]

    res += n[3] + '=7'
    print(res)
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
N = int(input())
B = list(map(int, input().split()))
A = [0] * N
for x in range(N - 1, -1, -1):
    if x == N - 1:
        A[x] = B[x - 1]
    elif x == 0:
        A[x] = B[x]
    else:
        A[x] = min(B[x], B[x - 1])
print(sum(A))


Measured memory_bytes: 3060
import itertools
#import math
#from collections import deque

n=int(input())
s=input()

t=s[:n][::-1]
u=s[n:]
dic=dict()
for i in itertools.product(range(2),repeat=n):
	t_=[""]*2
	u_=[""]*2
	for j in range(n):
		t_[i[j]]+=t[j]
		u_[i[j]]+=u[j]
	if (t_[0],t_[1]) not in dic:
		dic[(t_[0],t_[1])]=[1,0]
	else:
		dic[(t_[0],t_[1])][0]+=1
	if (u_[0],u_[1]) not in dic:
		dic[(u_[0],u_[1])]=[0,1]
	else:
		dic[(u_[0],u_[1])][1]+=1

ans=0
for i in dic.keys():
	ans+=dic[i][0]*dic[i][1]
print(ans)

Measured memory_bytes: 202488
def solve():
    N, A = map(int, input().split())
    X = list(map(int, input().split()))
 
    dp = [[0] * (A * N + 1) for _ in range(N + 1)]
    dp[0][0] = 1
    for i, x in enumerate(X):
        for j in reversed(range(1, i + 2)):
            for a in range(x, A * N + 1):
                dp[j][a] += dp[j - 1][a - x]
    print(sum(dp[i][A * i] for i in range(1, N + 1)))
 
solve()


Measured memory_bytes: 10376