akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            var HWN = Sarray();
            var H = HWN[0];
            var W = HWN[1];
            var N = HWN[2];
            var wall = new List<Tuple<long, long>>();
            for (var i = 0; i < N; ++i)
            {
                var rc = Sarray();
                wall.Add(Tuple.Create(rc[0], rc[1]));
            }
            wall.Add(Tuple.Create(H, W));
            wall = wall.OrderBy(h => h.Item1).ThenBy(w => w.Item2).ToList();
            var cmb = new Combination(H + W, Mod);
            //最初に通る壁がiの場合の数
            var dp = new long[N + 1];
            dp[0] = 1;
            for (var i = 0; i <= N; ++i)
            {
                dp[i] = cmb.com(wall[i].Item1 - 1 + wall[i].Item2 - 1, wall[i].Item1 - 1);
                for (var j = 0; j < i; ++j)
                {
                    if (wall[j].Item1 <= wall[i].Item1 && wall[j].Item2 <= wall[i].Item2)
                    {
                        var path = cmb.com(wall[i].Item1 - wall[j].Item1 + wall[i].Item2 - wall[j].Item2, wall[i].Item1 - wall[j].Item1);
                        dp[i] = (dp[i] - dp[j] * path % Mod + Mod) % Mod;
                    }
                }
            }
            WriteLine(dp[N]);
        }
        public class Combination
        {
            readonly long mod;
            readonly long[] fac, finv, inv;
            public Combination(long n, long mod = 1000000007)
            {
                long max = n + 1;
                this.mod = mod;
                fac = new long[max];
                finv = new long[max];
                inv = new long[max];
                fac[0] = fac[1] = 1;
                finv[0] = finv[1] = 1;
                inv[1] = 1;
                for (int i = 2; i < max; ++i)
                {
                    fac[i] = fac[i - 1] * i % mod;
                    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
                    finv[i] = finv[i - 1] * inv[i] % mod;
                }
            }
            public long com(long n, long k)
            {
                if (n < k) return 0;
                if (n < 0 | k < 0) return 0;
                return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
            }
        }

    }
}

Measured memory_bytes: 18400
#include <stdio.h>

int card_num;
int cards[100];
int k;

int main(void) {
	int i;
	int score_max;
	int current_score;
	int score_max2;
	int score_max3;
	int a,b,t;
	while(1) {
		scanf("%d%d",&card_num,&k);
		if(card_num==0 && k==0)break;
		for(i=0;i<card_num;i++)scanf("%d",&cards[i]);
		score_max=1;
		for(i=0;i<k;i++)score_max*=cards[i];
		current_score=score_max;
		for(i=k;i<card_num;i++) {
			current_score*=cards[i];
			current_score/=cards[i-k];
			if(current_score>score_max) {
				score_max=current_score;
			}
		}
		score_max2=score_max;
		for(a=0;a<card_num;a++) {
			for(b=a+1;b<card_num;b++) {
				t=cards[a];cards[a]=cards[b];cards[b]=t;
				score_max3=1;
				for(i=0;i<k;i++)score_max3*=cards[i];
				current_score=score_max3;
				for(i=k;i<card_num;i++) {
					current_score*=cards[i];
					current_score/=cards[i-k];
					if(current_score>score_max3) {
						score_max3=current_score;
					}
				}
				t=cards[a];cards[a]=cards[b];cards[b]=t;
				if(score_max2<score_max3)score_max2=score_max3;
			}
		}
		printf("%d\n",score_max2-score_max);
	}
	return 0;
}

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

using namespace std;

int B(int N, int M, vector<int>& A) {
	int days = N - accumulate(A.begin(), A.end(), 0);
	return (days < 0) ? -1 : days;
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> A(M);
	for (int i = 0; i < M; i++)
		cin >> A[i];
	cout << B(N, M, A);
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif

using P = pair<double,double>; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
//////////

// c++17での名前衝突を避けるためdefine
#define gcd nyagcd
#define lcm nyalcm
ll nyagcd(ll x, ll y){
  ll z;
  if(x > y) swap(x,y);
  while(x){
    x = y % (z = x); y = z;
  }    
  return y;
}
ll nyalcm(ll x,ll y){
  return 1LL * x / gcd(x,y) * y;
}

void solve(){
  inl(A,B);
  ll g = gcd(A,B);
  map<ll,int> m;
  for(ll i=2;i*i<=g;i++){
    while(g%i==0) m[i]++ , g/= i;
  }
  if(g != 1) m[g]++;
  out(sz(m) + 1);


}

Measured memory_bytes: 256
import sys

a, b, c, d = map(int, input().split())

num_list = [a, b, c, d]
num_list.sort()

time = 0

if a >= d or b <= c:
    time = 0
else:
    time = num_list[-2] - num_list[1]

print("{}".format(time)) 

Measured memory_bytes: 3060
s = list(map(int, input()))
for bit in range(1 << 3):
    n = 7 - s[0]
    ans = str(s[0])
    for i in range(3):
        if bit & (1 << i):  # 足し算の処理
            n -= s[i + 1]
            ans += '+' + str(s[i + 1])
        else:
            n += s[i+ 1]
            ans += '-' + str(s[i+1])
    if n == 0:
        print(ans + '=7')
        break

Measured memory_bytes: 3064
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int         long long   
#define double      long double
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define rall(v)     (v).rbegin(),(v).rend()
#define sort(v)     sort((v).begin(),(v).end())
#define rsort(v)    sort((v).rbegin(),(v).rend())
#define gcd(a,b)    __gcd((a),(b))
#define minn(v)     *min_element(v.begin(), v.end());
#define maxx(v)     *max_element(v.begin(), v.end());
#define print(x)    cout<<(x)<<endl;
#define sum(v)+x    accumulate(v.begin(), v.end(),x);
typedef pair<int,int> pii;  
typedef vector<int> vi;
//x.substr(start, length);
/*
// Create a vector containing n 
//vectors of size m.  
    vector<vector<int> > vec( n , vector<int> (m, 0));  
*/
struct type{
    int k, i, j;
};
//to check if a no is prime or not?
bool isPrime(int n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
}

// minimum subaaray sum of size k-sliding window approach
int findSubarray(int arr[], int n, int k)
{
	int window_sum = 0;
	int min_window = INT_MAX;
	int last = 0;
	for (int i = 0; i < n; i++)
	{
		window_sum += arr[i];
		if (i + 1 >= k)
		{
			if (min_window > window_sum)
			{
				min_window = window_sum;
				last = i;
			}
			window_sum -= arr[i + 1 - k];
		}
	}
	int sum=0;
	for(int i=last-k+1;i<=last;i++)
	{
	    sum+=arr[i];
	}
	return sum;
}
//finds the next permutation to given sequence of nos
int nextpermutation(vi v)
{
    vi t=v;
    sort(t);
    int x=0;
    while(true)
    {
        x++;
        if(t==v)
        {
            return x;
        }
        next_permutation(all(t));
    }
}
signed main() 
{
    fastio;
    cout << fixed << setprecision(12);
    string s;
    cin>>s;
    int n=s.length();
    int ans=1;
    bool flag=true;
    for(int i=1;i<n;i++)
    {
        if(flag and s[i]==s[i-1])
        {
            if(i==n-1)break;
            ans++;
            i++;
            flag=false;
        }
        else
        {
            ans++;
            flag=true;
        }
    }
    print(ans)
}
    
    


Measured memory_bytes: 3696
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k; cin >> n >> k;
    vll p(n);
    REP(i, n) cin >> p[i];
    double tmp = 0, ans;
    for (ll i = 0; i < k; i++) tmp += (double)((1 + p[i]) * p[i]) / 2.0 / p[i];
    ans = tmp;
    for (ll i = k; i < n; i++) {
        tmp += (double)((1 + p[i]) * p[i]) / 2.0 / p[i];
        tmp -= (double)((1 + p[i - k]) * p[i - k]) / 2.0 / p[i - k];
        chmax(ans, tmp);
    }
    cout << fixed << setprecision(12) << ans << '\n';
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, L[10];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> L[i];
    sort(L, L + N);

    int sm = 0;
    rep(i, 0, N - 1) sm += L[i];

    if (L[N - 1] < sm) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  map <int, int> data;
  vector <int> result(N * N, -1);

  int i, place;
  for (i = 0; i < N; i++) {
    cin >> place;
    data[place] = i + 1;
  }

  int finished;

  map <int, int>::reverse_iterator mri;
  finished = N * N;
  for (mri = data.rbegin(); mri != data.rend(); mri++) {
    const int number = mri->second;
    int leftnum = N - number;
    while (leftnum > 0) {
      finished--;
      if (finished <= mri->first - 1) {
        cout << "No" << endl;
        return 0;
      }
      if(result[finished] < 0) {
        result[finished] = number;
        leftnum--;
      }
    }
    result[mri->first - 1] = number;
  }

  map <int, int>::iterator mit;
  finished = -1;
  for (mit = data.begin(); mit != data.end(); mit++) {
    const int number = mit->second;
    int leftnum = number - 1;
    while (leftnum > 0) {
      finished++;
      if (finished >= mit->first - 1) {
        cout << "No" <<endl;
        return 0;
      }
      if (result[finished] < 0) {
        result[finished] = number;
        leftnum--;
      }
    }
  }

  cout << "Yes" << endl;
  for (i = 0; i < result.size(); i++) {
    cout << result[i] << " ";
  } cout << endl;

  return 0;
}


Measured memory_bytes: 2176
a=input().split()
N=int(a[0])
M=int(a[1])
X=int(a[2])
ryokinjo=[]
b=input().split()
for i in range(len(b)):
  ryokinjo.append(int(b[i]))
count1=0
count2=0
for i in range(len(ryokinjo)):
  if ryokinjo[i]<X:
    count1+=1
  if ryokinjo[i]>X:
    count2+=1
print(min([count1,count2]))
    

Measured memory_bytes: 9112
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int r, g, b, n;
	cin >> r >> g >> b >> n;
	int ans = 0;
	rep(i, 3001) {
		rep(j, 3001) {
			int tmp = n - r * i - g * j;
			if (tmp < 0) continue;
			if (tmp % b == 0) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

var N int
var C, V [20]int

func main() {
	fmt.Scan(&N)
	for i := 0; i < N; i++ {
		fmt.Scan(&C[i])
	}
	for i := 0; i < N; i++ {
		fmt.Scan(&V[i])
	}
	var ret int
	ret = 0
	for i := 0; i < N; i++ {
		if C[i]-V[i] > 0 {
			ret = ret + C[i] - V[i]
		}

	}
	fmt.Println(ret)
}


Measured memory_bytes: 512
# ttps://atcoder.jp/contests/abc134/submissions/6460745
n = int(input())
a = list(map(int, input().split()))
b = [None]*n

for i in range(n,0,-1):     #0はrangeの範囲外
    b[i-1] = a[i-1]
    k = 2*i                 #kはiの倍数
    while k <= n:
        b[i-1] ^= b[k-1]    #XOR 1^1=0^0=0,1^0=0^1=1
                            #ビット演算子
        k += i              #2i,3i,...と調べる

M = sum(b)
print(M)
if M>0:
    print(' '.join( [str(j+1) for j,b_ in enumerate(b) if b_==1] ))
        #b=1を抽出、index+1を" "で連結



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

int n;
string s;
vector< vector<char> > moji(10, vector<char>(0));

string solve() {
    string ans = "";
    char c;
    int count = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == '0') {
            if (count==0) continue;
            int num = c - '0';
            // cout << moji[num].size() << endl;
            ans += moji[num][(count-1) % moji[num].size()];
            count = 0;
        }
        else {
            c = s[i];
            count++;
        }
        
    }
    return ans;
}

int main() {
    cin >> n;
    moji[1] = {'.', ',', '!', '?', ' '};
    moji[2] = {'a', 'b', 'c'};
    moji[3] = {'d', 'e', 'f'};
    moji[4] = {'g', 'h', 'i'};
    moji[5] = {'j', 'k', 'l'};
    moji[6] = {'m', 'n', 'o'};
    moji[7] = {'p', 'q', 'r', 's'};
    moji[8] = {'t', 'u', 'v'};
    moji[9] = {'w', 'x', 'y', 'z'};

    // moji.push_back({'.', ',', '!', '?', ' '});
    // moji.push_back({'a', 'b', 'c'});
    // moji.push_back({'d', 'e', 'f'});
    // moji.push_back({'g', 'h', 'i'});
    // moji.push_back({'j', 'k', 'l'});
    // moji.push_back({'m', 'n', 'o'});
    // moji.push_back({'p', 'q', 'r', 's'});
    // moji.push_back({'t', 'u', 'v'});
    // moji.push_back({'w', 'x', 'y', 'z'});


    for(int i = 0; i < n; i++) {
        cin >> s;
        cout << solve() << endl;
    }
}


Measured memory_bytes: 3032
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <list>
using namespace std;
int n;
struct cit{
	cit(int x0=0,int y0=0,int i0=0) {
		x=x0,y=y0,id=i0;
	}
	int x,y,id;
}a[200090];
int bcj[200090],c[200090];
list<cit> l;

int fa(int x) {
	if(bcj[x]==x) return x;
	return bcj[x]=fa(bcj[x]);
}

inline void bing(int x,int y) {
	bcj[fa(y)]=fa(x);
}

inline bool cmpx(cit c1,cit c2) {
	return c1.x<c2.x;
}

int main(void) {
	scanf("%d",&n);
	for(int i=0; i<n; ++i) {
		scanf("%d%d",&a[i].x,&a[i].y);
		a[i].id=i,bcj[i]=i;
	}
	sort(a,a+n,cmpx);
	l.push_back(cit(0,200090,0));
	for(int i=0; i<n; ++i)
		if (a[i].y<=l.front().y) l.push_front(a[i]);
		else {
			cit lmin=l.front();
			while(l.front().y<a[i].y) {
				bing(a[i].id,l.front().id);
				l.pop_front();
			}
			l.push_front(lmin);
		}
	for(int i=0; i<n; ++i) c[fa(i)]++;
	for(int i=0; i<n; ++i) cout<<c[fa(i)]<<'\n';
}

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

using namespace std;
typedef long long ll;

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

    ll pt = 1;
    ll pa = 1;

    for (ll i = 0; i < N; ++i) {
        ll t;
        ll a;

        cin >> t;
        cin >> a;
        
        ll c = max((pt-1) / t, (pa-1) / a) + 1;

        pt = t * c;
        pa = a * c;
    }

    cout << pt + pa << endl;


    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		String S=sc.next();
		int K=sc.nextInt();
		
		String[] S2 = S.split("");
		char A=S.charAt(K-1);
		String A2 = String.valueOf(A);
		for(int i=0;i<N;i++){
			if(S2[i].equals(A2)){
			}else {
				S2[i]="*";
			}
		}
		
		for(int i=0;i<N;i++){
		    System.out.print(S2[i]);
		}
		
		System.out.println("");
        
	}

}



Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <cmath>
#include <utility>
#include <queue>
#include <stdio.h>
#include <string>
#include <map>
#include <stack>
#include <complex>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000007
const double eps = 1e-11;
using namespace std;
typedef long long int ll;
typedef complex<double> xy;

int main(){
    int n;
    cin >> n;
    for (int j=0; j<n; j++) {
        vector<xy> inp;
        double x,y,z,w;
        for (int i=0; i<2; i++) {
            cin >> x >> y >> z >> w;
            inp.push_back(xy(x-z,y-w));
        }
        double ans;
        ans =((conj(inp[0])*inp[1]).imag());
        bool b = abs(ans) < eps;
        cout << (b ? "YES" : "NO")<<endl;
    }
}

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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

int main(void)
{
    ll x, a,b ;
    cin >> x >> a >> b;

    cout << ((abs(x-a)<abs(x-b))?"A":"B") << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int M = scanner.nextInt();
        int N = scanner.nextInt();
        //int a = 11;
        //int b = 2;
        if (M > 0 && N > 0) {
            convert(M, N);
        }
    }

    public static void convert(int m, int n) {
        // 创建一个map对象，用来存储对应的字符
        Map<Integer, String> map = new HashMap<>();
        map.put(10, "A");
        map.put(11, "B");
        map.put(12, "C");
        map.put(13, "D");
        map.put(14, "E");
        map.put(15, "F");

        // 如果是10进制，直接输出结束
        if (n == 10) {
            String a = "" +m;
            System.out.println(a.length());
            return;
        }

        // 创建一个栈
        Stack list = new Stack();

        // 对输入的数值进行计算，直到这个值=1
        // 这里主要使用短除法
        while (m > 0) {
            // 计算余数，7%2=1
            int yushu = m % n;
            // 如果是小于10的进制
            if (n < 10) {
                list.push(yushu);
            } else {
                // 如果大于10的进制，取出余数，并且找到对应的字母
                list.push((yushu > 9 ? map.get(yushu) : yushu));
            }
            m = m / n;
        }

        // 输出
        int count = 0;
        if (!list.isEmpty()) {
            Enumeration items = list.elements();
            while (items.hasMoreElements()) {
                //System.out.print(list.pop());
                list.pop();
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    int n,a[1005];
        cin>>n;
    int i,j,flag,sum,flag2=0,flag3;
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n,cmp);
    for(i=0;i<n-1;i++)
    {
        flag=0;
        for(j=i+1;j<n;j++)
        {
            sum=a[i]*a[j];
            int x=sum,y;
            flag3=1;
            if(sum>0&&sum<=9)
            {
                flag=1;
                break;
            }
            while(x>9)
            {
                y=x%10;
                x=x/10;
                if(x%10!=y-1)
                {
                    flag3=0;
                    break;
                }
            }
            if(x>0&&x<=9&&flag3)
            {
                flag=1;
                break;
            }
            else
                continue;
        }
        if(flag)
        {
            cout<<sum<<endl;
            flag2=1;
            break;
        }
        if(flag2==0)
            continue;
    }
    if(!flag)
    {
        cout<<"-1"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3156
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
  
    ll k,i,j,a,b;
    cin>>k>>a>>b;
    for(i=a;i<=b;i++)
    {
    	if(i%k==0)
    	{
    		cout<<"OK";
    		return 0;
    	}
    }
    cout<<"NG";
}

Measured memory_bytes: 3652
from typing import List, Optional


class Node:
	def __init__(self, key) -> None:
		self.key: int = key
		self.left: Optional[Node] = None
		self.right: Optional[Node] = None
		self.parent: Optional[Node] = None


class Tree:
	def __init__(self) -> None:
		self.root: Optional[Node] = None


def insert(T: Tree, z: Node) -> None:
	y: Optional[Node] = None
	x: Optional[Node] = T.root
	while x is not None:
		y = x # 親を設定
		if z.key < x.key:
			x = x.left
		else:
			x = x.right
	z.parent = y

	if y is None:
		T.root = z
	elif z.key < y.key:
		y.left = z
	else:
		y.right = z


def find(k: int) -> str:
	z = T.root
	while z is not None:
		if k == z.key:
			return "yes"
		elif k < z.key:
			z = z.left
		else:
			z = z.right
	return "no"


def inorder(z: Optional[Node]):
	if z is not None:
		inorder(z.left)
		print(f" {z.key}", end="")
		inorder(z.right)


def preorder(z: Optional[Node]):
	if z is not None:
		print(f" {z.key}", end="")
		preorder(z.left)
		preorder(z.right)


if __name__ == "__main__":
	m = int(input())
	T = Tree()
	for _ in range(m):
		command = list(input().split())
		if command[0] == "insert":
			z = Node(int(command[1]))
			insert(T, z)
		elif command[0] == "find":
			key = int(command[1])
			print(find(key))
		else:
			inorder(T.root)
			print("")
			preorder(T.root)
			print("")


Measured memory_bytes: 86864
a, b = (int(_) for _ in input().split())

def xor(n):
    m = 0
    if (n % 4 == 0):
        m = n
    elif (n % 4 == 1):
        m = 1
    elif (n % 4 == 2):
        m = n + 1
    return (m)

A = xor(a - 1)
B = xor(b)
print(A ^ B)


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

template<class NODE>
struct SegmentTree {
	vector<NODE> node;
	using M = function<NODE(NODE, NODE)>;
	M merge;
	const NODE NODE_UNITY;
	int n;
	SegmentTree (int n_, M m, NODE node_unity) : merge(m), NODE_UNITY(node_unity) {
		n = 1;
		while (n < n_) n *= 2;
		node.resize(n * 2 - 1, NODE_UNITY);
	}
	void set(int p, NODE v) {
		p += n - 1;
		node[p] = v;
		while (p) {
			p = (p-1) / 2;
			node[p] = merge(node[p*2+1] , node[p*2+2]);
		}
	}
	NODE get(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		if (a <= l && r <= b) {
			return node[k];
		} else if (b <= l || r <= a) {
			return NODE_UNITY;
		}
		return merge(get(a, b, k * 2 + 1, l, (l+r) / 2), get(a, b, k * 2 + 2, (l+r) / 2, r));
	}
};

int main() {
	int n, Q;
	cin >> n >> Q;
	SegmentTree<int> S(n,
			[](int a, int b){return min(a, b);},
			INT_MAX
		);
	while (Q--) {
		int q, x, y;
		cin >> q >> x >> y;
		if (q == 0) {
			S.set(x, y);
		} else {
			cout << S.get(x, y+1) << endl;
		}
	}
}


Measured memory_bytes: 3872
#include <iostream>
#include <cmath>
using namespace std;


int main(){
    int a, b;
    int a_b = 0, b_a = 0;
    int i, j;
    cin >> a >> b;
    for (i=0;i<b;i++){
        a_b += pow(10, i) * a;
    }
    for (j=0;j<a;j++){
        b_a += pow(10, j) * b;
    }

    if (a_b >= b_a){
        cout << a_b << endl;
    }
    else{
        cout << b_a << endl;
    }
    return 0;
}

Measured memory_bytes: 512
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define scan(n,v) v.resize(n); rep(i,n){ cin>>v[i];}
#define MOD 1000000007ll
#define Yes(flag) cout<<((flag)? "Yes":"No");
#define YES(flag) cout<<((flag)? "YES":"NO");
#define be begin
#define pb push_back
#define fi first
#define se second
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
template<class T>T 
chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>T 
chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
//------------------------------------------------------
string s; int n;
void input(){
    cin>>n>>s;
}
void src(){
    int ans=0;
    rep(i,s.length()-2){
        string s2=s.substr(i,3);
        if(s2=="ABC") ans++;
    }
    cout<<ans;
}   
int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60;
#define LLINF 1e12
#define PI 3.14159265359
#define ALL(a) (a).begin(), (a).end()
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int dy8[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dx8[] = {0, 1, 0, -1, 1, 1, -1, -1};
int ny, nx;
typedef long long ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

unsigned GetDigit(unsigned num) { return to_string(num).length(); }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

ll nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////
int main()
{

    int H,W; cin >> H >> W;
    char S[H][W];
    REP(i,H) REP(j,W) cin >> S[i][j];

    vector<string> ans(H);

    REP(i,H){
        REP(j,W){
            if(S[i][j]=='#'){
                ans[i].push_back('#');
                continue;
            }
            int cnt=0;
            REP(k,8){
                int next_x = i + dx8[k];
                int next_y = j + dy8[k];
                if(next_x < 0 || next_x >= H || next_y < 0 || next_y >= W) continue;
                if(S[next_x][next_y]=='#') ++cnt;
            }
            ans[i].push_back(cnt+'0');
        }
    }

    REP(i,H){
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

#ifdef DEBUG
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
#else
template <class T, class... Args>
void debug(const T &x, const Args &... args) {}
template <class T> void debugVector(const vector<T> &v) {}
#endif

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

template <typename T> struct BIT {
    vector<T> v;
    BIT(int n) { v.assign(n + 1, 0); }
    // [0, k]
    T sum(int k) {
        T res = 0;
        for(++k; k > 0; k -= k & -k) {
            res += v[k];
        }
        return res;
    }
    // [l, r)
    T sum(int l, int r) {
        return (l == 0 ? sum(r - 1) : sum(r - 1) - sum(l - 1));
    }
    void add(int k, T x) {
        for(++k; k < v.size(); k += k & -k) {
            v[k] += x;
        }
    }
};

struct Data {
    int l, r, id;
    Data() {}
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    vector<int> a(n), ans(q), lastID(n + 1, -1);
    vector<Data> qr(q);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < q; i++) {
        cin >> qr[i].l >> qr[i].r;
        qr[i].l--;
        qr[i].r--;
        qr[i].id = i;
    }
    sort(ALL(qr), [](const Data &x, const Data &y) { return x.r < y.r; });
    int r = 0;
    BIT<int> bit(n);
    for(int i = 0; i < q; i++) {
        for(; r <= qr[i].r; r++) {
            if(lastID[a[r]] == -1) {
                lastID[a[r]] = r;
                bit.add(r, 1);
            } else {
                bit.add(lastID[a[r]], -1);
                lastID[a[r]] = r;
                bit.add(r, 1);
            }
        }
        ans[qr[i].id] = bit.sum(qr[i].l, qr[i].r + 1);
    }
    for(auto i : ans) {
        cout << i << "\n";
    }
}

Measured memory_bytes: 17488
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
    
//-------------------------↓↓↓↓↓↓------------------------
    
//------ 自分を天才だと信じる ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n>>k>>s;
    rep(i,Size(s)-1){
        if(s[i]==s[i+1])ans++;
        else cnt++;
    }
    rep(i,k){
        if(cnt==1){
            ans++;
            break;
        }
        if(cnt==0)break;
        ans+=2;
        cnt-=2;
    }
    Cout(ans);
    return 0;
}

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

int calcOrder(long long n){
    int sum = 0;

    do
    {
        n /= 10;
        sum += 1;
    } while (n != 0);

    return sum;
}

int main(){
    long long n;
    cin >> n;
    int ans = 1000000;

    for (auto i = 1; i <= sqrt(n); i++)
    {
        if(n % i != 0){
            continue;
        }

        long long quotient = n / i;
        int tmp;
        tmp = max(calcOrder(quotient), calcOrder(i));
        if(tmp < ans){
            ans = tmp;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define INF (1ll<<60)
#define mod 1000000007
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

vector<ll> sum;
void pre_process(vector<ll> &a,vector<ll> &s){//累積和のvector
    ll n=(ll)a.size();
    s.assign(n+1,0);
    for(ll i=0;i<n;i++){
        s[i+1]=s[i]+a[i];
    }
}
ll query(ll i,ll j,vector<ll> &s){//区間[i,j]の和
    return (s[j]-s[i]);
}

int main(){
    ll n,m;cin>>n>>m;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];

    pre_process(a,sum);

    vector<ll> cnt;
    rep(i,n+1){
        if(i==0) continue;
        cnt.push_back(sum[i]%m);
    }
    sort(cnt.begin(),cnt.end());
    cnt.push_back(-1ll);

    ll num=1;
    ll answer=0;
    rep(i,cnt.size()-1){
        if(cnt[i]==cnt[i+1]){
            num++;
        }else{
            if(cnt[i]==0){
                answer+=num*(num+1)/2;
            }else{
                answer+=(num-1)*num/2;
            }
            num=1;
        }
    }



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

Measured memory_bytes: 5888
package main

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

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}
func (io *Io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

// ax+by=gcd(a,b)
func extgcd(a, b int) (x, y int) {
	y = 1
	x = 0
	for u, v := 1, 0; a != 0; {
		q := b / a
		u, x = x - q * u, u
		v, y = y - q * v, v
		a, b = b - q * a, a
	}

	return
}

func modinv(a, m int) int {
	x, _ := extgcd(a, m)
	return (m + x % m) % m
}

func fact(n, mod int) int {
	ret := 1
	for n > 1 {
		ret = ret * n % mod
		n--
	}
	return ret
}

type P struct {
	w,p int
}

func main() {
	io := NewIo()
	defer io.writer.Flush()

	//n := io.NextInt()
	//k := io.NextInt()
	//
	//vp := make([]P, n, n)
	//for i := 0; i < n; i++ {
	//	vp[i].w = io.NextInt()
	//	vp[i].p = io.NextInt()
	//}
	n := io.NextInt()
	m := io.NextInt()
	r := regexp.MustCompile(fmt.Sprintf(`[0-9]{%d}-[0-9]{%d}`, n, m))
	s := io.Next()
	if r.MatchString(s) {
		io.Printf("Yes\n")
	} else {
		io.Printf("No\n")
	}
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ll  long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define tr(c,i) for(auto i : c)
#define pii pair< int,int >
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define er(x) cout << x << " "
#define err(x,y) cout << x << " "<<y
using namespace std;

const ll MAX =  1000 * 1000 ;
const int dx[] = { 1, -1 , 0 , 0  };
const int dy [] = { 0 ,0 , 1 , -1  };
const int MOD = 1000 * 1000 * 1000 + 7 ;
const int N = 301 ;
const int INF = INT_MAX ;
const int M = 200005;
int main ( ){
ll  h , w  , n ; 
cin >> h >> w >> n ;
cout << min ( (n + h - 1 ) / h  , ( n + w - 1  ) / w  ) ; 






return 0 ;

}


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

int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}

int main() {
  int x;
  cin >> x;
  int k = 360 / gcd(360, x);
  cout << k << endl;
  return 0;
}

Measured memory_bytes: 3576
#include<iostream> 
#include<string>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<sstream>
using namespace std;
 
#define sf scanf
#define pf printf
#define pfn printf("\n");
#define pfk printf(" ");
#define pf0 printf("0");
#define pf1 printf("1");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfdd(n,m) scanf("%d%d",&n,&m);
#define sfld(n) scanf("%lld",&n);
#define sfldd(n,m) scanf("%lld%lld",&n,&m);
#define sflf(n) scanf("%lf",&n);
#define sflff(n,m) scanf("%lf%lf",&n,&m);
#define sfc(n) scanf("%c",n);
#define sfcc(n,m) scanf("%c%c",n,m);
#define sfs(n) scanf("%s",n);
#define sfss(n,m) scanf("%s%s",n,m);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);
 
#define csh(a,n) memset(a,n,sizeof(a));
int fff(int i){
	int a=i;
	int j=i%10;
	i/=10;
	while(i){
		j*=10;
		j+=i%10;
		i/=10;
	}
	if(a==j){
		return 1;
	}
	else{
		return 0;
	}
}
int arr[1000000];
int main(){
	for(int i=10000;i<100000;i++){
		arr[i]=arr[i-1]+fff(i);
	}

	int a,b;
	cin>>a>>b;
	cout<<arr[b]-arr[a-1];
	
} 

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int n;
  string s;
  cin >> n;
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> s;
    sort(s.begin(), s.end());
    mp[s]++;
  }
  ll ans = 0;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    int s = it->second;
    ans += (ll) s * (s - 1) / 2;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 11136
import java.lang.Exception;
import java.lang.Integer;
import java.lang.System;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in).useDelimiter("\\D");

        int n;
        int i = 0;
        List<Integer> queue = new ArrayList<Integer>();
        while (true) {
            try {
                n = sc.nextInt();
            } catch (Exception ex) {
                break;
            }

            if (n > 0) {
                queue.add(n);
                i++;
            } else {
                System.out.println(queue.get(i - 1));
                queue.remove(i - 1);
                i--;
            }
        }
    }
}

Measured memory_bytes: 17212
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Mid (l+r)/2
const int mod=1e9+7,inf=0x3f3f3f3f,maxn=1e5+5;
int n,m,Q,K;

int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+c-'0';c=getchar();}
    return x*f;
}



signed main(){
//  freopen("a.in","r",stdin);
//  freopen("a.out","w",stdout);
    n=read();m=read();K=read();int ans;
    if(n<m)swap(n,m);
    ans=K/n+((K%n==0)?0:1);
    printf("%d\n",ans);



    return 0;
}

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

int main() {
  int s;
  cin >> s;
  
  vector<int> a = {s};
  
  while (true) {
    int ai;
    
    if (a.back() % 2 == 0) {
      ai = a.back() / 2;
    } else {
      ai = a.back() * 3 + 1;
    }
    
    for (int i = 0; i < a.size(); i++) {
      if (a.at(i) == ai) {
        cout << a.size() + 1 << endl;
        return 0;
      }
    }
    
    a.push_back(ai);
  }
}

Measured memory_bytes: 256
package main

import "fmt"

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

	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			if i*j == n {
				fmt.Println("Yes")
				return
			}
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<58;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

string s;

int main(){
	cin>>s;
	if(s[0]==s[2]) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

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

using namespace std;

int ans[100];

int main(void) {

	int A, B;

	

	cin >> A >> B;

	ans[0] = 1;
	ans[1] = A;
	for (int i = 2; i <= 50; i++) {
		ans[i] = ans[i - 1] + A - 1;
	}

	for (int i = 0; i <= 30; i++) {
		if (ans[i] >= B) { cout << i << endl; return 0; }
	}


	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 N = sc.nextInt();

          int K = sc.nextInt();
          
          int a[] = new int[K]; 
          
          for(int i = 0;i < K;i++){
              a[i] = sc.nextInt();
          }
          
          for(int i = N;;i++){
              String str = String.valueOf(i);                        
              boolean flag = true;
              for(int j = 0;j < K;j++){
                  String k = String.valueOf(a[j]);  
                  if(str.contains(k)){
                      flag = false;
                  }
              }               
              if(flag){
                  System.out.println(i);
                  return;
              }
          }            
                                    
        }
}
        

Measured memory_bytes: 37800
#include <iostream>

int main() {
  int32_t H1 = 0, M1 = 0, H2 = 0, M2 = 0, K = 0;
  std::cin >> H1 >> M1 >> H2 >> M2 >> K;

  std::cout << (H2 - H1) * 60 + (M2 - M1) - K << std::endl;
}

Measured memory_bytes: 3512
#include <stdio.h>

#define N 100

int main()
{
  int i, j, mj, num, tmp, count=0;
  int array[N];

  scanf("%d", &num);

  for( i=0; i<num; i++){
    scanf("%d", &array[i]);
  }

  for( i=0; i<num; i++){
    mj = i;

    for( j=i; j<num; j++){
      if( array[j] < array[mj] )mj = j;
    }

    if( array[i] != array[mj]){
    tmp = array[i];
    array[i] = array[mj];
    array[mj] = tmp;
    count++;
    }
  }

  for( i=0; i<num-1; i++){
    printf("%d ", array[i]);
  }
  
  printf("%d\n%d\n", array[num-1], count);

  return 0;
}

Measured memory_bytes: 600
#include <iostream>
 
using namespace std;
 
int main(){
int n;
  cin >> n;
int count = 0;
  for (int i = 0; i < n; ++i){
    int a,b;
    cin >> a >> b;
    if (a==b){
      count +=1;
    } else {count = 0;}
    if (count == 3) {
cout << "Yes";
      return 0;
  }
    
  }
    
    cout << "No";
    
    return 0;
}

Measured memory_bytes: 3048
from collections import deque

N = int(input())
A = list(map(int, input().split()))

q = deque()
for i in range(N):
  a = A[i]
  if i > 1 and i % 2 == 0:
    q.appendleft(a)
  else:
    q.append(a)

if N % 2 == 0:
  q.reverse()
print(" ".join(map(str, q)))


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

#define mod 1000000007

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

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	int N, K;
    cin >> N >> K;

    vector<double> p(N+1);
    p[0] = 0;
    rep(i, N){
        double num;
        cin >> num;
        p[i+1] = (num + 1.0) / 2.0 + p[i]; 
    }
    double ans = 0;
    rep(i, N - K + 1)
        ans = max(ans, p[i+K] - p[i]);

    printf("%.8f", ans);
	
	return 0;
}


Measured memory_bytes: 1792