akhauriyash/Code-Regression huggingface dataset:
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void calc(int n) {
    if (n == 0) {
        writeln(0);
        return;
    }

    int[] ans;
    while (n != 0) {
        if (n > 0) {
            ans ~= n % 2;
            n = -n / 2;
        }
        else {
            ans ~= -n % 2;
            n = (1 - n) / 2;
        }
    }

    ans.reverse();
    writeln(ans.map!(to!string).join());
}

void main() {
    int n = readint;
    calc(n);
}


Measured memory_bytes: 256
n = int(input())
A = tuple(map(int, input().split()))
A = sorted(A, reverse=True)

from collections import Counter
CA = Counter(A)

b = 0
for a in A:
    if CA[a] >= 2:
        CA[a] -= 2
        b = a
        break
c = 0
for a in A:
    if CA[a] >= 2:
        c = a
        break

print(b*c)

Measured memory_bytes: 22112
program answer
        implicit none
        character(len=1),allocatable,dimension(:) :: S
        integer :: N,K
        integer :: i,cn
        integer :: ans
        cn=0
        read(*,*) N,K
        allocate(S(N))
        read(*,'(100000A1)') (S(i),i=1,N)
        do i=1,N-1
          if( S(i) .ne. S(i+1)) then
            cn=cn+1
          end if
        end do
        ans = N - cn - 1 + 2*K
        if(ans .gt. N-1) ans = N-1
        write(*,'(I0)') ans
      end program answer


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>

#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <iterator>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define INF (1 << 30)
#define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back

#if DEBUG
#define _DEBUG(x) cout << #x << ": " << x << endl
#define _DDEBUG(x, y) cout << #x << ": " << x << ", " << #y << ": " << y << endl
#else
#define _DEBUG(x) ;
#define _DDEBUG(x, y) ;
#endif

#define ll long long
#define ull unsigned long long
#define MOD 1000000007

/** FOR VECTOR DEBUG */
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v)
{
    if (!v.empty())
    {
        out << '[';
        copy(v.begin(), v.end(), ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

/* template end */

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

    string n;
    cin >> n;
    for (int i = 0; i < 3; i++)
    {
        if (n[i] == '1')
        {
            n[i] = '9';
        }
        else if (n[i] == '9')
        {
            n[i] = '1';
        }
    }
#if DEBUG
    cout << "** RESULT **" << endl; // debug
#endif
    cout << n << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n;
    cin >> n;
    int count = 0;
    for (int i = 1; i <= n; i++)
    {
        if (i % 2 == 0)
            continue;
        int num = 0;
        for (int j = 1; j <= i; j++)
        {
            if (i % j == 0)
                num++;
        }
        if (num == 8)
        {
            count++;
            if (DEBUG)
                cout << i << endl;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <iomanip>

int main(int argc, char *argv[])
{
    int d, t, s;

    std::cin >> d >> t >> s;

    if (s * t >= d) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3616
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    long double solve(vector<int>& X, vector<int>& Y, string& dir) {
        int n = X.size();

        auto calc = [&](long double T) {
            const long double INF = 1e20;
            long double l = INF;
            long double r = -INF;
            long double t = -INF;
            long double b = INF;
            for (int i = 0; i < n; ++i) {
                long double x = X[i], y = Y[i];
                if (dir[i] == 'L') {
                    x -= T;
                } else if (dir[i] == 'R') {
                    x += T;
                } else if (dir[i] == 'U') {
                    y += T;
                } else {
                    y -= T;
                }
                l = min(l, x);
                r = max(r, x);
                b = min(b, y);
                t = max(t, y);
            }
            // cout << l << " " << r << " " << t << " " << b << " " << T << endl;
            long double res = (r - l) * (t - b);
            return res;
        };

        long double res = 1e20;
        long double lo = 0, hi = 1e9;
        for (int i = 0; i < 200; ++i) {
            auto l = lo + (hi - lo) / 3;
            auto r = hi - (hi - lo) / 3;

            if (calc(l) >= calc(r)) {
                lo = l;
            } else {
                hi = r;
            }
        }

        res = calc(lo);

        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int n;
    cin >> n;
    vector<int> X(n);
    vector<int> Y(n);
    string D;
    for (int i = 0; i < n; ++i) {
        int x, y;
        char d;
        cin >> x >> y >> d;
        X[i] = x;
        Y[i] = y;
        D += d;
    }

    Solution sol;
    cout << sol.solve(X, Y, D) << "\n";


    return 0;
}

Measured memory_bytes: 1280
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

struct P{ double x, y; };

int main()
{
    P p[4];
    while(cin >> p[0].x >> p[0].y >> p[1].x >> p[1].y >> p[2].x >> p[2].y >> p[3].x >> p[3].y)
    {
        if(p[0].x <= p[3].x && p[2].x <= p[1].x && p[0].y <= p[3].y && p[2].y <= p[1].y)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}

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

using namespace std;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int A,B,C,X,Y;
cin>>A>>B>>C>>X>>Y;

int mins = X>Y ? Y:X;
int maxs = X>Y ? X:Y;
int total=0;

if(A+B>C*2){
    total+=C*2*mins;
}
else{
    total+=A*mins;
    total+=B*mins;
}

int a=maxs-mins;
if(a*C*2>A*(X-mins)+B*(Y-mins)){
    total+=A*(X-mins);
    total+=B*(Y-mins);
}
else{
    total+=a*C*2;
}
cout<<total<<endl;

//system("pause");
return 0;
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var obj={};
var abc=[];
for(var i=0;i<Arr.length;i++){
var arr=Arr[i].split(" ").map(Number);
   if(i!=0 && arr.length==1){
      var cnt=0;
      for(var j=0;j<abc.length;j++){
         if(obj[abc[j]]>=1000000){console.log(abc[j]);cnt++;}
      }
      if(cnt==0)console.log("NA");
      if(arr[0]==0)break;
      obj={};
      abc=[];
   }else if(arr.length==3){
       if(!obj.hasOwnProperty(arr[0])){obj[arr[0]]=arr[1]*arr[2];abc.push(arr[0]);}
       else obj[arr[0]]+=arr[1]*arr[2];
   }
}

Measured memory_bytes: 10864
/**
 * File    : C.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-5-12 20:48:31
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

string s;
int K;
set<string> S;

int main()
{
  cin >> s;
  cin >> K;
  int N = (int)s.size();
  for (auto i = 0; i < N; i++)
  {
    for (auto j = 1; i + j <= N && j <= 5; j++)
    {
      S.insert(s.substr(i, j));
    }
  }
  auto it = S.begin();
  for (auto k = 0; k < K - 1; k++)
  {
    it++;
  }
  cout << *it << endl;
}

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

typedef long long ll;

 
int main(){
  int n;
  cin >> n;
  int even=0, odd=0, t4=0;
  for(int i=0; i<n; i++){
    int a;
    cin >> a;
    if(a%4==0){
      t4++;
      continue;
    }
    if(a%2==0){
      even++;
    }else{
      odd++;
    }
  }
  if(even>0) odd++;
  if(t4+1<odd){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
Imports System
Module ABC102B
	Sub Main()
		Dim n As Integer
		n = Integer.Parse(Console.ReadLine())
		Dim data(n) As Integer
		Dim inputs() As String = Console.ReadLine().Split()
		For i As Integer = 0 To n-1
			data(i) = Integer.Parse(inputs(i))
		Next
		Dim ans As Integer = -1
		
		For i As Integer = 0 To n-2
			For j As Integer = i+1 To n-1
				ans = Math.Max(ans,Math.Abs(data(i)-data(j)))
			Next
		Next
		Console.WriteLine(ans)
	End Sub
End Module


Measured memory_bytes: 13140
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

bool fl[100005];
inline void solve(){
    int n,op,ans=0; cin>>n>>op; 
    vi box(n+1,1);
    fl[1]=true;
    while (op-->0){
        int a,b;
        cin>>a>>b;
        if (box[a]>0){
            box[a]--; box[b]++;
            if (fl[a]){
                if (box[a]==0) fl[a]=false;
                fl[b]=true;
            }
        }
    }
    for (int i=1;i<=n;i++)
        if (fl[i]==true) ans++;
    cout << ans << endl;
}

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


Measured memory_bytes: 4048
from collections import Counter
from math import ceil, floor
n = int(input())
v = list(map(int, input().split()))
v = [v[::2], v[1::2]]
v_c = [sorted(Counter(x).items(),key=lambda x:x[1], reverse=True) + [(0, 0)]for x in v]
if v_c[0][0][0] == v_c[1][0][0]:
  ans1 = ceil(n / 2) - v_c[0][0][1] + floor(n / 2) - v_c[1][1][1]
  ans2 = ceil(n / 2) - v_c[0][1][1] + floor(n / 2) - v_c[1][0][1]
  print(min(ans1, ans2))
else:
  print(ceil(n / 2) - v_c[0][0][1] + floor(n / 2) - v_c[1][0][1])


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


// 素集合データ構造
struct UnionFind
{
  // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
  vector<int> par;
  // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    // 最初は全てのデータiがグループiに存在するものとして初期化
    rep(i,n) par[i] = i;
  }

  // データxが属する木の根を得る
  int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
  }

  // 2つのデータx, yが属する木をマージする
  void unite(int x, int y) {
    // データの根ノードを得る
    x = find(x);
    y = find(y);

    // 既に同じ木に属しているならマージしない
    if (x == y) return;

    // xの木がyの木より大きくなるようにする
    if (sizes[x] < sizes[y]) swap(x, y);

    // xがyの親になるように連結する
    par[y] = x;
    sizes[x] += sizes[y];
    // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
  }

  // 2つのデータx, yが属する木が同じならtrueを返す
  bool same(int x, int y) {
    return find(x) == find(y);
  }

  // データxが含まれる木の大きさを返す
  int size(int x) {
    return sizes[find(x)];
  }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
     //からのcin
    ll n,m,k;
    std::cin >> n>>m>>k;
    vector<ll> res(n,0);
    vector<ll> moto(n,0);
    UnionFind uf(n);
    for (int i = 0; i < m; i++) {
        ll a,b;
        std::cin >> a>>b;
        a--;b--;
        uf.unite(a,b);
        moto[a]++;
        moto[b]++;
    }
    
    for (int i = 0; i < n; i++) {
        res[i] = uf.size(i);
    }
    
    for (int i = 0; i < k; i++) {
        ll c,d;
        std::cin >> c>>d;
        c--;d--;
        if(uf.same(c,d)){
            res[c]--;
            res[d]--;
        }
    }
    for (int i = 0; i < n; i++) {
        res[i]-=moto[i];
    }
    for (auto e : res) {
        std::cout << e-1<<" ";
    }
    std::cout << std::endl;
}


Measured memory_bytes: 3200
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        int N = sc.nextInt();
        int M = sc.nextInt();
        var S = ReadLine();
        var T = ReadLine();

        var lcm = Lcm(N, M);
        var dic = new Dictionary<long, char>();
        for (int i = 0; i < N; i++) {
            dic.Add(i * (lcm / N), S[i]);
        }

        for (int i = 0; i < M; i++) {
            if (dic.ContainsKey(i * (lcm / M))) {
                if (dic[i * (lcm / M)] != T[i]) {
                    WriteLine(-1);
                    return;
                }
            }
        }

        WriteLine(lcm);
    }

    public long Lcm(long a, long b) {
        return a * b / Gcd(a, b);
    }

    public long Gcd(long a, long b) {
        if (a < b)
            return Gcd(b, a);
        while (b != 0) {
            var tmp = a % b;
            a = b;
            b = tmp;
        }
        return a;
    }
}



class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 18784
import java.util.Arrays;
import java.util.Scanner;

public class Main {	
    private static long[] A;
    private static int N;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        N = sc.nextInt();
        long K = sc.nextLong();
        A = new long[N];
        for(int i=0;i<N;i++){
            A[i] = sc.nextLong();
        }
        Arrays.sort(A);
        //System.out.println(getCntUnder(-8));
        //System.out.println(getCntUnder(-7));
        //System.out.println(getCntUnder(-6));

        long l=-1_000_000_000_000_000_000L;
        long r=1_000_000_000_000_000_000L;
        while(l<r){
            long m = (l+r)>=0 ? (l+r)/2 : (l+r+1)/2-1;
            if(getCntUnder(m) < K){
                l = m+1;
            }else{
                r = m;
            }
            //if(l<-200){break;}
        }
        System.out.println(l);
    }

    private static long getCntUnder(long k){
        long sum = 0;
        for(int i=0;i<N-1;i++){
            if(A[i] == 0){
                if(k >= 0)
                    sum += (N-1-i);
                continue;
            }
            long tgt = k / A[i];
            if(k < 0 && A[i] < 0 && ((-k) % (-A[i]) != 0)){
                tgt ++;
            }
            int l=i+1;
            int r=N-1;
            if(A[i] > 0) {
                while (l < r) {
                    int m = (l + r - 1) / 2 + 1;
                    if (tgt < A[m]) {
                        r = m - 1;
                    } else {
                        l = m;
                    }
                }
                //System.out.println(i + ":" + l);
                if(l < N && i < l && A[l] <= tgt){
                    sum += (l-i);
                }
            }else{
                while(l < r){
                    int m=(l+r)/2;
                    if(tgt > A[m]){
                        l = m+1;
                    }else{
                        r = m;
                    }
                }
                //System.out.println(i + ":" + l);
                if(l < N && i < l && A[l] >= tgt){
                    sum += (N-l);
                }
            }
        }
        return sum;
    }
}


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

const ll mod = 1000000007;
const double eps = 1e-8;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int main() {
    int N, M;
    cin >> N >> M;
    int res = N*(N-1)/2 + M*(M-1)/2;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;

namespace AtCoder {
    class Practice {
        static void Main() => CustomMain();

        static void Solve() {
            var k = ReadInt();

            if (IsEven(k)) {
                WriteAnswer(k / 2 * k / 2);
            } else {
                WriteAnswer((k / 2 + 1) * (k / 2));
            }
        }

        static void CustomMain() {
#if DEBUG
            // ファイルからテストケースを読み込む
            global::Common.ChangeStdIn();
            // 時間計測
            var stopwatch = new Stopwatch();
            stopwatch.Start();
#endif
            // 出力高速化
            var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            Console.SetOut(streamWriter);
            // 回答
            Solve();
#if DEBUG
            stopwatch.Stop();
            Console.WriteLine(stopwatch.Elapsed);
#endif
            Console.Out.Flush();
        }

        static string ReadString() => Console.ReadLine().Trim();
        static int ReadInt() => int.Parse(ReadString());
        static long ReadLong() => long.Parse(ReadString());
        static float ReadFloat() => float.Parse(ReadString());
        static double ReadDouble => double.Parse(ReadString());

        static string[] ReadStringArray() => ReadString().Split(' ');
        static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
        static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
        static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
        static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

        static T TypeConversion<T>(string s) {
            if (typeof(T) == typeof(int)) {
                return (T) Convert.ChangeType(int.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(long)) {
                return (T) Convert.ChangeType(long.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(double)) {
                return (T) Convert.ChangeType(double.Parse(s), typeof(T));
            } else {
                return (T) Convert.ChangeType(s, typeof(T));
            }
        }

        static void ReadMulti<T, U>(out T a, out U b) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
        }

        static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
            c = TypeConversion<V>(str[2]);
        }

        static void WriteAnswer(object ans) => Console.WriteLine(ans);

        static bool IsOdd(long num) {
            return (num & 1) == 1;
        }

        static bool IsEven(long num) {
            return (num & 1) == 0;
        }

        static long GCD(long a, long b) {
            return b != 0 ? GCD(b, a % b) : a;
        }
    }
}

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

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var s = "";
			while((s=Console.ReadLine())!=null)
			{
				var r = "";
				for(int i=0;i<s.Length;i++)
				{
					if(s[i]=='@')
					{
						i++;
						for (int j = 0; j < s[i]-'0'; j++)
							r += s[i + 1];
						i++;
					}
					else
					{
						r += s[i];
					}
				}
				Console.WriteLine(r);
			}
		}
	}
}

Measured memory_bytes: 5268
package main

import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

func Maximize(B [][]int, C []int) int {
  k := 0
  for j := 59; 0 <= j; j-- {
    if 0 < C[j] { continue }
    pivot := false
    for i, b := range B[k:] {
      if b[j] == 1 {
        pivot = true
        B[i + k], B[k] = B[k], B[i + k]
        break
      }
    }
    if !pivot { continue }
    for i, b := range B {
      if i == k { continue }
      if b[j] == 0 { continue }
      for j := range b {
        B[i][j] ^= B[k][j]
      }
    }
    k++
  }
  for _, b := range B[1:] {
    for j, bb := range b {
      B[0][j] ^= bb
    }
  }
  for j, b := range B[0] {
    C[j] |= b
  }
  ans := 0
  for j, c:= range C {
    ans += c * 1 << uint(j)
  }
  return ans
}

func Solve() {
  var N int
  NextInt(&N)
  var A []int
  NextIntVec(&A)
  B := make([][]int, N)
  C := make([]int, 60)
  M := 0
  for i, a := range A {
    B[i] = make([]int, 60)
    for _a, j := a, 0; j < 60; _a, j = _a / 2, j + 1 {
      B[i][j] = _a % 2
      C[j] ^= _a % 2
    }
    M ^= a
  }
  X := Maximize(B, C)
  Write(M ^ X + X)
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 54144
S = input()

L = [S]

for i in range(len(S)-1):
    L_new = []
    for l in L:
        L_new.append(l[:1+2*i] + '+' + l[1+2*i:])
        L_new.append(l[:1+2*i] + ' ' + l[1+2*i:])
    L = L_new

print(sum([eval(str.replace(l, ' ', '')) for l in L]))


Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		long h = stdIn.nextLong(); //モンスターの体力
		
		double aa = Math.log(h)/Math.log(2);
		int a = (int)aa;

		long cnt = 0;
		
		for(int i = 0; i <= a; i++) {
			cnt += Math.pow(2, i);
		}
		System.out.println(cnt);
	}

}


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

class A6{
  public static int n;
  public static void Main(){
    int k = 0;
    n  = int.Parse(Console.ReadLine());
    int[] A = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
    int[] B = new int[n];
    k = A.Max();

    Calc.CountingSort(A,ref B,k);

    Console.WriteLine(string.Join(" ",Array.ConvertAll(B, (e)=> e.ToString())));
    }
}


class Calc{
  static public void CountingSort(int[] A,ref int[] B,int k){
    int[] C = new int[k+1];

    for(int j = 0;j < A6.n;j++){
      C[A[j]]++;
    }
    for(int i = 1;i <= k;i++){
      C[i] += C[i - 1];
    }
    for(int j = A6.n - 1;j >= 0;j--){
      B[C[A[j]] - 1] = A[j];
      C[A[j]]--;
    }
  }
}


Measured memory_bytes: 265552
#include <stdio.h>
int main(void){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=n-1;i>=0;i--){
        if(i != 0){
            printf("%d ",a[i]);
        }
        else{
            printf("%d\n",a[i]);
        }
    }
    return 0;
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

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

inline bool inside(ll y, ll x, ll H, ll W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll p(n*n);
  rep(i,n*n) cin>>p[i], p[i]--;
  
  vvll d(n, vll(n,-1));
  rep(i,n){
    rep(j,n){
      if(d[i][j]==-1) d[i][j]=i;
      if(d[n-i-1][j]==-1) d[n-i-1][j]=i;
    }
    rep(j,n){
      if(d[j][i]==-1) d[j][i]=i;
      if(d[j][n-i-1]==-1) d[j][n-i-1]=i;
    }
  }
  // rep(i,n){
  //   rep(j,n) cout<<d[i][j];
  //   cout<<endl;
  // }
  
  vvll exist(n,vll(n,1));
  
  ll ans=0;
  rep(ki,n*n){
    ll now=p[ki];
    ll y=now/n, x=now%n;
    ans+=d[y][x];
    exist[y][x]=0;
    
    queue<pll> q;
    q.emplace(y,x);
    while(!q.empty()){
      ll y=q.front().first, x=q.front().second;
      q.pop();
      ll cost=d[y][x]+exist[y][x];
      rep(i,4){
        ll ny=dy[i]+y, nx=dx[i]+x;
        if(!inside(ny,nx,n,n)) continue;
        if(chmin(d[ny][nx],cost)){
          q.emplace(ny,nx);
        }
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 9276
<?php
  while (true) {
    list($h, $w) = explode(" ", trim(fgets(STDIN)));
    if (($h == 0) && ($w == 0)) {
      return;
    }
    $i = 1;
    while ($i <= $h) {
      print (str_repeat("#", $w) . "\n");
      $i++;
    }
    print ("\n");
  }
?>

Measured memory_bytes: 6576
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=1270;

int main(){
	while(1){
		int n,m;
		cin>>n>>m;
		if(n==0) break;
		int q;
		cin>>q;
		vvi a(m,vi(n)),b(m,vi(M));
		for(int i=0;i<q;i++){
			int t,x,y,z;
			cin>>t>>x>>y>>z;
			if(z==1) a[y-1][x-1]=t;
			else{
				for(int j=a[y-1][x-1];j<t;j++) b[y-1][j]=1;
			}
		}
		cin>>q;
		for(int i=0;i<q;i++){
			int x,l,r,res=0;
			cin>>l>>r>>x;
			for(int j=l;j<r;j++) res+=b[x-1][j];
			cout<<res<<endl;
		}
	}
}


Measured memory_bytes: 81236
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
         
        int r = stdIn.nextInt();
        int c = stdIn.nextInt();
         
        int[][] h = new int[r+1][c+1];
         
        for(int i = 0; i < r; i++) {
            int rsum = 0;
            for(int j = 0; j < c; j++) {
                int tmp = stdIn.nextInt();
                rsum += tmp;
                h[i][j] = tmp;
            }
            h[i][c] = rsum;
        }
         
        for(int i = 0; i < c+1; i++) {
            int rsum = 0;
            for(int j = 0; j < r; j++) {
                rsum += h[j][i];
            }
            h[r][i] = rsum;
        }
         
        for(int i = 0; i < r+1; i++) {
            for(int j = 0; j < c; j++) {
                System.out.print(h[i][j] + " ");
            }
            System.out.println(h[i][c]);
        }
    }
}


Measured memory_bytes: 41400
S = input()
T = input()


def pre_(X):
    d= dict()
    d[0]=0
    tmp = 0
    for i,s in enumerate(X):
        if s=="A":
           tmp +=1
        else:
            tmp+=2
        d[i+1]=tmp
    return d

Sx = pre_(S)
Tx = pre_(T)


for a,b,c,d in [list(map(int,input().split())) for _ in range(int(input()))]:
    """
    print(Sx[a-1])
    print(Sx[b])
    print(Tx[c-1])
    print(Tx[d])
    """
    print( "YES" if (((Sx[a-1]-Sx[b])- (Tx[c-1]-Tx[d]))%3==0) else "NO")

Measured memory_bytes: 59764
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] X = new int[3];
		X[0] = sc.nextInt();
		X[1] = sc.nextInt();
		X[2] = sc.nextInt();

		Arrays.sort(X);

		if(X[0] + X[1] == X[2]){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

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

struct Benri {
    Benri() {
        std::cin.tie(0); ios::sync_with_stdio(false);
        cout << fixed << setprecision(12);
    }
} benri;
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 (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 1000000007
#define MOD2 998244353
const int INF = 1 << 28;





int main() {
    ll N, K; cin >> N >> K;
    vll v;
    for (int i = 1; i * i <= N; i++) {
        v.pb(i);
        v.pb(N / i);
    }

    sort(all(v));
    v.erase(unique(all(v)), v.end());

    vll num;
    num.pb(1);
    rep(i, (int)v.size() - 1) {
        num.pb(v[i + 1] - v[i]);
    }

    int n = num.size();
    vector<vll> dp(K + 1, vll(n + 1, 0));
    dp[0][0] = 1;

    rep(i,K) {
        vll sum(n + 1, 0);
        rep(j,n) {
            sum[j + 1] = sum[j] + dp[i][j];
            sum[j + 1] %= MOD;
        }

        rep(j,n) {
            dp[i + 1][j] = sum[n - j] * num[j];
            dp[i + 1][j] %= MOD;
        }
    }

    ll ans = 0;
    rep(i,n) {
        ans += dp[K][i];
        ans %= MOD;
    }

    cout << ans << endl;
}






Measured memory_bytes: 51960
from scipy.sparse.csgraph import dijkstra

def main():
    n,x,y=map(int,input().split())
    cost = [[0 for i in range(n)] for i in range(n)]
    #cost[u][v] : 辺uvのコスト(存在しないときはinf この場合は10**10)
    for i in range(1,n):
        cost[i-1][i] = 1
#        cost[i][i-1]=1
    cost[x-1][y-1]=1
    cost[y-1][x-1]=1
    res=tuple(dijkstra(tuple(cost), directed=False))
    ans = [0 for i in range(n)]
    for i in range(n):
        for j in range(i,n):
            ans[int(res[i][j])] += 1
 
    for i in range(1,n):
        print(ans[i])
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 100976
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
// #pragma GCC optimize("O2")
typedef long long int ll;
typedef long double ld;
typedef map <ll,ll> mm;
typedef vector <ll> mv;
typedef pair <ll,ll> mp;
typedef set <ll> ms;
typedef multiset <ll> mms;
typedef queue <ll> mq;
typedef deque <ll> mdq;
typedef stack <ll> mst;
typedef priority_queue <ll> mpq;
typedef priority_queue <ll, vector<ll>, greater<ll> > mmh;
typedef complex<double> cd;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define flush cout.flush();
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb(v) push_back(v)
#define lb(v) lower_bound(v)
#define ub(v) upper_bound(v)
#define cn continue
#define forl(i,n) for(ll i=0;i<n;i++)
#define forlr(i,n) for(ll i=n-1;i>=0;i--)
#define rev(s) reverse(s.begin(),s.end())
void swap(ll &a,ll &b) {
	ll tmp=a;
	a=b;
	b=tmp;
}
ll atoistring(string s) {
	stringstream lol(s);
	ll x;
	lol>>x;
	return x;
}
void pv(mv v) {
	forl(i,v.size()) cout<<v[i]<<" ";
	cout<<"\n";
}
void pa(ll *v, ll size) {
	forl(i,size) cout<<v[i]<<" ";
	cout<<"\n";
}
void removeDups(mv &v) {
	sort(all(v));
	mv::iterator it = unique(v.begin(), v.end());
	v.resize(distance(v.begin(), it));
}
// ll facs[], facsinv[];
// ll nck(ll N,ll K,ll mod) {
// 	if(N<K) return 0;
// 	return (((facs[N]*facsinv[N-K])%mod)*facsinv[K])%mod;
// }
inline ld kthRoot(ld n, ll k) {
	return pow(k, (1.0 / k) * (log(n) / log(k)));
}
ll power(ll x, ll y, ll p) {
	ll res=1;
	x=x%p;
	while(y>0) {
		if(y&1) res = (res*x)%p;
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
void checkmod(ll &x, ll mod) {
	if(x>=mod) x%=mod;
}
ll ncr(ll n, ll r, ll mod) {
	ll ans = 1;
	forl(i,min(r,n - r)) {
		ans *= n - i;
		checkmod(ans,mod);
		ans *= power(i+1, mod - 2,mod);
		checkmod(ans,mod);
	}
	return ans;
}
ll sumofgp(ll a, ll n, ll m) {
	// n = number of terms - 1
	if(n < 0) return 0;
	if(n == 0) return 1;
	if(n==1) return (1+a)%m;
	ll ans;
	if(n%2) ans=(1+a)*sumofgp((a*a)%m,(n-1)/2,m);
    else ans=1+((a*(1+a))%m)*sumofgp((a*a)%m,n/2-1,m);
    return ans%m;
}
ll power_of_2_not_less(ll n) {
	if(!n) return 1;
	n--;
	n |= n>>1;
	n |= n>>2;
	n |= n>>4;
	n |= n>>8;
	n |= n>>16;
	n |= n>>32;
	n++;
	return n;
}
ll mod = 1e9 + 7;
// void checktime()
// {
// 	struct timespec ts;
// 	printf("Running Program\n");
// 	clock_gettime(CLOCK_MONOTONIC_RAW,&ts);
// 	long double st=ts.tv_nsec/(1e9)+ts.tv_sec;
// 	// Call Funcn Here
// 	clock_gettime(CLOCK_MONOTONIC_RAW,&ts);
// 	long double en=ts.tv_nsec/(1e9)+ts.tv_sec;
// 	printf("Program ended\nTime = %Lf\n",en-st);
// }

void thisIsMain() {
	ll n;
	cin>>n;
	ll ans = 1, num = 7;
	while(num % n) {
		num %= n;
		num *= 10;
		num += 7;
		ans ++ ;
		if(ans > n) {
			cout<<"-1\n";
			return ;
		}
	}
	cout<<ans<<"\n";
}

int main(void)
{
	fastio
	ll t = 1;
	// cin>>t;
	while(t--) thisIsMain();
	return 0;
}

Measured memory_bytes: 3636
# correct_case
# 6     1 2 3 4 5 6
# aaa = 1 1 0 1 1 1
# bbb = x x x x x 1 | k / 2まではa[i] と同じ
# bbb = x x x x 1 1 | k / 2まではa[i] と同じ
# bbb = x x x 1 1 1 | k / 2まではa[i] と同じ
# bbb = x 1 1 1 1 1 | sum_b[6] % 2 == 1 で != 0(a[1]) なので 1
# bbb = 0 1 1 1 1 1 | sum_b[2,3,4,5,6] % 2 = 1 で == 1(a[0]) なので 0

n = int(input())
aaa = list(map(int, input().split(' ')))
aaa = [0] + aaa
bbb = [0] * len(aaa)
ans_count = 0
ans = []
for i in range(n, 0, -1):
    hoge = 0
    for j in range(i+i, n+1, i):  # !!!!!!
        hoge += bbb[j]
    bbb[i] = 0 if (hoge % 2) == aaa[i] else 1
    if bbb[i] == 1:
        ans_count += 1
        ans.append(i)
    
print(ans_count)
if ans:
    print(' '.join(map(str, ans)))

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

using namespace std;

#define ll long long

struct node {
	int n; // 頂点の番号
	ll c = 0; // カウンター
	ll temp = 0;
	bool isVisited = false;
	set<int> children;
};

node* g;

void solve(int r, ll count) {
	g[r].isVisited = true;
	count += g[r].temp;
	g[r].c = count;
	for (auto vi : g[r].children) {
		if (!g[vi].isVisited)
			solve(vi, count);
	}
}

signed main() {
	int n, q;
	cin >> n >> q;
	g = new node[n];
	for (int i = 0; i < n; ++i)
		g[i].n = i;

	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		g[a].children.insert(b);
		g[b].children.insert(a);
	}

	while (q--) {
		int p, x;
		cin >> p >> x;
		--p;
		g[p].temp += x;
	}

	solve(0, 0);

	for (int i = 0; i < n; ++i)
		cout << g[i].c << " ";
	cout << endl;

	return 0;
}

Measured memory_bytes: 46080
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int n;
	cin >> n;
	int ans = 1;
	repr(i, 1, n+1) {
		int count = 0;
		int tmp = i;
		while (tmp % 2 == 0){
			tmp /= 2;
			count++;
			if (tmp == 0) break;
		} 
		ans = max(ans, count);
	}
	if (n == 1) {
		cout << ans << endl;
	}
	else {
		cout << pow(2, ans) << endl;
	}


	return 0;
}


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

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

  string s;
  int k;
  cin >> s >> k;

  set<string> S;
  rep(i, s.size()) {
    for (int j = 0; ; j++) {
      if (s.size()-i == j || k == j) break;
      S.insert(s.substr(i, j+1));
    }
  }

  int cnt = 0;
  for (auto&& i : S) {
    if (cnt == k-1) {
      cout << i << endl;
      return 0;
    }
    cnt++;
  }
}

Measured memory_bytes: 1664
#include<stdio.h>
#include<string.h>

int main(){

	int m, h[200] = {0}, rgst[200] = {0}, end[200] = {0}, i, j;
	char c[300];
	size_t len;

	end[0] = '-';

	while(1){
		scanf("%s", c);
		if(strcmp(c, end) == 0){
			break;
		}
		scanf("%d", &m);
		for(i = 0; i < m; i++){
			scanf("%d", &h[i]);
		}

		len = strlen(c);

		for(i = 0; i < m; i++){
			for(j = 0; j < len; j++){
				rgst[j] = c[j];
			}

			for(j = 0; j < len - h[i]; j++){
				c[j] = c[j + h[i]];
			}

			for(j = 0; j < h[i]; j++){
				c[len - h[i] + j] = rgst[j];
			}
		}

		printf("%s\n", c);

	}
	
	return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
namespace io{
	const int l=1<<20;
	char buf[l],*s,*t;
	char gc(){
		if(s==t){
			t=(s=buf)+fread(buf,1,l,stdin);
			return s==t?EOF:*s++;
		}
		return *s++;
	}
	char c;
	template<class IT>inline void gi(IT &x){
		x=0;c=gc();while(c<'0'||c>'9')c=gc();
		while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^'0');c=gc();}
	}
};
using io::gi;
#define ll long long
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
const int N=3005;
ll c[N],d[N],b[N];
inline ll expo(ll a,int b,ll c){
	ll s=1ll;
	while(b){
		if(b&1)s=s*a%c;
		b>>=1; a=a*a%c;
	}
	return s;
}
inline ll sub(int a,int b,int c){return a+b<c?a+b:a+b-c;}
int main(){
	int n,a,i,j;ll t;
	scanf("%d",&n);//printf("\n");
	c[0]=1ll;
	for(i=0;i< n;++i){
		for(j=i+1;j;--j)c[j]=((c[j-1]-c[j]*i)%n+n)%n;
		c[0]=((-c[0]*i)%n+n)%n;
//		for(j=0;j<=n;++j)printf("%lld ",c[j]);printf("c\n");
	}
//	for(j=0;j<=n;++j)printf("%lld ",c[j]);printf("C\n");
	for(i=0;i< n;++i){
		scanf("%d",&a);
		if(a){
			t=1ll;
			for(j=0;j<n;++j)if(j!=i)t=(t*(i-j+n))%n;
			t=expo(t,n-2,n);
			for(j=n;j;--j)d[j]=c[j];
			for(j=n;j;--j)d[j-1]=((d[j-1]+d[j]*i)%n+n)%n;
//			for(j=0;j<=n;++j)printf("%lld ",d[j]);printf("t=%lld\n",t);
			for(j=n;j;--j)b[j]=(b[j]+d[j]*t)%n;
		}
	}
	for(i=1;i<=n;++i)printf("%lld ",b[i]);
	return 0;
}

Measured memory_bytes: 384
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
s = ns()

stack = []

left = 0
right = 0

for si in s:
    if si == '(':
        stack.append('(')
        
    elif si == ')':
        if stack:
            stack.pop()
        else:
            left += 1
            
right = len(stack)

print(left*'(' + s + right*')')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

string s, t = "2019/04/30";

int main() {
	cin >> s;
	
	cout << (s <= t ? "Heisei" : "TBD") << endl;
	
	return 0;
}


Measured memory_bytes: 256