akhauriyash/Code-Regression huggingface dataset:
/* 
 Author:N_o_o_B 
 Created:November 24 2019 17:40:48
*/
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;
const int maxn=1e5+5;
vii adj[maxn];
int num;
vi col(maxn);
void dfs(int u,int par=-1,int color=-1){
    int cur=color+1;
    for(auto p:adj[u]){
        int to=p.fi,ind=p.se;
        if(to!=par){
            col[ind]=(cur)%num;
            cur=(cur+1)%num;
            dfs(to,u,col[ind]);
        }
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n;
    cin >> n;
    vi deg(n+1);
    fori(i,n-1){
        int u,v;
        cin >> u >> v;
        adj[u].pb({v,i});
        adj[v].pb({u,i});
        deg[u]++;
        deg[v]++;
    }
    num=*max_element(all(deg));
    int ind=max_element(all(deg))-deg.begin();
    dfs(ind);
    cout << num << endl;
    fori(i,n-1){
        cout << col[i]+1 << endl;
    }

    time_taken();
    return 0;
}

Measured memory_bytes: 7936
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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 EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> X(N);
    for(int i = 0; i < N; i++) cin >> X[i];
    int ans = 1e9;
    for(int i = 0; i < 100; i++) {
        int now = 0;
        for(int j = 0; j < N; j++) {
            int dx = i - X[j];
            now += dx * dx;
        }
        chmin(ans, now);
    }
    cout << ans;
    return 0;
}


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

using namespace std;

int n, a, b;

int main()
{
	cin >> n >> a >> b;
	if (abs(a - b) % 2 == 1)
	{
		cout << "Borys";	
	}	
	else
	{
		cout << "Alice";
	}
	return 0;
}


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

int partition(int A[], int p, int r) {
  int x = A[r-1];
  int i = p - 1;
  for (int j = p; j < r-1; j++) {
    if (A[j] <= x)
      swap(A[++i], A[j]);
  }
  swap(A[i+1], A[r-1]);
  return i+1;
}

int main() {
  int n, A[100000];
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> A[i];
  int r = partition(A, 0, n);
  for (int i = 0; i < n; i++) {
    if (i) cout << ' ';
    if (i == r) cout << '[' << A[i] << ']';
    else cout << A[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1552
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    
    INF = 10 ** 9
    dp = [INF] * (N+1)
    dp[0] = 0
    
    for i in range(1, N):
        c1 = abs(A[i]-A[i-1])
        dp[i] = min(dp[i], dp[i-1] + c1)        
        
        if i > 1:
            c2 = abs(A[i]-A[i-2])
            dp[i] = min(dp[i], dp[i-2] + c2)
    
    return dp[N-1]

print(solve())

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

typedef long long ll;
const int MaxN = 112345;
const ll mod = 1000000007;

class Solver {
	int n, kk, *a;
	int dp[MaxN];
public :
    Solver() {
		solve();
	}
	void solve();
	int solve(int k) {
		//cout << k << "k " << endl;
		if (k == 0) return false;
		if (dp[k] != -1) return dp[k];
		int win = 0;
		for (int i = 0; i < n; i++) {
			if (k < a[i]) continue;
			win |= (!solve(k - a[i]));
		}
		return dp[k] = win;
	}
};

void Solver::solve() {
	cin >> n >> kk;
	a = new int[n + 1];
	for (int i = 0; i < n; i++) {
		//cout << "please a" << endl;
		cin >> a[i];
	}
	memset(dp, -1, sizeof(dp));
	int ans = solve(kk);
	if (ans)
		cout << "First\n";
	else cout << "Second\n";
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    ll t=1;
    //cin >> t;
    while(t--) {
		Solver s;
	}
}


Measured memory_bytes: 8724
import java.util.*;

public class Main {

	/**
	 * @param args
	 */
	
	public static Scanner sc = new Scanner(System.in);
	
	void run() {
		List<Integer> list = new ArrayList<Integer>();
		
		while (sc.hasNextInt()) {
			list.add(sc.nextInt());
		}
		
		Collections.sort(list);
		
		System.out.println(list.get(list.size()-1));
		System.out.println(list.get(list.size()-2));
		System.out.println(list.get(list.size()-3));
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}

Measured memory_bytes: 17172
#include<iostream>
#include<map>
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a==b)
		cout<<c;
	else if(a==c)
		cout<<b;
	else if(b==c)
		cout<<a;
	
 } 

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

int main() {
  int N;
  int sum;
  cin >> N;
  
  for(int i; i<N; i++) {
    int l, r;
    cin >> l >> r;
    sum += (r-l+1);
  }
  
  cout << sum << endl;
}

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

int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;

  vector<int> v = {A, B, C, D, E};

  int n = 10;
  for (int i = 0; i < 5; i++) {
    if (v[i] % 10 != 0) {
      n = min(n, v[i] % 10);
      v[i] = (v[i] / 10 + 1) * 10;
    }
  }

  int sum = 0;
  for (int i = 0; i < 5; i++) {
    sum += v[i];
  }

  if (n != 10)
    sum = sum - 10 + n;

  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef double ld;
using namespace std;
void solve(){
    ll n;
    cin>>n;
    map<ll,ll> ma;
    for (int i = 0; i < n-1; ++i)
    {
        ll x;
        cin>>x;
        ma[x]++;
    }
    for (int i = 0; i < n; ++i)
    {
        cout<<ma[i+1]<<endl;
    }
    }
    
int main(){
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
return 0;
}

Measured memory_bytes: 16136
#include <bits/stdc++.h>
#define R cin>>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long unsigned int ll;;
int main(){
    int a,b,k;
    cin>>a>>b>>k;
    set<int> S;
    for (int i=a; i<a+k && i<=b; ++i) S.insert(i);
    for (int i=b; i>b-k && i>=a; --i) S.insert(i);
    for (int n: S) {
        cout<<n<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
import sys
import io


def run(input: io.TextIOBase, output: io.TextIOBase):
    x = input.readline().strip()
    r = ""
    for i in x:
        if i == "B":
            r = r[0:-1]
        else:
            r += i

    output.write(r + '\n')


if __name__ == '__main__':
    run(sys.stdin, sys.stdout)


Measured memory_bytes: 2940
#include <iostream>
using namespace std;
int main(){
	int r,d,x2000,r_new,x;
	
	cin >> r >> d >> x2000;
  
  r_new=x2000;
  
  for(int i=0;i<10;i++){
  	x=r*r_new-d;
    r_new=x;
    
  cout << r_new << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=100000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n,a[100100],to[100100][20],len,q;

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

int main()
{
	n=read();
	rep(i,1,n) a[i]=read();
	len=read();
	rep(i,1,n)
	{
		int pos=upper_bound(a+1,a+1+n,a[i]+len)-a-1;
		if (pos<=n) to[i][0]=pos;
	}
	rep(j,1,19) rep(i,1,n)
		to[i][j]=to[to[i][j-1]][j-1];
	q=read();
	while (q--)
	{
		int u=read(),v=read();
		if (u>v) swap(u,v);
		if (u==v) {printf("0\n");continue;}
		int ans=1;
		per(i,19,0)
			if (to[u][i]<v)
			{
				u=to[u][i];
				ans+=(1<<i);
			}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 9088
#include<stdio.h>
#include<algorithm>
using namespace std;
int val[20000];
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a+b){
		for(int i=0;i<a+b;i++)scanf("%d",val+i);
		std::sort(val,val+a+b);
		int ret=val[0];
		for(int i=1;i<a+b;i++){
			ret=max(ret,val[i]-val[i-1]);
		}
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
  int mm=0;
  char a[4],b[4],kari;
  cin >> a >> b;
  string ans;
  kari = a[0];
  a[0] = a[2];
  a[2] = kari;
  //cout << a <<endl;
  for (int i = 0; i < 3; i++ ){
    if (a[i] == b[i]){
    mm++;
    //cout << mm <<endl;
    }
  }

  if (mm == 3)
  ans = "YES";
  else
  ans = "NO";
  cout << ans <<"\n";
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long n = in.nextLong();
            long a = in.nextLong();
            long b = in.nextLong();

            if (a > b || (n == 1 && a != b)) {
                out.println(0);
                return;
            }

            long max = a + b * (n - 1);
            long min = a * (n - 1) + b;

            out.println(max - min + 1);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(nextString());
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 23380
n,k,s = map(int,input().split())
ans = []
for i in range(k):
  ans.append(str(s))
  
for j in range(n-k):
  if s != 1000000000:
    ans.append(str(s+1))
  else:
    ans.append(str(s-1))
print(' '.join(ans))

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

int main () {
	string r1,r2;
	cin >> r1;
	cin >> r2;
	// A B C
	// D E F
	// Rotate 180 Degrees
	// FED, CBA?
	if (r2[2] == r1[0] && r2[1] == r1[1] && r2[0] == r1[2])
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
# なぜかうまくいかない
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
R, S, P = MAP()
T = input()
point = {"r": R, "s": S, "p": P}
win = {"r": "p", "s": "r", "p":"s"}

# Tに対して勝つ
win_T = [win[x] for x in T]

ans = 0
for i in range(N):
    if i < K:
        ans += point[win_T[i]]
    # 同じにしたら勝けどできないから変える
    elif win_T[i-K] == win_T[i]:
        win_T[i] = None
    else:
        ans += point[win_T[i]]
print(ans)




Measured memory_bytes: 6472
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define pb push_back
#define f first
#define s second
#define endl "\n"
#define F(i,n) for(ll i=0;i<n;i++)
#define mem(x,val) memset(x,val,sizeof(x))
#define mod 1000000007
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cerr.tie(NULL)
 
int main()
{
    crap;
    ll T = 1;
    //cin>>T;
    while(T--){
    	ll h,n; cin>>h>>n;
        vector<ll> a(n); F(i,n) cin>>a[i];
        ll s = accumulate(a.begin(), a.end(),0LL);
        if(s>=h) cout<<"Yes\n";
        else cout<<"No\n";
    }
}

Measured memory_bytes: 1024
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}


const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    int64_t x;
    mint(int64_t x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int64_t t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    //for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) {return mint(*this) /= a;}
};

istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> frac, ifrac;
    combination(int n):frac(n+1), ifrac(n+1) {
        assert(n < mod);
        frac[0] = 1;
        for (int i = 1; i <= n; ++i) frac[i] = frac[i-1]*i;
        ifrac[n] = frac[n].inv();
        for (int i = n; i >= 1; --i) ifrac[i-1] = ifrac[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return frac[n]*ifrac[k]*ifrac[n-k];
    }
} c(2000000);

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;

    mint ans = c(r1+c1, r1);
    rep(i, r2-r1) {
        ans += c(r1+i+1+c2, c2);
    }
    rep(i, c2-c1) {
        ans += c(c1+i+1+r2, r2);
    }

    cout << ans << endl;
}

Measured memory_bytes: 34396
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <list>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define MOD 1000000007
#define PI 3.1415926535897932
#define rep(i, n) for (int i = 0; i < n; i++)
#define repe(i, j, n) for (int i = j; i < n; i++)
#define repi(i, n) for (int i = 0; i <= n; i++)
#define repie(i, j, n) for (int i = j; i <= n; i++)
#define all(x) x.begin(), x.end()
#define println() cout << endl
#define P pair<int, int>
#define fi first
#define se second

typedef long long ll;

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

struct UnionFind
{
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N)
    { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++)
            par[i] = i;
    }

    int root(int x)
    { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {                     // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry)
            return;   //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y)
    { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

void solve1()
{
    int k; cin >> k;

    string s = "";
    string a = "ACL";
    for(int i = 0; i < k; i++) {
        s += a;
    }

    cout << s << endl;
}

int main()
{
    solve1();
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int main(){
  string n;
  cin>>n;
  long long a=0;
  int p=n.size();
  for(int i=0;i<p;i++)a+=n.at(i)-'0';
  if(a%9==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3724
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
#include <set>
#include <queue>
using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
    int N, K, ans=0;
    cin >> N >> K;
    while(std::pow(K, ans) <= N){
        ans += 1;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
const int INF = 1001001001001001ll;
int dp[440][440];
vector<int> sum;
int rec(int l,int r){
    if(l+1 == r)return 0;
    if(l == r)return INF;
    if(dp[l][r])return dp[l][r];
    int ret = INF;
    for(int i = l+1;i <= r-1;i++){
        
        ret = min(ret,rec(l,i) + rec(i,r)+sum[r] - sum[l]);
    }
    return dp[l][r] = ret;

}
signed main(){
    int n;cin >> n;
    int a[n];
    rep(i,n)cin >> a[i];
    sum.resize(n+1);
    rep(i,n)sum[i+1] = sum[i] + a[i];
    cout << rec(0,n) << endl;
    return 0;
}

Measured memory_bytes: 5008
n = int(input())
s = list(input())
r = 0
g = 0
b = 0
for c in s:
    if c == 'R':
        r += 1
    elif c == 'G':
        g += 1
    else:
        b += 1

ans = r * g * b

for i in range(n - 1):
    for j in range(i + 1, n):
        if s[i] == s[j]:
            continue
        k = j * 2 - i
        if k >= n or s[k] == s[i] or s[k] == s[j]:
            continue
        ans -= 1

print(ans)


Measured memory_bytes: 9224
<?php
$a = trim(fgets(STDIN));
$b = fgets(STDIN);
$len = strlen($a);

$array_a = str_split($a);
$array_b =str_split($b);

$cnt=0;
for($i=0; $i<$len; $i++){
  if($array_a[$i] != $array_b[$i])$cnt++; 
}
echo $cnt;
?>

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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)


template <typename T>
void printV(vector<T> A) {
    if (A.empty()) cerr << "EMTPY\n";
    else { 
        cerr << "\n[";
        for (int i = 0; i < A.size() -1 ; ++i) {
            cerr << A[i] << ", ";
        }
        if (A.size()) cerr << A.back() << "]\n";
    }
}


template <typename T>
void printVV(vector<vector<T>> A) {
    cerr << "\n[";
    for (auto v : A) {
        printV<T>(v);
    }
    cerr << "]\n";
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << ": " << arg1 << endl;
}

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


int main(int argc, char **argv) {
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    cout << (t + s) << endl;
    return 0;
}



Measured memory_bytes: 256
N, T = map(int, input().split())
CT = []
res = -1

for i in range(N):
  t1, t2 = map(int, input().split())
  CT.append([t1, t2])

for ct in CT:
  if ct[1] <= T and (ct[0] < res or res < 0):
    res = ct[0]

if res >= 0:
  print(res)
else:
  print("TLE")

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

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int x = x2 - x1;
    int y = y2 - y1;

    cout << x2-y << " " << y2+x << " " << x1-y << " " << y1+x << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    long long n,W;
    cin >> n >> W;
    vector<long long> w(n),v(n);
    for(long long i = 0;i < n;i ++){
        cin >> w.at(i) >> v.at(i);
    }

    vector<vector<long long>> a(n,vector<long long>(W+1));

    for(int i = 0;i < W+1;i ++){
        if(w.at(0) <= i){
            a.at(0).at(i) = v.at(0);
        }
    }

    for(int i = 1;i < n;i ++){
        for(int j = 0;j < W+1;j ++){

            if(j >= w.at(i)){
                long long x = a.at(i-1).at(j);
                long long y = a.at(i-1).at(j-w.at(i)) + v.at(i);
                a.at(i).at(j) = max(x,y);
            }else{
                long long x = a.at(i-1).at(j);
                a.at(i).at(j) = x;
            }
        }
    }

    cout << a.at(n-1).at(W) << endl;
}

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

#define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for( int i = 0; i < (n); i++ )
#define Rrep(i, a, n) for( int i = (a); i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii;
typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

signed main() {
    map<int, int> m;
    int N;

    cin >> N;
    Rep(i, N) {
        int a; cin >> a;
        m[a]++;
    }

    int ans = 0;
    for ( map<int, int>::iterator it = m.begin(); it != m.end(); it++ ) {
        if ( (*it).fr < (*it).sc ) ans += (*it).sc - (*it).fr;
        if ( (*it).fr > (*it).sc ) ans += (*it).sc;
    }

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


Measured memory_bytes: 6272
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

int N, M, K, Q, W, H, R, C;
int dp[1100][1100];

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

    cin >> Q;
    vector<int> ans;

    REP(i, Q) {
        string a, b;
        cin >> a >> b;
        memset(dp, 0, sizeof(dp));

        FOR(i, 1, (int)a.size() + 1) {
            FOR(j, 1, (int)b.size() + 1) {
                if (a[i - 1] == b[j - 1]) chmax(dp[i][j], dp[i - 1][j - 1] + 1);
                chmax(dp[i][j], dp[i - 1][j]);
                chmax(dp[i][j], dp[i][j - 1]);
            }
        }
        /*
        REP(i, (int)a.size() + 1) {
            REP(j, (int)b.size() + 1) { cout << dp[i][j] << " "; }
            cout << endl;
        }
        */
        ans.push_back(dp[(int)a.size()][(int)b.size()]);
    }

    for (auto i : ans) {
        cout << i << endl;
    }

    return 0;
}



Measured memory_bytes: 7940
//#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define int long long
#define ll long long
#define str string
#define db double
#define ac() cout<<"Yes"<<endl;
#define wa() cout<<"No"<<endl;
#define ddd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed long long (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed long long (a)=0;(a)<(b);(a)++)
#define re readdd()
#define pr(a) printtt(a)
#define pee puts("");
#define eee putchar(' ');
#define pss(a) push_back(a)
#define ps(a) push(a)
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1%mod;while(b){if(b&1)ans=(long long)ans*a%mod;
a=(long long)a*a%mod;b>>=1;}return ans;}
int readdd(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void printtt(int x){if(x<0)putchar('-'),x=-x;
if(x>=10)printtt(x/10);putchar(x%10+'0');}
bool addd(int a,int b){return a>b;};
//


signed main(){
    int n=re,m=re;
    int ans=n*(n-1)/2;
    ans+=m*(m-1)/2;
    pr(ans);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int Q ;
char ans[35] ;

void DFS ( int , int , int ) ;

int main ( )
{
	//freopen ( "input.txt" , "rt" , stdin ) ;
	//freopen ( "output.txt" , "w+t" , stdout ) ;
	while ( scanf ( "%d" , &Q ) == 1 && Q ) {
		DFS ( Q , 0 , -1 ) ;
	}
	return 0 ;
}

void DFS ( int source , int sum , int idx )
{
	if ( sum > 0 && sum <= Q ) {
		
		ans[idx] = source + '0' ;
		ans[idx + 1] = '\0' ;
		if ( sum == Q ) {
			for ( int i = 0 , j = 0 ; ans[i] ; j++ ) {
				if ( ( j & 1 ) == 1 && ans[i] ) {
					putchar ( ' ' ) ;
				}
				else {
					printf ( "%d" , ans[i] - '0' ) ;
					i++ ;
				}
			}
			putchar ( '\n' ) ;
		}
	}
	for ( int i = source ; i > 0 ; i-- ) {
		if ( sum + i <= Q ) {
			DFS ( i , sum + i , idx + 1 ) ;
		}
	}
}

Measured memory_bytes: 1032
m,D=map(int,input().split())
ans=0
d=str(D)
M=0

for i in range(1,m+1):
  for j in range(10,D+1):
    j=str(j)
    j1=int(j[0])
    j2=int(j[1])
    if j1>=2 and j2>=2:
      M=j1*j2
      if i==M:
        ans+=1
print(ans)

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

typedef long long ll;

ll N, M;
vector<vector<ll>> Adj;
vector<bool> Seen;
ll C;

void dfs(ll v) {
  if (Seen[v]) return;
  Seen[v] = true;
  for (ll w : Adj[v]) {
    if (!Seen[w]) dfs(w);
  }
}
int main() {
  cin >> N >> M;
  Adj.resize(N);
  for (ll i = 0; i < M; ++i) {
    ll x, y, z;
    cin >> x >> y >> z;
    --x;
    --y;
    Adj[x].push_back(y);
    Adj[y].push_back(x);
  }
  Seen.resize(N);
  for (ll v = 0; v < N; ++v) {
    if (!Seen[v]) {
      ++C;
      dfs(v);
    }
  }
  cout << C << endl;
  return 0;
}


Measured memory_bytes: 8832
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>


using namespace std;

void dfs(int qi, int p, int x, vector<vector<int>>& g, vector<long>& ans) {

  int a = ans[qi]+x;
  ans[qi] = a;
  x = a;
  for(auto v : g[qi] ) {
    if(v == p) continue;
    dfs(v,qi,x,g,ans);
  }
}

int main() {
  int n,q;
  cin >> n >> q;
  vector<vector<int>> g(n+1);
  vector<long> ans(n+1,0);

  for (int i=0; i<n-1; i++) {
    int a,b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  for (int i=0; i<q; i++) {
    int qi,x;
    cin >> qi >> x;
    ans[qi] += x;
  }

  dfs(1,-1,0,g,ans);

  for (int i=1; i<=n; i++) {
    cout << ans[i] << (i==n? '\n' : ' ');
  }
}

Measured memory_bytes: 27392
#include <stdio.h>
#include <algorithm>
#pragma warning(disable: 4996)

int main () {
	long long l, r; scanf("%lld %lld", &l, &r);
	if ((l - 1) / 2019 != r / 2019) {
		printf("0"); return 0;
	}
	l %= 2019; r %= 2019;
	int ans = 2018;
	for (int i = l; i <= r + 1; i++) {
		for (int j = i + 1; j <= r; j++) {
			ans = std::min(ans, (i * j) % 2019);
		}
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

int main()
{
    int n, m;
    std::cin >> n >> m;

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

    std::sort(a.begin(), a.end(), std::greater<int>());

    std::vector<int> num_matches = { 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 };

    std::vector<int> dp_num(n + 1, 0);

    for (int i = 0; i <= n; i++) {
        for (auto num : a) {
            if (i + num_matches[num] <= n) {
                dp_num[i + num_matches[num]] = std::max(dp_num[i + num_matches[num]], dp_num[i] + 1);
            }
        }
    }

    std::vector<std::string> dp(n + 1, "");

    for (auto num : a) {
        if (num_matches[num] <= n) {
            dp[num_matches[num]] = std::max(dp[num_matches[num]], std::to_string(num));
        }
    }

    for (int i = 0; i <= n; i++) {
        if (dp[i] == "") {
            continue;
        }

        for (auto num : a) {
            if (i + num_matches[num] > n) {
                continue;
            }

            if (dp[i + num_matches[num]].length() <= dp[i].length()) {
                dp[i + num_matches[num]] = dp[i] + std::to_string(num);
            } else if (dp[i + num_matches[num]].length() == dp[i].length() + 1) {
                dp[i + num_matches[num]] = std::max(dp[i + num_matches[num]], dp[i] + std::to_string(num));
            }
        }
    }

    std::cout << dp[n] << std::endl;
}


Measured memory_bytes: 33536
/*
 * main.c
 *
 *  Created on: 2020/03/28
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}

void yesno(int ans) {
	if (ans == 1) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	return;
}

int main()
{
	ll X = 0;
	ll i = 0;
	scanf("%lld", &X);
	int j = 0;
	for (i = 100; i < X; ) {
		i = i + (i * 0.01);
		j++;
	}
	printf("%lld\n", j);
	return 0;
}


Measured memory_bytes: 1712
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    x,t = (int(_) for _ in input().split())
    
    print(max(x-t,0))
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3812
import sys
from collections import deque
input = sys.stdin.readline

def main():
    h, w, k = map(int, input().split())
    sx, sy, gx, gy = map(int, input().split())

    c = [input() for i in range(h)]

    not_yet = deque([(sx-1, sy-1)])
    dist = [[-1]*w for i in range(h)]
    dist[sx-1][sy-1] = 0
    already = [[False]*w for i in range(h)]
    already[sx-1][sy-1] = True

    while not_yet:
        x, y = not_yet.popleft()
        d = dist[x][y]

        for i in range(x+1, x+k+1):
            if i >= h or c[i][y] == "@":
                break
            if already[i][y] and dist[i][y] < d + 1:
                break
            if already[i][y] and dist[i][y] == d + 1:
                continue
            dist[i][y] = d + 1
            already[i][y] = True
            not_yet.append((i, y))

        for i in range(x-1, x-k-1, -1):
            if i < 0 or c[i][y] == "@":
                break
            if already[i][y] and dist[i][y] < d + 1:
                break
            if already[i][y] and dist[i][y] == d + 1:
                continue
            dist[i][y] = d + 1
            already[i][y] = True
            not_yet.append((i, y))
        
        for i in range(y+1, y+k+1):
            if i >= w or c[x][i] == "@":
                break
            if already[x][i] and dist[x][i] < d + 1:
                break
            if already[x][i] and dist[x][i] == d + 1:
                continue
            dist[x][i] = d + 1
            already[x][i] = True
            not_yet.append((x, i))

        for i in range(y-1, y-k-1, -1):
            if i < 0 or c[x][i] == "@":
                break
            if already[x][i] and dist[x][i] < d + 1:
                break
            if already[x][i] and dist[x][i] == d + 1:
                continue
            dist[x][i] = d + 1
            already[x][i] = True
            not_yet.append((x, i))

    ans = dist[gx-1][gy-1]
    print(ans)

    
if __name__ == "__main__":
    main()



Measured memory_bytes: 45388
N, M = map(int, input().split())
X = list(map(int, input().split()))
 
if N >= M:
    print('0')
else:
    X.sort()
    Y = []
    for i in range(M-1):
        Y.append(X[i+1] - X[i])
    Y.sort(reverse=True)
    print((X[M-1]-X[0]) - sum(Y[:N-1]))


Measured memory_bytes: 13960
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp2
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] monsterNumbers = Console.ReadLine().Split(' ');
            string[] limits = Console.ReadLine().Split(' ');

            long killNumber = 0;
            int nextMonsterNumber = int.Parse(monsterNumbers[0]);

            for (int i = 0; i < N; i++)
            {
                int mNumber = nextMonsterNumber;
                nextMonsterNumber = int.Parse(monsterNumbers[i + 1]);
                int limit = int.Parse(limits[i]);
                if (mNumber >= limit) killNumber += limit;
                else
                {
                    int surplus = limit - mNumber;
                    killNumber += mNumber;
                    if (nextMonsterNumber >= surplus)
                    {
                        nextMonsterNumber -= surplus;
                        killNumber += surplus;
                    }
                    else
                    {
                        killNumber += nextMonsterNumber;
                        nextMonsterNumber = 0;
                    }
                }
            }

            Console.WriteLine(killNumber);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 30172
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int[] point = new int[6];
		int n;
		Scanner scan = new Scanner(System.in);
		Boolean allDifference = true;
		
		n=scan.nextInt();
		Dice4[] dices = new Dice4[n];
		
		for(int i=0;i<n;i++){
			for(int j=0;j<6;j++){
				point[j]=scan.nextInt();
			}
			dices[i]=new Dice4(point);
		}
		scan.close();
		
		for(int i = 0;i<n;i++){
			for(int j=i+1;j<n;j++){
				if(dices[i].Compare(dices[j])==true){
					allDifference=false;
					break;
				}
			}
		}
		if(allDifference)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}
class Dice4{
	int T,F,R,L,B,D;
	int[] MaxMin = new int[2];

	public Dice4(int[] point){
		this.MaxMin[0]=this.MaxMin[1]=point[0];
		this.T=point[0];
		this.F=point[1];
		this.R=point[2];
		this.L=point[3];
		this.B=point[4];
		this.D=point[5];
		for(int i=0;i<6;i++){
			if(this.MaxMin[0]<point[i]){
				this.MaxMin[0]=point[i];
			}
			if(this.MaxMin[1]>point[i]){
				this.MaxMin[1]=point[i];
			}
		}
	}
	
	public Boolean Compare(Dice4 otherdice){
		Boolean Same=true;
		if((this.MaxMin[0]!=otherdice.MaxMin[0])||(this.MaxMin[1]!=otherdice.MaxMin[1]))
			Same=false;
		else{	
			for(int i=0;i<2;i++){
				Same=true;
				this.MoveToBottom(this.MaxMin[i]);
				otherdice.MoveToBottom(otherdice.MaxMin[i]);
				if((this.T!=otherdice.T)){
					Same=false;
				}
				if(Same){
					for(int j=0;j<4;j++){
						if(this.F==otherdice.F&&this.B==otherdice.B&&this.L==otherdice.L&&this.R==otherdice.R){
							Same=true;
							break;
						}
						else
							Same=false;
							otherdice.Move('R');
					}
				}
				if(Same)
					break;
			}
		}
		return Same;
	}
	
	public void MoveToBottom(int point){
		while(true){
			if(this.D==point){
				break;
			}
			else if(this.T==point){
				this.Move('S');
				this.Move('S');
				break;
			}
			else if(this.F==point){
				this.Move('S');
				break;
			}
			else{
				this.Move('R');
			}
		}
	}
	
	public void Move(char move){
		int temp;
		switch(move){
			case 'E':
				temp=this.D;
				this.D=this.R;
				this.R=this.T;
				this.T=this.L;
				this.L=temp;
				break;
			case 'S':
				temp=this.D;
				this.D=this.F;
				this.F=this.T;
				this.T=this.B;
				this.B=temp;
				break;
			case 'W':
				temp=this.D;
				this.D=this.L;
				this.L=this.T;
				this.T=this.R;
				this.R=temp;
				break;
			case 'N':
				temp=this.D;
				this.D=this.B;
				this.B=this.T;
				this.T=this.F;
				this.F=temp;
				break;
			case 'R':
				temp=this.F;
				this.F=this.R;
				this.R=this.B;
				this.B=this.L;
				this.L=temp;
		}
	}
}


Measured memory_bytes: 28884
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

int n;

void saiki(bitset<10> bs, char c, vector<string>& ans, string& s){
  if(bs.count() == n){
    ans.push_back(s);
    return;
  }
  rep(bit, 1<<n){
    if(bit==0) continue;
    bitset<10> add(bit);
    if((bs & add).count() > 0) continue;
    bool ok = false;
    rep(i,n){
      if(add[i]){
        s[i] = c;
        ok = true;
      }
      if(!ok && s[i] == '*'){
        break;
      }
    }
    if(!ok) continue;
    saiki((bs | add), (c+1), ans, s);
    rep(i,n){
      if(add[i]) s[i] = '*';
    }
  }
}

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);
  cin>>n;

  vector<string> ans;
  string s = "";
  rep(i,n){
    s += "*";
  }
  saiki(bitset<10>(0), 'a', ans, s);
  sort(all(ans));
  rep(i,ans.size()){
    cout<<ans[i]<<endl;
  }
}

Measured memory_bytes: 7796
#include<bits/stdc++.h>
#define lli unsigned long long int
#define MOD 1000000007
#define KING 1000000002
#define queen 1000002
#define fi first
#define se second
#define se second
#define nl cout<<'\n'
#define TEST cout<<"TEST",nl
#define pr pair<lli,lli>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define vi vector<lli>
#define vpi vector<pr> 
#define P pair<lli,pr>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define NA(i,s,n) for(lli i=s;i<n;i++)
using namespace std;

void solve(){
    int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; 
    int n; cin>>n; cout<<a[n-1];
    return;
}
int main(){
    fastIO;
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int  main()
{
  int a,b;
  cin>>a>>b;
  int x=1;
  if(b==1)
  {
    cout<<"0";
    return 0;
  }
  int y=a;
  while(y<b)
  {
    y--;
    y+=a;
    x++;
  }
  cout<<x;
} 

Measured memory_bytes: 256