akhauriyash/Code-Regression huggingface dataset:
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    string s;
    cin >> s;
    sort(ALL(s));
    uni(s);
    char i = 'a';
    for(int j = 0; j < SZ(s); j++){
        if(s[j] == i){
            i++;
        }else{
            cout << i;
            return 0;
        }
    }
    if(i > 'z'){
        cout << "None";
    }else{
        cout << i;
    }
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <ctype.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;
constexpr ll INF = 1000000000;
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	vector<int>h(n);
	rep(i, n)cin >> h[i];

	sort(h.begin(), h.end());
	
	int x = n - k + 1;
	int m = k - 1;
	int ans = INF;
	int now = 0;
	rep(i, x) {
		int now = abs(h[i] - h[i + m]);
		ans = min(ans, now);
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll=long long;  
using pLL = std::pair<ll, ll>;

#define SORT(v) std::sort(v.begin(), v.end())
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N ,K;
    cin >> N >> K;
    if((N+1)/2>=K){
        cout << "YES";
    }else{
        cout << "NO";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
    int n,a,b;
    cin >>n >>a >>b;
    vector<int> s(n);
    rep(i,n) cin >>s[i];
    sort(all(s));

    bool win = true;
    if(a==b){
        int x = 0;
        rep(i,n){
            int g = s[i]%(a+1);
            x ^= g;
        }

        if(x == 0) win = false;
    }
    else{
        if(s[n-1] <= min(a,b)){
            int x = 0;
            rep(i,n) x ^= s[i];

            if(x == 0) win = false;
        }
        else{
            if(a < b){
                int ct = 0;
                rep(i,n) ct += (a < s[i]);
                if(ct>1) win = false;
                else{
                    assert(ct == 1);

                    int x = 0;
                    rep(i,n) x ^= s[i];

                    int nx = s[n-1]^x;
                    int need = s[n-1] - nx;

                    if( !(need<=a && nx<=a) ) win = false;
                }
            }
        }
    }

    cout << (win?"Hanako":"Jiro") << endl;
    return 0;
}



Measured memory_bytes: 3264
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N =  sc.nextInt();
    int K =  sc.nextInt();
    long ans = 0;
    long cnt;
    for(int a= 1;a<=N;a++){
      long ak = a%K;
      long bk = (K-ak)%K;
      long ck = (K-ak)%K;
      if((bk+ck)%K ==0){
       long bc = (K-ak)%K;
       if (bc == 0){
          cnt = 0;
       }else{
          cnt = 1;
       }
       cnt += (N-bc)/K;
       ans += cnt*cnt;
      }
    
    }
    System.out.println(ans);
    
  }
}

Measured memory_bytes: 23764
open Batteries
module CountDict = Map.Make(Int)
let count_int lst =
  let rec add_lst dict l =
    match l with
    | [] -> dict
    | first :: rest ->
      if CountDict.mem first dict then add_lst (CountDict.add first ((CountDict.find first dict) + 1) dict) rest else
      add_lst (CountDict.add first 1 dict) rest
  in add_lst CountDict.empty lst

let n = read_int ()
let a = read_line () |> String.split_on_char ' ' |> List.map int_of_string

let dict = count_int a

let all = (CountDict.fold (fun key value a -> a + (value * (value - 1))) dict 0) / 2

let rec loop lst =
  match lst with
  | [] -> ()
  | first :: rest -> let value = CountDict.find first dict in Printf.printf "%d\n" (all - value + 1); loop rest

let _ = loop a


Measured memory_bytes: 26552
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second


int main(){
	int a, b, c, n;
	string s, t;
	cin >> a;
	if (a < 1000)cout << "ABC" << endl;
	else cout << "ABD" << endl;
	return 0;
}


Measured memory_bytes: 256
s = list(map(int, input()))
pre = 10*s[0]+s[1]
suf = 10*s[2]+s[3]

if 1 <= pre <= 12:
    if 1 <= suf <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= suf <= 12:
        print('YYMM')
    else:
        print('NA')


Measured memory_bytes: 2940
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

type priorityQueue []int

func (p priorityQueue) Len() int            { return len(p) }
func (p priorityQueue) Less(i, j int) bool  { return p[i] > p[j] }
func (p priorityQueue) Swap(i, j int)       { p[i], p[j] = p[j], p[i] }
func (p *priorityQueue) Push(x interface{}) { *p = append(*p, x.(int)) }
func (p *priorityQueue) Pop() interface{} {
	old := *p
	n := len(old)
	x := old[n-1]
	*p = old[0 : n-1]
	return x
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	ts := make(map[int][]int)
	for i := 0; i < n; i++ {
		sc.Scan()
		a, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		b, _ := strconv.Atoi(sc.Text())
		ts[a] = append(ts[a], b)
	}

	pq := make(priorityQueue, n)
	heap.Init(&pq)
	ans := 0
	for i := 1; i <= m; i++ {
		if _, ok := ts[i]; ok {
			for _, v := range ts[i] {
				heap.Push(&pq, v)
			}
		}
		if len(pq) != 0 {
			ans += heap.Pop(&pq).(int)
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 12544
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for {
		m, nMin, nMax := nextInt(sc), nextInt(sc), nextInt(sc)
		if m == 0 && nMin == 0 && nMax == 0 {
			break
		}

		score_list := []int{}
		for i := 0; i < m; i++ {
			score_list = append(score_list, nextInt(sc))
		}

		// 最低合格者数と最高合格者数の間の各得点間のギャップが最大になる合格者数を取得する
		scoreGap := 0
		scoreGapMax := 0
		qualifiedNum := 0
		for n := nMin; n <= nMax; n++ {
			scoreGap = score_list[n-1] - score_list[n]
			if scoreGap >= scoreGapMax {
				scoreGapMax = scoreGap
				qualifiedNum = n
			}
		}

		fmt.Println(qualifiedNum)
	}
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define each(i, mp) for (auto &i : mp)

int main()
{
  string n;
  cin >> n;
  if (n == "ABC")
  {
    cout << "ARC" << endl;
  }
  else
  {
    cout << "ABC" << endl;
  }
  return 0;
}


Measured memory_bytes: 3596
import java.util.*;
import java.math.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    BigInteger  a = sc.nextBigInteger();
    BigInteger  b = sc.nextBigInteger();
    String ans = "";
    if(a.compareTo(b) > 0){
      ans = "GREATER";
    }else if(a.compareTo(b) < 0){
      ans = "LESS";
    }else{
      ans = "EQUAL";
    }

    System.out.println(ans);
    
  }
}

Measured memory_bytes: 35916
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

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

    vl L(n);
    rep(i, n) {
        cin >> L[i];
    }
    sort(all(L));

    ll ans = n*(n-1)*(n-2)/6;
    exrep(i, 0, n-3) {
        exrep(j, i+1, n-2) {
            ans -= L.end() - lower_bound(all(L), L[i] + L[j]);
        }
    }

    out(ans);
    re0;
}

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

int N, K, C;
string S;

int L[200010], R[200010];

int main()
{
    cin >> N >> K >> C >> S;

    int lc = 0;
    int Cc = 0;
    int Sidx = 0;
    while (true) //L
    {
        if(lc == K) break;
        if(Cc == 0)
        {
            if(S[Sidx] == 'o')
            {
                L[lc] = Sidx + 1;
                lc++;
                Cc += C;
                Sidx++;
            }
            else
            {
                Sidx++;
            }
            
        }
        else Cc--, Sidx++;
    }
    int rc = K - 1;
    Cc = 0;
    Sidx = N - 1;

    while (true) //R
    {
        if(rc == -1) break;
        if(Cc == 0)
        {
            if(S[Sidx] == 'o')
            {
                R[rc] = Sidx + 1;
                rc--;
                Cc += C;
                Sidx--;
            }
            else
            {
                Sidx--;
            }
        }
        else Cc--, Sidx--;
    }

    for(int i = 0; i < K; i++) if(L[i] == R[i]) cout << L[i] << endl;
}


Measured memory_bytes: 3332
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a, b, cnt = 0;
  bool good = true;
  cin >> n >> m;
  int h[n];
  for (int i = 0 ; i < n; i++) cin >> h[i];
  vector<int> adj[n];
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    adj[a-1].push_back(b);
    adj[b-1].push_back(a);
  }
  for (int i = 0; i < n; i++) {
    for (auto x : adj[i]) {
      if (h[i] > h[x-1]) continue;
      else {
        good = false;
        break;
      }
    }
    if (good) cnt++;
    good = true;
  }
  cout << cnt;
}

Measured memory_bytes: 9100
s = gets.chomp.split("")

if s.map.with_index { |e, i| (i + 1).even? ? e : nil }.compact.all? { |e| e =~ /[LUD]/ }
  if s.map.with_index { |e, i| (i + 1).odd? ? e : nil }.compact.all? { |e| e =~ /[RUD]/ }
    puts "Yes"
    exit
  end
end
puts "No"


Measured memory_bytes: 1788
#include <stdio.h>
#include <string.h>
 
int main()
{
    int i, m, h, len;
    char cards[201], temp[201];
     
    while(1) {
        scanf("%s",cards);
        if(strcmp(cards,"-") == 0) break;
        len = strlen(cards);
        scanf("%d",&m);
        for (i=0; i<m; i++) {
            scanf("%d",&h);
            strcpy(temp,cards);
            strcpy(cards,&temp[h]);
            strncpy(&cards[len - h],temp,h);
            cards[len] = '\0';
        }
        printf("%s\n",cards);
    }
    return 0;
}

Measured memory_bytes: 596
using System;
class Prog{
  static void Main(){
    int[] ls = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
    int a = ls[0];
    int b = ls[1];
    if(a<10 && b<10){
      Console.WriteLine(a * b);
    }else{
      Console.WriteLine("-1");
    }
  }
}

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

#define ll long long
using namespace std;

const int MOD = 1e9 + 7;

vector<vector<ll>> matmul(vector<vector<ll>> A, vector<vector<ll>> B) {
    int N = A.size();
    vector<vector<ll>> C(N, vector<ll>(N, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < N; k++) {
                C[i][j] = (C[i][j] + ((A[i][k] * B[k][j]) % MOD) ) % MOD;
            }
        }
    }
    return C;
}

vector<vector<ll>> fastExpo(vector<vector<ll>> A, ll k) {
    if (k == 1)
        return A;

    auto B = fastExpo(A, k / 2);
    B = matmul(B, B); // B*B
    if (k % 2 != 0) // odd power
        B = matmul(B, A);   // res = B*B*A

    return B;
}

int main() {
    int N;
    ll K;
    cin >> N >> K;
    vector<vector<ll>> matrix(N, vector<ll>(N, 0));

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> matrix[i][j];
        }
    }
    auto res = fastExpo(matrix, K);
	
  	ll count=0;
    for (auto row: res) {
        for (auto i:row) {
          	if(i)
              	count = ((count % MOD) +  (i %MOD)) % MOD ;
            //cout << i << " ";
        }
        //cout << endl;
    }
  	cout<<count;
    return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const vector<int> emp;

int n;
int d[110];
int pt[110];
bool us[110];
int nd[110];

int main() {
	cin >> n;
	rep(i, n) cin >> d[i];
	int m = *max_element(d, d + n);

	int now = 0;

	vi ln;
	if (m & 1) {
		for (int i = m; i >= (m + 1) / 2; --i) 
			ln.pb(i);
		for (int i = (m + 1) / 2; i <= m; ++i) 
			ln.pb(i);
	} else {
		for (int i = m; i >= m / 2; --i) 
			ln.pb(i);
		for (int i = m / 2 + 1; i <= m; ++i) 
			ln.pb(i);
	}
	for (int i : ln) {
		bool fd = 0;
		rep(j, n) {
			if (!us[j] && d[j] == i) {
				fd = 1;
				us[j] = 1;
				nd[now] = i;
				pt[now++] = j;
				break;
			}
		}
		if (!fd) {
			puts("Impossible");
			return 0;
		}
	}		

	int lim = (m + 1) / 2;

	rep(i, n) {
		if (!us[i] && d[i] <= lim) {
			puts("Impossible");
			return 0;
		}
	}

	puts("Possible");

	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)] 
ans = [0]*(10**5+1)

for i in range (len(A)):
    ans[A[i]] += 1
maxlen = max(max(A),max(max(BC)))
S = 0
for i in range(maxlen+1):
        S += ans [i]*i
for i in range(Q):
    ans[BC[i][1]] += ans[BC[i][0]]
    S = S + ans[BC[i][0]] *BC[i][1] - ans[BC[i][0]]*BC[i][0]
    ans[BC[i][0]] = 0
    print(S)

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

#define ALL(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0, __##i##_length = (n); i < __##i##_length; i++)
#define rep_reverse(i, n) for (ll i = (n)-1; 0 <= i; i--)
#define FOR(i, from, to) for (ll i = (from), __##i##_end = (to); i < __##i##_end; i++)
#define FOR_REVERSE(i, from, to) for (ll i = (to)-1, __##i##_end = (from); __##i##_end <= i; i--)
#define foreach(e, v) for (const auto e : (v))
#define vfree(v) std::vector<int>().swap(v)
#define DEBUG(x) cout << #x << " = " << (x) << endl

using namespace std;
typedef int64_t ll;
typedef vector<ll> llv;
typedef vector<llv> llvv;

int main()
{
    ll N,K;
    cin >> N >> K;
    if (K == 1)
    {
        cout << 0 << endl;
        return 0;
    }
    N -= K;
    cout << N << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s;
	cin>>s;
	ll sum =0;
	ll ans=0;
	char now='0';
	for(int i=0;i<s.size();i++){
		if(now!=s[i]){
			sum++;
		}
		if(now=='0'){
			now='1';
		}
		else{
			now='0';
		}
	}
	now='1';
	for(int i=0;i<s.size();i++){
		if(now!=s[i]){
			ans++;
		}
		if(now=='0'){
			now='1';
		}
		else{
			now='0';
		}
	}
	cout <<min(ans,sum);// your code goes here
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>
#include<iomanip>
 
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp(a, b) make_pair(a, b)
#define mt(a,b,c) make_tuple(a,b,c)
#define rank qwertyuio
#define next dfghjk
#define plus fsghsf
#define minus ytryr
#define pb push_back
#define debug(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
 
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int mod = (int)1e9 + 7;
const int mod1 = (int)1e9 + 9;
const int mod2 = 998244353;
const int mod3 = (int)1e6+3;
const ld eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;
 
 
ll binary_search(vector<ll> arr,ll val,ll l,ll r){
    ll m=l+(r-l)/2;
    if(l>=r){
        return l;
    }
    if(val<arr[m]){
        return binary_search(arr,val,l,m);
    }
    else{
        return binary_search(arr,val,m+1,r);
    }
}//return position less than
ll binary_search2(vector<ll> arr,ll val,ll l,ll r){
    ll m=l+(r-l)/2;
    if(l>=r){
        return l;
    }
    if(val<=arr[m]){//changed here
        return binary_search2(arr,val,l,m);
    }
    else{
        return binary_search2(arr,val,m+1,r);
    }
}//return position less than or equal
ll power(ll x, ll y) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % mod;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % mod; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % mod; 
    } 
    return res; 
} 
ll modInverse(ll n) 
{ 
    return power(n, mod-2); 
}
ll gcdl(ll a ,ll b){ 
    if (a == 0) 
        return b;  
    return gcdl(b % a, a);  
 }
bool sortxy(pii &a,pii &b){
    if(a.first!=b.first){
        return a.first<b.first;
    }
    else{
        return a.second<b.second;
    }
}
bool sortyx(pii &a,pii &b){
    if(a.second!=b.second){
        return a.second<b.second;
    }
    else{
        
        return a.first<b.first;
    }
}
ll minll(ll a,ll b){
    return a<b? a:b;
}

ll save[200007];
int num=100000;
int main()
{   ll n;
    int k;
    cin>>n>>k;
    int ans=0;
    while(n>0){
        n/=k;
        ans++;
    }
    cout<<ans;
    
}


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

namespace ConsoleApp92 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int A = st[0];
            int B = st[1];
            int C = st[2];
            int X = st[3];
            int Y = st[4];

            //係数の調整
            X *= 2;
            Y *= 2;

            long ans = 0;

            int minCombine = Math.Min(A + B, 2 * C);

            if (X > Y) {
                ans += (Y / 2) * minCombine;
                ans += Math.Min((X - Y) / 2 * A, (X - Y) * C);
            } else {
                ans += (X / 2) * minCombine;
                ans += Math.Min((Y - X) / 2 * B, (Y - X) * C);
            }

            Console.WriteLine(ans);



        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
typedef long long ll;
int const INF=1000000000;
ll DP[101][100001];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    REP(i,101)REP(j,100001)DP[i][j]=-1;
    int N,W;
    cin>>N>>W;
    vector<int>w(N+1),v(N+1);
    for(int i=1;i<=N;i++){
        cin>>w[i]>>v[i];
    }
    DP[0][0]=0;
    for(int i=0;i<=N-1;i++){
        for(int j=0;j+w[i+1]<=W;j++){
            if(DP[i][j]!=-1){
                DP[i+1][j+w[i+1]]=max(DP[i+1][j+w[i+1]],DP[i][j]+v[i+1]);
            }
        }
        for(int j=0;j<=W;j++){
            if(DP[i][j]!=-1){
                DP[i+1][j]=max(DP[i][j],DP[i+1][j]);
            }
        }
    }
    ll sub=0;
    for(int i=0;i<=100001;i++){
        sub=max(sub,DP[N][i]);
    }
    cout<<sub<<endl;
}

Measured memory_bytes: 79232
#include <bits/stdc++.h>
using namespace std;
#define fo(i,n) for(int i=0;i<n;i++)
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
int main(){
    int h,w,cnt =0;cin >>h >>w;
    char p;
    while(cin>>p){
        if(p=='#'){
            ++cnt;
        }
    }
    if(cnt==h+w-1){
        cout << "Possible";
    }
    else{
        cout << "Impossible";
    }
}


Measured memory_bytes: 3600
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
#define MAX(a, b) ((ll)(a) > (ll)(b)) ? (ll)(a) : (ll)(b)
#define MIN(a, b) ((ll)(a) > (ll)(b)) ? (ll)(b) : (ll)(a)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll mod = 1000000007;
pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1}};

ll N, X;


ll solve(ll a, ll b) {

	if (a % b == 0) {

		return 2 * b * ((a / b) - 1) + b;

	}
	else {
		return 2 * b * ((a/b)) + solve(b, a % b);
	}

}


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

	cout << N + solve(MAX(N-X, X), MIN(N-X, X)) << endl;


	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int x = sc.nextInt();
      int a = sc.nextInt();
      int b = sc.nextInt();
      x = x-a;
      while(x>=0){
      x -= b;
      }
      System.out.println(x+b);
      sc.close();
    }
}


Measured memory_bytes: 21716
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int z= 0;
		for(int a=1;a>0;a++){
			int x = scan.nextInt();
			int y = scan.nextInt();
			if(x==0 && y==0){
				break;
			}
			if(x>y){
				z = x;
				x = y;
				y = z;
			}
			if(x<=y){
				System.out.println(x +" "+ y);
			}
		}
	}
}

Measured memory_bytes: 27144
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=1000002;

int dp[2][1005],fc[1005],in[1005];

int C(int n,int r){
	if(n<r){
		return 0;
	}
	return mul(mul(fc[n],in[r]),in[n-r]);
}

int calc(int count,int size){
	int ans=1;
	int tot=size*count;
	for(int i=0;i<count;i++){
		ans=mul(ans,C(tot,size));
		tot-=size;
	}
	return mul(ans,in[count]);
}

void solve(){
	int n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	dp[0][n]=1;
	for(int i=a;i<=b;i++){
		for(int set=c;set<=d;set++){
			if(set*i>n){
				break;
			}
			int cnst=calc(set,i);
			for(int last=n;last>=set*i;last--){
				add(dp[1][last-set*i],mul(mul(cnst,C(last,set*i)),dp[0][last]));
			}
		}
		for(int j=0;j<=n;j++){
			add(dp[0][j],dp[1][j]);
			dp[1][j]=0;
		}
	}
	cout<<dp[0][0];
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	fc[0]=1;
	for(int i=1;i<=1000;i++){
		fc[i]=mul(fc[i-1],i);
	}
	in[1000]=powz(fc[1000],mod-2);
	for(int i=999;i>=0;i--){
		in[i]=mul(in[i+1],i+1);
	}
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int ans[3003][3003];
int main(){
	string s, t;
	cin>>s>>t;
	int n = s.size();
	int m = t.size();
	for(int i = 0; i <= n; ++i){
		for(int j = 0; j <= m; ++j){
			if(i == 0 || j == 0)ans[i][j]=0;
			else if(s[i - 1] == t[j - 1])ans[i][j]=ans[i - 1][j - 1] + 1;
			else ans[i][j] = max(ans[i - 1][j], ans[i][j - 1]);
		}
	}
	int i, j;
	string res = "";
	for(i = n, j = m; i > 0 && j > 0; ){
		if(s[i - 1] == t[j -  1]){
			res += s[i - 1];
			i--,j--;
		}
		else if(ans[i][j - 1] > ans[i - 1][j])j--;
		else i--;
	}
	reverse(res.begin(), res.end());
	cout<<res<<endl;
	return 0;
}


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

int judge(vector<int>& card)
{
    if ((card[0] < card[1]) &&
        (card[1] < card[2]))
    {
        return 1;
    }
    return 0;
}

int main()
{
    vector<int> card(3);
    REP(i, 3) cin >> card[i];
    int K;
    cin >> K;

    if(judge(card))
    {
        cout << "Yes" << endl;
        return 0;
    }

    while((card[0] >= card[1]) && (K > 0))
    {
        card[1] *= 2;
        K--;
    }

    while((card[1] >= card[2]) && (K > 0))
    {
        card[2] *= 2;
        K--;
    }

    if(judge(card))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define err(x) cout<<#x<<"= "<<x<<endl;
#define FOR(i,a,b) for(int i =a; i< b; ++i)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define INF 1000000000
#define TRVI(it,it1,it2) for(vi::iterator it = it1; it!= it2; it++)
#define ff first
#define ss second
#define mp make_pair
#define pq priority_queue<int, vector<int>, greater<int> >
#define ll long long
const ll PR = 1000000009;
#define SIZE 1
#define vi vector<ll>
#define pii pair<int,int>
#define endl '\n'

int main(){
//	#ifdef ONLINE_JUDGE
//	freopen("a.in", "r" , stdin);
//	freopen("a.out", "w", stdout);
//      cin.tie(false); cout.tie(false);	
//	#endif
	ios::sync_with_stdio(false);
	ll n;
	vi A,B;
	cin>>n;
	for(int i =0; i< n; i++){
		int a,b;
		cin>>a>>b;
		A.pb(a);
		B.pb(b);
	}
	ll ans =0;
	for(int i = n-1; i>= 0; i--){
		ll now = A[i]+ans;
		ll rem = B[i] - now%B[i];
		if(rem == B[i])rem = 0;
		ans+= rem;
//		cout<<now<<' '<<B[i]<<' '<<rem<<endl;
	}
	cout<<ans<<endl;
	return 0;
};

Measured memory_bytes: 2164
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

const int maxN = 300011;

int n, i, a[maxN];
int B, W;

bool check(ll least) {
    int i, j, u;

    u = 0;
    for (i = 1; i <= n; i++) {
        if (i & 1) {
            u += a[i];
        } else {
            if (u - a[i] < 0 && u >= least) {
                u = 0;
                continue;
            }
            u -= a[i];
        }
    }

    if (u < least) return false;
    return true;
}

int main()
{
    //freopen("test.in","r",stdin);

    scanf("%d", &n);
    for (i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        if (i & 1)
            B += a[i];
        else
            W += a[i];
    }

    if (n % 2 == 0) {
        printf("%d %d", max(B, W), min(B, W));
        return 0;
    }


    ll ans = 0;
    for (ll step = 1LL << 30; step > 0; step >>= 1)
        if (check(ans + step))
            ans += step;
  
    printf("%lld %lld", ans + W, B - ans);


    return 0;
}


Measured memory_bytes: 1408
#include <algorithm>
#include <string.h>
#include <stdio.h>

int main()
{
	const double EPS = 1.0e-10;
	double a,b,c,d,e,f;
	double x,y;
	while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
		x = (e * c - b * f) / (a * e - b * d);
		y = (a * f - d * c) / (a * e - b * d);
		if(-0.0005 < x && x < 0.0+EPS) x = 0.0;
        if(-0.0005 < y && y < 0.0+EPS) y = 0.0;
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

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

using namespace std;

int main()
{
    int n, a, max, min;
    long long int sum = 0;
    cin >> n;
    max = -1000000;
    min = 1000000;

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

        if (a > max)
        {
            max = a;
        }
        if (a < min)
        {
            min = a;
        }

        sum += a;
    }
    cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3112
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

int main(){
  int H, W; cin >> H >> W; int N; cin >> N;
  int X = max(H, W);
  if(N%X==0) cout << N/X << endl;
  else cout << N/X+1 << endl;
    
  
 
}

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

int main() {
  int N;
  std::cin >> N;

  if (N == 0)
    return (std::cout << "0" << std::endl), 0;

  std::string res;
  for (int i = N; i; i /= -2) {
    if (i % (-2) == 0) {
      res += '0';
    } else {
      if (i < 0) --i;
      res += '1';
    }
  }
  std::reverse(res.begin(), res.end());
  std::cout << res << std::endl;
}

Measured memory_bytes: 256
n = int(input())
A,B = map(int,input().split())
for _ in range(n-1):
    a,b = map(int,input().split())
    aa = 0
    bb = 0
    if A % a == 0:
        aa = A // a
    else:
        aa = A // a + 1
    if B % b == 0:
        bb = B // b
    else:
        bb = B // b + 1
    m = max(aa, bb)
    A,B = a * m, b * m
print(A+B)

Measured memory_bytes: 3064
#include<algorithm>
#include <iostream>
#include<bitset>
#include<map>
#include<set>
#include<vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define N 100001
int main() {
	int n;long long sum = 0;
	cin >> n;
	vector<int> a(n), b(n), c(n);
	rep(i, n) cin >> a[i];
	rep(i, n)cin >> b[i];
	rep(i, n)cin >> c[i];
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	rep(i, n) {
		int num_upper = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
		int num_lower = n - (lower_bound(c.begin(), c.end(), b[i] + 1) - c.begin());
		sum += 1LL * num_upper * num_lower;
	}
	cout << sum << endl;
}

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


int main() {
	long long int N, A, B, C, D;
	string S;
	cin >> N >> A >> B >> C >> D >> S;
	A--; B--; C--; D--;

	bool f = false;
	for(long long int i = A; i <= C; i++) {
		if(S[i] == '#') {
			if(f) {
				cout << "No" << endl;
				return 0;
			} else {
				f = true;
			}
		} else {
			f = false;
		}
	}
	f = false;
	for(long long int i = B; i <= D; i++) {
		if(S[i] == '#') {
			if(f) {
				cout << "No" << endl;
				return 0;
			} else {
				f = true;
			}
		} else {
			f = false;
		}
	}
	if(D < C) {
		int count = 0;
		f = false;
		for(long long int i = max(0LL, B - 1); i <= min(N - 1LL, D + 1); i++) {
			if(S[i] == '.') {
				count++;
			} else {
				count = 0;
			}
			if(count >= 3) {
				f = true;
				break;
			}
		}
		if(!f) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}



Measured memory_bytes: 640
def judge_prime(num):
    FLAG = True
    
    for i in range(2, int(num**.5)+1):

        if (num%i == 0):
            FLAG = False
    
    if (num == 2):
        FLAG = True
    
    return(FLAG)

X = int(input())

while (True):
    flag = judge_prime(X)
    
    if (flag):
        break
    
    X += 1

print(X)


Measured memory_bytes: 2940
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;
int a,n,b;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);

#ifndef ONLINE_JUDGE
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#endif


cin >> n >> a >> b;
cout << min(a,b) << " " << max(a+b-n, 1LL*0) <<endl; 





return 0;}
///....


Measured memory_bytes: 256
import java.util.Scanner;

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

    String s = scanner.next();
    s = s.replace('1', '0');
    s = s.replace('9', '1');
    s = s.replace('0', '9');
    System.out.println(s);
  }
}


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

int main () {
  int a, b;
  cin >> a >> b;
  if (a > b) cout << "a > b" << endl;
  else if (a < b) cout << "a < b" << endl;
  else cout << "a == b" << endl;
  return 0;
}


Measured memory_bytes: 3088
fn main() {
    proconio::input! {
        k: i32,
        a: i32,
        b: i32
    }
    let mut ans = "NG";
    for n in a..=b {
        if n % k == 0 {
            ans = "OK";
            break;
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 2076
#include <stdio.h>
#include <math.h>

int main(){
	long long	h;
	scanf("%lld", &h);

	for(int i=0; i<42; i++){
		if(h < (long long)pow(2, i)){
			printf("%lld\n", ((long long)pow(2, i))-1);
			return 0;
		}
	}
	return 0;
}

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

#define int long long
#define rep(i,n) for(int i=0;i<n;i++)

int N;
int A[300010];
int mod = 1000000007;

signed main()
{
    cin >> N;
    rep(i, N)cin >> A[i];

    int ans = 0;
    rep(i, 60)
    {
        int cnt1 = 0, cnt2 = 0;
        rep(j, N)
        {
            if(A[j] & (1ll << i))cnt1++;
            else cnt2++;
        }
        ans = (ans + (1ll << i) % mod * (cnt1 * cnt2 % mod) % mod) % mod;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5924
#include<cstdio>
#include<iostream>
using namespace std;
int a[5],b[5]={0,1,0,-1};
int n=3,k,ans;
int main()
{
	for(int i=1;i<=n;++i)
	scanf("%d",&a[i]);
	scanf("%d",&k);
	for(int i=1;i<=n;++i)
	{
		if(k>=a[i])k-=a[i],ans+=a[i]*b[i];
		else
		{
			ans+=k*b[i];
			break;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

ll n, k;
vector<ll> a, b;
vector<vector<ll>> to;
map<P, ll> color;

void dfs(ll cv, ll par) {
  vector<bool> used(k, false);
  ll a = par, b = cv;
  if (a > b) swap(a, b);
  if (par != -1) used[color[{a, b}]] = true;
  ll c = 0;
  REP(j, SZ(to[cv])) {
    ll u = cv, v = to[cv][j];
    if (v == par) continue;
    if (u > v) swap(u, v);
    if (color.find({u, v}) == color.end()) {
      while (used[c]) {
        c = (c + 1) % k;
      }
      color[{u, v}] = c;
      used[c] = true;
      c = (c + 1) % k;
    } else {
      ll t = color[{u, v}];
      used[t] = true;
    }
    dfs(to[cv][j], cv);
  }
}

int main() {
  cin >> n;
  a = vector<ll>(n - 1);
  b = vector<ll>(n - 1);
  to = vector<vector<ll>>(n);
  REP(i, n - 1) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    to[a[i]].push_back(b[i]);
    to[b[i]].push_back(a[i]);
  }
  k = 0;
  REP(i, n) { k = max(k, SZ(to[i])); }

  dfs(0, -1);

  cout << k << endl;
  REP(i, n - 1) {
    if (a[i] > b[i]) swap(a[i], b[i]);
    cout << color[{a[i], b[i]}] + 1 << endl;
  }
}

Measured memory_bytes: 22656
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;
	cout<<(6-a-b)<<endl;
	return 0;
}


Measured memory_bytes: 256
import std.algorithm;
import std.bigint;
import std.bitmanip;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


immutable string YES = "YES";
immutable string NO = "NO";


auto solve(long X) {
    return [7, 5, 3].canFind(X);
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    long X;
    X = input.front.to!long;
    input.popFront;

    static if (is(ReturnType!solve == void))
        solve(X);
    else {
        auto ans = solve(X);

        static if (isFloatingPoint!(ReturnType!solve))
            writeln(format("%.9f", ans));
        else static if (is(ReturnType!solve == bool))
            writeln(ans ? YES : NO);
        else
            writeln(ans);
    }
}


Measured memory_bytes: 256
def f():
 global d
 p=[]
 for i in range(len(d)-1):
  a,b=d[i],d[i+1]
  r=(b-a)/3
  p+=[a,a+r,(a+b+r*1j*3**.5)/2,b-r]
 d=p+[d[-1]]
d=[0j,100+0j]
for _ in[0]*int(input()):f()
for e in d:print(e.real,e.imag)


Measured memory_bytes: 5884
#include <bits/stdc++.h>
using namespace std;
map<long long,long long>m;
long long n;
const long long M=1e9+7;
inline long long read()
{
  long long x=0;
  char c=getchar();
  for(; c<'0'  || c>'9';  c=getchar());
  for(; c<='9' && c>='0'; c=getchar())x=(x<<3)+(x<<1)+c-'0';
  return x;
}
long long ans(long long x)
{
  return !m[x]?m[x]=(ans(x/2)+ans((x-1)/2)+ans((x-2)/2))%M:m[x];
}
int main()
{
  return m[0]=1,m[1]=2,n=read(),printf("%lld",ans(n)),0;
}

Measured memory_bytes: 256
// Problem : A - AC or WA
// Contest : AtCoder Beginner Contest 152
// URL : https://atcoder.jp/contests/abc152/tasks/abc152_a
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcount(x)
#define f first
#define se second
using namespace std;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
int abst(int a)
{return a<0?-a:a;}
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}

void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n,m;
cin>>n>>m;
if(n==m)
cout<<"Yes\n";
else
cout<<"No\n";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t;
//cin>>t;
t=1;
while(t--)
{
    solve();
}
}


Measured memory_bytes: 256
from itertools import product
# from line_profiler import LineProfiler


def putpiece(X,Y,bitmap,unused,pieces,numans,pcsans):
    if not unused: return numans + 1, pieces
    if numans > 1: return 2, pieces
    b,k,y,x = unused[-1]
    for h,w in set([ (k//i,k//(k//i)) for i in range(1,min(X+1,k+1)) if not (k//i)*(k//(k//i)) - k]):
        ps, pe, qs, qe = max(0,y-h+1), min(Y-h+1,y+1), max(0,x-w+1), min(X-w+1,x+1)
        for pt,qt in product(range(ps,pe),range(qs,qe)):
            rt,st = pt+h-1, qt+w-1
            piece = ( sum([2**(st-qt+1)-1 << j*X for j in range(rt-pt+1)]) << X-st-1 ) << (Y-rt-1)*X
            mark = ( 1 << X-x-1 ) << (Y-y-1)*X
            if not (bitmap&piece)^mark:
                numans,pcsans = putpiece(X,Y,bitmap|piece,unused[:-1],pieces+[[b,k,pt,qt,rt,st]],numans,pcsans)
            if numans > 1: return 2, pcsans
    else:
        return numans,pcsans

def main():
    while(True):
        X,Y,n = map(int,input().split())
        if not X: break
        bk = sorted([list(map(int,input().split())) for _ in range(n)])
        ss = [list(map(int,input().split())) for _ in range(Y)]
        yxs = sorted([ss[i][j],i,j] for i,j in product(range(Y),range(X)) if ss[i][j])
        bkyx = [ bk[i]+yxs[i][1:] for i in range(n)]
        filled = "".join([ "".join(["1" if ss[i][j] else "0" for j in range(X)]) for i in range(Y)])
        nans,pcs = putpiece(X,Y,int(filled,2),bkyx,[],0,0)
        if nans > 1:
            print("NA")
        elif nans:
            toprint = [[0]*X for _ in range(Y)]
            for i,_,sy,sx,ey,ex in pcs:
                for j in range(sy,ey+1): toprint[j][sx:ex+1] = [i]*(ex-sx+1)
            for a in toprint: print(" ".join(str(b) for b in a))
        else:
            print("NA")

if __name__ == "__main__":
    # prf = LineProfiler()
    # prf.add_function(main)
    # prf.add_function(putpiece)
    # prf.runcall(main)
    # prf.print_stats()
    main()


Measured memory_bytes: 5720
s=int(input())
x=[0]*1000001
x[s]=1
for i in range(1,1000010):
    if s%2==0:
        s//=2
    else:
        s=3*s+1

    if x[s]==1:
        print(i+1)
        exit()
    else:
        x[s]=1

Measured memory_bytes: 46192
function Main(input) {
  input = input.split("\n");
  tmp = input[0].split(" ");
  var n = parseInt(tmp[0]);
  tmp2 = input[1].split(" ");
  a = new Array(n);
  var max=0;
  var ans=0;
  var min=0;
  for(i=0;i<n;i++){
    a[i]=parseInt(tmp2[i]);
    if(min>a[i]||i==0){
      min=a[i];
    }
    if(max==a[i]-min){
      ans++;
    }else if(max<a[i]-min){
      ans=1;
      max=a[i]-min;
    }
  }
  console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 17484