akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
class Main{
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int k = saori.saori_hayami();
		int a = 0;
		String[] d = new String[k];
		for(int i = 0;i < k;i++){
			d[i] = saori.nextHayami();
		}
		boolean flg = true;
		for(int i = n; i < 100000;i++){
			a:for(int j = 0; j < d.length;j++){
				if(Integer.toString(i).contains(d[j])){
					flg = false;
					break a;
				}
			}
			if(flg){
				System.out.println(i);
				break;
			}
			flg = true;
		}

	}
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 27084
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)


int main(){
	int n,p,r[101],cnt;
	vector<pii> v;
	for(;;){
		scanf("%d,%d",&n,&p);
		if(n==0&&p==0)break;
		v.push_back(pii(p,n));
	}
	sort(v.rbegin(),v.rend());
	cnt=0;
	int s = v.size();
	rep(i,s){
		if(i>0 && v[i-1].first == v[i].first)cnt++;
		r[v[i].second-1]=i+1-cnt;
	}
	while(~scanf("%d",&n))printf("%d\n",r[n-1]);
	
	return 0;
}

Measured memory_bytes: 1192
s = input()
pre = ""
suf = ""
rev = False

for i in range(int(input())):
        q = input().split()
        if len(q)==1: rev = not rev
        else:
                t, f, c = q
                f = int(f)
                if rev: f += 1
                f %= 2
                if f: pre += c
                else: suf += c
if rev: print(suf[::-1] + s[::-1] + pre)
else: print(pre[::-1] + s + suf)

Measured memory_bytes: 4468
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}
func mint(a int) int {
	return (a + 1000000007) % 1000000007
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	var n int

	fmt.Sscan(getNextLine(scanner), &n)
	s := getNextLine(scanner)
	dp := make([][]int, n)
	for i := 0; i < n; i++ {
		dp[i] = make([]int, n)
		dp[i][0] = 1
	}

	sums := make([]int, n)
	for j := 0; j < n-1; j++ {
		sums[0] = dp[0][j]
		for i := 1; i < n; i++ {
			sums[i] = sums[i-1] + dp[i][j]
		}
		if s[j] == '<' {
			for i := n - j - 1; i > 0; i-- {
				dp[i-1][j+1] = mint(sums[i-1])
			}
			continue
		}
		for i := n - j - 1; i > 0; i-- {
			dp[i-1][j+1] = mint(sums[n-j-1] - sums[i-1])
		}
	}
	fmt.Println(dp[0][n-1])
}


Measured memory_bytes: 44672
#include <bits/stdc++.h>
using namespace std;
void fast(){
cin.tie(0);
cin.sync_with_stdio(0);
}

int main()
{
    fast();
   long long n,r=0,g=0,b=0;
   cin>>n;
   string s;
   cin>>s;
   r=count(s.begin(),s.end(),'R');
   g=count(s.begin(),s.end(),'G');
  b=count(s.begin(),s.end(),'B');
  long long sum=r*g*b;
  for(int i=0;i<n;i++)
  {
      for(int j=i+1;j<n;j++)
      {
          int k=2*j -i;
          if(k<n&&s[i]!=s[j]&&s[j]!=s[k]&&s[k]!=s[i]){sum--;}
      }
  }
  cout<<sum;
return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	vector<int> n(4);
	rep(i, 4) cin >> n[i];
	sort(all(n));
	vector<int> ans = { 1,4,7,9 };
	if (n == ans) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while ( sc.hasNextInt() ) {
      int target = sc.nextInt();
      int count = sc.nextInt();
      int[] denominations = new int[count];
      for ( int i = 0; i < count; i++ ) {
        denominations[i] = sc.nextInt();      
      }
      System.out.println(findMinimumNumberofCoins(target, denominations));
    } 
  }

  public static int findMinimumNumberofCoins(int target, int[] denominations) {
    
    int[] cache = new int[target+1];

    for ( int i = 1; i <= target; i++ ) {
      int min = i;
      for ( int denomination : denominations ) {
        if ( i - denomination >= 0 ) {
          min = Math.min(min, cache[i-denomination]);
        }
      }
      // loop through all denominations and update the min  
      cache[i] = min+1;
    }
    return cache[target];
  }
  
} 

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

int main(){
  char a[]={"A"};
  char b[]={"B"};
  char o[]={"O"};
  char type[3];
  int ax=0,bx=0,ox=0,abx=0,n;

  while(scanf("%d,%s",&n,type)!=EOF){
    if(strcmp(type,a)==0)
      ax++;
    else if(strcmp(type,b)==0)
      bx++;
    else if(strcmp(type,o)==0)
      ox++;
    else
      abx++;
  }
  printf("%d\n%d\n%d\n%d\n",ax,bx,abx,ox);
  return 0;
}

Measured memory_bytes: 0
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace abc176
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            solve_abc176A();
            Console.Out.Flush();
        }

        public static void solve_abc176B()
        {
        }

        public static void solve_abc176A()
        {
            int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int w = (a[0] + a[1] - 1) / a[1];
            Console.WriteLine(w * a[2]);
        }
    }
}

Measured memory_bytes: 28420
let f n = if n mod 2 = 0 then n / 2 else (3 * n) + 1
let occurence = Array.make 1000001 false
let memo = Array.make 1000001 None
let memo_seq s i =
  let rec inner i =
    match memo.(i) with
    | None -> if i = 1 then s 
              else let ans = f (inner (i - 1)) in memo.(i) <- Some ans; ans
    | Some j -> j 
  in inner i

let rec search s m = 
  let v = memo_seq s m in 
  if occurence.(v) then m else (occurence.(v) <- true; search s (m + 1))

let _ =
  let s = Scanf.scanf "%d" (fun s -> s) in
  search s 1 |> print_int

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

namespace ConsoleApplication1
{
    class Program
    {
        static int[,] dp;
        static int[] p;

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            dp = new int[n + 1, n + 1];
            p = new int[n + 1];

            string[] input = Console.ReadLine().Split(' ');
            p[0] = int.Parse(input[0]);
            p[1] = int.Parse(input[1]);

            for (int i = 2; i <= n; i++)
            {
                input = Console.ReadLine().Split(' ');
                p[i] = int.Parse(input[1]);
            }

            for (int i = 1; i < n; i++)
            {
                dp[i, i + 1] = p[i - 1] * p[i] * p[i + 1];
            }

            for (int j = 0; j <= n - 3; j++)
            {
                for (int i = 3 + j; i <= n; i++)
                {
                    dp[i - 2 - j, i] = Rec(i - 2 - j, i);
                }
            }

            Console.WriteLine(dp[1, n]);
        }

        static int Rec(int r, int c)
        {
            int min = int.MaxValue;
            int num = c - r;

            for (int i = 0; i < num; i++)
            {
                min = Math.Min(
                    min,
                    dp[r, r + i] + dp[r + i + 1, c] + p[r - 1] * p[r + i] * p[c]);
            }

            return min;
        }
    }
}

Measured memory_bytes: 9212
#include <bits/stdc++.h>
#define INF 1000000000000001
#define ll long long
using namespace std;

int main()
{
  ll x;
  cin >> x;
  ll ans = 0;
  ans += (x / 500) * 1000;
  ans += ((x % 500) / 5) * 5;
  cout << ans << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

//4Head

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(NULL));

ll const mod = 1e9 + 7;

namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}

	ll poww(ll a, ll b) {
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}

	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

ll const maxn = 3e5 + 5;

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll h; cin >> h;
	ll ans = 0;
	ll kek = 1;
	while (h > 0) {
		ans += kek;
		if (h == 1) {
			h = 0;
		} else {
			h /= 2;
			kek *= 2;
		}
	}
	cout << ans << endl;
	return 0;
}

/*
3
0 1
3 0
1 0
*/

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

const int N = 1e5 + 5;

int dp[N];
vector<int> adj[N];

int n, m;

void read() {
  scanf("%d %d", &n, &m);
  for (int i = 0 ; i < m ; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    adj[u].push_back(v);
  }
}

int solve(int pos) {
  int &ret = dp[pos];
  if (ret != -1) return ret;

  ret = 0;
  for (int nex : adj[pos]) {
    ret = max(ret, 1 + solve(nex));
  }
  return ret;
}

int work() {
  memset(dp, -1, sizeof dp);
  int ret = 0;
  for (int i = 1 ; i <= n ; i++)
    ret = max(ret, solve(i));
  return ret;
}

int main() {
  read();
  cout << work() << endl;
  return 0;
}

Measured memory_bytes: 7424
#include<bits/stdc++.h>
using namespace std;
const int maxn = 101, maxk = 100100, mod = 1e9 + 7;
long long dp[maxn][maxk], a[maxn];
int n, k;

int main(){
	ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for(int i = 0 ; i < n ; ++i)
        cin >> a[i];
    for(int i = 0 ; i <= min(a[0], (long long)k) ; ++i)
        dp[0][i] = 1;
    
    for(int i = 1 ; i < n ; ++i){
        for(int j = 1 ; j <= k ; ++j)
            dp[i - 1][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % mod;
        for(int j = 0 ; j <= k ; ++j){
            int lo = max(0LL , (long long)j - a[i]);
            int hi = j;
            dp[i][j] = dp[i - 1][hi] - (lo > 0 ? dp[i - 1][lo - 1]:0) + mod;
            dp[i][j] %= mod;
        }        
    }
    cout << dp[n - 1][k] << '\n';
    return 0;
}

Measured memory_bytes: 78464
using System;

namespace H___Grid_1
{
    class Program
    {
        static void Main(string[] args)
        {
            var HW = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var H = HW[0];
            var W = HW[1];

            long MOD = 1000000007;

            var grid = new string[H];
            for (int i = 0; i < H; i++) grid[i] = Console.ReadLine();

            var DP = new long[H, W];
            for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) DP[i, j] = 0;
            for (int i = 0; i < H; i++) if (grid[i][0] == '.') DP[i, 0] = 1; else break;
            for (int j = 0; j < W; j++) if (grid[0][j] == '.') DP[0, j] = 1; else break;

            for (int i = 1; i < H; i++)
                for (int j = 1; j < W; j++)
                    if (grid[i][j] == '.') DP[i, j] = (DP[i - 1, j] + DP[i, j - 1]) % MOD;

            Console.WriteLine(DP[H - 1, W - 1]);
        }
    }
}


Measured memory_bytes: 28892
#include<iostream>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back

#define rep(i, N) for(ll i = 0; i < N; i++)
#define repa(i, a, N) for(ll i = a; i < N; i++)
#define repr(i, N) for(ll i = N-1; i >= 0; i--)

#define drep(i, N, j, M) rep(i, N) rep(j, M)
#define trep(i, N, j, M, k, L) rep(i, N) rep(j, M) rep(k, L)

#define all(A) A.begin(), A.end()

// const ll mod = 1e9 + 7;
const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}

ll id(char c) {
	return c - 'a';
}

bool isOK(vi& a, ll k, ll index) {
	return a[index] < k * (index + 1);
}

ll binary_search(vi& a, ll k) {
	ll left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	ll right = (ll)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		ll mid = left + (right - left) / 2;

		if (isOK(a, k, mid))
			right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}

template<class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
	return os << "{" << p.first << "," << p.second << "}";
}

template<class t> ostream& operator<<(ostream& os, const vector<t>& v) {
	os << "{";
	for (auto e : v)os << e << ",";
	return os << "}";
}

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

	for (ll a = 1; a <= 9; a++) {
		for (ll b = 1; b <= 9; b++) {
			if (N == a * b) {
				Yes();
				return 0;
			}
		}
	}
	No();
	return 0;
}

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

int main(){
  int a,n,ans=0;cin>>n;
  map<int,int> mp;
  for(int i=0;i<n;i++) cin>>a,mp[a]++;
  for(auto p:mp){
    if(p.first<p.second) ans+=p.second-p.first;
    if(p.first>p.second) ans+=p.second;
  }
  cout<<ans;
}

Measured memory_bytes: 4736
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    else:
        if m == -1 or f == -1:
            print("F")
        elif m + f >= 80:
            print("A")
        elif m + f >= 65 and m + f < 80:
            print("B")
        elif m + f >= 50 and m + f < 65:
            print("C")
        elif m + f >= 30 and m + f < 50:
            if r >= 50:
                print("C")
            else:
                print("D")
        else:
            print("F")


Measured memory_bytes: 5596
#include "bits/stdc++.h"
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const long long mod = 1e9 + 7;

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

ll powMod(ll n, ll k, ll m) {
	if (k == 0) {
		return 1;
	} else if (k % 2 == 1) {
		return powMod(n, k - 1, m) * n % m;
	} else {
		ll t = powMod(n, k / 2, m);
		return t * t % m;
	}
}

int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;

	for (int i = 0; i < 150; i++) {
		c -= b;
		if (c <= 0) {
			cout << "Yes" << endl;
			return 0;
		}
		a -= d;
		if (a <= 0) {
			cout << "No" << endl;
			return 0;
		}
	}
}


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

#define inf 0x3f3f3f3f
#define INF 1000111000111000111LL
#define mod 1000000007
#define pi acos(-1.0)
#define eps 1e-8
#define endl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define all(cc) (cc).begin(),(cc).end()
using lli = long long int ;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vb = vector<bool> ;
using vvi = vector<vector<int>> ;
using vlli = vector<long long int> ;
using vpii = vector<pair<int, int>> ;

int main()
  {
    ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
    int n, ans=inf ;
    string s ;
    cin>> n >> s ;
    s='#'+s ;
    vi cntW(n+1, 0), cntE(n+1, 0) ;
    for(int i=1 ; i<=n ; i++)
      {
        cntW[i]=cntW[i-1]+(s[i]=='W') ;
        cntE[i]=cntE[i-1]+(s[i]=='E') ;
      }
    for(int i=1 ; i<=n ; i++) ans=min(ans, cntW[i-1]+cntE[n]-cntE[i]) ;
    cout<< ans ;
  }


Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n; cin >>n;
  vector<int> v(n);
  int buf;
  for (int i=0; i<n; i++) cin >>v.at(i);
  for (int i=0; i<n; i++){
    cin >>buf;
    v.at(i) -= buf;
  }
  int ans=0;
  for (int i=0; i<n; i++){
    ans += max(v.at(i), 0);
  }
  
  cout <<ans;
  cout <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

template <typename T>
vector<T> dijkstra(int s, vector<vector<pair<int, T>>> &G) {
    const T inf = numeric_limits<T>::max();
    using P     = pair<T, int>;
    int n       = G.size();
    vector<T> d(n, inf);
    priority_queue<P, vector<P>, greater<P>> q;
    d[s] = 0;
    q.emplace(d[s], s);
    while (!q.empty()) {
        P p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;
        for (auto &e : G[v]) {
            int u = e.first;
            T c   = e.second;
            if (d[u] > d[v] + c) {
                d[u] = d[v] + c;
                q.emplace(d[u], u);
            }
        }
    }
    return d;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, x, y;
    cin >> n >> x >> y;
    x--, y--;
    vector<vector<pair<int, int>>> edges(n);
    for (int i = 0; i < n - 1; ++i) {
        edges[i].emplace_back(i + 1, 1);
        edges[i + 1].emplace_back(i, 1);
    }
    edges[x].emplace_back(y, 1);
    edges[y].emplace_back(x, 1);
    vector<lint> ret(n, 0);
    for (int i = 0; i < n; ++i) {
        auto dist = dijkstra(i, edges);
        for (int j = 0; j < n; ++j) {
            if (j == i)
                continue;
            ret[dist[j]]++;
        }
    }
    for (int i = 1; i <= n - 1; ++i) {
        cout << ret[i] / 2 << "\n";
    }
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;

int main() {
    long long X, Y;
    cin >> X >> Y;
   
    long long A=X, ans=0;
    while (A <= Y){
        A *= 2;
        ans++;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int W, H, N;

int main() {
    cin >> W >> H >> N;
    int x0 = 0, x1 = W, y0 = 0, y1 = H;
    for (int i = 0; i < N; i++) {
        int x, y, a;
        cin >> x >> y >> a;
        if(a==1)
            x0 = max(x, x0);
        if(a==2)
            x1 = min(x, x1);
        if(a==3)
            y0 = max(y, y0);
        if(a==4)
            y1 = min(y, y1);
    }
    cout << max(x1 - x0, 0) * max(y1 - y0, 0) << endl;   
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N,K;cin>>N>>K;
    int pos;
    rep(i,N){
        int a;cin>>a;
        if(a==1)pos=i;
    }

    int ans=LLONG_MAX;
    for(int i=0;i<=K-1;i++){
        int a=max(0ll,pos-i);
        int b=max(0ll,N-pos-1-(K-1-i));
        chmin(ans,1+(a+K-2)/(K-1)+(b+K-2)/(K-1));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"log"
)

func main() {
	log.SetFlags(log.Lshortfile)
	var N, M int
	fmt.Scan(&N, &M)
	getFactInv()
	if abs(N-M) >= 2 {
		fmt.Println("0")
	} else if abs(N-M) == 1 {
		fmt.Println(p(N, N) * p(M, M) % MOD)
	} else if N == M {
		fmt.Println(p(N, N) * p(M, M) % MOD * 2 % MOD)
	} else {
		fmt.Println("0")
	}

}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

const MAX = 2000010

var MOD int = 1000000007 // 素数
var fact [MAX]int        // 階乗
var factInv [MAX]int     // 階乗の逆元
var inv [MAX]int

func getFactInv() {
	// 最初に一度だけ実行
	inv[1], fact[0], factInv[0] = 1, 1, 1
	// nHkはn+k+1Ckとなるためn+kをとる
	var i int
	for i = 2; i < MAX; i++ {
		inv[i] = inv[MOD%i] * (MOD - MOD/i) % MOD
	}
	for i = 1; i < MAX; i++ {
		fact[i] = fact[i-1] * i % MOD
		factInv[i] = factInv[i-1] * inv[i] % MOD
	}
}

// 1 以上 N 以下の N 個の整数の中から，相異なる K 個の整数を選ぶパターンの数を C(N,K) と書きます．
func c(n, k int) int {
	if k < 0 || k > n {
		return 0
	}
	return fact[n] * factInv[k] % MOD * factInv[n-k] % MOD
}

// 1 以上 N 以下の N 個の整数の中から，相異なる K 個の整数を選び，順番に並べるパターンの数を P(N,K) と書きます．
// p(N, N)のときN!
func p(n, k int) int {
	if k < 0 || k > n {
		return 0
	}
	return fact[n] * factInv[n-k] % MOD
}

// 1 以上 N 以下の N 個の整数の中から，重複を許して K 個の整数を選ぶパターンの数を H(N,K) と書きます．
func h(n, k int) int {
	if n == 0 && k == 0 {
		return 1
	}
	if n == 0 {
		return 0
	}
	return c(n+k-1, k)
}


Measured memory_bytes: 47360
using System;
using System.Collections.Generic;
using System.Text;

namespace ITP1_11_D
{
	class Program
	{
		// faces[] = { 0, 1, 2, 3, 4, 5, 6 };
		//   0
		// 3 1 2 4
		//   5
		static void Main(string[] args)
		{
			string s1 = Console.ReadLine();
			int count = int.Parse(s1);

			List<Dice> diceList = new List<Dice>();
			bool result = false;
			for (int k = 0; k < count; k++) {
				string s2 = Console.ReadLine();
				string[] faces = s2.Split();
				Dice dice = new Dice(faces);
				if (diceList.Contains(dice)) {
					result = true;
				}
				diceList.Add(dice);
			}

			if (result) {
				Console.WriteLine("No");
			} else {
				Console.WriteLine("Yes");
			}

			//Console.WriteLine("Hit Any Key");
			//Console.ReadLine();
		}
	}

	class Dice : IEquatable<Dice>
	{
		//   1
		// 4 2 3 5
		//   6
		public string Top { get; private set; }
		public string North { get; private set; }
		public string South { get; private set; }
		public string East { get; private set; }
		public string West { get; private set; }
		public string Bottom { get; private set; }
		public Dice(string[] faces)
		{
			Top = faces[0];
			North = faces[4];
			South = faces[1];
			East = faces[2];
			West = faces[3];
			Bottom = faces[5];
		}
		public Dice(Dice dice)
		{
			Top = dice.Top;
			North = dice.North;
			South = dice.South;
			East = dice.East;
			West = dice.West;
			Bottom = dice.Bottom;
		}
		public void MoveN()
		{
			// T<-S<-B<-N<-T
			string tmp = Top;
			Top = South;
			South = Bottom;
			Bottom = North;
			North = tmp;
		}
		public void MoveS()
		{
			// T<-N<-B<-S<-T
			string tmp = Top;
			Top = North;
			North = Bottom;
			Bottom = South;
			South = tmp;
		}
		public void MoveE()
		{
			// T<-W<-B<-E<-T
			string tmp = Top;
			Top = West;
			West = Bottom;
			Bottom = East;
			East = tmp;
		}
		public void MoveW()
		{
			// T<-E<-B<-W<-T
			string tmp = Top;
			Top = East;
			East = Bottom;
			Bottom = West;
			West = tmp;
		}
		public void MoveCW()
		{
			// N<-W<-S<-E<-N
			string tmp = North;
			North = West;
			West = South;
			South = East;
			East = tmp;
		}
		public void MoveCCW()
		{
			// N<-E<-S<-W<-N
			string tmp = North;
			North = East;
			East = South;
			South = West;
			West = tmp;
		}

		public bool Equals(Dice other)
		{
			for (int i = 0; i < 6; i++) {
				Dice dice2 = new Dice(other);
				switch (i) {
				case 0:
					break;
				case 1:
					dice2.MoveS();
					break;
				case 2:
					dice2.MoveN();
					break;
				case 3:
					dice2.MoveW();
					break;
				case 4:
					dice2.MoveE();
					break;
				case 5:
					dice2.MoveN();
					dice2.MoveN();
					break;
				}
				for (int j = 0; j < 4; j++) {
					if (Top == dice2.Top && Bottom == dice2.Bottom &&
						North == dice2.North && South == dice2.South &&
						East == dice2.East && West == dice2.West) {
						return true;
					}
					dice2.MoveCW();
				}
			}
			return false;
		}
	}
}

Measured memory_bytes: 9628
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip> // setprecisionに必要
using namespace std;
#define PI 3.14159265358979323

double A_angle(int min){
    return 360*min/720.0;
}

double B_angle(int min){
    return 360*min/60.0;
}

int main(){
    int A,B,H,M;
    cin >> A >> B >> H >> M;

    double angle;
    angle = abs(A_angle(60*H+M) - B_angle(M));

    cout << fixed << setprecision(15) << sqrt(A*A+B*B-2*A*B*cos(angle*PI /180.0)) << endl;

    return 0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

template<uint_fast64_t modulus>
class modInt{
    using u64 = uint_fast64_t;

private:
    u64 num;

    u64 _power(u64 _x, u64 _n){
        u64 res = 1;
        while(_n > 0){
            if(_n & 1){
                res = res * _x % modulus;
            }
            _x = _x * _x % modulus;
            _n >>= 1;
        }
        return res;
    }

public:
    modInt(){
        num = 0;
    }

    modInt(u64 x){
        num = x % modulus;
    }

    u64 get(void){
        return num;
    }

    void print(void){
        cout << num << endl;
        return;
    }

    void print(char c){
        cout << num << c;
    }

    modInt &operator+=(const modInt &rhs){
        num += rhs.num;
        if(num >= modulus){
            num -= modulus;
        }
        return *this;
    }

    modInt &operator-=(const modInt &rhs){
        if(num < rhs.num){
            num += modulus;
        }
        num -= rhs.num;
        return *this;
    }

    modInt &operator*=(const modInt &rhs){
        num = num * rhs.num % modulus;
        return *this;
    }

    modInt &operator/=(const modInt &rhs){
        num = num * _power(rhs.num, modulus - 2) % modulus;
        return *this;
    }

    modInt operator+(const modInt &rhs){
        return modInt(*this) += rhs;
    }

    modInt operator-(const modInt &rhs){
        return modInt(*this) -= rhs;
    }

    modInt operator*(const modInt &rhs){
        return modInt(*this) *= rhs;
    }

    modInt operator/(const modInt &rhs){
        return modInt(*this) /= rhs;
    }
};

using mint = modInt<MOD>;

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

    lint n, m, k;
    cin >> n >> m >> k;

    vector<mint> fact(n * m + 1), inv_fact(n * m + 1);
    fact[0] = 1;
    inv_fact[0] = 1;
    reps(i, n * m){
        fact[i] = fact[i - 1] * mint(i);
        inv_fact[i] = inv_fact[i - 1] / mint(i);
    }

    mint ans = 0;
    rep(i, n + 1){
        ans += fact[n * m - 2] * inv_fact[k - 2] * inv_fact[n * m - 2 - k + 2] * mint(i) * mint(n - i) * mint(m) * mint(m);
    }

    rep(i, m + 1){
        ans += fact[n * m - 2] * inv_fact[k - 2] * inv_fact[n * m - 2 - k + 2] * mint(i) * mint(m - i) * mint(n) * mint(n);
    }

    ans.print();

    return 0;
}

Measured memory_bytes: 3328
from collections import deque
dq = deque()
for _ in range(int(input())):
    ss = input()
    if ss == "deleteFirst":
        del dq[0]
    elif ss == "deleteLast":
        del dq[-1]
    else:
        c, s = ss.split()
        s = int(s)
        if c == "insert":
            dq.appendleft(s)
        elif c == "delete":
            if s in dq:
                dq.remove(s)
print(*dq)



Measured memory_bytes: 45944
import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline
    n=int(readline())
    d={}
    for _ in range(n):
        a = readline().strip()
        if a in d:
            d[a]+=1
        else:
            d[a]=1
    cnt=0
    for key in d:
        if d[key]%2==1:
            cnt+=1
    print(cnt)
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

Measured memory_bytes: 20456
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
 
long long int INF = 2e18;
const ll fact_table = 3200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define endl "\n"
#ifdef ENJAPMA
    #undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

const ll mod = 998244353ll;
// const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll mod){ll x=1;while(b){while(!(b&1)){(a*=a)%=mod;b>>=1;}(x*=a)%=mod;b--;}return x;}
void YES(bool cond){ if(cond){ p("YES");}else{ p("NO");} return;}
void Yes(bool cond){ if(cond){ p("Yes");}else{ p("No");} return;}

/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/

bool multicase = false;

ll n,m,num,a,b,c,d,e,h,q;
ll w, k, ans;

ll x[500005];
ll dp[500005];
string s;

void solve(){
    cin >> s;
    n = s.size();
    for(ll i=0;i<n;i++){
        if(s[i] == '?'){
            pu("D");
        }else{
            pu(s[i]);
        }
    }
    el;
    return;
}


int main(){
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if(multicase){
        cin >> q;
    }else{
        q = 1; 
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}
















Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long

int main() {
	int n;
	scanf("%d" , &n);
	string s, t;
	cin >> s >> t;
	int sub = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == t[0]) {
			int j = 0;
			while (j < n && i < n && s[i] == t[j]) {
				i++;
				j++;
				sub++;
			}
			if (j < n && i < n){
				sub = 0;
			}
			i--;
		}
	}
	cout << 2 * n - sub << endl;
}


Measured memory_bytes: 3672
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass

MOD = 1000000007  # type: int


def solve(L: str):
    a = 1
    b = 1
    for Li in L:
        if Li == "1":
            a *= 3
            a %= MOD
            b *= 2
            b %= MOD
        else:
            a += (a - b) * 2
            a %= MOD
    print(a)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = next(tokens)  # type: str
    solve(L)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
N = int(input())
A = [int(i) for i in input().split()]


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


ans = []
c = 0
for i in range(N, 0, -1):
    if A[i-1] % 2 == 1:
        c += 1
        ans.append(i)
        for j in make_divisors(i):
            A[j-1] += 1
print(c)
if c != 0:
    print(*ans[::-1])


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

int main(){
    string s;
    int cmax = 0,count = 0;
    cin >> s;
    for(int i=0; i<int(s.size());i++){
        if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
            count++;
        }else{
            cmax = max(cmax,count);
            count=0;
        }
    }
    cmax = max(cmax,count);
    cout << cmax << '\n';
}


Measured memory_bytes: 3640
N, M = list(map(int, input().split()))
AB = []
for i in range(M):
    a, b = list(map(int, input().split()))
    AB.append([a, b])

graph = []
for i in range(N):
    graph.append([False]*N)

for a, b in AB:
    a -= 1
    b -= 1
    graph[a][b] = True
    graph[b][a] = True

# for gi in graph:
#     print(gi)

from itertools import permutations
l = [i for i in range(1, N)]
patterns = list(permutations(l))

# print(patterns)

cnt = 0
for pi in patterns:
    cur = 0
    ok = True
    # t: 次の目的地
    for t in pi:
        if not graph[cur][t]:
            ok = False
        cur = t
    if ok:
        cnt += 1


print(cnt)


Measured memory_bytes: 39920
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		sc.close();

		int mod = 1000000007;
		int rn = (int) Math.sqrt(n);
		int[] cnt = new int[rn + 1];
		cnt[1] = n;
		for (int i = 2; i <= rn; i++) {
			cnt[i] = n / i;
			cnt[i - 1] -= cnt[i];
		}
		cnt[rn] -= rn;

		long[][] dp = new long[k + 1][rn + 1];
		for (int j = 1; j <= rn; j++) {
			dp[0][j] = 1;
			dp[1][j] = dp[1][j - 1] + 1;
		}
		for (int i = 2; i <= k; i++) {
			long sum = 0;
			for (int j = rn; j > 0; j--) {
				sum += dp[i - 2][j] * cnt[j];
				sum %= mod;
				dp[i][j] = dp[i - 1][rn] + sum;
				dp[i][j] %= mod;
			}
			for (int j = 1; j <= rn; j++) {
				dp[i][j] += dp[i][j - 1];
				dp[i][j] %= mod;
			}
		}

		long ans = dp[k][rn];
		for (int j = 1; j <= rn; j++) {
			ans += dp[k - 1][j] * cnt[j];
			ans %= mod;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 52564
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define int ll

int n,p;


int pow(int n,int k){
  if(k==0) 
    return 1;

  if(k%2)
    return (n*pow(n,k/2)*pow(n,k/2));

  return (pow(n,k/2)*pow(n,k/2));
}

signed main(){
  cin>>n>>p;

  map<int,int> mp;
  
  for(int i=2;i*i<=p;i++){
    while(p%i==0){
      p/=i;
      mp[i]++;
    }
  }
  if(p>1)
    mp[p]++;

  int ans=1;
  for(auto i:mp){
    if(i.S>=n)
      ans *= pow(i.F,i.S/n);
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}



use std::cmp;
use std::iter::Iterator;

fn main() {
    input! {
      a:i32,
      p:i32,
    }

    println!("{}", (a* 3 + p)/2);

    

}



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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		String[] buff=new String[n];
		long count=0,sum=0;

		for(int i=0;i<n;i++) {
			buff[i]=sc.next();
			buff[i]=sortS(buff[i]);
		}
		Arrays.sort(buff);
		for(int i=0;i<n-1;i++) {
			if(buff[i].equals(buff[i+1]))count++;
			else {
				if(count>=1) {
					sum+=(long)(0.5*count*(count+1));
				}
				count=0;
			}
			//System.out.println("count:"+count+" sum:"+sum);
		}
		if(count!=0)sum+=(long)(0.5*count*(count+1));
		System.out.println(sum);
	}
	public static String sortS(String s) {
		char[] sort = new char[s.length()];
		String res="";
		for(int i=0;i<sort.length;i++) {
			sort[i]=s.charAt(i);
		}
		Arrays.sort(sort);
		for(int i=0;i<sort.length;i++) {
			res+=String.valueOf(sort[i]);
		}
		return res;
	}
}



Measured memory_bytes: 96876
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <queue>
#define _PI (3.141592653589793)
int main()
{
	int N, M;
	std::cin >> N >> M;
	std::multimap<int, int> toMap;
	for (int i = 0; i < M; ++i) {
		int A, B;
		std::cin >> A >> B;
		toMap.insert(std::multimap<int, int>::value_type(A, B));
		toMap.insert(std::multimap<int, int>::value_type(B, A));
	}
	std::map<int, int> answer;
	std::queue<int> queue;
	queue.push(1);
	while (!queue.empty()) {
		const int room_index = queue.front();
		queue.pop();
		auto range = toMap.equal_range(room_index);
		for (auto itr = range.first; itr != range.second; ++itr) {
			const int from = itr->second;
			if (from == 1) {
				continue;
			}
			auto itr2 = answer.find(from);
			if (itr2 == answer.end()) {
				answer.insert(std::map<int, int>::value_type(from,room_index));
				queue.push(from);
			}

		}
	}
	if (answer.size() == N - 1) {
		std::cout << "Yes" << std::endl;
		for (auto itr = answer.begin(); itr != answer.end(); ++itr) {
			std::cout << itr->second << std::endl;
		}
	}
	else {
		std::cout << "No" << std::endl;
	}
	return 0;
}

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

//variable
int n = 0 ;
char store_name[101] = {0} ;
char board[101] = {0} ;
int interval = 0 ;
int string_count = 0 ;
int cmp = 0 ;
int answer_flg = 0 ;
int answer = 0 ;

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

    for (int i = 0 ;i < n ;i++ )
    {
        cin >> board ;

        cmp = 0 ;
        answer_flg = 0 ;

        for (int first = 0 ;first < strlen( board ) ;first++ )
        {
            //cout << "[first ]" << first << " " << board[first] << " " << store_name[0] << endl ;
            if ( board[first] == store_name[0] )
            {
                interval = 0 ;
                for (int second = first + 1 ;second < strlen( board ) ;second++ )
                {
                    //cout << "[second]" << second << " " << board[second] << " " << store_name[1] << endl ;
                    interval++ ;
                    if ( (interval + second) > strlen( board ) ) break ;

                    if ( board[second] == store_name[1] && interval <= 49 )
                    {
                        string_count = 2 ;
                        for (int j = 1 ;j <= strlen( store_name ) - 2 ;j++ )
                        {
                            int k = second + (interval * j) ;

                            if ( k > strlen( board ) ) break ;

                            //cout << "[k     ]" << k << " " << board[k] << " " << store_name[string_count] << endl ;
                            //cout << "[string_count]" << string_count << " " << store_name[string_count] << endl ;

                            if ( store_name[string_count] == board[k] )
                            {
                                cmp++ ;
                                string_count++ ;
                            }
                            else break ;

                            if ( cmp == strlen( store_name ) - 2 )
                            {
                                answer_flg++ ;
                            }
                            //cout << first << " , " << second << " , " << k << " , " << interval << " , " << cmp << " , " << answer_flg << endl ;
                        }
                    }
                }
            }
        }
        if ( answer_flg ) answer++ ;
    }

    cout << answer << endl ;
    return 0 ;
}

Measured memory_bytes: 3100
#include <cstdio>
#include <cstdlib>
#define REP(i,n) for (int i=0;i<(n);i++)
int main(){
	int N;
	char S[52][52]={};
	int k[52][26]={};
	int sum[26];REP(i,26){sum[i]=114514;}
	scanf("%d",&N);
	REP(i,N){scanf("%s",S[i]);}
	REP(i,N){for(int j=0;26&&S[i][j]!=0;j++){k[i][S[i][j]-'a']++;}REP(j,26){if(sum[j]>k[i][j]){sum[j]=k[i][j];}}}
	

	REP(i,26){REP(j,sum[i]){printf("%c",'a'+i);}}printf("\n");
	system("pause");
	return 0;
}


Measured memory_bytes: 376
n, m = map(int, input().split())
a = [list(map(int, input().split()))[1:] for i in range(n)]

ans = 0
for x in range(m):
    count = 0
    for i in range(n):
        if x + 1 in a[i]:
            count += 1
    if count == n:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
	int a, b;

	scanf("%d", &a);
	scanf("%d", &b);

	if (a < b) {
		printf("a < b\n");
	} else if (a > b) {
		printf("a > b\n");
	}
	else {
		printf("a == b\n");
	}

	return 0;
}

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

	int main(){
	 string S,T;
      int counter =0;
	 cin>>S>>T;
      for(int i=0; i < S.size() ; i++){
        if (S.at(i)!=T.at(i)) counter++;
      }
        cout << counter << endl;
    }

Measured memory_bytes: 3840
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

map<ll,ll> M;

ll dfs(ll V){
	if(V==1LL){
		M[1]=1;
		return 1;
	}
	ll H = V/2LL;
	if(M.find(H)!=M.end()){
		return M[H];
	}

	ll S=0,R;
	R = dfs(H);
	M[H]=R;
	S+=2*R+1;
	return S;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	ll H=in<ll>();
	
	out(dfs(H));

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c,k,i,sum;
	scanf("%d %d %d %d",&a,&b,&c,&k);
	if(b>=a&&b>=c)
	for(i=1;i<=k;i++)
	{
		b=b+b; 
	}
	else if(a>=b&&a>=c)
    for(i=1;i<=k;i++)
	{
		a=a+a; 
	}
	else if(c>=b&&c>=a)
	for(i=1;i<=k;i++)
	{
		c=c+c; 
	}
	sum=a+b+c;
	printf("%d",sum); 
	return 0;
 } 

Measured memory_bytes: 128
from math import sqrt

x = int(input())
sqrt_x = int(sqrt(x))

ans = 1

for b in range(1, sqrt_x+1):
    for p in range(2, sqrt_x+1):
        
        exp = (b)**(p)
        
        if exp<=x and ans<=exp:
            ans = exp
        
print(ans)

Measured memory_bytes: 3060
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  ll a, b, c;
  scanf("%lld%lld%lld", &a, &b, &c);
  printf("%lld\n", MIN(b / a, c));
  return 0;
}


Measured memory_bytes: 128