akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    int n;
    cin >> n;
    string s = to_string(n), t;
    t.resize(s.size());
    repi(i, t){
        *i = s[0];
    }
    if(n <= stoi(t)){
        cout << t << endl;
    }else{
        repi(i, s){
            cout << (char)(s[0] + 1);
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

int main() {
  int m=100000, n;
  scanf("%d", &n);
  for(int i=0;i<n;i++) {
    m*=1.05;
    if (m%1000 != 0)
      m+=1000;
    m=m/1000*1000;
  }
  printf("%d\n", m);
}

Measured memory_bytes: 0
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 105
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S[MAX_INT];
ll cases;

int main() {
	go;
	cin >> N >> M;
    fi(i, 0, N, 1) {
    	cin >> S[i + 1];
    	S[i + 1] += '#';
    	reverse(all(S[i + 1]));
    	S[i + 1] += '#';
    	reverse(all(S[i + 1]));
    }
    fi(i, 0, S[1].size(), 1) {
    	S[0] += '#';
    }
    fi(i, 0, S[1].size(), 1) {
    	S[N + 1] += '#';
    }
    fi(i, 0, N + 2, 1) {
    	cout << S[i] << "\n";
    }

    
	return 0;
}
/*
	Powered by Buggy Plugin
*/




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

int main(){
  char a;
  cin >> a;
  if(a == 'a' || a == 'i' || a == 'u' || a == 'e' || a == 'o'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;

int main(){
    int n;
    cin>>n;
    map<char,ll> mp;
    mp['M']=0;
    mp['A']=0;
    mp['R']=0;
    mp['C']=0;
    mp['H']=0;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        if(mp.count(s[0])==1){
            mp[s[0]]++;
        }
    }
    ll ans=0;
    ans+=mp['M']*mp['A']*mp['R'];
    ans+=mp['M']*mp['A']*mp['C'];
    ans+=mp['M']*mp['A']*mp['H'];
    ans+=mp['M']*mp['R']*mp['C'];
    ans+=mp['M']*mp['R']*mp['H'];
    ans+=mp['M']*mp['C']*mp['H'];
    ans+=mp['A']*mp['R']*mp['C'];
    ans+=mp['A']*mp['R']*mp['H'];
    ans+=mp['A']*mp['C']*mp['H'];
    ans+=mp['R']*mp['C']*mp['H'];
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=10,S=50;
int n,m,s;
int a[S+1],b[S+1],c[S+1],d[S+1];
int lis[N+1];
int ans;
void dfs(int x=1,int now=1){
	if(x==n+1){
		int res=0;
		for(int i=1;i<=s;i++)if(lis[b[i]]-lis[a[i]]==c[i])res+=d[i];
		ans=max(ans,res);
		return;
	}
	lis[x]=now;
	for(int i=now;i<=m;i++)dfs(x+1,i);
}
int main(){
	cin>>n>>m>>s;
	for(int i=1;i<=s;i++)cin>>a[i]>>b[i]>>c[i]>>d[i];
	dfs();
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
signed main()
{
    ll n;
    cin >> n;

    ll best = 1e12;
    repi(i, sqrt(n) + 2) {
        if (n % i == 0) {
            best = min(best, i + n/i - 2);
        }
    }
    put(best);

    return 0;
}

Measured memory_bytes: 3684
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<char> a(26);
    a.at(0)='A';
    a.at(1)='B';
    a.at(2)='C';
    a.at(3)='D';
    a.at(4)='E';
    a.at(5)='F';
    a.at(6)='G';
    a.at(7)='H';
    a.at(8)='I';
    a.at(9)='J';
    a.at(10)='K';
    a.at(11)='L';
    a.at(12)='M';
    a.at(13)='N';
    a.at(14)='O';
    a.at(15)='P';
    a.at(16)='Q';
    a.at(17)='R';
    a.at(18)='S';
    a.at(19)='T';
    a.at(20)='U';
    a.at(21)='V';
    a.at(22)='W';
    a.at(23)='X';
    a.at(24)='Y';
    a.at(25)='Z';
    for(long long i=0; i<s.size(); i++){
        for(int j=0; j<26; j++){
            if(s.at(i)==a.at(j)){
                if(j>25-n){
                    s.at(i)=a.at(j+n-26);
                }
                else{
                    s.at(i)=a.at(j+n);
                }
                break;
            }
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
using namespace std;

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
 int n, m;
 cin >> n >> m;
 for(int i=0;i<n;i++){
  string s;
  cin >> s;
  cout << s << endl << s << endl;
 }
	

return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] list = new int[n];
		int[] newList = new int[n];
		int tmpNum;
		for(int i =0; i<n; i++) {
			tmpNum = Integer.parseInt(sc.next());
			list[i] = tmpNum;
			newList[i] = tmpNum;
		}
		Arrays.sort(newList);
		int tmp = list[0];
		int flg = 0;

		int first = 0;
		int firstIndex = 0;
		int last = 0;
		int lastIndex = 0;
		for(int i=1; i<n; i++) {

			if(flg == 1 && list[i] < tmp) {
				last = list[i];
				lastIndex = i;
				flg = 2;
			}

			if(flg == 0 && list[i] < tmp) {
				first = list[i-1];
				firstIndex = i-1;
				flg = 1;
			}
			tmp = list[i];
		}

		if(flg == 2) {
			list[firstIndex] = last;
			list[lastIndex] = first;
		}else if(flg==1){
			list[firstIndex] = list[firstIndex + 1];
			list[firstIndex + 1] = first;
		}
		int judge = 0;
		for(int i=0;i<n;i++) {
			if(list[i] != newList[i]) {
				judge = 1;
			}
		}

		if(judge==0) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}

	}
}

Measured memory_bytes: 23764
#include<stdio.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const int L=128,C=62;
int s[C*2+2][L+1];int diff,edit[C+1]={0},sz[2*C+2]={0};
static inline int decode(int x){return x<=26?64+x:(x<=52?96-26+x:48+x-52-1);}
static inline int ask(int u,int i,int j)
{
  int len=diff;
  printf("? ");rep(k,sz[u]){len--;putchar(decode(s[u][k]));}len--;putchar(decode(s[u<<1][i]));
  rep(k,sz[u<<1|1]-j){len--;putchar(decode(s[u<<1|1][k+j]));}puts("");fflush(stdout);
  int res;if(scanf("%d",&res)!=0)return res==len;else return -1;
}
static inline void solve(int u,int le,int ri)
{
  if(le==ri){sz[u]=edit[le];rep(i,edit[le]){s[u][i]=le;}return;}
  int mid=(le+ri)>>1;
  solve(u<<1,le,mid);solve(u<<1|1,mid+1,ri);
  for(int i=0,j=0;i<sz[u<<1]||j<sz[u<<1|1];)
  {
    if(i<sz[u<<1]&&(j==sz[u<<1|1]||ask(u,i,j))){s[u][sz[u]++]=s[u<<1][i];i++;}
    else{s[u][sz[u]++]=s[u<<1|1][j];j++;}
  }
}
int main(void)
{
  rep(i,C)
  {
    printf("? ");rep(j,L){putchar(decode(i+1));}puts("");fflush(stdout);
    int res;if(!scanf("%d",&res))return -1;
    edit[i+1]=L-res;diff+=L-res;
  }
  solve(1,1,C);
  printf("! ");rep(i,sz[1])putchar(decode(s[1][i]));puts("");fflush(stdout);
  return 0;
}

Measured memory_bytes: 3708
#include <iostream>
#include <string>
#include <vector>

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

int main(void) {
	int H, W, K;
	cin >> H >> W >> K;
	vector<string> s(H);
	rep(i, H) {
		cin >> s[i];
	}
	int ans = 0;
	rep(is, 1 << H) { //行の選択の仕方
		rep(js, 1 << W) { //列の選択の仕方
			//消されない黒の数
			int cnt = 0; 
			rep(i, H) {
				//一番上の行からスタート
				rep(j, W) {
					//行が選択されているとき
					if ((is >> i) & 1) continue;
					//列が選択されているとき
					if ((js >> j) & 1) continue;
					if (s[i][j] == '#') cnt++;
				}
			}
			if (cnt == K) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3160
def ok(str_):
    len_=len(str_)
    for i in range(len_):
        if str_[i] != str_[len_-i-1]:
            return False

    return True

s=input()
len_=len(s)
if not ok(s):
    print('No')
elif not ok(s[:len_//2]):
    print('No')
elif not ok(s[len_//2+1:]):
    print('No')
else:
    print('Yes')


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
typedef long long ll;
#define MOD 1000000007

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    
    if(n == m) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    
    return 0;
}


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

using namespace std;

int a[6];

int main()
{
    for(int i = 1;i <= 5;i++)
        scanf("%d",&a[i]);
    int sum = 0;
    for(int i = 1;i <= 5;i++)
        if(a[i] % 10 != 0)
            sum += a[i] + 10 - a[i] % 10;
        else
            sum += a[i];
    for(int i = 1;i <= 5;i++)
        a[i] = a[i] % 10;
    sort(a + 1,a + 1 + 5);
    int j = 1;
    while(a[j] == 0 && j < 5)
        j++;
    if(a[j] != 0)
        sum -= 10 - a[j];
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 256
/**
 *  author:   TakeruOkuyama
 *  created:  
**/
#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>;

const int MOD = 1000000007;

int main(){
    int a, b;
    cin >> a >> b;
    if(a < 0){
        if(b < 0){
            if(abs(a - b) % 2 == 1){
                cout << "Positive" << endl; 
            }else{
                cout << "Negative" << endl;
            }
        }else{
            cout << "Zero" << endl;
        }
    }else{
        if(a == 0){
            cout << "Zero" << endl;
        }else{
            cout << "Positive" << endl;
        }
    }
return 0;}

/**
 * g++ code.cpp
 * ./a.out
 * shift + ctrl + i
**/ 

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"
 
using namespace std;

bool is_palindrome (int n) {
  vector<int> arr;
  while (n > 0) {
    arr.push_back(n % 10);
    n /= 10;
  }
  for (int i=0; i<int(arr.size()/2)+1; i++) {
    if (arr[i] != arr[arr.size()-1-i]) return false;
  }
  return true;
}

int main() {
  int A, B;
  cin >> A >> B;
  
  int counter = 0;
  for (int i=A; i<=B; i++) {
    if (is_palindrome(i)) counter++;
  }
  cout << counter << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
	int n, x;
	cin >> n >> x;
	int ans = 1;
	int pos = 0;
	vector<int> l(n);
	for (int i = 0; i < n; i++) {
		cin >> l.at(i);
	}
	for (int i = 0; i < n; i++) {
		int t = pos + l.at(i);
		if (t > x) break;
		pos = t;
		ans++;
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;
typedef unsigned long long BITMASK; typedef long long ll; typedef long double ld;
#define has_bit(bit_mask, x) ((bit_mask) & (1Uint << (x)))
#define turn_on_bit(bit_mask, x) (bit_mask |= (1Uint << (x)))
#define turn_off_bit(bit_mask, x) (bit_mask &= (~(1Uint << (x))))
#define smallest_on_bit(bit_mask) (__builtin_ctzint((bit_mask) & (-(bit_mask))))
#define CLOCK_START clock_t chrono_clk_beg = clock()
#define CLOCK_END clock_t chrono_clk_end = clock(); cerr << (double(chrono_clk_end - chrono_clk_beg) / CLOCKS_PER_SEC) << " sec"
#define bug(args ...) cerr << __LINE__ << ">> ", err(new istringstream(string(#args)), args), cerr << '\n'
#define all(x) x.begin(), x.end()
#define mapfind(mp, x) (mp.find(x) != mp.end())
#define removeDuplicates(vec) sort(vec.begin(), vec.end()); vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define int ll
#define double ld
void err(istringstream *iss) {} template<typename T, typename ... Args> void err(istringstream *iss, const T &_val, const Args & ... args) { string _name; *iss >> _name; if (_name.back()==',') _name.pop_back(); cerr << _name << " = " << _val << "; ", err(iss, args ...); }
#define MOD 1000000007

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> arr(n);
    for (int i = 0; i < n; ++i) cin >> arr[i];
    auto x = find(all(arr), 1);
    if (x == arr.end()) cout << "-1\n";
    else
    {
        int cur = 1;
        for (int i = x-arr.begin(); i < n; ++i)
            if (arr[i] == cur+1) cur++;
        cout << (n-cur) << '\n';
    }
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int N;
    cin >> N;
    int t[N+ 1], x[N+1], y[N+1];
    t[0] = x[0] = y[0] = 0;
    for(int i = 1; i < N+1; i++) cin >> t[i] >> x[i] >> y[i];
    bool is_can = true;
    rep(i, N){
        int dt = t[i+1] - t[i];
        int dl = fabs(x[i+1] - x[i]) + fabs(y[i+1] - y[i]);
        if(dt < dl){
            is_can = false;
            break;
        }else if(dt > dl){
            if((dt - dl) % 2 != 0){
                is_can = false;
                break;
            }
        }
    }
    if(is_can) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1408
import math
N,M=map(int,input().split())
m=min(N,M)
M=max(N,M)
r=10**9+7
if M-m>1:print(0)
if M-m==1:print(math.factorial(M)**2//M%r)
if M==m:print(2*math.factorial(M)**2%r)

Measured memory_bytes: 4740
#include<bits/stdc++.h>
#define Mod 998244353
#define ll long long
using namespace std;
int n,k;
ll c[500100],f[500100];
int l[500010],r[500010];
void add(int x,int y) {
	for(;x<=n;x+=x&(-x))
		c[x]=(c[x]+y+Mod)%Mod; 
}
ll ask(int x) {
	ll ans = 0;
	for(;x;x-=x&(-x))
		ans=(ans+c[x]+Mod)%Mod;
	return ans%Mod;
}
int main() {
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++)
		scanf("%d%d",&l[i],&r[i]);
	f[1]=1;
	for(int i=1;i<=n;i++) {
		if(i>=2) f[i]=ask(i);
		for(int j=1;j<=k;j++) {
			add(i+l[j],f[i]);
			add(i+r[j]+1,-f[i]);
		}
	}
	printf("%d\n",f[n]);
	return 0;
}

Measured memory_bytes: 6856
from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
kaburi = 0
for i in range(n):
    if s[n-i-1:] == t[:i+1]:
        kaburi = max(i+1,kaburi)
print(n*2-kaburi)

Measured memory_bytes: 3060
n, k = map(int, input().split())
h = []
for _ in range(n):
    h.append(int(input()))

h.sort()

d = []
for i in range(n + 1 - k):
    d.append(h[i + k - 1] - h[i])
    if h[i + k - 1] - h[i] == 0:
        break

print(min(d))

Measured memory_bytes: 55896
#include "bits/stdc++.h"
/*#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>
*/
#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}
inline int  in(){int n;scanf("%lld",&n);return n;}
inline void out(int n){printf("%lld\n",n);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int dp[100010];
vi table;

int n;

void init(){
    fill(dp,dp+100010,INF);
    int i=6;
    table.pb(1);
    while(true){
        if(i>100000) break;
        table.pb(i);
        i*=6;
    }
    i=9;
    while(true){
        if(i>100000) break;
        table.pb(i);
        i*=9;
    }
    rep(i,table.size()) dp[table[i]]=1;
}

signed main(){
    io();

    init();
    cin>>n;
    for(int cnt=1;;cnt++){
        if(dp[n]!=INF) break;
        REP(i,1,100001){
            rep(j,table.size()){
                if(i+table[j]>100000) continue;
                
                dp[i+table[j]]=min(dp[i]+1,dp[i+table[j]]);
            }
        }
    } 
    cout<<dp[n]<<endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
    int n;
    cin >> n;
    int count = 0;
    for (int i = 1; i <= n; i++)
    {
        if(to_string(i).size() %2 != 0)
        {
            count++;
        }
    }
    cout << count << endl;
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long v = sc.nextLong();
    long b = sc.nextLong();
    long w = sc.nextLong();
    long t = sc.nextLong();
    if(v <= w){
      System.out.println("NO");
      return;
    }
    long distance = Math.abs(a - b);
    long speed = Math.abs(v - w);
    if(distance > t * speed){
      System.out.println("NO");
      return;
    }
    System.out.println("YES");
  }
}

Measured memory_bytes: 35460
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;
 
int main() {
	int N = 0;
	int max,sum1,sum2;
	vector <int> V(20,0);
	vector <int> C(20,0);

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

	for(int j = 0;j < N;j++){
		cin >> C[j]; 
	}

	for(int k = 0; k < N;k++){
		if(V[k] > C[k] && V[k]!=C[k]){
			sum1 += V[k];
			sum2 += C[k];
		}
	}

	cout << sum1 - sum2 << endl;
	return 0;
}

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

// INT VS LL

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

    string s;
    cin >> s;
    int ans = 0, cnt = 0;
    for (auto c: s){
    	if (c == 'R'){
    		cnt++;
    	}
    	else{
    		cnt = 0;
    	}
    	ans = max(ans, cnt);

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

Measured memory_bytes: 3644
#define _CRT_SECURE_NO_WARNINGS
#define TASK "C-large"
#pragma comment(linker, "/STACK:1710886400")
#include <stdio.h>
#include <iostream>
#include <iomanip> 
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>
#include <assert.h>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <random>
#include <complex>
using namespace std;

const int MOD = 1000000007;
const int INF = 1000000007;
const long double EPS = 1e-6;
const int HASH_POW = 29;
const long double PI = acos(-1.0);
mt19937_64 rnd(1);

double workTime()
{
	return double(clock()) / CLOCKS_PER_SEC;
}

void my_return(int code)
{
#ifdef MYDEBUG
	cout << "\nTime = " << fixed << setprecision(3) << workTime() << endl;
#endif
	exit(code);
}

int fact(int n)
{
	int ans = 1;
	for (int i = 2; i <= n; ++i)
		ans = ans * 1ll * i % MOD;
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#ifdef MYDEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	/*freopen(TASK".in", "r", stdin);
	freopen(TASK".out", "w", stdout);*/
#endif

	int n, m;
	scanf("%d %d", &n, &m);
	if (n < m)
		swap(n, m);
	if (n - m > 1)
		printf("0\n");
	else if (n - m == 1)
		printf("%d\n", fact(n)*1ll*fact(m) % MOD);
	else
		printf("%d\n", 2ll*fact(n)*fact(m) % MOD);
	
	my_return(0);
}


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

int main(){
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	
	bool dp[k+1];
	memset(dp,0,sizeof(dp));
	
	for(int i=1;i<=k;i++){
		for(int val: a){
			if(val>i)
			continue;
			
			if(dp[i-val]==0)
			dp[i]=1;
		}
	}
	
	if(dp[k])
	cout<<"First"<<endl;
	else
	cout<<"Second"<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <map>

int main()
{
	std::map<std::string, int> count_map;
	std::string str{};
	int max_length = 0;
	std::string max_str{};
	int hist_max_count = 0;
	std::string hist_max_str{};

	while (std::cin >> str)
	{
		if (count_map.count(str) == 0)
		{
			count_map[str] = 1;
		}
		else
		{
			count_map[str]++;
		}

		if (max_length < str.length())
		{
			max_length = str.length();
			max_str = str;
		}

		if (hist_max_count < count_map[str])
		{
			hist_max_count = count_map[str];
			hist_max_str = str;
		}
	}

	std::cout << hist_max_str << " " << max_str << std::endl;
	return 0;
}

Measured memory_bytes: 3064
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
typedef long long int ll;
using namespace std;
#define FOR(i,a,n) for(int i=(ll)a;i<(ll)n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
int main() {
	string s;
	cin >> s;
	int c=-1, f=-1;
	TFOR(i, s.size()) {
		if (s[i] == 'C'&&c == -1)c = i;
		if (s[i] == 'F')f = i;
	}
	cout << (c != -1 && f != -1 && c < f ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
import math
N,K = map(int,input().split())
list2 = [1]
tmp = 1
while tmp < 10 ** 5 + 1:
    tmp *= 2
    list2 += [tmp]

L2 = len(list2)
ans = 0
for i in range(1,N+1):
    tmp = math.ceil(K/i)
    
    for j in range(L2):
        if tmp <= list2[j]:
            break
    ans += list2[j] ** (-1)
ans /= N
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
 
#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.size()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>());
#define VSORT(v) sort(v.begin(),v.end());
#define VGSORT(v) sort(v.begin(),v.end(),greater<int>());
#define REV(a) reverse(begin(a),end(a));
#define FIND(v,i) find(v.begin(),v.end(),i);

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////
	int n;
  string s;
    cin >> n >> s;
    int cnt=0;
    int ans=0;
    REP(i,n){
        if(s[i]=='I') cnt++;
        else cnt--;
        ans=max(ans,cnt);
    }
    cout << ans << endl;


/////////////////////////////////////////////
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int P = 998244353;
inline int add(int a, int b) {if((a += b) >= P) a -= P; return a;}
inline int sub(int a, int b) {if((a -= b) < 0) a += P; return a;}
inline int mul(int a, int b) {return 1ll * a * b % P;}
inline int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----
const int N = 4020;
int n, k;
int c[N][N], p2[N];
int gao(int n, int k, int p) {
	int res = 0;
	rep(q, 0, p + 1) {
		int t = mul(mul(c[p][q], p2[q]), c[n + k - 2 * p - 1][q + k - 2 * p - 1]);
		res = add(res, t);
	}
	return res;
}
int main(){
	c[0][0] = p2[0] = 1;
	rep(i, 1, N) rep(j, 0, i + 1) c[i][j] = j == 0 ? 1 : add(c[i - 1][j - 1], c[i - 1][j]);
	rep(i, 1, N) p2[i] = mul(p2[i - 1], 2);
	scanf("%d%d", &k, &n);
	rep(i, 2, k + k + 1) {
		int p = 0;
		bool same = 0;
		for(int j = 1; j + j <= i; j++) {
			if(i - j >= 1 && i - j <= k) {
				p++;
				if(i - j == j) {
					same = 1;
					p--;
				}
			}
		}
		int ans = 0;
		if(same) {
			ans = add(gao(n, k - 1, p), gao(n - 1, k - 1, p));
		} else {
			ans = gao(n, k, p);
		}
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 61952
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <tuple>
#define FOR0(var, max) for (ui (var) = 0; (var) < (max); ++(var))
#define FOR_INV(var, min, max) for (ui (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

const static ui QMAX = 100000;
const static ui LMAX = 100000;
const static ui RMAX = 100000;

static ui Q, R;
static pair<ui, ui> Qi[QMAX];
static ui Sums[RMAX];

bool is_prime(ul x) {
  if (x == 2 || x == 3 || x == 5 || x == 7) {
    return true;
  } else if (x <= 1 || (x & 1) == 0 || x == 4 || x == 6 || x == 8 || x == 9) {
    return false;
  }

  for (ul i = 2; i * i <= x; i++) {
    if ((x % i) == 0) {
      return false;
    }
  }
  return true;
}

bool is_similar(ul n) {
  if ((n & 1) == 0) {
    return false;
  }
  // cout << n << ", " << ((n + 1) / 2) <<  ", " << (is_prime(n) && is_prime((n + 1) / 2)) << endl;
  return is_prime(n) && is_prime((n + 1) / 2);
}

void solve(void) {
  Sums[0] = 0;
  FOR0(_i, R) {
    ui i = _i + 1;
    Sums[i] = Sums[_i] + (is_similar(i) ? 1 : 0);
  }
  FOR0(i, Q) {
    auto x = Qi[i];
    auto l = x.first;
    auto r = x.second;
    cout << Sums[r] - Sums[l - 1] << endl;
  }
}

int main(void) {
  cin >> Q;
  R = 0;
  FOR0(i, Q) {
    ui l, r;
    cin >> l >> r;
    Qi[i] = make_pair(l, r);
    R = max(R, r);
  }
  solve();
  return 0;
}

Measured memory_bytes: 1920
#include<stdio.h>

int main(void){
	int n,i,l;
	long a[5000],ans,s;
	
	for(i=0;i<5000;i++)a[i]=NULL;
	
	while(scanf("%d",&n)){
		if(n==0)break;
		ans=-100000;
		for(i=0;i<n;i++){
			scanf("%ld",&a[i]);
		}
		
		for(i=0;i<n;i++){
			s=0;
			for(l=i;l<n;l++){
				s+=a[l];
				if(ans<s)ans=s;
			}
		}
		
		printf("%ld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { 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; }
const long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;

int main(int argc, char const *argv[]) {
    ll n;
    cin >> n;
    map<ll, ll> m;
    rep(i,n){
        m[i]=0;
    }
    rep(i,n-1){
        ll a;
        cin >> a;
        m[a-1]++;
    }
    rep(i,n){
        cout << m[i] << endl;
    }

    return 0;
}


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

int main()
{
	string S;
	cin >> S;

	int ans = 0;

	for (int i = 0; i < S.length(); i++)
	{
		if(i % 2 == 1){
			if(S[i] == 'R')
				ans = 1;
		}
		else{
			if(S[i] == 'L')
				ans = 1;
		}
	}
	if(ans == 1){
		cout << "No" <<endl;
	}
	else{
		cout << "Yes" << endl;
	}

	return 0;
}

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

int main(int argc, const char * argv[]) {
    int a, b, c;
    int temp_a, temp_b, temp_c;
    int cnt;
    bool bin;
    
    //初期化
    cnt = 0;
    bin = true;
    
    cin >> a >> b >> c;
    
    if (!(a%2==0 && b%2==0 && c%2==0)) {
        bin = false;
    }
    
    while (bin == true) {
        temp_a = a;
        temp_b = b;
        temp_c = c;
        
        temp_a = b/2 + c/2;
        temp_b = a/2 + c/2;
        temp_c = a/2 + b/2;
        
        if (temp_a==a && temp_b==b && temp_c==c) {
            cnt = -1;
            break;
        }else if (temp_a%2==0 && temp_b%2==0 && temp_c%2==0) {
            a = temp_a;
            b = temp_b;
            c = temp_c;
        }else{
            bin = false;
        }
        cnt++;
    }
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
	if(a * b % 2 == 0) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

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

int fact(int n)
{
	if(n==0 || n==1)
		return 1;
	else
		return n*fact(n-1);
}

int main()
{
	int n,i,x,j,rank1=0,rank2=0,count;
	int arr[10];
	vector <int> v1,v2;
	cin >> n;
	for(i=0;i<n;i++)
	{
		cin >> x;
		v1.push_back(x);
	}
	for(i=0;i<n;i++)
	{
		cin >> x;
		v2.push_back(x);
	}
	memset(arr,0,10*sizeof(int));
	for(i=0;i<n;i++)
	{
		x = v1[i];
		count=0;
		for(j=1;j<v1[i];j++)
		{
			if(arr[j]==0)
				count++;
		}
		rank1 += count*fact(n-i-1);
		arr[x]=1;
	}
	rank1++;
	memset(arr,0,10*sizeof(int));
	for(i=0;i<n;i++)
	{
		x = v2[i];
		count=0;
		for(j=1;j<v2[i];j++)
		{
			if(arr[j]==0)
				count++;
		}
		rank2 += count*fact(n-i-1);
		arr[x]=1;
	}
	rank2++;
	cout << abs(rank1-rank2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	int n,k;
	cin>>n>>k;
	int sum=0;
	sum+=pow(n/k,3);
	if(k%2==0){
		sum+=pow((n+k/2)/k,3);
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
using namespace std;

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;

#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0,};


int N,M;
// bool checked[100010];




int main() {
  cin >> N >> M;
  int ans = 0;
  int a,b;
  vpint req(M);
  rep(i,M){
    cin >> a >> b;
    req[i] = mp(a,b);
  }
  sort(req.begin(),req.end());
  int left,right;
  left = 0;
  right = 0;


  rep(i,M){
    if(left==req[i].fi){
      // checked[i] = true;
      // right = min(right,req[i].se);
      continue;
    }
    if(req[i].fi < right){
      // checked[i] = true;
      // left = max(left, req[i].fi);
      right = min(right,req[i].se);
      continue;
    }
    ans++;
    left = req[i].fi;
    right = req[i].se;

  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
//--------------------------------------------------template----------------------------------------//
//c
#include <stdio.h>
#include <time.h>
#include <math.h>
//c++
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <complex>
#include <cmath>
//c++11
#include <tuple>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
//#define sort(v,n) sort(v,v+n)
//#define vsort(v) sort(v.begin(),v.end())
//#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int n, k;
int a[100], b[100];
int s[100];
int main() {
	cin >> n >> k;
	for (int i = 0; i <= n; i++)s[i] = 0;
	for (int i = 0; i < k; i++) {
		cin >> a[i] >> b[i];
		s[a[i]]++;
		s[b[i]]++;
	}
	for (int i = 1; i <= n; i++) {
		cout << s[i] << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
void solve();
int main()
{
	int t = 1;
//	cin >> t;
	for(int i=1; i <= t; i++)
	{
		solve();
		cout << '\n';
	}
	return 0;
}

void solve()
{
	lli a; cin >> a;
	string res;
	while(a)
	{
		int tmp = a % 26;
		if(tmp == 0) tmp = 26;
		res += (char)(tmp + 'a' - 1);
		a -= tmp;
		a /= 26;
	}
	reverse(res.begin(), res.end());
	cout << res << '\n';
}

Measured memory_bytes: 3600
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);
    
    public static void main(String[] args) throws Exception {
        int n = sc.nextInt();
        int sum = 0;
        ArrayList<Integer> problemList = new ArrayList<>();
        
        for(int i = 0; sum <= n; ++i) {
            sum += i;
            problemList.add(i);
        }
        
        int diff = sum - n;
        problemList.remove(diff);
        
        for(int i = 0; i < problemList.size(); ++i) {
            if(problemList.get(i) > 0) System.out.println(problemList.get(i));
        }
    }
}


Measured memory_bytes: 22612
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10


def main():
	N = INT()
	S = input()

	s1 = []
	dic_s2 = defaultdict(int)

	for x in product([0, 1], repeat=N):
		s1_red = ""
		s1_blue = ""
		s2_red = ""
		s2_blue = ""
		for i in range(N):
			if x[i]:
				s1_red += S[i]
				s2_red += S[N+i]
			else:
				s1_blue += S[i]
				s2_blue += S[N+i]

		s1.append((s1_red, s1_blue))
		dic_s2[(s2_blue[::-1], s2_red[::-1])] += 1

	ans = 0
	for x in s1:
		ans += dic_s2[x]

	print(ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 271676
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
class UnionFind{
private:
	vector<int> Parent;
public:
	UnionFind(int N){rep(i,N) Parent.push_back(-1);}
	int root(int A){
		if(Parent[A]<0) return A;
		else return root(Parent[A]);
	}
	int size(int A){return -Parent[root(A)];}
	bool connect(int A,int B);
};

signed main(){
    int a,b,x;
    cin>>a>>b>>x;
    int ans;
    ans = b/x-a/x;
    if(a/x*x==a) ans++;
    cout<<ans<<endl;
}


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

ll beki[200020];
ll l[200020],r[200020];

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--) 
#define Rep(i,a) for(int i = 0; i < a; i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ab(x) ((x) < 0 ? -(x) : (x))
using namespace std;
typedef long long LL;
typedef map<int, int>::iterator mit;
typedef set<int>::iterator sit;
typedef pair<int, int> pii;
#define x first
#define y second
const int N = 310;
int n, m, a[N][N];
bool vis[N];
int main() {
	scanf("%d%d",&n,&m);
	rep(i,1,n) rep(j,1,m) scanf("%d",&a[i][j]);
	int ans = n; memset(vis, true, sizeof(vis));
	rep(i,1,m) {
		int mx = 0, mxa = 0;
		static int cnt[N]; memset(cnt, 0, sizeof(cnt));
		rep(j,1,n) rep(k,1,m) if (vis[a[j][k]]) { cnt[a[j][k]]++; break; }
		rep(j,1,m) if (cnt[j] > mx) mx = cnt[j], mxa = j;
		ans = min(ans, mx);
		vis[mxa] = false;
	}
	printf("%d\n",ans);
	return 0;
}


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

int main() {
  long n,ans = 0;
  cin >> n;
  vector<int> ls(n);
  for(int i=0 ;i<n ;i++){
    cin >> ls[i];
  }
  sort(ls.begin(),ls.end());
  for(int i=0 ;i<n-2 ;i++){
    for(int j=i+1 ;j<n-1 ;j++){
      for(int k=j+1 ;k<n ;k++){
        if(ls[i] + ls[j] > ls[k]){
          ans++;
        }
      }
    }
  }

  cout << ans << endl;
}

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

namespace ABC043A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            int s;
            int i;
            //n 個数
            //s 人数

            //にんずうを入力
            n = int.Parse(Console.ReadLine());

            //ひつようなこすうをにゅうりょく
            s = 0;    //0にしょきか

            for (i = 1; i <= n; i++)  //1>>ｎの繰り返し
            {
                s = s + i;       //sをi増やす
            }
                      Console.WriteLine(s);
        
                Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
int mod(ll a){return a%1000000007;};
typedef pair<int,int> i_i;



int main(){
    ll q,h,s,d;cin>>q>>h>>s>>d;
    ll n;cin>>n;n=4*n;
    
    if(h>2*q)h=2*q;
    if(s>2*h)s=2*h;
    if(d>2*s)d=2*s;
    
    ll ans=0;
    ans+=(n/8)*d;
    n-=8*(n/8);
    ans+=(n/4)*s;
    n-=4*(n/4);
    ans+=(n/2)*h;
    n-=2*(n/2);
    ans+=(n/1)*q;
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String b = sc.nextLine();
        if (a.charAt(0) == b.charAt(2) && a.charAt(1) == b.charAt(1) && a.charAt(2) == b.charAt(0)) System.out.println("YES");
        else System.out.println("NO");
    }

}

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

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n;
    cin>>n;

    set<int> s;
    for(int i=1;i<=n;i++){
        int d;
        cin>>d;
        s.insert(d);
    }

    cout<<s.size()<<"\n";

    return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include "math.h"
#include <set>
using namespace std;
#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 RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
 

vector <int > H;
int A,B,C; 
  
int main()
{
  cin >> A>> B >> C;
  cout << max(C-(A-B),0) << endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int _max = 100010;
typedef long long ll;

map<ll,ll>m;

int main()
{
    ll a[200010];
    int n;
    cin>>n;
    int jie=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        jie=jie^a[i];
    }
    for(int i=0;i<n;i++){
        printf("%d ",jie^a[i]);
    }
    return 0;
}

Measured memory_bytes: 5220
#include<bits/stdc++.h>
using namespace std;
int main(){
  int D,K;
  cin>>K>>D;
  //vector<int>ans;
  for(int k=K;k>1;k--){
    cout<<D-k+1<<" ";
  }
  cout<<D<<" ";
  for(int k=1;k<K;k++){
    cout<<D+k<<" ";
  }

}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <valarray>
#include <iterator>
#include <stack>
#include <set>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <list>
#include <map>
#include <strstream>
#include <streambuf>
#include <string>
#include <sstream>

#define def(type,vec) vector<type> vec
#define last(arr) arr.size()-a
#define loop(i,n) for(ll i=0 ; i<n ; ++i)
#define all(v) ((v).begin()),((v).end())
#define pb push_back
#define ll long long
#define iteloop(type,data,name,it) for(type<data>::iterator it=name.begin() ;it!=name.end() ; ++it)

using namespace std;
string int_to_string(int x){
        string str;
        ostringstream temp;
        temp<<x;
        str=temp.str();
        return str;
}

int main(){
    int n,k;
    cin>>n>>k;
    char chr;
    set<char> st;
    loop(i,k){
        cin>>chr;
        st.insert(chr);
    }
    for(int i=n ; i<=100000 ; i++){
        string str=int_to_string(i);
        bool x=true;
        loop(j,str.size()){
            if(binary_search(all(st),str[j])){
                x=false;
            }
        }
        if(x){
            cout<<i<<endl;
            break;
        }
    }
}



Measured memory_bytes: 256
#include <cstdio>

int main(void){
    // Here your code !
   int x;
   int i = 1;
   
   while (1){
       scanf("%d", &x);
       if (x == 0) break;
       printf("Case %d: %d\n", i, x);
       i++;
   }
    return 0;
}

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

    using namespace std;

    int main() {
        int a, b, c;
        cin >> a >> b >> c;
        if(a+b+c >21)
        {
            cout << "bust\n";
        }
        else
        {
            cout << "win\n";
        }
        return 0;
    }

Measured memory_bytes: 256
def judge(all_num, cover_num):
    if ((all_num-1) % (cover_num-1)) == 0:
        return int((all_num-1)/(cover_num-1))
    else:
        return int((all_num-1)/(cover_num-1)) + 1


if __name__ == "__main__" :
    n_k = list(map(int, input().split()))
    array = list(map(int, input().split()))
    min_point = judge(n_k[0], n_k[1])
    print(min_point)

Measured memory_bytes: 14008
#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;

int main() {
	vector<vector<vector<long long>>> U(10000,vector<vector<long long>>(100, vector<long long>(12,1000)));

	int N, M;
	cin >> N >> M;
	cout << M + (max(0, 10 - N) * 100);
}

Measured memory_bytes: 133504
local N = io.read("n")
local p = io.read("n")
local c = 0
local a = 0
for i=2,N do
  local h = io.read("n")
  if h <= p then
    c = c + 1
    a = math.max(a, c)
  else
    c = 0
  end
  p = h
end
print(a)

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

int main(){
 string S;
 cin >> S;
 int ans = 0;
  for(int i=0; i<4; i++){
   if(S[i] == '2'){
     ans++;
   }
 }
  cout << ans << endl;
 return 0;
}

Measured memory_bytes: 256