akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;

int main(){
	string s,t;
	cin>>s>>t;
	int ans=t.length();
	
	for(int i=0;i<s.length();i++){
		int res=t.length();
		for(int j=0;j<t.length();j++){
			if(i+t.length()>s.length()) break;
			if(t[j]==s[i+j]) res--;
		}
		ans=min(ans,res);
	}
	
	printf("%d",ans);
}

Measured memory_bytes: 3692
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
	
	int a[3],sup,cns;
	
	cin >> sup;
	
	for(cns=0; cns<sup; cns++){
		for(int i=0; i<3; i++){
			cin >> a[i];
		}
		
		sort(a,a+3);
		
		if(a[2]*a[2]==a[1]*a[1]+a[0]*a[0]){
			cout << "YES" << endl;
		}
		
		else{
			cout << "NO" << endl;
		}
		
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    string S;
    cin >> S;
    cout << (S.substr(0, 4) == "YAKI" ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 764
import java.util.Scanner;

public class Main {

	static int[] fib;

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

		int n = Integer.parseInt(sc.nextLine());

		fib = new int[n + 1];

		fib[n] = getFib(n);

		System.out.println(fib[n]);

		sc.close();
	}

	private static int getFib(int n) {
		if (fib[n] != 0)
			return fib[n];

		if (n == 0 || n == 1)
			return fib[n] = 1;

		return fib[n] = getFib(n - 1) + getFib(n - 2);
	}
}



Measured memory_bytes: 26168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll N, M; cin >> N >> M;
    vector<ll> H(N); for (int i = 0; i < N; ++i) cin >> H[i];
    vector<vector<ll>> G(N);
    for (int i = 0; i < M; ++i) {
        ll a, b; cin >> a >> b;
        G[a - 1].push_back(b - 1);
        G[b - 1].push_back(a - 1);
    }

    ll ans = 0;
    vector<bool> is_high(N, true);
    for (int i = 0; i < N; ++i) {
        if (!is_high[i]) continue;
        for (auto j: G[i]) {
            if (H[j] >= H[i]) {
                is_high[i] = false;
                break;
            }
        }
        if (is_high[i]) {
            ans++;
            for (auto j: G[i]) is_high[j] = false;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 9824
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
    long long int n,sum=0,k;
    cin>>n;
    if(n==3||n==5||n==7){
    	cout<<"YES"<<endl;
    }
    else{
    		cout<<"NO"<<endl;
    }
    return 0;
}

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

#define crap ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=1;i<=(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;
using ll = long long;
ll gcd(ll a, ll b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
 } 
void dfs(int x,int y,vector<int>v[],vector<int>&s,int a[],vector<int>&vis)
{
    vis[x]=1;
    s.pb(x);
    if(x==y)
    {
        int ans=INT_MAX;
        for(int i=0;i<s.size();i++)
        {
            //cout<<s[i]<<" ";
            s[i]=a[s[i]];
           // cout<<s[i]<<" ";
        }
        sort(s.begin(),s.end());
        for(int i=1;i<s.size();i++)
        {
            ans=min(ans,abs(s[i]-s[i-1]));
        }
        cout<<ans<<"\n";
        //cout<<"\n";
        return;
    }
    int f=0;
    for(int i=0;i<v[x].size();i++)
    {
        if(vis[v[x][i]]!=1)
            {dfs(v[x][i],y,v,s,a,vis);f=1;}
    }
    s.pop_back();
}
void DFSCall(int x,int y,vector<int>v[],int n, vector<int>s,int a[])
{
    vector<int> vis(n+1,0);
    dfs(x,y,v,s,a,vis);
}
void solve()
{
	ll a,b;
    cin>>a>>b;
    cout<<a*b;
}
int main()
{
	crap;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r", stdin) ;
   		freopen("output.txt","w", stdout) ;
    	freopen("error.txt","w", stderr) ;
    #endif
    int t;
   t=1;
    while(t--)
    {
    	solve();
    }
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second
#ifdef DEBUG
#include <boost/core/demangle.hpp>
#define dump(x) cerr << "L" << __LINE__ << ": in " << __PRETTY_FUNCTION__ << " \e[32;1m" << boost::core::demangle(typeid(x).name()) << "\e[37m" << " " << (#x) << " = " << (x) << "\e[m" << endl;
#else
#define dump(x)
#endif
using namespace std;
template <typename T> using V = vector<T>;
template <typename T, typename U> using P = pair<T,U>;
template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
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){os << "{";ITR(i,v){if(i!=v.begin())os << ","; os << *i;}os << "}"; return os;}
template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T,U> &p){os << "(" << p.first << "," << p.second << ")"; return os;}

template <typename T> T& chmin(T &a, const T &b){return a = min(a,b);}
template <typename T> T& chmax(T &a, const T &b){return a = max(a,b);}

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

  int N; cin >> N;
  vector<LLI> A(N); cin >> A;
  vector<LLI> B(N); cin >> B;

  LLI sum_A = accumulate(ALL(A),0LL);
  LLI sum_B = accumulate(ALL(B),0LL);

  if(sum_A < sum_B){
    cout << -1 << endl;
    return 0;
  }

  int ans = 0;
  LLI d = 0;
  REP(i,N){
    if(A[i] < B[i]){
      ++ans;
      d += B[i]-A[i];
    }
  }

  vector<LLI> v;
  REP(i,N){
    if(A[i] > B[i]){
      v.push_back(A[i]-B[i]);
    }
  }
  dump(v);

  sort(ALL(v));
  reverse(ALL(v));

  for(auto x : v){
    if(d > 0){
      ++ans;
      d -= x;
    }
  }

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 2428
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
# define MAX_N 1000010
/* ちゃんと考えてわかって実装 */

int main(void){
    int k;
    cin >> k;
    queue<ll> lunlun;
    for(int i=1; i<=9; i++){
        lunlun.push(i);
    }
    ll num;
    for(int i=0; i<k; i++){
        num = lunlun.front();
        lunlun.pop();
        if(num % 10 != 0){
            lunlun.push(10*num + (num%10) - 1);
        }
        lunlun.push(10*num + (num%10));
        if(num % 10 != 9){
            lunlun.push(10*num + (num%10) + 1);
        }
    }
    cout << num << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

int main(){
  long long int N,M;
  scanf("%lld %lld", &N, &M);
  
   if(N * 2 >= M){
     printf("%lld\n", M/2);
   }
   else{
     printf("%lld\n", N+(M-N*2)/4);
   }
   return 0;

}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define lld long long int
#define ld long double
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,a,b)	for(lld i=a;i<=b;i++)
#define repr(i,a,b) for(lld i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

int main()
{
     ios;
     lld r,d,x;
     cin>>r>>d>>x;
     rep(i,1,10)
     {
         cout<<r*x-d<<endl;
         x=r*x-d;
     }
    return 0;
}


Measured memory_bytes: 256
n = int(input())
ans = [0] * 10001
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x <= n:
                ans[x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x] += 1

for i in range(1, n + 1):
    print(ans[i])

Measured memory_bytes: 9412
n,k = map(int,input().split())
ls = list(map(int,input().split()))
l,p = 0,0
for i in range(n):
    if l < k:
        p += (1+ls[i])/2
        l += 1
        continue
    if i == k:
        now = p
    now = now-((1+ls[i-k])/2)+((1+ls[i])/2)
    p = max(p,now)
print(p) 

Measured memory_bytes: 25060
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In,' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var V = new int[N];
            var C = new int[N];

            for(var i = 0;i < N; i++){
                V[i] = cin.ReadInt;
            }

            for(var i = 0;i < N; i++){
                C[i] = cin.ReadInt;
            }

            var ans = 0;

            for(var i = 0;i < N; i++){
                if(V[i] - C[i] > 0) ans += V[i] - C[i];
            }

            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream,char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if(inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for(int i = 0;i < tmp.Length;i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }

}


Measured memory_bytes: 11220
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
using namespace std;
using ll = long long;
using ld = long double;
ll mod = ll(1e9)+7;
ll inf = ll(1e18);
template<typename T1, typename T2> ll ceill(T1 a, T2 b){ return (a+b-1)/b; }
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) for (auto vvv : vv) cout << vvv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

using dbg::Debug;
Debug debug;

class BBetweenAAndB {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll a, b, x;
	    in >> a >> b >> x;
	    out << b/x - a/x + (a%x == 0) << endl;
	}
};


int main() {
	BBetweenAAndB solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) (x).begin(), (x).end()

inline void Main() {
  // code
  int n,o[50],p[50],check=0;
  cin>>n;
  rep(i,n) o[i] = i+1;
  rep(i,n) cin>>p[i];

  rep(i, n) {
    if(o[i] != p[i]) {
      if(p[p[i]-1] != o[i]) {
        cout << "NO" << endl;
        return;
      } else {
        check++;
      }
    }
  }

  if(check>2) {
    cout << "NO" << endl;
  } else {
    cout<< "YES" << endl;
  }
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 256
/* << IN THE NAME OF GOD >> */
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pob pop_back
#define ft first
#define ftt ft.ft
#define ftc ft.sc
#define sc second
#define err(x) cerr << #x  << " = "<<  x << '\n'
#define out(x) cout << x << '\n'
#define forp(i, r, l) for(int i = int(r); i < int(l); i++)
#define forn(i, r, l) for(int i = int(r); i > int(l); i--)
#define FAST ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define ctz __builtin_ctz
typedef pair<int, int> pii;
typedef pair<ll ,ll> pll;
const int maxn = 1e6 + 120;
 



int a ,b ,k;
set<int> st;

int main(){FAST;
    cin >> a >> b >> k;

    for(int i = a; i < a + k && i <= b; i++)
        st.insert(i);
    for(int i = b; i >= a && i > b - k;--i)
        st.insert(i);
    for(auto it = st.begin(); it != st.end(); it++)
        out(*it);
   return 0;
}
 












Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

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

  int h, w, n;
  cin >> h >> w >> n;

  int m = max(h, w);
  int ans = (n + m - 1) / m;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;

using namespace std;
int MOD = 1000000007;


ll gcd(ll a,ll b){
  if( b == 0 ) return a;
  return gcd(b,a%b);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b;
  cin >> a >> b;
  if( a == 0 ){
    
  }
  ll ret = gcd(a,b);
  if( a >= b &&  ret == b ) cout << "0" << endl;
  else if( a < b ) {
    ret = min(abs(a) , abs(a-b));
    cout << ret << endl;
  }
  else{
    ll r = a % b;
    ret = min( r , abs(r-b));
    cout << ret << endl;
  }


  return 0;
}



Measured memory_bytes: 256
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

#include <bits/stdc++.h>
 
using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair

typedef long long ll;
typedef long double ld;

void solve(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    while(b <= a){
        b *= 2;
        k--;
    }
    while(c <= b){
        c *= 2;
        k--;
    }
    cout << (k >= 0 ? "Yes\n" : "No\n");
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x

int main() {

  string S, ans = "Yes";
  int i;

  cin >> S;

  REP(i, S.length()){
    if( i % 2 == 1 ){
      if( S[i] == 'R' ){
        ans = "No";
        break;
      }
    }else {
      if( S[i] == 'L' ){
        ans = "No";
        break;
      }
    }
  }

  cout << ans << endl;
}

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 256
#include <stdio.h>


int main(void){
	long long X,Y;
	int ans=1;
	scanf("%lld %lld",&X,&Y);
	long long a=X;
	while(a*2 <=Y){
		ans++;
		a *= 2;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int x = sc.nextInt();
        int a = sc.nextInt();
           
        out.println(x<a ?0:10);
        out.flush();
    }

    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}
//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int a,b;
//    double c;
//    P(int a, int b) {
//    	this.b=b;
//    	this.a=a;
//    	this.c=(double)b/a;
//    }
//
//    public int compareTo(P p){
//        return Double.compare(p.c,c);
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 21204
import java.io.*;

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String[] in1 = br.readLine().split(" ");
        int N = Integer.parseInt(br.readLine());

        int[] a = new int[N];
        for(int i = 0; i < N; i++){
            a[i] = Integer.parseInt(br.readLine());;
        }
        br.close();

        long ans = 0L;

        for(int i = 0; i < N; i++){
            
            if(i > 0 && a[i] > 0 && a[i-1] == 1){
                ans++;
                a[i]--; a[i-1]--;
            }
            
            ans += a[i] / 2;
            a[i] %= 2;
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 30676
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

class P
{
    static void Main()
    {
        var Nx = Console.ReadLine().Split().Select(int.Parse).ToList();
        if (Nx[0] == 2)
        {
            if (Nx[1] == 2)
            {
                Console.WriteLine("Yes");
                Console.WriteLine("1 2 3");
            }
            else
            {
                Console.WriteLine("No");
            }
            return;
        }
        var count = Nx[0] * 2 - 1;
        int lb = Nx[1] - 2;
        int ub = Nx[1] + 2;
        int headCount = (count - 5) / 2;
        int tailCount = (count - 5) / 2;
        int[] mid = new int[] { Nx[1] + 2, Nx[1] - 1, Nx[1], Nx[1] + 1, Nx[1] - 2 };
        if (lb < 0 || count + 1 < ub)
        {
            Console.WriteLine("No");
            return;
        }
        else if (lb < 1 || count < ub)
        {
            if (lb < 1)
            {
                lb++;
                tailCount++;
                mid = new int[] { Nx[1] + 2, Nx[1] - 1, Nx[1], Nx[1] + 1 };
            }
            if (count < ub)
            {
                ub--;
                headCount++;
                mid = new int[] { Nx[1] - 1, Nx[1], Nx[1] + 1, Nx[1] - 2 };
            }
        }
        
        Console.WriteLine("Yes");
        List<int> collection = Enumerable.Range(1, count).Where(x => x < lb || ub < x).ToList();
        Console.WriteLine(string.Join("\n",collection.Take(headCount).Concat(mid).Concat(collection.Skip(headCount))));
    }
}


Measured memory_bytes: 28124
import itertools
s = input()
p = itertools.product(['+','-'], repeat = 3)
for i in p:
    ev = '{}{}{}{}{}{}{}'.format(s[0],i[0],s[1],i[1],s[2],i[2],s[3])
    if eval(ev) == 7:
        print(ev+'=7')
        break

Measured memory_bytes: 8964
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
using P = pair<int, int>;

int X, Y, Z; //????????¬??????????¨?????????°???????????°??????????????????????????°
int roulette[4];
P eventInfo[60] = { P(0, 0) };
double dp[60][6000] = {};

void inputRoulette()
{
	for (int i = 0; i < X; i++)
	{
		cin >> roulette[i];
	}
}
void inputEventInfo()
{
	for (int i = 0; i < Z; i++)
	{
		int n, e, a;
		cin >> n >> e >> a;
		eventInfo[n].first = e;
		eventInfo[n].second = a;
	}
}

void solve()
{
	dp[0][0] = 1.0;
	for (int i = 0; i < Y; i++)
	{
		for (int j = 0; j < Y * 100; j++)
		{
			if (dp[i][j] == 0) continue;
			for (int k = 0; k < X; k++)
			{
				int nextPos = min(Y, i + roulette[k]);
				int nextMoney = j;
				int eventType = eventInfo[nextPos].first;
				int eventValue = eventInfo[nextPos].second;

				if (eventType == 1) nextPos = min(Y, i + roulette[k] + eventValue);
				if (eventType == 2) nextMoney = j + eventValue;
				if (eventType == 3) nextMoney = max(0, j - eventValue);
				dp[nextPos][nextMoney] += dp[i][j] / X;
			}
		}
	}
}
double getAnswer()
{
	double ans = 0;
	for (int i = 0; i < Y * 100; i++)
	{
		ans += i * dp[Y][i];
	}
	return ans;
}
void clear()
{
	for (int i = 0; i < 60; i++)
	{
		for (int j = 0; j < 6000; j++)
		{
			dp[i][j] = 0;
		}
	}

	for (int i = 0; i < 60; i++)
	{
		eventInfo[i] = P(0, 0);
	}
}

int main()
{
	while (cin >> X >> Y >> Z, X + Y + Z)
	{
		clear();
		inputRoulette();
		inputEventInfo();
		solve();
		cout << (int)getAnswer() << endl;
	}

	return 0;
}

Measured memory_bytes: 5840
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main(){
    int n, k; cin >> n >> k;
    double res = 0;
    rept(i, 1, n+1){
        int num = i; double par = 1;
        while(num < k){
            num *= 2;
            par /= 2;
        }
        res += par;
    }
    res /= n;
    cout << fixed << setprecision(12);
    cout << res << ln;
}
    

 


Measured memory_bytes: 3772
x = int(input())
a = [input() for _ in range(x)]
y = int(input())
b = [input() for _ in range(y)]

count_max = 0
for j in a:
  if (a.count(j) - b.count(j)) > count_max:
    count_max = a.count(j) - b.count(j)
print(count_max)

Measured memory_bytes: 9100
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<cstring>
using namespace std;
#define INF 100000000
int mini(int a,int b){
	if(a<b){
		return a;
	}else{
		return b;
	}
}

int cost(int p,int q,int m,int co[][101]){
	int i,s[101],a,j,d[101],b;
	for(i=0;i<=m;i++){s[i]=0;d[i]=INF;}
	a=p;s[a]=1;d[a]=0;
	for(i=1;i<=m;i++){
		for(j=1;j<=m;j++){
			d[j]= mini(d[j],d[a]+co[a][j]);
		}
		s[a]=1;b=INF;
		for(j=1;j<=m;j++){
			if(s[j]==0&&d[j]<=b){
				a=j;b=d[j];
			}
		}
		s[a]=1;
	}
	return d[q];
}

int main(){
	while(1){
		int i,a=0,b=0,p,q,r,j,k,n,m,co[101][101],ti[101][101],s[101],ans[200];
		for(i=0;i<101;i++){
			s[i]=0;
			for(j=0;j<101;j++){
				if(i==j){
					co[i][j]=0;
					ti[i][j]=0;
				}else{
					co[i][j]=INF;
					ti[i][j]=INF;
				}
			}
		}
		cin>>n>>m;
		if(n==0&&m==0)break;
		for(i=0;i<n;i++){
			cin>>a>>b;
			cin>>co[a][b]>>ti[a][b];
			co[b][a]=co[a][b];
			ti[b][a]=ti[a][b];
		}
		cin>>k;
		for(i=0;i<k;i++){
			cin>>p>>q>>r;
			if(r==0){
				ans[i]=cost(p,q,m,co);
			}else{
				ans[i]=cost(p,q,m,ti);
			}
		}
		for(i=0;i<k;i++){
			cout<<ans[i]<<endl;
		}
	}

    return 0;
}

Measured memory_bytes: 1236
# time complexity: O(NW)
# space complexity: O(NW)

import sys
fin = sys.stdin.readline
N, W = [int(elem) for elem in fin().split()]
items = [[int(elem) for elem in fin().split()] for _ in range(N)]


dp = [[0] * (W + 1) for _ in range(N + 1)]

for i in reversed(range(N)):
    for j in range(W + 1):
        value, weight = items[i]
        if j < weight:
            dp[i][j] = dp[i + 1][j]
        else:
            dp[i][j] = max(dp[i + 1][j],
                           dp[i + 1][j - weight] + value,
                           dp[i][j - weight] + value)

print(dp[0][W])



Measured memory_bytes: 16664
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] c = sc.next().toCharArray();
        int ans = 0;
        if(s[0] == c[0]) ans++;
        if(s[1] == c[1]) ans++;
        if(s[2] == c[2]) ans++;
        System.out.println(ans);
        sc.close();

    }

}


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

const int MAX_COLS = 105;
int candies[2][MAX_COLS];
int N;

int calculateNumberOfCandies(int move_down_index) {
  int number_of_candies = 0;
  for (int i = 0; i <= move_down_index; ++i) {
    number_of_candies += candies[0][i];
  }
  for (int i = move_down_index; i < N; ++i) {
    number_of_candies += candies[1][i];
  }
  return number_of_candies;
}

void solve() {

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

  int max_number_of_candies = 0;
  // Find index at which to move down so that we get maximal amount of candies.
  for (int i = 0; i < N; ++i) {
    int number_of_candies = calculateNumberOfCandies(i);
    if (number_of_candies > max_number_of_candies) {
      max_number_of_candies = number_of_candies;
    }
  }
  cout << max_number_of_candies << endl;
}

int main() {
    solve();
}

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

int main() {
  char c;
  vector<int> list(26, 0);
  while (scanf("%c", &c) != EOF) {
    if('a' <= c && c <= 'z') list[c - 'a']++;//小文字
    else if('A' <= c && c <= 'Z') list[c - 'A']++;
  }
  for(int i = 0; i < 26; i++) {
    char alp = 'a' + i;
    printf("%c : %d\n", alp, list[i]);
  }
}


Measured memory_bytes: 3208
#include <bitset>
#include <iostream>
#include <vector>

using namespace std;

int main(int argc, const char *argv[]) {
  int n, m;
  cin >> n >> m;

  vector<vector<int>> lamps(m);
  for (int i = 0; i < m; i++) {
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int s;
      cin >> s;
      s--;
      lamps[i].push_back(s);
    }
  }

  vector<int> vp(m);
  for (int i = 0; i < m; i++) {
    cin >> vp[i];
  }

  int ans = 0;
  for (int i = 0; i < (1 << n); i++) {
    bool on = true;
    bitset<10> bs(i);
    for (int j = 0; j < lamps.size(); j++) {
      // j個目の電球がつくかどうか．．．．
      int cnt = 0;
      for (int k = 0; k < lamps[j].size(); k++) {
        if ((i >> lamps[j][k]) & 1) {
          cnt++;
        }
      }

      if (cnt % 2 != vp[j]) {
        on = false;
        break;
      }
    }

    if (on) {
      ans++;
    }
  }

  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (H, W) = readLine()!!.split(" ").map { it.toInt() }
    val c = mutableListOf<LongArray>()
    (0..9).forEach {
        val ci = readLine()!!.split(" ").map { it.toLong() }.toLongArray()
        c.add(ci)
    }

    val A = mutableListOf<IntArray>()
    (1..H).forEach {
        val a = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
        A.add(a)
    }

    fun worshallFloyd() {
        // TODO CAUTION order i, j, k
        (0..9).forEach { i ->
            (0..9).forEach { j ->
                (0..9).forEach { k ->
                    c[j][k] = Math.min(c[j][k], c[j][i] + c[i][k])
                }
            }
        }
    }

    // O(10^3)
    worshallFloyd()
    var minCost = 0L
    // O(HW)
    A.forEach {
        it.forEach {a ->
            if (a >= 0) {
                minCost += c[a][1]
            }
        }
    }
    println(minCost)
}


Measured memory_bytes: 41892
n,k=map(int,input().split())
a=list(map(int,input().split()))

lim=60
to=[[0]*n for i in range(lim)]

for i in range(n):
  aft=a[i]
  aft-=1
  to[0][i]=aft

for i in range(lim-1):
  for j in range(n):
    to[i+1][j]=to[i][to[i][j]]

v=0
for i in range(lim,-1,-1):
  l=2**i
  if l<=k:
    v=to[i][v]
    k-=l

print(v+1)

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

using namespace std;

vector<int> findShortestPath(int N, int M, vector<vector<int>>& neighbors){
  vector<bool> visited(N, false);
  queue<int> q;
  vector<int> parent(N, -1);
  q.emplace(0);
  visited[0] = true;
  while (!q.empty()){
    int curr = q.front();
    q.pop();
    for (int nei : neighbors[curr]){
      if (!visited[nei]){
        visited[nei] = true;
        parent[nei] = curr + 1;
        q.emplace(nei);
      }
    }
  }
  for (bool b : visited){
    if (!b) return {};
  }
  return parent;
}

int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<vector<int>> neighbors(N);
  for (int i = 0;i < M;i++){
    int A, B;
    cin >> A >> B;
    neighbors[A - 1].emplace_back(B - 1);
    neighbors[B - 1].emplace_back(A - 1);
  }
  vector<int> res = findShortestPath(N, M, neighbors);
  if (res.empty()) cout << "No" << endl;
  else{
    cout << "Yes" << endl;
    for (int i = 1;i < res.size();i++){
      cout << res[i] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 10224
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	cout << (N * (N - 1)) / 2 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<tuple>
#include<utility>
#include<stack>
#include<set>
#include<iomanip>
using ll=long long int;
using namespace std;

int sumofdigits(int n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

int main() {

	int n;
	cin >> n;

	if (n % sumofdigits(n) == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}




	return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n,m;
	char a,b;
	cin>>a>>b;
	n=a-'A'; m=b-'A';
	if(n>m) cout<<'>'<<endl;
	else if(n<m) cout<<'<'<<endl;
	else cout<<'='<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define wi(t) int t;cin>>t;while(t--)
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve() {
  ll int n,i=1;
  cin>>n;
  while(1)
  {
      if((i*360)%n==0)
      {
          cout<<(i*360)/n<<endl;
          return;
      }
      i++;
  }
  
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    //wi(t)
    {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}





Measured memory_bytes: 10688
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int any[200000];
	int n = 0;
	int a = 0;
	cin >> n;
	for (int i = 0; i < 200000; i++)
	{
		any[i] = 0;
	}
	for (int i = 0; i < n-1; i++)
	{
		cin >> a;
		any[a - 1] ++;
	}
	for (int i = 0; i < n; i++)
	{
		cout << any[i] << endl;
	}
}

Measured memory_bytes: 4420
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

LL DP[10][10];//[from][to] fromからtoへ変換するのに必要なエネルギー
int H,W;

int main(){
 
    cin>>H>>W;
    REP(i,10)REP(j,10){
        cin>>DP[i][j];
    }

    // REP(i,10){
    //     REP(j,10){
    //         cout<<DP[i][j];
    //     }
    //     cout<<endl;
    // }
    //ここでDPを用いてある数字を１に変換するのに必要な手数を調べる？？
    while(true){
        bool ischanged=false;
        REP(from,10)REP(to,10)REP(X,10){
            LL old=DP[from][to];
            LL old1=DP[from][X];
            LL old2=DP[to][X];
            
            DP[from][to]=min(DP[from][X]+DP[X][to],DP[from][to]);
            DP[from][X]=min(DP[from][to]+DP[to][X],DP[from][X]);
            DP[to][X]=min(DP[to][from]+DP[from][X],DP[to][X]);
            
            ischanged= (DP[from][to]!=old)||(DP[from][X]!=old1)||(DP[to][X]!=old2);
        }
        if(ischanged==false){break;}
    }
  
    LL ans=0;
    REP(i,H)REP(j,W){
        int a;
        cin>>a;
        if(a==-1){continue;}
        ans+=DP[a][1];
    }
    cout<<ans<<endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    signed main(){
	int n,k,q,a;
      cin>>n>>k>>q;
      vector<int> p(n+2,0);
      for(int i=1;i<=q;i++){
        cin>>a;
    	p[a]++;
      }
      for(int i=1;i<=n;i++){
        if(p[i]+k-q<=0) cout<<"No"<<'\n';
        else cout<<"Yes"<<'\n';
      }
      return 0;
    }

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

//#define debug
typedef long long ll;

int main(){
#ifdef debug
    freopen("test.in", "r", stdin);
#endif
    int A, B, C;
    while(cin>>A>>B>>C){
        bool flag=false;
        for(int i=0; i<B; ++i){
            if((A*i)%B==C){
                flag=true;
            }
        }
        if(flag)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


int main() {

    int n,k;
    cin>>n>>k;

    int a=0;
    while(1){
        if(n == 0){
            break;
        }else{
            n /= k;
            a++;
        }
        
    }
    cout << a << endl;


    



    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 1<<29
#define linf (1e16)
#define eps (1e-8)
#define Eps (1e-12)
#define mod 1000000007
#define pi acos(-1.0)
#define phi (1.0+sqrt(5.0))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define pld(a) printf("%.10Lf\n",(ld)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pii> vpi;

int main()
{
  int n,h,w,ans=0;
  cin>>n>>h>>w;
  for(int i=0;i<n;i+=2){
    int a,b;
    cin>>a>>b;
    ans+=h*(w-max(w-a,b));
    ans+=h*(w-max(a,w-b));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3120
# util functions
class UnionFind
  def initialize(n) # n: number of elements in the forest
    @par  = []
    @rank = []
    @vs   = []  
    n.times do |i|
      @par[i] = i
      @rank[i] = 0
      @vs[i] = 1
    end
  end
  attr_accessor :par, :rank, :vs

  def find(x)
    raise "x = #{x} is out of range 0..#{@par.size - 1}" unless @par[x]
    if @par[x] == x
      return x
    else
      return find( @par[x] )
    end
  end

  def unite( x, y )
    xrt = find(x)
    yrt = find(y)
    return if xrt == yrt
    
    if @rank[xrt] > @rank[yrt]
      @par[yrt] = xrt
      @vs[xrt] += @vs[yrt]
    else
      @par[xrt] = yrt
      @vs[yrt] += @vs[xrt]
      @rank[yrt] += 1 if @rank[xrt] == @rank[yrt]
    end
  end

  def same( x, y ) # returns true/false
    return find( x ) == find( y )
  end

end # UnionFind

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

# body
$nn = inputs[0][0]
$mm = inputs[0][1]
$setE = inputs[1..-1]

if $debugFlag
  print "nn: "
  p $nn
  print "mm: "
  p $mm
  print 
  p $setE
end

result = []
cur = $nn * ($nn - 1) / 2
result << cur

uf = UnionFind.new($nn)
$setE.reverse!
($setE.size-1).times do |i|
  if uf.same($setE[i][0]-1, $setE[i][1]-1 )
    result << cur
    next
  end

  cur -= uf.vs[ uf.find( $setE[i][0]-1 ) ] * uf.vs[ uf.find( $setE[i][1]-1 ) ]
  result << cur
  uf.unite( $setE[i][0]-1, $setE[i][1]-1 )
end

result.reverse.each do |e_i|
  puts e_i
end


Measured memory_bytes: 15712
#include<iostream>

using namespace std;

int main(void) {
	int D, N;

	cin >> D >> N;


	if (D == 0) { if (N < 100) { cout << N << endl; } else { cout << 101 << endl; } }
	else if (D == 1) { if (N < 100) { cout << 100 * N << endl; } else { cout << 10100 << endl; } }
	else if (D == 2) { if (N < 100) { cout << 10000 * N << endl; } else { cout << 1010000 << endl; } }

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

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

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

    int h = sc.nextInt();
    int w = sc.nextInt();

    char[][] c_array = new char[h][w];


    for(int i=0; i<h; i++){
      c_array[i] = sc.next().toCharArray();
    }



    int ans = solve(c_array);
    System.out.println(ans);

  }

  public static int solve(char[][] c){
    int ret = 0;
    int h = c.length;
    int w = c[0].length;

    Deque<Position> p = new ArrayDeque<>();

    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        if(c[i][j]=='#'){
          p.add(new Position(i,j,0));
        }
      }
    }


    while(p.size()>0){
      Position xy = p.poll();
      int x = xy.x;
      int y = xy.y;
      int depth = xy.d;

      if(depth>ret){
        ret = depth;
      }

      if(x+1<w && c[y][x+1]=='.'){
        c[y][x+1] = '#';
        p.add(new Position(y,x+1,depth+1));
      }
      if(x-1>=0 && c[y][x-1]=='.'){
        c[y][x-1] = '#';
        p.add(new Position(y,x-1,depth+1));
      }
      if(y+1<h && c[y+1][x]=='.'){
        c[y+1][x] = '#';
        p.add(new Position(y+1,x,depth+1));
      }
      if(y-1>=0 && c[y-1][x]=='.'){
        c[y-1][x] = '#';
        p.add(new Position(y-1,x,depth+1));
      }




    }



    return ret;
  }
}

class Position{
  Position(int y , int x, int d){
    this.x = x; this.y = y; this.d = d;
  }


  int x;
  int y;
  int d;
}

Measured memory_bytes: 66744
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,a[4];
int32_t main(){
CODE_START;
cin >> a[0] >> a[1] >> a[2];
sort(a,a+3);
if(a[0]+a[1]==a[2]){
    rc("Yes");
}
cout << "No";
return 0;}

Measured memory_bytes: 256
import collections
N=int(input())
A=list(map(int,input().split()))
S = collections.Counter(A)
T=[]
sq=-1;r1=-1;r2=-1
T=S.most_common()
T.sort(reverse=True,key=lambda x: x[0])
#print(T)
for i in range(len(T)):
  if T[i][1]>3:
    if sq==-1:
      sq=i
      if r1==-1:
        r1=i
      else:
        if r2==-1:
          r2=i
  elif T[i][1]>1:
    if r1==-1:
      r1=i
    else:
      if r2==-1:
        r2=i
#print(sq,r1,r2)
if r1!=-1 and r2!=-1:
  if sq!=-1:
    print(max(T[sq][0]**2,T[r1][0]*T[r2][0]))
  else:
    print(T[r1][0]*T[r2][0])
elif sq!=-1:
  print(T[sq][0]**2)
else:
  print(0)

Measured memory_bytes: 22436