akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using  namespace std;

int main() {
  int n;
  cin >> n;
  int t[n+1], x[n+1], y[n+1];
  t[0] = x[0] = y[0] = 0;
  rep(i, n) cin >> t[i+1] >> x[i+1] >> y[i+1];

  bool f = true;
  rep(i, n) {
    int tmp = (t[i+1]-t[i]) - (x[i+1]+y[i+1]-x[i]-y[i]);
    if (tmp < 0 || tmp%2 != 0) f = false;
  }
  cout << (f ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 1408
from collections import defaultdict
from bisect import bisect_right

s = input()
t = input()
idxs = defaultdict(list)

for i, c in enumerate(s):
    idxs[c].append(i)
for i, c in enumerate(s):
    idxs[c].append(len(s) + i)

ans, cur_i = -1, -1
for c in t:
    if c not in idxs: print(-1); break
    a = idxs[c]
    nxt = a[bisect_right(a, cur_i)]
    ans += nxt - cur_i
    cur_i = nxt % len(s)
else: print(ans+1)


Measured memory_bytes: 12148
import std.stdio, std.string, std.conv, std.algorithm;

void main()
{
    foreach(_; 0..readln.chomp.to!int)
    {
        readln;
        int up, down;

        auto inp=readln.split.map!(to!int);
        for(int i; i < inp.length-1; ++i)
        {
            up=max(inp[i+1]-inp[i],up);
            down=min(inp[i+1]-inp[i],down);
        }
        writeln(up, " ", -down);
    }
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, K, Q;
  cin >> N >> K >> Q;
  vector<long> data(N, K - Q);
  long a;
  for(int i = 0; i < Q; i++){
    cin >> a;
    data.at(a - 1)++;
  }
  for(int i = 0; i < N; i++){
    if(data.at(i) <= 0)cout << "No" << endl;
    else cout << "Yes" << endl;
  }
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> box(n);
  for(int i = 0; i < n; i++){
    cin >> box.at(i);
  }
  sort(box.begin(),box.end());
  cout << box.at(n-1) - box.at(0) << endl;
}

Measured memory_bytes: 3504
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

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

        bool[,] bomb = new bool[h, w];
        for (int i = 0; i < h; i++)
        {
            string str = sc.Next();
            for (int j = 0; j < w; j++)
            {
                bomb[i, j] = str[j] == '#';
            }
        }

        string[,] answer = new string[h, w];
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                if (bomb[i, j])
                {
                    answer[i, j] = "#";
                    continue;
                }
                int count = 0;
                for (int k = -1; k <= 1; k++)
                {
                    for (int l = -1; l <= 1; l++)
                    {
                        if (i + k < 0 || i + k >= h || j + l < 0 || j + l >= w)
                        {
                            continue;
                        }
                        if (k == 0 && l == 0)
                        {
                            continue;
                        }
                        if (bomb[i + k, j + l])
                        {
                            count++;
                        }
                    }
                }
                answer[i, j] = count.ToString();
            }
        }

        for (int i = 0; i < h; i++)
        {
            string str = "";
            for (int j = 0; j < w; j++)
            {
                str += answer[i, j];
            }
            Console.WriteLine(str);
        }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13140
////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
namespace my {
char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }
ll gcd(ll a, ll b) {  // O( log(a) )
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
ll lcm(ll a, ll b) { return a * (b / my::gcd(a, b)); }  // O( log(a) )
bool isPrime(ll n) {                                    // O( sqrt(n) )
  bool flag = true;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      flag = false;
      break;
    }
  }
  return flag;
}
vector<pair<ll, ll>> primeFac(ll n) {  // O( sqrt(n) )
  vector<pair<ll, ll>> ret;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0) continue;
    ll exp = 0;
    while (n % i == 0) {
      n /= i;
      exp++;
    }
    ret.push_back(make_pair(i, exp));
  }
  if (n != 1) ret.push_back(make_pair(n, 1));
  return ret;
}
template <typename T>
void input_vec(vector<T> &a, ll n) {
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
}
template <typename T>
void input_set(set<T> &a, ll n) {
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.insert(tmp);
  }
}
}  // namespace my
////////////////////////////////////////////////

int main() {
  ll h, w, m;
  cin >> h >> w >> m;
  vector<pair<ll, ll>> bomb;
  vector<ll> bh(h, 0), bw(w, 0);
  for (int i = 0; i < m; i++) {
    ll hi, wi;
    cin >> hi >> wi;
    bomb.push_back(make_pair(--hi, --wi));
    bh.at(hi)++;
    bw.at(wi)++;
  }

  vector<bool> hKouho(h, false), wKouho(w, false);
  ll bhMax = 0, bwMax = 0;
  ll tmp = 0;
  ll cnth = 0, cntw = 0;
  for (auto &bhi : bh) bhMax = max(bhMax, bhi);
  for (ll i = 0; i < h; i++) {
    if (bh.at(i) == bhMax) {
      hKouho.at(i) = true;
      cnth++;
    }
  }
  for (auto &bwi : bw) bwMax = max(bwMax, bwi);
  for (ll i = 0; i < w; i++) {
    if (bw.at(i) == bwMax) {
      wKouho.at(i) = true;
      cntw++;
    }
  }

  ll ans = bhMax + bwMax;
  ll kouho = cnth * cntw;
  for (auto &bombi : bomb) {
    if (hKouho.at(bombi.first) && wKouho.at(bombi.second)) kouho--;
  }
  if (kouho <= 0) ans--;
  // cout << kouho << endl;

  cout << ans << endl;
}

Measured memory_bytes: 16304
#include<set>  
#include<map>  
#include<stack>  
#include<cstdio>  
#include<queue>  
#include<cmath>  
#include<vector>  
#include<cstring> 
#include<climits>  
#include<iostream> 
#include<algorithm> 
using namespace std;
#define INF 0x3f3f3f3f
#define LL long long
vector<pair<int,int> > nei[1000005];
vector<int> cit[1000005];
vector<int>comp;
int col[1000005];
bool vis[1000005];
vector<int>newnei[1000005];
int dp[1000005];
 int poi[1000005];
 queue<int> q;                //无需跑最短路，直接写bfs，用queue 
 int main()
 {
     int n,m;
     cin>>n>>m;
     memset(col,-1,sizeof col);
     for(int i=0;i<m;i++)
     {
         int x,y,c;
         scanf("%d %d %d",&x,&y,&c);
         x--,y--,c--;
         nei[x].push_back(make_pair(c,y));
         nei[y].push_back(make_pair(c,x));
         cit[c].push_back(x);
         cit[c].push_back(y);
         comp.push_back(c);
     }
     sort(comp.begin(),comp.end());
     comp.erase(unique(comp.begin(),comp.end()),comp.end());
     for(int i=0;i<n;i++)
     {
         sort(nei[i].begin(),nei[i].end());
     }
     int newci=n;
     for(int i=0;i<comp.size();i++)
     {
         int cmp=comp[i];
         for(int j=0;j<cit[comp[i]].size();j++)
         {
             int v=cit[comp[i]][j];
             if(col[v]==cmp) continue;
             q.push(v);
             col[v]=cmp;
             vector<int> ciin;
             while(!q.empty())
             {
                 v=q.front();
                 ciin.push_back(v);
                 q.pop();
                 int k=0;
                 for(;poi[v]<nei[v].size();poi[v]++)            //这里的poi[v]很好的利用了按公司编号从小到大的单调性 
                 {
                     k=poi[v];
                     if(nei[v][k].first!=cmp) break;
                     int u=nei[v][k].second;
                     if(col[u]==cmp) continue;
                     col[u]=cmp;
                     q.push(u);
                 }
             }
             for(int k=0;k<ciin.size();k++)
             {
                 int v=ciin[k];
                 newnei[v].push_back(newci);
                 newnei[newci].push_back(v);
             }
             newci++;
         }
     }
     for(int i=0;i<newci;i++) dp[i]=-2;
     dp[0]=1;
     q.push(0);
     while(!q.empty())
     {
         int v=q.front();
         q.pop();
         for(int k=0;k<newnei[v].size();k++)
         {
             int u=newnei[v][k];
             if(dp[u]==-2)
             {
                 dp[u]=dp[v]+1;q.push(u);
             }
             
         }
     }
     cout<<dp[n-1]/2;
 }

Measured memory_bytes: 104052
import java.util.*;
// Good catch
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		System.out.println(a>b ? a-1 : a);
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

}

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

using namespace std;

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	int L[n];
	long long ans = 0;

	for(int i = 0 ;i < n; ++i) cin >> L[i];

	sort(L, L+n);

	for(int i = 0 ; i < n ; ++i) {
		for(int j = i+1 ; j < n; ++j) {
			for(int k = i+2 ; k < n; ++k) {
				int s1 = L[i];
				int s2 = L[j];
				int s3 = L[k];

				if ( (s1 == s2) or (s2 == s3) or (s3 == s1) ) {

				}
				else {
					if ( (s1+s2 > s3) and (s2+s3>s1) and (s3+s1>s2) ) {
						if( (s1 < s2) and (s2 < s3) ) {
							++ans;
						}
					}
				}
			}
		}
	}

	cout << ans;

	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
ll a[100010];
int main() {
	ll n;
	cin>>n;
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	for(ll i=0;i<n;i++){
		if(a[i]==0){
			cout << 0;
			return 0;
		}
	}
	ll ans=1;
	for(ll i=0;i<n;i++){
		ll cnt=ans;
		ans*=a[i];
	//	cout <<ans<<endl;

		if(ans<cnt){
			cout << -1;
			return 0;
		}
		if(ans>1000000000000000000||ans<0){
			cout << -1;
	//		cout <<ans<<endl;
			return 0;
		}		
	}
	cout << ans;
	// your code goes here
	return 0;
}

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

N = INT()
W = [input() for i in range(N)]

s = set(W)
if len(s) != len(W):
    print("No")
    exit()
else:
    for i in range(N-1):
        if W[i][-1] != W[i+1][0]:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 5576
#include<stdio.h>

int main(){
int A, B, S, D;
scanf("%d\n%d", &A, &B);
if(1<=A && A<=B && B<=20){
  if(B%A==0){
    S=A+B;
    printf("%d\n",S);
  }else{
    D=B-A;
    printf("%d\n",D);
  }
}
return 0;
}


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

int a,b,c;
int main()
{
    cin >> a >> b >> c;
    for (int i = 0; i<=10000; i++)
    {
        if ((a*i)%b == c)
        {
            cout << "YES";
            return 0;
        }
    }
    cout << "NO";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef   long long int ll;
using namespace std;
int main ()
{
     ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    ll n;cin>>n;
    ll a[n],k,sum=0,ans=10000000;
    for (ll i=0;i<n;i++) cin>>a[i];
    for (ll i=1;i<=200;i++) {
        sum=0;
        for (ll j=0;j<n;j++) {
            k=a[j]-i;
            k=k*k;
            sum+=k;
        }
        ans=min(sum,ans);
    }
    cout<<ans<<endl;
}





Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	int x=0,y=0;
	for(int k=1;k<=n;k++)
	{
		int u;
		scanf("%d",&u);
		if(u&1) x++;
		else y++;
	}
	if(x&1)
	{
		printf("NO");
	}
	else
	{
		printf("YES");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define infinite 9123456789
#define PRECISION cout.precision(3); cout.setf(ios::fixed);

int L, R, d;

void solve(){
	cin >> L >> R >> d;
	int resp=0;
	for(int i=L; i<=R; i++) if(i%d==0) resp++;
	cout << resp;
}
signed main(){
	solve();
}

Measured memory_bytes: 3620
#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 n;
    cin >> n;
    if (n % 1000 == 0) {
        cout << 0 << endl;
        return 0;
    }
    int ans = (((n / 1000) + 1) * 1000) - n;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
N, K, Q = map(int, input().split())
result = {}
for i in range(Q):
    winner = int(input())
    result[winner] = result.get(winner, 0) + 1

for i in range(N):
    if K - (Q - result.get(i + 1, 0)) > 0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 54744
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
l = list(map(int,input().split()))

k = (lcm_list(l))-1

ans = [0]*n
for i in range(n):
    ans[i] = k%l[i]

print(sum(ans))

Measured memory_bytes: 9612
// Problem : F - Contrast
// Contest : AtCoder - AtCoder Beginner Contest 178
// URL : https://atcoder.jp/contests/abc178/tasks/abc178_f
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

int a[maxN], b[maxN], frq[maxN];
set<int> occ[maxN];
set<pii, greater<pii>> s;
vi vec[maxN];
set<int> nonempty;
int ans[maxN], frq2[maxN];

// sprawdz MODULO!
int main() {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n; cin >> n;
	REP(i, n) {
		cin >> a[i];
		frq[a[i]]++;
	}
	REP(i, n) {
		cin >> b[i];
		frq[b[i]]++;
		frq2[b[i]]++;
		if(frq[b[i]] > n) {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
	REP(i, n) {
		s.insert({frq2[b[i]], b[i]});
	}
	REP(i, n) {
		// cout << "before " << endl;
		// for (auto x: s) {
			// cout << x.st << " " << x.nd << endl;
		// }
		if (i > 0 && a[i] != a[i - 1]) {
			for (auto x: vec[a[i - 1]]) {
				occ[ans[x]].insert(x);
				if (sz(occ[ans[x]]) == 1) {
					nonempty.insert(ans[x]);
				}
			}
		}
		auto it = s.begin();
		if (it->nd == a[i]) {
			it++;
			if (it == s.end()) {
				it--;
				assert(!nonempty.empty());
				auto it2 = nonempty.begin();
				if (*it2 == a[i]) it2++;
				assert(it2 != nonempty.end());
				vec[a[i]].push_back(i);
				ans[i] = *it2;
				int val = *occ[*it2].begin();
				occ[*it2].erase(val);
				ans[val] = a[i];
				if (occ[*it2].empty()) {
					nonempty.erase(*it2);
				}
				pii p = *it;				
				s.erase(it);
				if (p.st > 1) {
					s.insert({p.st - 1, p.nd});
				}
				continue;
			}
		}
		vec[a[i]].push_back(i);
		ans[i] = it->nd;
		pii p = *it;
		s.erase(it);
		if (p.st > 1) {
			s.insert({p.st - 1, p.nd});
		}
	}
	REP(i, n) {
		assert(ans[i] != a[i]);
		cout << ans[i] << " ";	
	}
	return 0;
}
 


Measured memory_bytes: 102692
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    
    cin>>a>>b;
    
    if(a>=b){
        for(int i=1;i<=a;i++)
        cout<<b;
    }
    else 
     for(int i=1;i<=b;i++)
      cout<<a;
      
    return 0;
}
     
   




Measured memory_bytes: 3652
import java.util.*;

public class Main {

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

        int n = sc.nextInt();// 青いカードの枚数
        HashMap<String, Integer> cards = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String key = sc.next();
            if (cards.containsKey(key)) {
                cards.put(key, cards.get(key) + 1);
            } else {
                cards.put(key, 1);
            }
        }

        int m = sc.nextInt();// 赤いカードの枚数
        for (int i = 0; i < m; i++) {
            String key = sc.next();
            if (cards.containsKey(key)) {
                cards.put(key, cards.get(key) - 1);
            } else {
                cards.put(key, -1);
            }
        }

        int max = 0;
        for (Map.Entry<String, Integer> entry: cards.entrySet()) {
            if (max < entry.getValue()) max = entry.getValue();
        }

        System.out.println(max < 0 ? 0 : max);
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
  map<long,bool> m;
  long s,k=1;
  cin>>s;
  while(true){
    if(m[s])break;
    m[s]=true;
    if(s%2){s*=3;s++;}
    else s/=2;
    k++;
  }
  cout<<k;
  return 0;
}

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

long comb(int n,int s){
  if(n<s)
    return 0;
  int64_t a=1,b=1;
  for(int i=0;i<s;i++)
    a*=n-i;
  for(int i=1;i<=s;i++)
    b*=i;
  return a/b;
}

int main(){
  int k,s;
  cin >> k >> s;
  cout << comb(s+2,2) - comb(s-k+1,2)*3 +comb(s-k-k,2)*3 << endl;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,t,s;cin>>n>>t;
  vector<pair<int,int>>x(n);
  for(int i=0;i<n;i++)cin>>x.at(i).second>>x.at(i).first;
  sort(x.begin(),x.end());
  int c=x.at(0).second;
  if(x.at(0).first>t)cout<<"TLE"<<endl;
  else{
    if(n!=1){
      for(int i=1;i<n;i++){
        if(x.at(i).first>t){
          s=i;
          break;
        }
      }
      if(s>1){
        for(int j=1;j<s;j++){
          c=min(c,x.at(j).second);
        }
      }
    }
    cout<<c<<endl;
  }
}
      
    
      
      


Measured memory_bytes: 256
from bisect import bisect_left

n = int(input())
arr = list(map(int, input().split()))
arr.sort()

ans = 0
for small in range(n - 2):
    for mid in range(small + 1, n - 1):
        div = bisect_left(arr, arr[small] + arr[mid], 0, n)
        if div > mid + 1:
            ans += div - mid - 1

print(ans)

Measured memory_bytes: 9288
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define pb push_back
#define INF 1e11
#define mod 11092019
#define eps 1e-15
#define abs(x) ((x)>=0?(x):-(x))
#define y1 solai
#define fi first
#define se second
typedef long long ll;
typedef long double ldb;
typedef pair<ll,ll> pll;
const ll N=2100;
ll n,p[12],len;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin>>n;
	p[0]=1;
	for(ll i=1;i<=10;i++)
		p[i]=p[i-1]*26;
	for(len=1;n>p[len];len++)
		n-=p[len];
	for(;len;len--)
	{
		for(ll i=1;i<=26;i++)
			if(n>p[len-1])
				n-=p[len-1];
			else
				cout<<char(i+'a'-1),i=26;
	}
}


Measured memory_bytes: 3644
#include<cstdio>
#define N 2000010
#define mod 1000000007
int x[10],y[10],fact[N+5],inv[N+5],ans;
int C(int x,int y) { return 1ll*fact[x+y]*inv[x]%mod*inv[y]%mod; }
int F(int x1,int y1,int x2,int y2) { return (1ll*C(x2+1,y2+1)+1ll*C(x1,y1)-1ll*C(x1,y2+1)-1ll*C(x2+1,y1)+mod+mod)%mod; }
int main()
{
	for(int i=1;i<=6;i++) scanf("%d",&x[i]);
	for(int i=1;i<=6;i++) scanf("%d",&y[i]);
	fact[0]=1;
	for(int i=1;i<=N;i++) fact[i]=1ll*fact[i-1]*i%mod;
	inv[1]=1;
	for(int i=2;i<=N;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	inv[0]=1;
	for(int i=1;i<=N;i++) inv[i]=1ll*inv[i]*inv[i-1]%mod;
	for(int i=x[3];i<=x[4];i++) 
		ans=(ans+1ll*(mod-y[3]-i)%mod*F(i-x[2],y[3]-1-y[2],i-x[1],y[3]-1-y[1])%mod*F(x[5]-i,y[5]-y[3],x[6]-i,y[6]-y[3])%mod)%mod;
	for(int i=x[3];i<=x[4];i++) 
		ans=(ans+1ll*(i+y[4]+1)%mod*F(i-x[2],y[4]-y[2],i-x[1],y[4]-y[1])%mod*F(x[5]-i,y[5]-y[4]-1,x[6]-i,y[6]-y[4]-1)%mod)%mod;
	for(int i=y[3];i<=y[4];i++) 
		ans=(ans+1ll*(mod-x[3]-i)%mod*F(i-y[2],x[3]-1-x[2],i-y[1],x[3]-1-x[1])%mod*F(y[5]-i,x[5]-x[3],y[6]-i,x[6]-x[3])%mod)%mod;
	for(int i=y[3];i<=y[4];i++) 
		ans=(ans+1ll*(i+x[4]+1)%mod*F(i-y[2],x[4]-x[2],i-y[1],x[4]-x[1])%mod*F(y[5]-i,x[5]-x[4]-1,y[6]-i,x[6]-x[4]-1)%mod)%mod;
	printf("%d\n",ans);
}

Measured memory_bytes: 15744
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
//#define int   long long
#define ll   long long
#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 vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int>
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double

int main()
{
	FAST;
	ll n, a, b;
	cin >> n >> a >> b;
	cout << min(n*a, b);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
using namespace std;
int main(){
  string s;
  cin >> s;
  deque<char> q;
  for (char c : s) q.push_back(c);
  bool rev = false; // trueなら反転
  int n;
  cin >> n;
  rep(i,n){
    int t;
    scanf("%d",&t);
    if(t == 1){
      rev = !rev;
    }else{
      int f; char c;
      scanf("%d %c",&f,&c);
      //先頭に追加
      if((f==1 && !rev) || (f==2 && rev) ){
        q.push_front(c);
      }else{
        q.push_back(c);
      }
    }
  }
  if(rev) reverse(q.begin(), q.end());
  string ans;
  for (char c : q) ans += c;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
    using namespace std;
    #define rep(i,n) for(int i=0; i<(n); i++)
     
    typedef long long ll;
    typedef pair<int,int> P;
     
    int main(){
    	int X,Y,a,b,c;
    	cin >> X >> Y >> a >> b >> c;
    	vector<P> A;
     
    	rep(i,a){int t; cin >> t; A.push_back(make_pair(t,0)); }
    	rep(i,b){int t; cin >> t; A.push_back(make_pair(t,1)); }
    	rep(i,c){int t; cin >> t; A.push_back(make_pair(t,2)); }
    	sort(A.begin(),A.end());
    	reverse(A.begin(),A.end());
     
    	ll ans = 0;
    	int x=0, y=0, z=0; 
    	int idx=0; 
    	while(true){
    		P p = A[idx];
    		idx++;
    		if(x==X && p.second==0)continue;
    		if(y==Y && p.second==1)continue;
    		switch(p.second){
    			case 0: x++; break;
    			case 1: y++; break;
    			case 2: z++; break;
    			default :break;
    		}
    		ans += p.first;
    		if(x+y+z == X+Y)break;
    	}
     
    	cout << ans << endl;
    	return 0; 
    }

Measured memory_bytes: 6384
#include <iostream>
#include <string>
#include <vector>
#include <set>
using namespace std;

set<string> groups;
struct Group {
    string name;
    set<string> member;
    Group() {;}
    Group(string n) : name(n) {;}
};

vector<string> splitAll(string s,string t){
    vector<string> v;
    for(int p=0; (p = s.find(t)) != s.npos; ){
        v.push_back(s.substr(0,p));
        s=s.substr(p+t.size());
    }
    v.push_back(s);
    return v;
}

Group make_group(string s) {
    vector<string> sv = splitAll(s,":");
    Group g(sv[0]);
    string members = sv[1];
    members = splitAll(members, ".")[0];
    vector<string> mv = splitAll(members, ",");
    for(int i=0; i<mv.size(); ++i) {
        g.member.insert(mv[i]);
    }
    return g;
}

int main() {
    int n;
    string line;
    while(cin>>n, n) {
        vector<Group> gv;
        set<string> groupname;
        for(int i=0; i<n; ++i) {
            cin>>line;
            gv.push_back(make_group(line));
            groupname.insert(gv.back().name);
        }

        typedef set<string>::iterator ssi;
        for(int i=0; i<gv.size(); ++i) {
            string target = gv[i].name;
            ssi it;
            for(int j=0; j<gv.size(); ++j) {
                if((it = gv[j].member.find(target)) != gv[j].member.end()) {
                    gv[j].member.erase(it);
                    for(ssi ite = gv[i].member.begin(); ite != gv[i].member.end();
                        ++ite) {
                        gv[j].member.insert(*ite);
                    }
                }
            }
        }

        cout<<gv[0].member.size()<<endl;
    }
}

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

using namespace std;

using ll = long long;

const int N = 3e3 + 5;
const int MOD = 998244353;

int n, s;
int a[N];
ll dp[N][N];

int main() {
	scanf("%d %d", &n, &s);
	for (int i = 1; i <= n; i++) scanf("%d", a + i);
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= s; j++) {
			dp[i][j] = 2 * dp[i - 1][j];
			if (j - a[i] >= 0) dp[i][j] += dp[i - 1][j - a[i]];
			dp[i][j] %= MOD;
		}
	}
	printf("%lld\n", dp[n][s]);
}

Measured memory_bytes: 74240
# 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 all(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(1e5) + 2;
const int LG = 20;
const ll mod = 998244353;
const int INF = 2147483647;
const ll linf = 1e18;
const ld pi = acos(-1);
const ld EPS = 1e-10;

int n, a[N];
int main (){
    scanf ("%d", &n);
    int cnt = 0;
    for (int i = 1; i <= n; ++i) scanf ("%d", a + i), cnt += (a[i] < 0);
    for (int i = 1; i <= n; ++i) a[i] = abs(a[i]);
    if (cnt & 1) {
        sort (a + 1, a + n + 1);
        a[1] = -a[1];
    }
    ll sum = 0;
    for (int i = 1; i <= n; ++i) sum += a[i];
    return !printf ("%lld\n", sum);
}


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

struct node { string s; int p, i; };

bool cmp(node a, node b) {
        if(a.s != b.s)
                return a.s < b.s;
        return a.p > b.p;
}

int main(void)
{
	ios_base::sync_with_stdio(0);
        int n;
        cin >> n;
        vector<node> a(n);
        for(int i = 0; i < n; i++) {
                cin >> a[i].s >> a[i].p;
                a[i].i = i + 1;
        }
        sort(a.begin(), a.end(), cmp);
        for(int i = 0; i < n; i++)
                cout << a[i].i << endl;
	return 0;
}


Measured memory_bytes: 256
N, Y = map(int, input().split())

flag=False
for i in range(N+1):
    for j in range(N+1-i):    
        if 10000*i+5000*j+1000*(N-i-j)==Y:
            print(i,j,N-i-j)
            flag=True
            break

    if flag==True:
        break
     
else:
    print("-1 -1 -1")

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0007
{
	class Program
	{
		static void Main(string[] args)
		{
			var	n	= int.Parse( Console.ReadLine() );

			long	money	= 100000;
			for( int i = 0; i < n; i++ ) {
				money	= (long)((double)money * 1.05);
				money	+= 999;
				money	= (money / 1000) * 1000;
			}
			Console.WriteLine( money );
		}
	}
}

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

static const ll mod = 1000000007;

int main(void){
    int n;
    ll k;
    cin >> n >> k;
    vector<int> a;
    for(int i=0; i<n; i++){
        int x;
        cin >> x;
        a.push_back(x);
    }

    // 単体のaの中の転倒数を求める。(n^2)
    ll in_a = 0;
    for(int i=0; i<n-1; i++){
        for(int j=i; j<n; j++){
            if(a[i]>a[j]) in_a += 1;
        }
    }

    // 各ブロックについて。
    in_a = (in_a * k) % mod;

    // aの各要素についてそれ以下のものの個数を数える。
    vector<ll> num_smaller(n);
    for(int i=0; i<n; i++){
        num_smaller[i] = 0;
        for(int j=0; j<n; j++){
            if(a[i] > a[j]) num_smaller[i] += 1;
        }
    }

    // num_smallerの各要素に対して
    ll in_k_blocks = 0;
    ll k_factor = k*(k-1)/2 % mod;
    for(int i=0; i<n; i++){
        in_k_blocks += k_factor*num_smaller[i];
        in_k_blocks = in_k_blocks % mod;
    }

    ll ans;
    ans = (in_a + in_k_blocks) % mod;

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#define ll long long
#define out(a) printf("%d ",a)
#define writeln printf("\n")
#define N 100050
using namespace std;
int n,now;
int a[N];
bool f[N],flag;
int ans;
int read()
{
	int s=0,t=1; char c;
	while (c<'0'||c>'9'){if (c=='-') t=-1; c=getchar();}
	while (c>='0'&&c<='9'){s=s*10+c-'0'; c=getchar();}
	return s*t;
}
ll readl()
{
	ll s=0,t=1; char c;
	while (c<'0'||c>'9'){if (c=='-') t=-1; c=getchar();}
	while (c>='0'&&c<='9'){s=s*10+c-'0'; c=getchar();}
	return s*t;
}
int main()
{
	n=read(); flag=false;
	for (int i=1;i<=n;i++)
	  a[i]=read();
	for (int i=1;i<=n;i++){
	  if (a[i]==a[i+1]&&!flag) flag=true,now=i;
	  if (flag&&a[i]!=a[i+1]) {
	  //	out(now);
	    flag=false;
	    ans+=(i-now+1)/2;
	  }
    }
	out(ans);
	return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
S=input()
X=[1]
for i in range(1,N):
    if S[i]!=S[i-1]:
        X.append(1)
    else:
        X[-1]+=1
M=len(X)
T=M-2*K
if T<=0:
    T=1
print(N-T)

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

int main() {
	char c[3][4],a;
	int i;
	while(cin >> c[0]) {
		if (c[0][0]=='0') break;
		cin >> c[1]  >> c[2];
		a='+';
	  if (((c[0][0]==c[1][1] && c[1][1]==c[2][2]) || (c[0][2]==c[1][1] && c[1][1]==c[2][0])) && c[1][1]!='+') a=c[1][1];
		else {	
		for (i=0;i<3;i++) {
			if (c[i][0]==c[i][1] && c[i][1]==c[i][2]) a=c[i][0];
			if (c[0][i]==c[1][i] && c[1][i]==c[2][i]) a=c[0][i];
			if (a!='+') break;
		}  
	}	
	if (a!='+') cout << a << endl; else cout << "NA" << endl;
}
return 0;
}		

Measured memory_bytes: 1132
#Biscuits

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

#奇数の数
k = 0
for a in A:
    k += a%2
if ( k ==0 ):
    ans = (3-P)%2 * 2**N
else:
    ans = 2**(N-1)
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main()
{
	int a; cin >> a;
	int arr[a + 50];
	for(int i=0; i<a; i++)
		cin >> arr[i];
	int ans = 0;
	for(int i=0; i < a - 1; i++)
	{
		if(arr[i] > arr[i + 1])
		{
			ans += arr[i] - arr[i + 1];
			arr[i + 1] = arr[i];
		}
	}
	cout << ans << '\n';
}

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

int n;
char c;
set<char> st;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	while(n--) {
		cin >> c;
		st.insert(c);
	}
	cout << (st.size() == 3? "Three": "Four");
	return 0;
}

Measured memory_bytes: 256
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-03-07 21:13:08
*/

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

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    string s;
    cin >> s;
    int q;
    cin >> q;
    vector<pair<int, pair<int, char>>> query(q);
    for (int i = 0; i < q; i++) {
        int t, f;
        char c;

        cin >> t;
        if (t == 1) {
            query[i].first = 1;
        } else {
            cin >> f >> c;
            query[i].second.first = f;
            query[i].second.second = c;
        }
    }

    int rev = 0;
    string lead, end;
    lead = end = "";
    for (int i = 0; i < q; i++) {
        if (query[i].first == 1) {
            if (rev) rev = 0;
            else rev = 1;
        } else {
            int f = query[i].second.first;
            char c = query[i].second.second;

            if (rev) {
                // f = 1なら末尾、f = 2なら先頭
                if (f == 1) {
                    end += c;
                } else {
                    lead.insert(lead.begin(), c);
                }
            } else {
                // f = 1なら先頭、f = 2なら末尾
                if (f == 1) {
                    lead.insert(lead.begin(), c);
                } else {
                    end += c;
                }
            }
        }
    }

    string ans = "";
    if (rev) {
        reverse(all(s));
        reverse(all(lead));
        reverse(all(end));
        ans += end;
        ans += s;
        ans += lead;
    } else {
        ans += lead;
        ans += s;
        ans += end;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3740
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

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

const long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);



ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}


#define comuse Comuse()

ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}


ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

ll modpow(ll a,ll n,ll mod){
  ll ans=1;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  //vll segtree(524287);
  //ll N=262144;
  ll n,m;
    cin>>n>>m;
  if(500*n>=m){
    cout<<"Yes\n";
  }
  else{
    cout<<"No\n";
  }
}
  

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

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

   if(n%2==0){
      for(int i=0; i<n/2; ++i) std::cout << a[n-i*2-1] << ' ';
      for(int i=0; i<n/2; ++i) std::cout << a[i*2] << ' ';
   }else{
      for(int i=0; i<n/2+1; ++i) std::cout << a[n-i*2-1] << ' ';
      for(int i=0; i<n/2; ++i) std::cout << a[i*2+1] << ' ';
   }
   std::cout << std::endl;
   return 0;
}


Measured memory_bytes: 2944
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N, K;
        public long MOD = 1000000007;
        public int[] V;

        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                N = line[0];
                K = line[1];
            }
            V = Input.ReadIntArray();

            long ret = 0;
            for (int l = 0; l <= N; l++)
            for (int r = 0; r <= N; r++)
            {
                List<int> lst = new List<int>();
                if (l + r > N) continue;
                if (l + r > K) continue;
                for (int i = 0; i < l; i++)
                {
                    lst.Add(V[i]);
                }

                for (int i = 0; i < r; i++)
                {
                    lst.Add(V[N - 1 - i]);
                }

                lst.Sort();

                int k = K - (l + r);
                int rr = lst.Sum();
                for (int i = 0; i < Math.Min(k, lst.Count); i++)
                {
                    if (lst[i] < 0) rr -= lst[i];
                }

                ret = Math.Max(ret, rr);
            }

            Console.WriteLine(ret);
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396
from itertools import product
abcd = list(map(int, list(input())))


for ops in product(['+', '-'], repeat=3):
    temp = abcd[0]
    ans = str(abcd[0])
    for i, op in enumerate(ops):
        if op=='+':
            temp+=abcd[i+1]
            ans+='+'+str(abcd[i+1])
        else:
            temp-=abcd[i+1]
            ans+='-'+str(abcd[i+1])
    if temp==7:
        ans+='=7'
        break
print(ans)

Measured memory_bytes: 9144
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int  main()
{
	int n; cin >> n;
	vector<int> p(n);
	int cnt = 0;
	rep(i, n)
	{
		cin >> p[i];
	}
	for (int i = 1; i < n - 1; i++)
	{
		priority_queue<int> q;
		q.push(p[i-1]);q.push(p[i+1]);q.push(p[i]);
		q.pop();
		if (q.top() == p[i])
			cnt++;
	}
	cout << cnt << endl;
	return 0;
}


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

int main() {
  int N, K;
  int count = 0;
  cin >> N >> K;
  vector<int> height(N);
  for (int i = 0; i < N; i++) {
    cin >> height.at(i);
    if (K <= height.at(i)) {
      count++;
    }
  }
  
  cout << count << endl;
}

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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n;cin>>n&&n;){
		vi res(n+1,-1);
		deque<tuple<int,int>> q;
		q.emplace_back(1,1);
		while(q.size()){
			int x,c; tie(x,c)=q.front(); q.pop_front();
			if(res[x]!=-1) continue;
			res[x]=c;
			q.emplace_front((x*10)%n,c);
			q.emplace_back((x+1)%n,c+1);
		}
		cout<<res[0]<<endl;
	}
}


Measured memory_bytes: 1408
K=int(raw_input())

s=0
tmp=1
ans=0
A=[]
bfr=0
def func(a):
    sa=str(a)
    tmp=sum(int(s) for s in sa)
    return float(a)/tmp

while(ans<K):
    tmp2=tmp+10**s
    tmp3=tmp+2*10**s
    if func(tmp2) > func(tmp3):
        s+=1
    else:
        print(tmp)
        tmp = tmp2
        bfr=func(tmp)
        ans+=1


Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define pb push_back
#define pii pair<long long,long long>
#define endl '\n'
#define N 100001
int mod=1000000007;
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
vector<int> parent(N),sz(N);
int modexp(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        
        return modexp((x*x)%M,n/2,M);
    else                             
        return (x*modexp((x*x)%M,(n-1)/2,M))%M;
}
void make_set(int s)
{
    parent[s]=s;
    sz[s]=1;
}
int find_parent(int p)
{
    if(p==parent[p])
    return p;
    return parent[p]=find_parent(parent[p]);
}
void union_set(int a,int b)
{
    a=find_parent(a);b=find_parent(b);
    if(a!=b)
    {
        if(a<b)
        swap(a,b);
        parent[b]=parent[a];
        sz[a]+=sz[b];
    }
}
void solve()
{
    int n; cin>>n;
    unordered_map<string,int> mp;
    string s;
    while(n--)
    {
        cin>>s; mp[s]++;
    }
    cout<<mp.size();
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test; test=1;
    while(test--)
    {
        solve();
    }
    return 0;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli n;
	cin>>n;
	vector<lli> v(n),q(n);
	REP(i,0,n){
		cin>>v[i];
		v[i]--;
		q[i] = v[i];
	}

	lli ans = INF;
	lli cnt=0;

	REP(i,0,n-1){
		if(v[i]==i){
			if(DEBUG)cout<<"v[i] swap!"<<v[i]<<endl;
			swap(v[i],v[i+1]);
			cnt++;
		}
	}
	if(v[n-1]==n-1)swap(v[n-2],v[n-1]),cnt++;
	ans = min(ans,cnt);
	cnt=0;

	for(lli i=n-1;i>0;i--){
		if(q[i]==i){
			if(DEBUG)cout<<"q[i] swap!"<<q[i]<<endl;
			swap(q[i],q[i-1]);
			cnt++;
		}
	}
	if(q[0]==0)swap(q[0],q[1]),cnt++;
	ans = min(ans,cnt);
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 1792