akhauriyash/Code-Regression huggingface dataset:
N = int(input())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


l = make_divisors(N)
answer = 10 ** 12

for i in l[:len(l) // 2 + 2]:
    answer = min(answer, i + N // i - 2)

print(answer)

Measured memory_bytes: 3280
#include <iostream>
#include <vector>

int main(){
    int k;
    std::vector<int> a(5);
    for(auto i = 0; i < 5; i++){
        std::cin >> a.at(i);
    }
    std::cin >> k;

   if(a.at(a.size() - 1) - a.at(0) > k){
       std::cout << ":(" << std::endl;
   }
   else{
       std::cout << "Yay!" << std::endl;
   }

   return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  x,a=LI()

  if x<a:
    return 0
  else:
    return 10

print(main())


Measured memory_bytes: 8092
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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;}

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h1,h2,m1,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	cout<<(h2-h1)*60+(m2-m1)-k<<endl;
}

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

char ar[10][10];
int cnt, h, w;

bool f(int i, int j, int cur)
{
	if (i >= h or j >= w)
		return false;
	if (ar[i][j] == '.')
		return false;
	if (i == h - 1 and j == w - 1 and cur == cnt)
		return true;
	if (i == h - 1 and j == w - 1)
		return false;
	return f(i + 1, j, cur + 1) or f(i, j + 1, cur + 1);
}

int main()
{
	cin >> h >> w;
	for (int i = 0; i < h; ++i)
		for (int j = 0; j < w; ++j) {
			cin >> ar[i][j];
			if (ar[i][j] == '#')
				++cnt;
		}

	cout << (f(0, 0, 1) ? "Possible" : "Impossible");

	return 0;
}


Measured memory_bytes: 384
abc = list(sorted(map(int, input().strip().split())))

if abc[1] == abc[2]:
  c = (abc[1] - abc[0]) // 2 + (2 if (abc[1]-abc[0]) % 2 == 1 else 0)
  print(c)
else:
  c = 0
  p1 = abc[2] - abc[1]
  abc[1] += p1
  abc[0] += p1
  c += p1
  c += (abc[1] - abc[0]) // 2 + (2 if (abc[1]-abc[0]) % 2 == 1 else 0)
  print(c)

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

namespace MSB
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int L = S.Length;
            string WorL = "";
            int count = 0;
            for (int i = 0; i < L; i++)
            {
                WorL = S.Substring(i, 1);
                if (WorL== "x")
                {
                    count++;
                }
            }
            if (count>=8)
            {
                Console.WriteLine("NO");
            }
            else
            {
                Console.WriteLine("YES");
            }
        }
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;
public class Main {
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		double A=sc.nextDouble();
		double B=sc.nextDouble();
		double H=sc.nextDouble();
		double M=sc.nextDouble();
		double Ar=(60*H+M)/2;
		double Br=M*6;
		double ans;
		if(Ar>Br) {
			double ans2;
			ans2=A*A+B*B-2*A*B*Math.cos(Math.toRadians(Ar-Br));
			ans=Math.sqrt(ans2);
		}
		else if(Ar==Br){
			ans=Math.abs(A-B);
		}
		else {
			double ans2;
			ans2=A*A+B*B-2*A*B*Math.cos(Math.toRadians(Br-Ar));
			ans=Math.sqrt(ans2);
		}
		System.out.println(ans);
	}
}


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

int n, ans = 0;
map<int, int> mp;

int main() {
  cin >> n;
  for(int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    ++mp[x];
  }
  for(auto it = mp.begin(); it != mp.end(); ++it)
    if(it->second % 2) ++ans;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
struct fastio { fastio () { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } _io;
template<class T, class U> bool chmax(T& a, const U &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> bool chmin(T& a, const U &b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	long long n;
	cin >> n;
	long long ans = 0;
	for (long long i = 1; i <= n; i++) {
		long long j = n - (i - 1);
		ans += i * j;
	}
	
	for (int i = 0; i < n - 1; i++) {
		long long l, r;
		cin >> l >> r;
		if (l > r) swap(l, r);
		r = (n - r) + 1;
		ans -= (l * r);
	}

	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define whole(x) (x).begin(), (x).end()
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
 
const int N = int(2e5) + 2;
const int LG = 20;
const ll mod = (int)1e9 + 7;
const int INF = (int)1e9 + 7;
const ll linf = 1e18; 
const ld pi = acos(-1);
const int base = 10;
const ld EPS = 1e-9;

int n, a, b;
int main (){
    scanf ("%d %d %d", &n, &a, &b);
    printf ("%d\n", min(n * a, b));
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { cout << p.first << ' ' << p.second; return os; }

#define int i64

vi32 edges[200000];

void solve() {
  int n; cin >> n;
  vector<bool> seen(200000, true);
  rep(i, n) {
    int x, y; cin >> x >> y;
    x--, y--;
    y += 100000;
    edges[x].push_back(y);
    edges[y].push_back(x);
    seen[x] = seen[y] = false;
  }
  int cnt_x, cnt_y;
  function<void(int)> dfs = [&](int v) {
    seen[v] = true;
    if (v < 100000) cnt_x++; else cnt_y++;
    each(u, edges[v]) {
      if (seen[u]) continue;
      dfs(u);
    }
  };
  int ans = 0;
  rep(i, 200000) {
    if (seen[i]) continue;
    cnt_x = 0, cnt_y = 0;
    dfs(i);
    ans += cnt_x * cnt_y;
  }
  cout << ans - n << '\n';
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(long long i=a; i<b; i+=1)
#define repr(i,a,b) for(long long i=a; i<=b; i+=1)
#define vec vector<ll>
#define map map<char,int>
#define repa(p,A) for(auto p:A)
#define pb push_back
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
const double PI=acos(-1);
using namespace std;

int main( ) {
    ll A,B;
    cin>>A>>B;
    rep(i,0,A+1) {
        if(2*i+4*(A-i)==B) {
            cout<<"Yes"<<endl;
            return 0;

        }
        }
     cout<<"No"<<endl;

    }
    


Measured memory_bytes: 3620
import java.util.Scanner;

//Joseph's Potato
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if((n|m)==0)break;
			int k = n-1;
			int r = n;
			boolean[] f = new boolean[n];
			while(r>1){
				int c = 0;
				while(c<m){
					k=(k+1)%n;
					if(!f[k])c++;
				}
				f[k]=true;
				r--;
			}
			for(int i=0;i<n;i++)if(!f[i])System.out.println(i+1);
		}
	}
}

Measured memory_bytes: 26648
// 2020-07-15 21:44:03
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

void answer() {
  ll n, m;
  cin >> n >> m;
  map<ll, ll> mp;
  rep(i, n) {
    ll a;
    cin >> a;
    mp[a]++;
  }
  rep(i, m) {
    ll b, c;
    cin >> b >> c;
    mp[c] += b;
  }
  ll ans = 0;
  for(auto it = mp.rbegin(); it != mp.rend(); it++) {
    if(n <= 0) break;
    ll a, b;
    tie(a, b) = *it;
    debug(a, b);
    ans += a * min(n, b);
    n -= min(n, b);
  }
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 16112
<?php
$str = str();
$current = "";
$prev = "";
$count = 0;
for($i = 0, $len = strlen($str); $i < $len; $i++){
  $current.=$str[$i];
  if($current!=$prev){
    $prev = $current;
    $current = "";
    $count++;
  }
}
echo $count;

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array:";
            echo implode(" ", $val)."\n";
        }else{
            echo "array:array\n";
            foreach($val as $row){
                echo implode(" ", $row)."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}

Measured memory_bytes: 4732
#include<bits/stdc++.h>
#define Abra_Ka_Dabra ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;

const long long mod = 1e9 + 7;
const double PI = acos(-1);
const double EPS = 1e-9;


int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	Abra_Ka_Dabra

	int n, m;
	ll k;
	cin >> n >> m >> k;
	vector<ll> x(n), y(m);
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> y[i];
	}
	for (int i = 1; i < n; i++) {
		x[i] += x[i - 1];
	}
	for (int i = 1; i < m; i++) {
		y[i] += y[i - 1];
	}
	int res = 0;
	for (int i = 0; i < n && x[i] <= k; i++) {
		int l = 0, r = m - 1, maxi = i + 1;
		while (l <= r) {
			int mid = l + (r - l) / 2;
			ll tmp = x[i] + y[mid];
			if (tmp <= k) {
				maxi = i + mid + 2;
				l = mid + 1;
			} else r = mid - 1;
		}
		res = max(res, maxi);
	}
	for (int i = 0; i < m && y[i] <= k; i++) {
		int l = 0, r = n - 1, maxi = i + 1;
		while (l <= r) {
			int mid = l + (r - l) / 2;
			ll tmp = y[i] + x[mid];
			if (tmp <= k) {
				maxi = i + mid + 2;
				l = mid + 1;
			} else r = mid - 1;
		}
		res = max(res, maxi);
	}
	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 6356
#include<stdio.h>
 
#define MAX 26
 
typedef struct{
  int p;
  int l;
  int r;
} Tree;
 
Tree T[MAX];
 
void preorder(int a){
  if(a==-1) return;
 
  printf(" %d",a);
  preorder(T[a].l);
  preorder(T[a].r);
}
 
void inorder(int a){
  if(a==-1) return;
 
  inorder(T[a].l);
  printf(" %d",a);
  inorder(T[a].r);
}
 
void postorder(int a){
  if(a==-1) return;
 
  postorder(T[a].l);
  postorder(T[a].r);
  printf(" %d",a);
}
 
int main(){
  int n,i,id,left,right;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    T[i].p=-1;
    T[i].l=-1;
    T[i].r=-1;
  }
 
  for(i=0;i<n;i++){
    scanf("%d%d%d",&id,&left,&right);
    T[id].l=left;
    T[id].r=right;
    if(left!=-1) T[left].p=id;
    if(right!=-1) T[right].p=id;
  }
 
  for(i=0;i<n;i++){
    if(T[i].p==-1){
      printf("Preorder\n");
      preorder(i);
      printf("\nInorder\n");
      inorder(i);
      printf("\nPostorder\n");
      postorder(i);
    }
  }
  printf("\n");
 
  return 0;
}

Measured memory_bytes: 616
#include <iostream>
#include<iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

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


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

using namespace std;

int main() {
  int len;
  string S;
  
  cin >> S;
  
  len = S.length();
  for (int i = 0; i < len; i++) {
    S.erase(S.begin());
    S.push_back('x');
  }
  
  cout << S;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,ans = 0;
    cin >> n;
    int a[1000];
    for(int i = 0;i < n;i++)cin >> a[i];
    for(int i = 1;i < n;i++){
        if(a[i] == a[i-1]){
            ans++,i++;
        }
    }
    cout << ans << endl;
}

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

int main(){
    long n,i,j=0;
    cin >> n;
    long a[n];
    for(long i=0;i<n;i++){
        cin >> a[i];
        if((a[i])%2==0){
        }else{j++;}
    }
    if(j){
        cout << "first";
    }else{
        cout << "second";
    }
    return 0;
} 

Measured memory_bytes: 1024
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
    String str=sc.next();
    char[] c=str.toCharArray();



    if(c[0]==c[1] && c[2]==c[3] &&c[0]!=c[2] || c[0]==c[2] && c[1]==c[3]&&c[0]!=c[1]||c[0]==c[3] && c[1]==c[2]&&c[0]!=c[1]){
      System.out.println("Yes");
    }else{

        System.out.println("No");
    }
  
  }
}

Measured memory_bytes: 21844
N = int(input())
A = [None] + list(map(int, input().split()))

balls = [None] + ([0] * N)


def ball_in(i):
    k = 2
    n = 0
    while k * i <= N:
        n += balls[k * i]
        k += 1
    return 0 if n % 2 == A[i] else 1

for i in range(N, 0, -1):
    balls[i] = ball_in(i)

M = 0
B = []
for i, b in enumerate(balls[1:]):
    if b == 1:
        M += 1
        B.append(str(i + 1))

print(M)
print(" ".join(B))


Measured memory_bytes: 17844
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int N;
ll A[5050];
vector<int> g[5050];

ll dp[5050][5050][2];
ll memo[5050][2];
int num[5050];
const ll INF=1e18;

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

  int sum=1;
  if(A[now]<0) dp[now][0][1]=A[now];
  else dp[now][0][0]=A[now];

  for(int next:g[now]){
    if(next==par) continue;
    for(int i=0;i<sum;i++){
      for(int j=0;j<num[next];j++){
        for(int k=0;k<2;k++){
          for(int l=0;l<2;l++){
            memo[i+j][k|l]=min(memo[i+j][k|l],dp[now][i][k]+dp[next][j][l]);

            if(dp[next][j][l]<0||(l==0&&dp[next][j][l]<INF)){
              memo[i+j+1][k]=min(memo[i+j+1][k],dp[now][i][k]);
            }
          }
        }
      }
    }

    sum+=num[next];
    for(int i=0;i<sum;i++){
      for(int k=0;k<2;k++){
        dp[now][i][k]=memo[i][k];
        memo[i][k]=INF;
      }
    }
  }
  num[now]=sum;
}

int main(){
  cin>>N;
  for(int i=0;i<N;i++) cin>>A[i];
  for(int i=1;i<N;i++){
    int u,v;
    cin>>u>>v;
    u--;v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }

  for(int i=0;i<=N;i++){
    for(int k=0;k<2;k++){
      for(int j=0;j<=N;j++){
        dp[i][j][k]=INF;
      }
      memo[i][k]=INF;
    }
  }

  dfs(0,-1);

  int ans=N-1;
  for(int i=0;i<N;i++){
    if(dp[0][i][0]<INF) ans=min(ans,i);
    if(dp[0][i][1]<0) ans=min(ans,i);
  }
  cout<<ans<<endl;

  return 0;
}


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

int main(){
	int n;
	while(cin >> n && n){
		int sum = 2;
		int piyo = 2;
		for(int i=1; i<n; ++i){
			sum += piyo;
			piyo++;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int c = sc.nextInt();
        int[][] array = new int[r][c];
        for (int i = 0; i < r; i++) {
            for (int j = 0; j < c; j++) {
                array[i][j] = sc.nextInt();
            }
        }
        
        int count = 0;
        for (int h = 0; h < r - 1; h++) {
            for (int i = h + 1; i < r; i++) {
                int tmp = 0;
                for (int j = 0; j < c; j++) {
                    tmp += (int)Math.pow(Math.abs(array[h][j] - array[i][j]), 2);
                }
                
                double tmp2 = Math.sqrt(tmp);
                if (tmp2 == (int)tmp2) {
                    count++;
                }
            }
        }
        
        System.out.println(count);
    }
}


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

class Program
{
	static void Main(string[] args)
	{			
		//文字列を読み込む
		int[] input = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
		int N = input[0];
		int K = input[1];
		
		int answer = Convert(N, K).Length;
		
		Console.WriteLine(answer);
      
	}

     public static string Convert(int x, int n)
	{
		string result = "";
		while(x > 0){
				result += (x%n).ToString();
				x /= n;
		}
		return result;
	}
}

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

int N;
vector<vector<int>> graph(222222);
vector<int> color(222222,-1);
vector<int> ans(222222,0);

void DFS(int f,int t){
	if(f==-1)color[t]=0;
	for(auto x:graph[t]){
		if(color[x]==-1){
			color[x]=(color[t]+1)%2;
			DFS(t,x);
		}
	}
}

int main(){
	cin >> N;
	for(int i=0;i<N-1;i++){
		int a,b;
		cin >> a >> b;
		a--;
		b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	
	DFS(-1,0);
	
	int c=accumulate(color.begin(),color.begin()+N,0);
	
	if(c<=N/3){
		int used3=0;
		int used12=0;
		for(int i=0;i<N;i++){
			if(color[i]==1)ans[i]=3*(++used3);
		}
		for(int i=0;i<N;i++){
			if(ans[i]==0){
				if(used3<N/3)ans[i]=3*(++used3);
				else{
					ans[i]=3*(used12/2)+((used12)%2)+1;
					used12++;
				}
			}
		}
	}else if((N-c)<=N/3){
		int used3=0;
		int used12=0;
		for(int i=0;i<N;i++){
			if(color[i]==0)ans[i]=3*(++used3);
		}
		for(int i=0;i<N;i++){
			if(ans[i]==0){
				if(used3<N/3)ans[i]=3*(++used3);
				else{
					ans[i]=3*(used12/2)+((used12)%2)+1;
					used12++;
				}
			}
		}
	}else{
		int used1=0;
		int used2=0;
		int used3=0;
		for(int i=0;i<N;i++){
			if(color[i]==0 && used1<(N+2)/3)ans[i]=1+3*(used1++);
			else if(color[i]==1 && used2<(N+1)/3)ans[i]=2+3*(used2++);
			else ans[i]=3*(++used3);
		}
	}
	
	for(int i=0;i<N;i++)printf("%d%c",ans[i],((i<N-1)?(' '):('\n')));
	return 0;
}

Measured memory_bytes: 20096
#include <bits/stdc++.h>
using namespace std; inline void fileio(const char* in, const char* out) { freopen(in, "r", stdin); freopen(out, "w", stdout); } 
#define TD typedef
#define forx(i,n) for(int i = 0; i < (n); ++i)
#define forxr(i,n) for(int i = (n)-1; i >= 0; --i)
TD long long ll; TD long double ld; TD pair<int,int> pii; TD pair<ll,ll> pll; TD vector<int> VI; TD vector<bool> VB; TD vector<ll> VL;
const char nl = '\n'; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; const ld EPS = 1e-9, PI = acos(-1);
#define ff first
#define ss second
#define all(c) c.begin(),c.end()

int main() {
  atexit([](){ cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << nl; });
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout << fixed << setprecision(12);
  // Emily <3
  int n, k; cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    int a; cin >> a;
  }
  k--;
  int ans = 0;
  while (n > 1) {
    n -= k;
    ans++;
  }
  cout << ans << nl;
  return 0;
}



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

using namespace std;

/* typedef */
typedef long long ll;

/* constant */
const int INF = 1 << 30;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;

/* global variables */

/* function */

/* main */
int main(){
    int n, s, t;
    cin >> n;
    vector< pair< int, int> > times(n);
    for (int i = 0; i < n; i++) {
        cin >> s >> t;
        times[i] = make_pair(s, t);
    }
    sort(times.begin(), times.end());

    int ans = 0;
    int tail = NIL;
    for (int i = 0; i < n; i++) {
        s = times[i].first;
        t = times[i].second;
        if (t < tail) 
            tail = t;
        else if (tail < s) {
            ans++;
            tail = t;
        }
    }

    cout << ans << '\n';

}



Measured memory_bytes: 3636
N, M = input().split()
N = int(N)
M = int(M)
S = []
C = []
A = []
zero_flag = False
for m in range(M):
  s, c = input().split()
  s = int(s)
  c = int(c)
  S.append(s)
  C.append(c)
  if s == 2 and c == 0 and N == 2:
    A.append('0')
  elif s == 2 and c == 0 and N == 3:
    A.append('00')
  elif s == 3 and c == 0 and N == 3:
    A.append('0') 
  else:
  	A.append(str((10**(N-(s-1)-1)) * c))
  if s == 1 and c == 0 and N != 1:
    zero_flag = True

flag = False
for a1 in A:
  for a2 in A:
    if a1 != a2 and len(a1) == len(a2):
      if a1 != a2:
        flag = True

if zero_flag:
  print(-1)
elif flag:
  print(-1)
else:
  ans = list(set(A))
  sum_ans = 0
  for a in ans:
    sum_ans += int(a)
  if sum_ans < (10**(N-1)) and N != 1:
  	sum_ans = sum_ans + (10**(N-1)) 
  print(sum_ans)


Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
    int a, b, k;
    scanf("%d%d%d", &a, &b, &k);

    for (int i = a; i <= b; i++){
        if (a + k - 1 >= i || b - k + 1 <= i){
            printf("%d\n", i);
        }
    }

    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#define REP(i, m, n) for(long long i = m; i < n; ++i)
#define CO(n) cout << n << endl
using namespace std;

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

string S;
ll N, cur, ans;

int main()
{
    ios::sync_with_stdio(false);
    cin >> S;
    N = S.length();
    if (N==1) {
        cout << stoi(S) << endl;
        return 0;
    }
    else{
        REP(i, 0, pow(2, N-1)){
            cur = (int)(S[0] - '0');
            bitset<9> bs(i);
            string simb = bs.to_string().substr(9-N+1, 9);
            REP(j, 0, N-1){
                int n = (int)(S[j+1] - '0');
                if (simb[j] == '0') cur = cur*10 + n;
                else{
                    ans += cur;
                    cur = n;
                }
            }
            ans += cur;
        }
        CO(ans);
        return 0;
    }
}

Measured memory_bytes: 256
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque




def main():
    num = int(input())

    now_ind = 1
    while 1:
        if (now_ind + 1) * now_ind >= num * 2:
            break
        now_ind += 1
    hiku = ((now_ind + 1) * now_ind) // 2 - num

    for i in range(now_ind):
        if i + 1 == hiku:
            continue
        print(i + 1)







if __name__ == '__main__':
    main()



Measured memory_bytes: 42728
#include "bits/stdc++.h"
using namespace std;

const int N = 100;
char s[N];
int p;
char term() {
    if(s[p] == '+') {
        p++;
        char c = term();
        c = (c - 'A' + 1) % 26 + 'A';
        return c;
    }
    if(s[p] == '-') {
        p++;
        char c = term();
        c = (c - 'A' - 1 + 26) % 26 + 'A';
        return c;
    } else {
        p++;
        return s[p - 1];
    }
}
string expr();
string factor() {
    if(s[p] == '[') {
        p++;
        string t = expr();
        reverse(t.begin(), t.end());
        p++;
        return t;
    } else {
        char c = term();
        string t;
        t.push_back(c);
        return t;
    }
}

string expr() {
    string res;
    for(;;) {
        if(s[p] == ']' or !s[p]) break;
        res += factor();
    }
    return res;
}

main() {
    while(1) {
        for(int i = 0; i < 100; ++i) s[i] = ' ';
        scanf("%s", s);
        if(s[0] == '.') return 0;
        vector<int> v;
        for(int i = 0; i < 100; ++i)
            if(s[i] == '?') v.emplace_back(i);
        int k = v.size();
        string ans(100, 'Z');
        auto dfs = [&](auto &&f, int x, char y) -> void {
            if(x) s[v[x - 1]] = y;
            if(x == k) {
                p = 0;
                ans = min(ans, expr());
                return;
            } else {
                for(char c = 'A'; c <= 'Z'; c++) f(f, x + 1, c);
            }
        };
        dfs(dfs, 0, 'A');
        cout << ans << "\n";
    }
}



Measured memory_bytes: 3256
#include<stdio.h>
#include<string.h>
#define LEN 100000

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P);
P dequeue();

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s %d", Q[i].name,&Q[i].t);
  }
  head = 1;
  tail = n+1;
  while(head != tail) {
    u = dequeue();
    if(u.t > q) {
      elaps += q;
      u.t -= q;
      enqueue(u);
    } else {
      elaps += u.t;
      u.t = 0;
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}

void enqueue(P x){
  Q[tail] = x;
  if(tail == LEN) tail = 1;
  else tail++;
}

P dequeue(){
  P x = Q[head];
  if(head == LEN) head = 1;
  else head++;
  return x;
}

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

int main(){
	int h, w;
	cin >> h >> w;
	char s[50][50];
	rep(i,h){
	  rep(j,w){
	    cin >> s[i][j];
	  }
	}
	
	bool can = true;
	rep(i,h){
	  rep(j,w){
	    if(s[i][j] == '#'&&s[i][j+1] != '#'&&s[i][j-1] != '#'&&s[i+1][j] != '#'&&s[i-1][j] != '#') can = false;
	  }
	}
	if(can) cout << "Yes" << endl;
	else cout << "No" << endl;
 return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(S, s) S.find(s) != string::npos

int main() {
	int N, q;
	cin >> N >> q;
	vector<priority_queue<int>> PQ(N);
	Rep(i, q) {
		int n;
		cin >> n;
		if (n == 0) {
			int t, x;
			cin >> t >> x;
			PQ[t].push(x);
		}
		else if (n == 1) {
			int t;
			cin >> t;
			if (!PQ[t].empty()) {
				cout << PQ[t].top() << endl;
			}
		}
		else if (n == 2) {
			int t;
			cin >> t;
			if (!PQ[t].empty()) {
				PQ[t].pop();
			}
		}
	}
	return 0;
}


Measured memory_bytes: 4024
import scala.io.Source

object Main extends App {
  var set = (1 to 10000).filter(x => isPrimeNumber(x)).toSet
  val in = Source.stdin.getLines
  for (line <- in) {
    val n = line.toInt
    val count1 = (1 to n / 2)
      .filter(x => set.contains(x))
      .filter(x => set.contains(n + 1 - x))
      .size
    val count2 =
      if (n % 2 == 1 && set.contains((n + 1) / 2)) 1
      else 0

    println(count1 * 2 + count2)
  }

  def isPrimeNumber(value: Int): Boolean = {
    if (value < 2) false
    else if (value == 2) true
    else if (value % 2 == 0) false
    else {
      val sqrt = Math.sqrt(value).toInt
      for (i <- 3 to sqrt by 2) {
        if (value % i == 0) {
          return false
        }
      }

      true
    }
  }
}



Measured memory_bytes: 97012
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	ll x = in(), y = in();
	cout << (x % y == 0 ? -1 : x * (y - 1)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 100005
using namespace std;
long long i,j,k,l,s[N],S[N],n,m,ans,A[N],B[N];
struct node {
	long long x,y;
}a[N];
int main() {
	scanf("%lld%lld",&n,&m);
	for (i=1;i<=n;i++) scanf("%lld%lld",&a[i].x,&a[i].y);
	for (i=1;i<=n;i++) s[i]=s[i-1]+a[i].y;
	for (i=n;i;i--) S[i]=S[i+1]+a[i].y;
	for (i=1;i<=n;i++) A[i]=max(A[i-1],s[i]-a[i].x);
	for (i=n;i;i--) B[i]=max(B[i+1],S[i]-(m-a[i].x));
	ans=0;
	for (i=1;i<=n;i++) ans=max(ans,s[i]-a[i].x);
	for (i=1;i<=n;i++) ans=max(ans,S[i]-(m-a[i].x));
	for (i=1;i<=n;i++) ans=max(ans,s[i]-2*a[i].x+B[i+1]);
	for (i=1;i<=n;i++) ans=max(ans,S[i]-2*(m-a[i].x)+A[i-1]);
	printf("%lld\n",ans);
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>

using namespace std;

int main(void){
  string str;
  string truth = "CODEFESTIVAL2016";
  int count = 0;
  
  cin >> str;
  
  for(int i = 0 ; i < str.length() ; i++){
    if(str[i] != truth[i]) count++;
  }
  
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int line = sc.nextInt();
        if(line%2==0){
        	System.out.println(line);
        }
      else System.out.println(line*2);
    }
}

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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
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(b<a){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

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BContests {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n, a, b;
	    in >> n >> a >> b;
	    int one=0, two=0, three=0;
	    int p = 0;
	    for(int i=0; i<n; i++){
	        in >> p;
	        if(p <= a) one++;
	        else if(a < p && p <= b) two++;
	        else three++;
	    }

	    out << min(min(one, two), three) << endl;
	}
};


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


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

int main(void){
    int i, j, H, W;
    while(1){
        cin >> H >> W; 
        if (H==0 && W==0) break;
        for(i=0; i<H; i++){
            for(j=0; j<W; j++){
                if(i==0 || i==H-1 || j==0 || j==W-1) cout << "#";
                else cout << ".";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
     int n;
     long long a[105];
     cin>>n;
     for (int i = 0; i < n; i++)
         cin>>a[i];
     sort(a,a+n);
     cout<<a[n-1]-a[0]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
int n;
vector<int>msp;
for(int i=2;i<300000;i++){
	bool isprime=false;
	if(i%7==1||i%7==6){
		for(int j=0;j<msp.size();j++){
			if(i%msp[j]==0){isprime=true;break;}
		}
		if(!isprime)msp.push_back(i);
	}
}
while(true){
cin>>n;
if(n==1)break;
cout<<n<<":";
for(int i=0;i<msp.size();i++){
	if(n%msp[i]==0)cout<<" "<<msp[i];
}
cout<<endl;
}
return 0;
}



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

int main() {
  int N, L;
  cin >> N >> L;
  string S[N], s;
  for(int i = 0; i < N; i++) {
    cin >> S[i];
  }

  sort(S, S + N);
  
  for(int i = 0; i < N; i++) {
    s += S[i];
  }
  
  cout << s << endl;
  
  return 0;
}


Measured memory_bytes: 256
#ifdef __LOCAL
  #define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> bool chmin(T &a,T b) {if(a>b) {a=b; return true;} return false;}
#define itn int
#define fi first
#define se second
#define intmax numeric_limits<int>::max()
#define llmax numeric_limits<ll>::max()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;
const ll lnf=1ll<<60;

int main(){
  itn n; cin >> n;
  vector<pii> d(n);
  rep(i,n){
    cin >> d[i].fi >> d[i].se;
  }
  bool f=0;
  rep(i,n-2){
    if(d[i].fi==d[i].se&&d[i+1].fi==d[i+1].se&&d[i+2].fi==d[i+2].se){
      f=1;
    }
  }
  if(f){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main(void){
    // Your code here!
    int N;
    string S;
    cin >> N;
    cin >> S;
    
    vector<int> black(N);
    vector<int> white(N);
    
    for (int i = 0; i < N; i++){
        if (S[i] == '#') black[i] = 1;
        else white[i] = 1;
    }
    
    black.insert(black.begin(), 0);
    white.push_back(0);
    
    vector<int> black_ruisekiwa(N + 1);
    vector<int> white_ruisekiwa(N + 1);
    
    for (int i = 0; i < N; i++){
        black_ruisekiwa[i + 1] = black[i + 1] + black_ruisekiwa[i];
    }
    
    for (int i = N; i > 0; i--){
        white_ruisekiwa[i - 1] = white_ruisekiwa[i] + white[i - 1];
    }
    
    int ans = 999999;
    for (int i = 0; i < N + 1; i++){
        ans = min(ans, black_ruisekiwa[i] + white_ruisekiwa[i]);    
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
using ll=long long;
using ld=long double;
using namespace std;
ll h[110000];
int main(){
    ll n,a,b,c,sum=0,tmp,ans=1e10;
    cin>>n>>a>>b;
    rep(i,0,n)cin>>h[i];
    c=a-b;
    sort(h,h+n);
    ll l=0,r=h[n-1];
    while(l<=r){
      sum=0;
      tmp=(r+l)/2;
      rep(i,0,n)sum+=max((ld)0,ceil(((ld)h[i]-tmp*b)/(ld)c));
      if(tmp>=sum){
        ans=min(ans,tmp);
        r=tmp-1;
      }
      else l=tmp+1;
    }
    cout<<ans;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  char c;
  cin >> c;
  cout << (char) (c + 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
	string w;
	cin >> w;
	int S = w.size();
	for (int i = 0; i < S; i++) {
		int sum = -1;
		for (int j=0; j < S; j++ ) {
			if (w[i] == w[j]) {
				sum = sum + 1;
			                  }
			
		                           }
		if (sum % 2 == 0) {
			cout << "No" << endl;
			return 0;
		                  }


	                            }
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
using System;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
        int a = int.Parse(ReadLine());
        int b = 0;
        for(int i=1;i<=a;i++){
            b += i;
            if(b >= a){
                WriteLine(i);
                break;
            }
        }
    }
}


Measured memory_bytes: 11092
N=int(input())
A=[0]*(N+1)
A[1:N]=list(map(int,input().split()))
#print(A)
totalDis=0
for i in range(N+1):
    totalDis+=abs(A[i+1]-A[i])
ans=0
for i in range(1,N+1):
    if A[i-1]<=A[i]<=A[i+1] or A[i-1]>=A[i]>=A[i+1]:
        ans=totalDis
    elif A[i-1]<=A[i+1]<=A[i] or A[i-1]>=A[i+1]>=A[i]:
        ans=totalDis-abs(A[i+1]-A[i])*2
    else:
        ans=totalDis-abs(A[i]-A[i-1])*2
    print(ans)


Measured memory_bytes: 14940
#include<iostream>

int main(){

	int l;
	while (std::cin >> l){

		if (l == 0)break;

		bool flg = true;
		for (int i = 1, m, n; i <= 12; i++){
			std::cin >> m >> n;
			l -= (m - n);

			if (flg&&l <= 0)std::cout << i << std::endl, flg = false;
			if (i == 12 && l > 0)std::cout << "NA" << std::endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cmath>
#include <vector>
#include <limits>
#include <algorithm>
using namespace std;

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

void bubbleSort( vector<int>& num, vector<char>&mark );
void selectSort( vector<int>& num, vector<char>&  mark );

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

	vector<int> num(n);
	vector<char> mark(n);
	REP( i, n ) cin >> mark[i] >> num[i];

	vector<int> num2(num);
	vector<char> mark2(mark);

	bubbleSort( num, mark );
	cout << "Stable" << endl;

	selectSort( num2, mark2 );
	REP( i, n ) {
		if( mark[i] != mark2[i] ) {
			cout << "Not stable" << endl; 
			return 0;
		}
	}
	cout << "Stable" << endl;

}

void bubbleSort( vector<int>& num, vector<char>&mark ) {
	int flag = 1;
	for( int i = 0; flag == 1; i++ ) {
		flag = 0;
		for( int j = num.size() - 1; j > i; j-- ) {
			if( num[j - 1] > num[j] ) {
				flag = 1;
				swap( num[j - 1], num[j] );
				swap( mark[j - 1], mark[j] );
			}
		}
	}

	REP( i, num.size() - 1
	) cout << mark[i] << num[i] << " ";
	cout << mark[num.size() - 1] << num[num.size() - 1] << endl;

}

void selectSort( vector<int>& num, vector<char>&  mark ) {
	REP( i, num.size() - 1 ) {
		int p = i;
		for( int j = i + 1; j < num.size(); j++ ) {
			if( num[j] < num[p] ) {
				p = j;
			}
		}
		if( p != i ) {
			swap( mark[p], mark[i] );
			swap( num[p], num[i] ); 
		}
	}

	REP( i, num.size() - 1 ) cout << mark[i] << num[i] << " ";
	cout << mark[num.size() - 1] << num[num.size() - 1] << endl;
}



Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define ALL(i) (i).begin(),(i).end()
#define RALL(i) (i).begin(),(i).end(),greater<int>()
using namespace std;
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\n'; }

typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 200005
// #define int long long

signed main(){
    ll X,Y,ans=0;
    cin>>X>>Y;
    while(X<=Y){
        X *= 2;
        ans++;
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;

int main(){
  string s;cin>>s;
  int n=(int)s.size();
  int ans=0;
  for(int i=0;i*2+1<n;i++){
  	ans+=int(s[i]!=s[n-i-1]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  int ans;
  int saidai;
  if (360%N == 0){
    saidai=N;
   }else{
    saidai=gcd(N, 360%N);
   }

 ans=360/saidai; 
 cout << ans <<endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 1e9+7;

int main(){
    ll N, MAX = 0; cin >> N;
    multiset<ll> ST;
    set<ll> ban;
    for(int i = 0; i < N; i++){
        ll x; cin >> x;
        MAX = max(MAX, x);
        if(ST.find(x) != ST.end()) ban.insert(x);
        ST.insert(x);
    }
    for(auto x : ST){
        ll i = 2;
        while(x*i <= MAX){
            ST.erase(x*i);
            i++;
        }
    }
    for(auto x : ban) ST.erase(x);
    cout << ST.size() << endl;

}

Measured memory_bytes: 13760
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

void solve(std::string S){
    cout<< ((S == "ABC")? "ARC":"ABC")<<endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3104
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    sc.close();

    int max = Math.max(a, Math.max(b, c));
    String result = 2 * max == a + b + c ? "Yes" : "No";
    System.out.println(result);
  }
}

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

int main(){
  int N, M; cin >> N >> M;
  multiset<long long> A;
  for(int i=0; i<N; i++){
    long long tmp; cin >> tmp;
    A.insert(tmp);
  }
  for(int i=0; i<M; i++){
    auto itr=--A.end();
    long long m=*itr;
    A.erase(itr);
    A.insert(m/2);
  }
  long long result=0;
  auto itr=A.begin();
  for(int i=0; i<N; i++){
    result+=*itr;
    itr++;
  }
  cout << result << endl;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"
#include <math.h>
int ans;
int main(int argc, char* argv[]){
  float a=0,b=0,c=0;
  scanf("%f %f",&a,&b);
   printf("%.0f",ceil(a/(b*2+1)));
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define N 100010
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template< class T > void prArray(T a,char ch = ' '){
  for(int i=0;i<(int)a.size();i++,cout<<ch){
    if(i) cout<<ch;
    cout<<a[i];
  }
  cout<<endl;
}



signed main(){
  int A,B,C;
  cin>>A>>B>>C;
  
  if(A%2 == 0 || B%2 == 0 || C%2 == 0)cout<<0<<endl;
  else cout<<min({A*B,B*C,C*A})<<endl;
  
  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a>2&&a%3==0){
        cout<<"Possible"<<endl;
        goto ss;        
    }
    if(b>2&&b%3==0){
        cout<<"Possible"<<endl;
        goto ss;
    }
    if(a+b>2&&(a+b)%3==0){
        cout<<"Possible"<<endl;
        goto ss;
    }
    cout<<"Impossible"<<endl;
    ss:;
}


Measured memory_bytes: 256