akhauriyash/Code-Regression huggingface dataset:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    x,y=map(int,input().split())
    if x>3:x=0
    if y>3:y=0
    prize=[0,300000,200000,100000]
    ans=prize[x]+prize[y]
    if (x,y)==(1,1):
        ans+=400000
    print(ans)

main()

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

const int MAX_N = 8000;

bool dp[MAX_N + 3][MAX_N + 3][2];
int x[MAX_N + 3];
int y[MAX_N + 3];

int main() {
	string s;
	int dx, dy, dir = 1, sx;
	cin >> s >> dx >> dy;

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'F')  dx--;
		else {
			sx = i;
			break;
		}
	}

	int ix = 0, iy = 0;
	for (int i = sx; i < s.size(); i++) {
		if (s[i] == 'T' && dir == 1) {
			dir *= -1;
			iy++;
		}
		else if (s[i] == 'T' && dir == -1) {
			dir *= -1;
			ix++;
		}
		else if (s[i] == 'F' && dir == -1) {
			y[iy]++;
		}
		else if (s[i] == 'F' && dir == 1) {
			x[ix]++;
		}
		//else cout << << " " << endl;

	}
	dp[0][0][0] = 1;
	dp[0][0][1] = 1;

	for (int i = 1; i <= ix; i++) {
		for (int j = 0; j <= MAX_N; j++) {
			if (j + x[i] <= MAX_N) dp[i][j][0] = dp[i - 1][abs(j - x[i])][0] || dp[i - 1][abs(j + x[i])][0];
			else dp[i][j][0] |= dp[i - 1][abs(j - x[i])][0];
		}
	}
	for (int i = 1; i <= iy; i++) {
		for (int j = 0; j <= MAX_N; j++) {
			if (j + y[i] <= MAX_N) dp[i][j][1] = dp[i - 1][abs(j - y[i])][1] || dp[i - 1][abs(j + y[i])][1];
			else dp[i][j][1] |= dp[i - 1][abs(j - y[i])][1];
		}
	}

	if (dp[ix][abs(dx)][0] && dp[iy][abs(dy)][1]) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 63616
n,k=map(int,input().split())
l=[True]*n
h=list(map(int,input().split()))
for i in range(k):
    a,b=map(int,input().split())
    a-=1
    b-=1
    if l[a] and h[a]<=h[b]:
        l[a]=False
    if l[b] and h[a]>=h[b]:
        l[b]=False
count=0
for i in range(n):
    if l[i]:
        count+=1
print(count)

Measured memory_bytes: 85836
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define gcd __gcd
#define lcm(n, m) n * m / gcd(n, m)
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define so(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数

int main() {
  ll N, M, a = 0, b = 0, c = 0, d = 0;
  ci(N, M);
  ve<pair<ll, ll>> A(N);
  rep(i, N){
    ci(a, b);
    A.at(i) = mp(a, b);
  }
  so(A);
  repll(i, N){
    if(d + A.at(i).sc < M){
      c += A.at(i).ft * A.at(i).sc;
      d += A.at(i).sc;
    }
    else{
      c += A.at(i).ft * (M - d);
      co(c);
      rt;
    }
  }
}

Measured memory_bytes: 1792
import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static ArrayList<Integer>[] al;
	static int[] size,level,parent;
	
	static void dfs(int u,int p,int curr)
	{
		size[u]=1;level[u]=curr;
		
		parent[u]=p;
		
		for(int x:al[u])
		{
			if(x!=p)
			{
				dfs(x,u,curr+1);size[u]+=size[x];
			}
		}
	}
	
	@SuppressWarnings("unchecked")
    public static void main(String args[]) throws Exception
    {
		int n=sc.nextInt();al=new ArrayList[n];
		
		for(int i=0;i<n;i++)
		{
			al[i]=new ArrayList<Integer>();
		}
		
		for(int i=1;i<n;i++)
		{
			int u=sc.nextInt()-1,v=sc.nextInt()-1;
			
			al[u].add(v);al[v].add(u);
		}
	
		level=new int[n];size=new int[n];parent=new int[n];dfs(0,-1,1);
		
		int dis=level[n-1]-level[0]-1,now=dis/2,curr=n-1;
		
		while(now>0)
		{
			curr=parent[curr];now--;
		}
		
		int val2=size[curr],val1=n-val2;
		
		out.println(val1>val2?"Fennec":"Snuke");out.close();
	}
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

Measured memory_bytes: 73880
s = int(input())

f = [s]

for i in range(1,1000000):
    if f[i-1] % 2 == 0:
        f.append(f[i-1]//2)
    else:
        f.append(3*f[i-1] + 1)
        
    for j in range(len(f)-1):
        if f[i] == f[j]:
            print(i + 1)
            exit()

Measured memory_bytes: 9164
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
template<typename A, size_t NNN, typename T>
void Fill(A (&array)[NNN], const T &val){
    fill( (T*)array, (T*)(array+NNN), val );
}
#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=1e9+7;
#define N 610000
ll n,m,k;
ll mem[N];
int a[N];
int main(){
    n=in();
    rep(i,n){
        a[i]=in();
    }
    mem[0]=0;
    mem[1]=abs(a[1]-a[0]);
    rep2(i,2,n-1){
        mem[i]=min(mem[i-1]+abs(a[i]-a[i-1]),mem[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<mem[n-1];
    return 0;
}

Measured memory_bytes: 2812
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <time.h>
using namespace std;
typedef long long ll;
int main() {
	int n, k, x[100],cnt=0;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> x[i];
		cnt += min(x[i] * 2, abs(x[i] - k) * 2);
	}
	cout << cnt << endl;
	system("PAUSE");
	return 0;
}


Measured memory_bytes: 504
N, D = map(int, input().split())
E = [[int(i) for i in input().split()] for i in range(N)]

a = 0

for j in (range(N)):
    for k in (range(N)):
        if j > k:
            dif = 0
            dis = 0
            for n in range(D):
                dif += (E[j][n]-E[k][n])**2
                dis = pow(dif, 0.5)
            if dis.is_integer():
                a += 1

print(a)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ
int main()
{
    int A, B;
    cin >> A >> B;
    cout << max(2 * A - 1, max(A + B, 2 * B - 1));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	string S;
	cin >> S;

	S.pop_back();
	//cout << S << endl;

	while (S.size()) {
		if (S.size() % 2) {
			S.pop_back();
		}
		else {
			string a, b;
			a = S.substr(0, S.size() / 2);
			b = S.substr(S.size() / 2);

			if (a == b) break;
			else S.pop_back();
		}
	}

	cout << S.size() << endl;
}

Measured memory_bytes: 3616
import java.math.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.io.*;

public class Main {


    public static long f(long n){
        if(n==1) return 1;
        return n*f(n-1);
    }

    public static void main(String[] args) throws Exception {

        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int res = 0;
        int p = 0;
        for(int i=0;i<n;i++) {
            int b = scan.nextInt();
            res -= b*b;
            p += b;

        }

        res += p*p;

        System.out.print(res/2);




    }

    
}


Measured memory_bytes: 23764
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  ll a,b,c;
  cin>>a>>b>>c;
  cout << max(0LL,c-(a-b)) << endl;
  return 0;
}

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

void solve(int TestCase) {
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << " " << b << " " << c << " " << endl;
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    int t = 1;
    //cin >> t;
    for(auto i = 1; i <= t; ++i) {
    //    cout << "Case #"<< i << ": ";
        solve(i);
    }
}

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

namespace ConsoleApplication7
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] ab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int a = ab[0] - 1;
            int b = ab[1] - 1;
            bool skip = true;
            Console.WriteLine("40 100");

            for (int i = 0; i < 20; i++)
            {
                if (i % 2 == 0)
                {
                    for (int j = 0; j < 100; j++)
                    {
                        if (b > 0 && skip)
                        {
                            Console.Write("#");
                            skip = !skip;
                            b--;
                        }
                        else if (b > 0 && !skip)
                        {
                            Console.Write(".");
                            skip = !skip;
                        }
                        else
                        {
                            Console.Write(".");
                        }
                    }
                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine("....................................................................................................");
                }
            }
            skip = true;
            for (int i = 0; i < 20; i++)
            {
                if (i % 2 == 0)
                {
                    Console.WriteLine("####################################################################################################");
                }
                else
                {
                    for (int j = 0; j < 100; j++)
                    {
                        if (a > 0 && skip)
                        {
                            Console.Write(".");
                            skip = !skip;
                            a--;
                        }
                        else if (a > 0 && !skip)
                        {
                            Console.Write("#");
                            skip = !skip;
                        }
                        else
                        {
                            Console.Write("#");
                        }
                    }
                    Console.WriteLine();
                }
            }
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 13140
package main

import (
	"fmt"
)

func main() {

	var N,K int
	fmt.Scan(&N,&K)


	d := SliceInt(K)

	res := make(map[int]int)

	for i:=0;i<K;i++{

		fmt.Scan(&d[i])

		A:=SliceInt(d[i])
	
		for j:=0;j<d[i];j++{

			fmt.Scan(&A[j])
		}

		for i:=0;i<len(A);i++{

			val,ok := res[A[i]]

			if ok==true{

				res[A[i]] = val+1

			}else{

				res[A[i]] = 1
			}

		}
	}


	fmt.Println(N-len(res))

}

//SliceInt 引数サイズのSliceを返す
func SliceInt(a int) []int {

	IntSample := make([]int, a)

	return IntSample

}


Measured memory_bytes: 2444
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let k: usize = iterator.next().unwrap().parse().unwrap();
    let mut s: Vec<char> = iterator.next().unwrap().chars().collect();

    let mut prev_end = 0;
    for _ in 0..k {
        let mut begin = 0;
        for i in (prev_end + 1)..n {
            if s[i - 1] != s[i] {
                begin = i;
                break;
            }
        }
        if begin == 0 {
            return (n - 1).to_string();
        }
        let mut end = begin;
        for i in (begin + 1)..n {
            if s[i - 1] == s[i] {
                end = i;
            } else {
                break;
            }
        }
        for i in begin..=end {
            if s[i] == 'L' {
                s[i] = 'R';
            } else {
                s[i] = 'L';
            }
        }
        prev_end = end;
    }

    let mut h: usize = 0;
    for i in 1..n {
        if s[i - 1] == s[i] {
            h += 1;
        }
    }
    h.to_string()
}


Measured memory_bytes: 2444
#include <iostream>

using namespace std;

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    int ctltx = 0;
    for(int i=0; i<m; i++) {
        int a;
        cin >> a;
        if(a<x) ctltx++;
    }
    cout << min(ctltx, m-ctltx) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
string s1,s2,s3;
cin>>s1>>s2>>s3;
if(s1[0]>=97&&s1[0]<=122){
    s1[0]=s1[0]-32;
    cout<<s1[0];
}
 if(s2[0]>=97&&s2[0]<=122){
    s2[0]=s2[0]-32;
    cout<<s2[0];
}
 if(s3[0]>=97&&s3[0]<=122){
    s3[0]=s3[0]-32;
    cout<<s3[0];
}
return 0 ;
}


Measured memory_bytes: 256
/**
 * File    : B.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-11-15 21:20:17
 * 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 <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#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;

int cnt(int X)
{
  int ans = 0;
  while (X % 2 == 0)
  {
    X /= 2;
    ++ans;
  }
  return ans;
}

int main()
{
  int N;
  int A[210];
  cin >> N;
  for (auto i = 0; i < N; i++)
  {
    cin >> A[i];
  }
  int ans = cnt(A[0]);
  for (auto i = 1; i < N; i++)
  {
    ans = min(ans, cnt(A[i]));
  }
  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

int main(){
  ll A,B,C,K;
  cin >> A >> B >> C >> K;
  if(K <= A) cout << K << endl;
  else if(K <= A + B) cout << A << endl;
  else cout << 2 * A - K + B << endl;
}

Measured memory_bytes: 3640
using System;

namespace ConsoleApp2
{
    public class Program
    {
        public static void Main(string[] args)
        {
            long x = 0;

            x = long.Parse(Console.ReadLine());

            int year = 0;
            long c = 100;
            while (true)
            {
                if (c >= x)
                    break;

                c = (long)(c * 1.01);
                year++;
            }

            Console.WriteLine(year);
        }
    }
}


Measured memory_bytes: 17636
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
int main(){
 string s;
 cin>>s;
 bool f = true;
 if(s[2]!=s[3])f=false;
 if(s[4]!=s[5])f=false; 
 int ans =0;
 if(f)cout<<"Yes"<<endl;
 else cout<<"No"<<endl;

}

Measured memory_bytes: 256
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A += [a]
    B += [b]
s1 = sum(A)
s2 = sum(B)
C = A + B
C.sort()
s3 = sum(C[:N])
s4 = sum(C[N:])
check = 1
m1 = C[N-1]
m2 = C[N-2]
for i in range(N):
    a = min(A[i], B[i])
    b = max(A[i], B[i])
    if b < m1:
        check = 0
        break
    elif b == m1 and a != b:
        check = 0
        break
    elif a < m1:
        s4 = min(s4, s3 - m1 + b)
    elif a == m1:
        s4 = min(s4, s3 - m2 + b)
if check == 0:
    print(min(s1, s2, s3))
else:
    print(min(s1, s2, s4))

Measured memory_bytes: 13396
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

vector<int> pp;
void preparePrime( int maxp )
{
    int i;
    vector<int> a(maxp+1);
    for(i=2; i<=maxp; i++) {
        int k=i+i;
        while(k<=maxp) {
            a[k]=1;
            k+=i;
        }
    }
    for(i=2; i<=maxp; i++) {
        if(a[i]==0) pp.push_back( i );
    }
    return;
}

int main(int argc, char* argv[])
{
    int Q;
    scanf("%d", &Q);
    vector<int> a(Q);
    int i,j;
    int N=0;
    for(i=0; i<Q; i++) {
        scanf("%d", &a[i]);
        N=max(N,a[i]);
    }

    preparePrime( N );

    vector<int> z;
    int siz=(int)pp.size();
    for(i=0; i<siz; i++) {
        z.push_back(pp[i]);
        ll tmp=(ll)pp[i]*pp[i];
        if(tmp<=N) {
            z.push_back(tmp);
            tmp*=pp[i];
            if(tmp<=N) {
                z.push_back(tmp);
            }
        }
    }
    for(i=0; i<siz; i++) {
        for(j=i+1; j<siz; j++) {
            ll tmp = (ll)pp[i]*pp[j];
            if(tmp<=N) {
                z.push_back(tmp);
            }
        }
    }
    sort(z.begin(), z.end());

    int t;
    for(t=0; t<Q; t++) {    
        int M=a[t];
        int cnt=lower_bound(z.begin(), z.end(), M+1)-z.begin();
        printf("%d\n", M-1-cnt);
    }

    return 0;
}




Measured memory_bytes: 3256
using System;

namespace ALDS1_1_D
{
    class Program
    {
        static void Main(string[] args)
        {
            int element = int.Parse(Console.ReadLine());
            long[] input = new long[element];

            for (int i=0; i<element; i++)
            {
                input[i] = long.Parse(Console.ReadLine());
            }
            long max = input[1] - input[0];
            long min = input[0];


            for (int i=1; i<element; i++)
            {

                if (min > input[i-1]) min = input[i-1];

                if ((input[i] - min) > max) max = input[i] - min;
            }

            Console.WriteLine(max);
        }
    }
}

Measured memory_bytes: 12316
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

namespace {
	#define trace(...) cerr << ">> ", __f(#__VA_ARGS__, __VA_ARGS__);
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1) {
	  cerr << name << " = " << arg1 << std::endl; }
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args) {
	  const char* comma = strchr(names + 1, ',');
	  cerr.write(names, comma - names) << " = " << arg1<<" | ";__f(comma+1, args...); }
}

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds; // OST: find_by_order, order_of_key
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// #pragma GCC optimize("Ofast")
// optimize("unroll-loops")
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

// https://c...content-available-to-author-only...s.com/blog/entry/60737
// gp_hash_table has far superior performance for insertions/deletions, while cc has marginally better performance for reads/writes
// gp_hash_table<int, int> table;
// const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
// struct chash {
//     int operator()(int x) const { return x ^ RANDOM; }
// };
// gp_hash_table<key, int, chash> table;

int main() {
#ifdef LOCAL_EXEC
//    freopen("sample.in", "r", stdin);
#else
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#endif

    int k, x;
    cin >> k >> x;
    if (k*500 >= x) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
using namespace std;

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

const int INFTY=1e9;

int Y() {
    char buf[10];
    scanf("%s", buf);
    return buf[0]=='Y';
}

int main() {
    int i, n, a, b, sp=0;
    scanf("%d%d", &a, &b);
    n=a+b;
    if(a<=b) {
        printf("Impossible\n");
        return 0;
    }
    vi s(n);
    for(i=0; i<n; i++) {
        if(sp==0) s[sp++]=i;
        else {
            printf("? %d %d\n", i, s[sp-1]);
            fflush(stdout);
            if(Y()) s[sp++]=i;
            else sp--;
        }
    }
    vi w(n);
    w[s[0]]=1;
    for(i=0; i<n; i++) if(i!=s[0]) {
        printf("? %d %d\n", s[0], i);
        fflush(stdout);
        w[i]=Y();
    }
    printf("! ");
    for(i=0; i<n; i++) printf("%d", w[i]);
    printf("\n");
    fflush(stdout);
    return 0;
}

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

int main()
{
  int s_num=0;
  int t_count=0;
    string S;
  cin>>S;
  for(int i=0;i<4;i++){
    if(S.at(i)==S.at(0)){
      s_num++;
    }
    if(S.at(i)==S.at(1)){
      s_num++;
    }
    if(S.at(i)==S.at(2)){
      s_num++;    
    }
    if(S.at(i)==S.at(3)){
      s_num++;
    }
//    cout<<s_num<<endl;
    if(s_num==2){
      t_count++;
    }
    s_num=0;
  }
    if(t_count==4){
    cout<<"Yes"<<endl;      
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<climits>
#include<algorithm>
using namespace std;

typedef long long int ll;

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

    ll ans = 0;
    for (ll i = 1; i <= n - 1; i++) {
        ans += (n - 1) / i;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  int n; cin >> n;
  vector<int> x(n), y(n);
  rep(i, n) {
    int xi; cin >> xi;
    x[i] = xi;
    y[i] = xi;
  }
  sort(y);

  priority_queue<int, vector<int>, greater<int>> right;
  int midi = (n - 1) / 2;
  int mid = y[midi];
  for (int i = midi + 1; i < n; i++) right.push(y[i]);

  // debug3(midi, mid, right.top());

  for (int i = 0; i < n; i++) {
    int z = x[i];
    // debug(z);
    if (z < mid) outl(right.top());
    else if (z > mid) outl(mid);
    else if (right.top() == mid) outl(mid);
    else outl(right.top());
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;

int main() {
    string s;
    cin1(s);

    lli len = s.length();
    lli from = 0;
    lli to = 0;
    REP(i,0,len) {
        if (s[i] == 'A') {
            from = i;
            break;
        }
    }
    REPE_R(i,len-1,0) {
        if (s[i] == 'Z') {
            to = i;
            break;
        }
    }
    cout << to-from+1 << endl;
}


Measured memory_bytes: 640
#ABC129 B
N = int(input())
W =  list(map(int, input().split()))
S1 = 0
S2 = sum(W)
ans = S2
for i in range (N):
    S1 += W[i]
    S2 -= W[i]
    ans = min(ans, abs(S2 - S1))
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<cmath>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
const ll MOD = 1000000007;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
#define print(x) cout << (x) << endl;
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
 
template<typename T>
T gcd(T a,T b){return b?gcd(b,a%b):a;}

const int INF = 1e9;
const ll LLINF = 1e16;
 
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
 
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

// 割り算の切り上げ処理
template<typename T>
T round_up(T a, T b) {
  return (a + b - 1) / b;
}


using pint = pair<int, int>;
using pll = pair<ll, ll>;

ll dp[1010][3];
const int MAX_DIGIT = 100;
int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n){
      if(a[i] % 2 == 0){
        if(a[i] % 3 != 0 && a[i] % 5 != 0){
          print("DENIED");
          return 0;
        }
      }
    }
    print("APPROVED");

}


Measured memory_bytes: 256
S=input()
count=0
for i,s in enumerate(S):
    if i%2 == 0 and s in ["R","U","D"]:
        count+=1
    if i%2 == 1 and s in ["L","U","D"]:
        count+=1
if count == len(S):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String N = in.readLine();

		int x = Integer.parseInt(N);
		double sum = 0;
		N = in.readLine();
		String[] A = N.split(" ");
		for(int i=0;i<x;i++){
			sum += 1.0/Integer.parseInt(A[i]);
		}

		System.out.println(1/sum);

	}




}


Measured memory_bytes: 21076
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();
		long[] a = new long[n+1];
		for(int i=1;i<n+1;i++) {
			a[i] = a[i-1] + in.nextInt();
		}
		List<Long> list = new ArrayList<>();
		for(int l=0;l<n;l++) {
			for(int r=l+1;r<=n;r++) {
				list.add(a[r]-a[l]);
			}
		}
		List<Long> remain = new ArrayList<>();
		long ans = 0;
		int i = 0;
		for(i=40;i>=0;i--) {
			remain = new ArrayList<>();
			for(long beauty : list) {
				if(((beauty>>i)&1)==1) remain.add(beauty);
			}
			if(remain.size()>=k) {
				ans += 1L<<i;
				list = remain;
			}
		}
		System.out.println(ans);
		in.close();
		
		

	}

}


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

int main() {
	int n ;
	scanf("%d",&n);
	char s[n+5];
	string res;
	scanf("%s",s);
	char cur = s[0];
	res.push_back(cur);
	for(int i = 1 ; i < n ; ++i){
		if(cur != s[i]){
			res.push_back(s[i]);
			cur = s[i];
		}
	}
	printf("%d",res.length());
	return 0;
}

Measured memory_bytes: 512
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    N = II()
    A = LMIIS()
    for i in range(N):
        A[i] = [A[i],i]
    A.sort()


    for i in range(N):
        print(A[i][1]+1)

        

if __name__ == '__main__':
    main()

Measured memory_bytes: 65684
#include <iostream>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;

ll n, k, c, a[200010];

ll modpow(ll x, ll e) {
  ll res = 1;
  while (e > 0) {
    if (e & 1) res = res * x % MOD;
    x = x * x % MOD;
    e >>= 1;
  }
  return res;
}


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

  ll ans = k;
  a[k] = 1;
  for (ll i = k - 1; i > 0; --i) {
    a[i] = modpow(k / i, n);
    for (ll j = i * 2; j <= k; j += i) {
      a[i] = (a[i] - a[j] + MOD) % MOD;
    }
    ans = (ans + a[i] * i % MOD) % MOD;
  }
  cout << ans;
  return 0;
}



Measured memory_bytes: 4416
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	const int MAXN = 2e5;
	string s;
	int p[MAXN], n, pw = 1;
	cin >> s;
	n = s.size();
	p[n] = 0;
	for(int k = n - 1; k >= 0; --k) {
		p[k] = (pw * (s[k] - '0') + p[k + 1]) % 2019;
		pw = 10LL * pw % 2019;
	}
	long long cnt = 0;
	int S[2019] = {0};
	S[0] = 1;
	for(int k = n - 1; k >= 0; --k) {
		cnt += S[p[k]];
		++S[p[k]];
	}
	cout << cnt << '\n';
	return 0;
}

Measured memory_bytes: 4536
import java.util.*;

public class Main {

	static final int r = 1000000000 + 7;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		int n = s.length();
		long dp[][] = new long[n + 1][13];
		dp[0][0] = 1;
		for(int i = 0; i < n; ++i) {
			char t = s.charAt(i);
			int c = -1;
			if(t != '?')c = t - '0';
			for(int j = 0; j < 10; ++j) {
				if(c != -1 && c != j) continue;
				for(int k = 0; k < 13; ++k) {
					dp[i + 1][(k * 10 + j) % 13] += dp[i][k];
				}
			}
			for(int j = 0; j < 13; ++j)dp[i + 1][j] %= r;
		}
		long ans = dp[n][5];
		System.out.println(ans);
	}
}


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

class dice{
  int below,side[4];
public:
  int top;
  dice(){top=1; below=6; side[0]=2; side[1]=3; side[2]=5; side[3]=4;};
  void north(),east(),west(),south();
  void right(),left();
};
  
void dice::north()
{
  int x=top;
  top=side[0];
  side[0]=below;
  below=side[2];
  side[2]=x;
}
void dice::east()
{
  int x=top;
  top=side[3];
  side[3]=below;
  below=side[1];
  side[1]=x;
}
void dice::west()
{
  int x=top;
  top=side[1];
  side[1]=below;
  below=side[3];
  side[3]=x;
}
void dice::south()
{
  int x=top;
  top=side[2];
  side[2]=below;
  below=side[0];
  side[0]=x;
}
void dice::right()
{
  int x=side[0];
  side[0]=side[1];
  side[1]=side[2];
  side[2]=side[3];
  side[3]=x;
}
void dice::left()
{
  int x=side[0];
  side[0]=side[3];
  side[3]=side[2];
  side[2]=side[1];
  side[1]=x;
}

int main()
{
  while(true){
    dice sai;
    int n;
    cin >> n;
    if(n<1) break;
    int ans=1;
    for(int i=0;i<n;i++){
      string ward;
      cin >> ward;
      if(ward=="North")	sai.north();
      else if(ward=="East") sai.east();
      else if(ward=="West") sai.west();
      else if(ward=="South") sai.south();
      else if(ward=="Right") sai.right();
      else if(ward=="Left") sai.left();
      ans +=sai.top;  
    }
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3068
import java.io.BufferedReader;
import java.io.InputStreamReader;

//public class Problem0007_DebtHell {
public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String line;
			
			while((line = reader.readLine()) != null) {
				int month = Integer.parseInt(line);
				
				int debt = 100;
				for(int i = 0; i < month; i++) {
					debt = (int)Math.ceil(debt * 1.05);
				}
				System.out.println(debt * 1000);
			}
			
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
}

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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 100100;

int bor[N][2];
int sz;
int root = 0;

void add(string& s) {
	int tek = 0;
	forn(i, sz(s)) {
		if (bor[tek][s[i] - '0'] == -1) {
			bor[tek][s[i] - '0'] = sz++;
		}
		tek = bor[tek][s[i] - '0'];
	}
}

vi ord;

void dfs(int v, int h) {	
	int cnt = 0;
	forn(i, 2) {
    	if (bor[v][i] != -1) {
    		dfs(bor[v][i], h + 1);
    		cnt++;
    	}
	}
	debug(v);
	if (cnt == 1) {
	 	ord.pb(h);
	}
}

ll l;

ll f(ll a) {
	a = l - a;
	forn(i, 62) {
		if (a & (1ll << i)) {
			return (1ll << i);
		}
	}
	return 0;
}

int main () {
	//std::ios::sync_with_stdio(false);
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
	int n;
	cin >> n >> l;
	memset(bor, -1, sizeof(bor));
	root = 0;
	sz = 1;
	string qwe;
	getline(cin, qwe);
	forn(i, n) {
		string s;
		getline(cin, s);
		add(s);			
	}
	dfs(0, 0);
	ll ans = 0;
	debug(all(ord));
	forn(i, sz(ord)) {
		ans ^= f(ord[i]);
	}
	if (ans) {
		puts("Alice");
	} else {
		puts("Bob");
	}


	return 0;
}

Measured memory_bytes: 4760
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def solve():
    H, W = map(int, input().split())

    num_white = 0
    field = []
    for _ in range(H):
        field.append(list(input()))
        num_white += field[-1].count(".")

    memo = [[INF] * W for _ in range(H)]
    memo[0][0] = 1

    que = deque()
    que.append((0, 0))
    while que:
        y, x = que.popleft()
        c = memo[y][x]

        for i in range(len(dy4)):
            ny, nx = y + dy4[i], x + dx4[i]

            if inside(ny, nx, H, W) and memo[ny][nx] > c + 1 and field[ny][nx] == '.':
                memo[ny][nx] = c + 1
                que.append((ny, nx))

    if memo[-1][-1] == INF:
        return -1
    else:
        return num_white - memo[H - 1][W - 1]


def main():
    print(solve())


if __name__ == '__main__':
    main()


Measured memory_bytes: 3952
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
ll A,B;
  cin>>A>>B;
  ll ans=0;
  ll sum=1;
  for(ll i=0;i<=100;i++){
    if(sum>=B){
      break;
    }


    if(i==0){
      sum+=A-1;
      ans++;
    }
    else{
      sum+=A-1;
      ans++;
    }

  
   
    
}
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>

typedef long long ll;

using namespace std;
const int MOD = 1e9 + 7;
 

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}




int main(){

    ll n,a,b;

    scanf("%lld %lld %lld",&n,&a,&b);

    ll ans;
     ans=(modpow(2,n,MOD)-1)%MOD;
    ll p1=1;
    ll q1=1;

    for(ll i=n;i!=n-a;--i){
        p1=p1*i%MOD;
    }
    for(ll i=1;i<=a;++i){
        q1=q1*i%MOD;
    }

    ans=(ans-modpow(q1,MOD-2,MOD)*p1%MOD)%MOD;

    ll p2=1;
    ll q2=1;

    for(ll i=n;i!=n-b;--i){
        p2=p2*i%MOD;
    }

    for(ll i=1;i<=b;++i ){
        q2=i*q2%MOD;
    }

     ans=(ans-modpow(q2,MOD-2,MOD)*p2%MOD)%MOD;


     ans=(ans+MOD)%MOD;

     cout<<ans<<endl;
}

Measured memory_bytes: 3764
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define M 100010
#define inf 1e9
using namespace std;
struct point{
	int to,next;
}e[M<<1];
int n,m,num,root;
int ans[M],head[M],odd[M],L[M],R[M];
void add(int from,int to)
{
	e[++num].next=head[from];
	e[num].to=to;
	head[from]=num;
}
void dfs1(int x,int fa)
{
	for(int i=head[x];i;i=e[i].next)
	{
		int to=e[i].to;
		if(to==fa) continue;
		dfs1(to,x);
		R[x]=min(R[x],R[to]+1);
		L[x]=max(L[x],L[to]-1);
		if(odd[to]!=-1)
		{
			if(odd[x]==-1) odd[x]=odd[to]^1;
			else if(odd[to]==odd[x])
			{
				printf("No\n");
				exit(0);
			}
		}
	}
}
void dfs2(int x,int fa)
{
	if(fa)
	{
		R[x]=min(R[x],R[fa]+1);
		L[x]=max(L[x],L[fa]-1);
		if(odd[x]==-1) odd[x]=odd[fa]^1;
	}
	if(L[x]>R[x]||(L[x]==R[x]&&odd[x]!=(L[x]&1)))
	{
		printf("No\n");
		exit(0);
	}
	for(int i=head[x];i;i=e[i].next)
	{
		int to=e[i].to;
		if(to==fa) continue;
		dfs2(to,x);
	}
}
void Getans(int x,int fa)
{
	if(!fa) ans[x]=L[x];
	else
	{
		ans[x]=ans[fa]-1;
		if(ans[x]<L[x]) ans[x]+=2;
	}
	for(int i=head[x];i;i=e[i].next)
	{
		int to=e[i].to;
		if(to==fa) continue;
		Getans(to,x);
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int x,y; scanf("%d%d",&x,&y);
		add(x,y); add(y,x);
	}
	for(int i=1;i<=n;i++) L[i]=-inf,R[i]=inf,odd[i]=-1;
	int k;scanf("%d",&k);
	for(int i=1;i<=k;i++)
	{
		int u,v;scanf("%d%d",&u,&v); root=u;
		odd[u]=(v&1);
		L[u]=R[u]=v;
	}
	dfs1(root,0);
	dfs2(root,0);
	Getans(root,0);
	printf("Yes\n");
	for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL UPPER = 1e9;

int main(){
    
    // 1. 入力情報取得.
    LL S;
    scanf("%lld", &S);
    
    // 2. 三頂点を計算.
    // (X1, Y1) は, 原点と設定.
    // 座標平面上で三角形の面積を計算する公式.
    // https://mathwords.net/x1y2hikux2y
    LL X1, X2, X3, Y1, Y2, Y3;
    X1 = 0LL;
    Y1 = 0LL;
    X2 = min((LL)sqrt(S) + 1, UPPER);
    Y3 = min((LL)sqrt(S) + 1, UPPER);
    Y2 = 1LL;
    X3 = X2 * Y3 - S;
    // printf("%lld\n", X2 * Y3 - Y2 * X3);
    
    // 3. 出力 ～ 後処理.
    printf("%lld %lld %lld %lld %lld %lld\n", X1, Y1, X2, Y2, X3, Y3);
    return 0;

}


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

int dp[1000002][2];

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

    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 1000002; j++) {
            dp[j][i] = 1e9;
        }
    }
    dp[0][0] = 0;
    dp[0][1] = 1;

    int n = s.size();
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 2; j++) {
            int a = s[i] - '0';
            if (j == 1) a++;
            dp[i + 1][0] = min(dp[i + 1][0], dp[i][j] + a);
            dp[i + 1][1] = min(dp[i + 1][1], dp[i][j] + 10 - a);
        }
    }

    cout << min(dp[n][0], dp[n][1] + 1) << endl;
}


Measured memory_bytes: 9116
from collections import Counter


def solve(n, v):
    origin_odd = [v[i] for i in range(n) if i % 2 == 1]
    origin_even = [v[i] for i in range(n) if i % 2 == 0]

    o = Counter(origin_odd).most_common()
    e = Counter(origin_even).most_common()

    o.sort(key=lambda k: k[1])
    e.sort(key=lambda k: k[1])
    # (a, b)
    o_p = o[-1]
    e_p = e[-1]
    ans = 0
    if len(o) == 1 and len(e) == 1:
        if o_p[0] == e_p[0]:
            ans = n//2
        else:
            ans = 0
    elif len(o) == 1:
        if o_p[0] == e_p[0]:
            e_s = e[-2]
            ans = n - (o_p[1]+e_s[1])
        else:
            ans = n - (o_p[1]+e_p[1])
    elif len(e) == 1:
        if o_p[0] == e_p[0]:
            o_s = o[-2]
            ans = n - (e_p[1]+o_s[1])
        else:
            ans = n - (e_p[1]+o_p[1])
    else:
        o_s = o[-2]
        e_s = e[-2]
        if o_p[0] == e_p[0]:
            o_s = o[-2]
            e_s = e[-2]
            ans = n-(max(o_p[1]+e_s[1], o_s[1]+e_p[1]))
        else:
            ans = n-(o_p[1]+e_p[1])

    return ans


if __name__ == '__main__':
    n = int(input())
    v = list(map(int, input().split()))
    print(solve(n, v))


Measured memory_bytes: 21076
#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<cctype>
#include<cmath>
#include<queue>
#include<stack> 
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
//const int MAX_V=105;
const long long mod =1e9+7;


int main(){
  char X,Y;
  int a,b;
  cin >> X >> Y;
  
  if(X>Y){
    cout << '>' << endl;
  }else if(X<Y){
    cout << '<' << endl;
  }else{
    cout << '=' << endl;
  }

    return 0;
}
 

Measured memory_bytes: 256
#include<stdlib.h>
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
using namespace std;

int main()
{
	string x;
	getline(cin, x, '\n');
	int sum1 = 0;
	int sum2 = 0;
	//cout << x << endl;	

	// 1010...
	for (int i = 0; i < x.length(); i++)
	{
		if (i % 2 == 0 && x[i] != '1')
		{		
			sum1++;
		}
		if (i % 2 == 1 && x[i] != '0')
		{	
			sum1++;
		}		
	}

	// 0101..
	for (int i = 0; i < x.length(); i++)
	{
		if (i % 2 == 0 && x[i] != '0')
		{
			sum2++;
		}
		if (i % 2 == 1 && x[i] != '1')
		{			
			sum2++;
		}
	}
	//cout << sum1 << "  " << sum2 << endl;


	if (sum1 > sum2)
	{
		cout << sum2 << endl;
	}
	else
	{
		cout << sum1;
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 512