akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Threading.Tasks;
 
static class Program
{
static void Main()
{
  string inputVal = Console.ReadLine();
  int val1 = int.Parse(inputVal.Substring(0, 2));
  int val2 = int.Parse(inputVal.Substring(2, 2));
  bool mayMonthVal1 = val1 >= 1 && val1 <= 12;
  bool mayMonthVal2 = val2 >= 1 && val2 <= 12;

  string ret = "";
  //NA
  if (val1 < 0)
    ret = "NA";
  else if (val1 == 0 && val2 == 0)
    ret = "NA";
  else if (val1 == 0 && mayMonthVal2)
    ret = "YYMM";
  else if (val2 == 0 && mayMonthVal1)
    ret = "MMYY";
  else if (mayMonthVal1 && mayMonthVal2)
    ret = "AMBIGUOUS";
  else if (mayMonthVal1)
    ret = "MMYY";
  else if (mayMonthVal2)
    ret = "YYMM";
  else
    ret = "NA";
  Console.WriteLine(ret);
}
}

Measured memory_bytes: 13140
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>

const long INF = (1l << 30);
const long LINF = (1l << 60);

long n, q;
std::string s;
char spell[200005][2];

long drop(long a){
    for(int i = 0; i < q; i++){
        if(s[a] == spell[i][0]){
            if(spell[i][1] == 'L'){
                if(a == 0){
                    return 1l;
                }else{
                    a--;
                }
            }else{
                if(a == n-1){
                    return 2l;
                }else{
                    a++;
                }
            }
        }
    }
    return 0l;
}

long binary(long flag){
    long ok, ng;
    if(flag == 1){
        ok = -1, ng = n;
    }else{
        ok = n, ng = -1;
    }
    while(std::abs(ok-ng) > 1){
        long mid = (ok+ng)/2;
        if(drop(mid) == flag){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    return ok;
}

int main(){
    scanf("%ld%ld", &n, &q);
    std::cin >> s;
    //*
    scanf("%*c");
    for(int i = 0; i < q; i++){
        scanf("%c%*c%c%*c", &spell[i][0], &spell[i][1]);
    }
    //*/
    /*
    for(int i = 0; i < q; i++){
        printf("  %hhd %hhd\n", spell[i][0], spell[i][1]);
    }
    printf("%hhd\n", '\n');
    printf("%hhd\n", ' ');
    //*/

    /*
    printf("  %ld\n", binary(1));
    printf("  %ld\n", binary(2));
    //*/
    printf("%ld\n", binary(2)-binary(1)-1);
}


Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  long t;
  vector<long> c , v;
  for ( int i = 0; i < n ; i++){
      cin >> t;
      v.push_back(t);
  }
  for ( int i = 0; i < n ; i++){
      cin >> t;
      c.push_back(t);
  }
  long ans = 0;
  for ( int i = 0; i < n ; i++){
      if (v[i] > c[i]){
        ans += v[i] - c[i];
      }
  }
  
  cout << ans <<  endl;  
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
ll n, a, b;
//ld ;
//string s;
int main() {
  cin >> n >> a >> b;
  ll patternX = ((a+b)%2 == 0) ? (b-a)/2 : n;
  ll patternY = ((a+b)%2 == 0) ? (a-1) + (b-a)/2 : a + (b-a-1)/2;
  ll patternZ = ((a+b)%2 == 0) ? (n-b) + (b-a)/2 : (n-b+1) + (b-a-1)/2;
  ll res = (patternX<=patternY && patternX<=patternZ) ? patternX : (patternY<=patternZ) ? patternY : patternZ;
  //cout << patternX <<  patternY <<  patternZ << endl;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, k = inintm()

ans = 0

for i in range(1,n+1):
    b = 0
    for _ in range(1,18):
        if i >= k:
            break
        i *= 2
        b += 1
    ans += (1/n)*(0.5**b)

print(ans)


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

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define INF (1 << 29)

using namespace std;

/*class Point{
	public:
		double x, y;

		Point(double x = 0, double y = 0): x(x), y(y) {}

		Point operator + (Point p){ return Point(x + p.x, y + p.y); }
		Point operator - (Point p){ return Point(x - p.x, y - p.y); }
		Point operator * (double a){ return Point(a * x, a * y); }
		Point operator / (double a){ return Point (x / a, y / a); }

		double abs(){ return sqrt(norm()); }
		double norm(){ return x * x + y * y; }

		bool operator < (const Point &p) const{
			return x != p.x ? x < p.x : y < p.y;
		}

		bool operator == (const Point &p) const{
			return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
		}
};

class Segment{
	public:
		Point p1, p2;
		Segment(Point p1 = Point(), Point p2 = Point()): 
			p1(p1), p2(p2) {}
};

class Circle{
	public:
		Point c;
		double r;
		Circle(Point c = Point(), double r = 0.0): c(c) , r(r) {}
};

typedef Segment Line;
typedef vector<Point> Polygon;
typedef Point Vector;

double dot(Vector a, Vector b){
	return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b){
	return a.x * b.y - a.y * b.x;
}
*/

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

	for(int i = 0; i < m; i++){
		int s; cin >> s;
		n -= s;
	}

	if(n >= 0) cout << n << endl;
	else cout << -1 << endl;
	
	return 0;
}


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

using namespace std;
using p = pair<long long, int>;
#define INF 100000000

int main(){
	int n;
	cin >> n;
	double x[n];
	double y[n];
	
	for(int i = 0; i < n; i++)  cin >> x[i] >> y[i];
	
	vector<int> order(n);
	for(int i = 0; i < n; i++) order[i] = i; 
	double ans = 0;
	
	do{
		for(int i = 0; i < n-1; i++){
			double x_length = x[order[i]] - x[order[i+1]];
			double y_length = y[order[i]] - y[order[i+1]];
			ans += sqrt(x_length*x_length + y_length*y_length);
		}
	} while(next_permutation(order.begin(),order.end()));
	double divide = 1.0;
	double k = (double)n; 
	for(double i = 1; i <= k; i++) divide*=i;
	cout << fixed << setprecision(9) << ans/divide << endl;
}
	
	


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

struct BFSState{
  std::string s;
  int depth;
  BFSState(std::string str,int d):s(str),depth(d){}
};

int Solve(int n){
  std::vector<std::pair<std::string,std::string>> replacement(n);
  for(int i=0;i<n;i++){
    std::string a,b;
    cin>>a>>b;
    replacement[i]=std::make_pair(a,b);
  }

  std::string from,to;
  cin>>from>>to;

  std::queue<BFSState> q;
  q.push(BFSState(from,0));
  while(!q.empty()){
    BFSState curr=q.front();
    q.pop();
    if(curr.s.size()==to.size()){
      if(curr.s==to){
        return curr.depth;
      }
    }else if(curr.s.size()>to.size()){
      continue;
    }else{

      for(auto r:replacement){
        std::string next="";


        for(int i=0;i<curr.s.size();i++){
          if(i+r.first.size()<=curr.s.size()&&curr.s.substr(i,r.first.size())==r.first){
            next+=r.second;
            i+=(r.first.size()-1);
          }else{
            next+=curr.s[i];
          }

        }
        if(next.size()>0&&next!=curr.s){
          q.push(BFSState(next,curr.depth+1));
        }


      }

    }
  }
  return -1;

}



int main(void){
  cout << std::fixed << std::setprecision(16);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  while(true){
    int n;
    cin>>n;
    if(n==0){
      return 0;
    }
    cout<<Solve(n)<<endl;
  }

  



  return 0;
}



Measured memory_bytes: 3500
N, K = map(int, input().split())
A = sorted([int(a) for a in input().split()])
F = sorted([int(f) for f in input().split()], reverse=True)
INF = 10**12+10

l = -1
r = INF
while r - l > 1:
    c = (l + r) // 2
    SUM_B = 0
    for i in range(N):
        SUM_B += max(0, A[i] - c//F[i])
    if SUM_B <= K:
        r = c
    else:
        l = c

print(r)

Measured memory_bytes: 122700
#include <cstdio>
using namespace std;
typedef long long LL;

int a, b;
int max(int x, int y)
{
    return (x > y) ? x : y;
}
int main()
{
    scanf("%d%d", &a, &b);
    printf("%d\n", max(a + b, max(a - b, a * b)));
    return 0;
}

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

int main() {
	int n, k;
	while (cin >> n >> k, n, k) {

		int a[100005];
		for (int i = 0;i < n;i++) {
			cin >> a[i];
		}

		int ans = 0;
		for (int i = 0;i <= n - k;i++) {
			int s = 0;
			for (int j = 0;j < k;j++) {
				s += a[i + j];
			}
			if (s > ans)ans = s;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3480
#include<stdio.h>
#include<string>
int main(){
    int n,c[4];
    for(int i=0;i<4;i++) c[i] = 0;
    char s[10];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%s",s);
        if(s[0]=='A'){
            c[0]++;
        }else if(s[0]=='W'){
            c[1]++;
        }else if(s[0]=='T'){
            c[2]++;
        }else if(s[0]=='R'){
            c[3]++;
        }
    }
    printf("AC x %d\n",c[0]);
    printf("WA x %d\n",c[1]);
    printf("TLE x %d\n",c[2]);
    printf("RE x %d\n",c[3]);
    

}
/*
WA, TLE, RE 
AC x 
C
0

WA x 
C
1

TLE x 
C
2

RE x 
C
3

*/

Measured memory_bytes: 1732
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define sf scanf
#define pf printf
#define INF (ll)1e15
#define mod 1000000007

///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///int kx[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ky[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
///int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
///int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction
 
///using namespace __gnu_pbds;
using namespace std;
 
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}
///typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
 
const int S=123456;
typedef pair<ll,ll>ii;
int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    #endif
    int n,m;
    while(sf("%d %d",&n,&m)==2)
    {
        ii ara[n+5];
        for(int i=0;i<n;i++)sf("%lld %lld",&ara[i].first,&ara[i].second);

        sort(ara,ara+n);
        ll sum=0,ans=0;
        for(int i=0;i<n;i++)
        {
            if(sum+ara[i].second<m)
            {
                ans+=(ara[i].first*ara[i].second);
                sum+=ara[i].second;
            }
            else
            {
                ll need=m-sum;
                ans+=(ara[i].first*need);
                break;
            }
        }
        pf("%lld\n",ans);
    }   
    return 0;
}
 









 




























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

int main(){
    vector<int> cnt(4, 0);
    int x;
    for (int i = 0; i < 6; i++) cin >> x, cnt[x - 1]++;
    bool flag = true;
    for (int i = 0; i < 4; i++) if (cnt[i] == 3) flag = false;
    if (flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
N,A,B,C=map(int,input().split())
l_list=[]
for i in range(N):
    l_list.append(int(input()))
def f(i,a,b,c):
    if i==N:
        if a*b*c==0:
            return 10**10
        else:
            return abs(a-A)+abs(b-B)+abs(c-C)-30
    else:
        addno=f(i+1,a,b,c)
        addA=f(i+1,a+l_list[i],b,c)+10
        addB=f(i+1,a,b+l_list[i],c)+10
        addC=f(i+1,a,b,c+l_list[i])+10
        return(min(addno,addA,addB,addC))
print(f(0,0,0,0))


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

void mover(int sx, int sy, int tx, int ty) {
	int nowx = sx, nowy = sy;
	while (nowy != ty)
	{
		if (nowy < ty)
		{
			nowy++;
			cout << "U";
		}
		else
		{
			nowy--;
			cout << "D";
		}
	}
	while (nowx != tx)
	{
		if (nowx < tx) {
			nowx++;
			cout << "R";
		}
		else {
			nowx--;
			cout << "L";
		}
	}
}
int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	mover(sx, sy, tx, ty);
	mover(tx, ty, sx, sy);
	if (sx - tx <= 0)cout << "L";
	else cout << "R";
	mover(sx + ((sx - tx) / abs(sx - tx)), sy, tx, ty-(sy-ty)/abs(sy-ty));
	if (sy - ty <= 0)cout << "D";
	else cout << "U";
	if (sx - tx >= 0)cout << "L";
	else cout << "R";
	mover( tx-((sx - tx) / abs(sx - tx)), ty ,sx , sy+ (sy - ty) / abs(sy - ty));
	if (sy - ty >= 0)cout << "D";
	else cout << "U";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int countYakusu(int x){
    int cnt = 0;
    for(int i = 1; i <= x; i++){
        if(x % i == 0) cnt++;
    }
    return cnt;
}

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

    int ans = 0;
    for(int i = 1; i <= n; i = i + 2){
        if(countYakusu(i) == 8) ans++;
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
/*
        HELLO WORLD
        -----------
        SHUBHAM
        -----------
        :) CODING
*/
#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;

#define ff                                         first
#define ss                                         second
#define pb                                         push_back
#define int                                        long long
#define mp                                         make_pair
#define pii                                        pair<int,int>
#define vi                                         vector<int>
#define mii                                        map<int,int>
#define umii                                       unordered_map<int,int>
#define pqb                                        priority_queue<int>
#define pqs                                        priority_queue<int,vi,greater<int>>
#define setbits(x)                                 __builtin_popcountll(x)
#define zerobits(x)                                 __builtin_ctzll(x)
#define mod                                        1000000007
#define inf                                        1e18
#define ps(x,y)                                    fixed<<setprecision(y)<<x
#define mk(arr,n,type)                             type *arr=new type[n]
#define test(t)                                    int t;cin>>t;while(t--)
#define rep(i,n)                                   for(int i=0;i<n;i++)
#define rep1(i,n)                                  for(int i=1;i<=n;i++)
#define fio                                        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SIZE                                       1000001
#define all(x)                                     (x).begin(),(x).end()
#define sclk()                                     auto start_time = Clock::now()
#define eclk()                                     auto end_time = Clock::now();  cout << "\nTime Taken : " << chrono::duration_cast<chrono::milliseconds>(end_time    - start_time).count() << " ms"
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef std::chrono::high_resolution_clock Clock;

int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int a,int b) { return b?gcd(b,a%b):a;}

void f_io()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif // ONLINE_JUDGE
}
int dp[100000];
int arr[100000];
int n;
int solve()
{
  dp[0]=0;
  dp[1]=abs(arr[1]-arr[0]);
  for(int i=2;i<n;i++)
    dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
  return dp[n-1];
}
int32_t main()
{
   cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>arr[i];
  }
  cout<<solve();
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;
  
int main(void)
{
  int num;
  int* goods;
  int highest_index;
  int sum;

  cin >> num;

  goods = new int[num];
  
  for(int i = 0; i < num; i++){
    cin >> goods[i];
  }

  highest_index = 0;
  for(int i = 1; i < num; i++){
    if (goods[highest_index] < goods[i]){
      highest_index = i;
    }
  }

  goods[highest_index] /= 2;
  
  sum = 0;
  for(int i = 0; i < num; i++){
    sum += goods[i];
  }

  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>
#include<sstream>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cout << '\n';}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << '[' << *it << " = " << a << "]  ";
    err(++it, args...);
}

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<lli, lli> tii;
typedef tuple<lli, lli, lli> tiii;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;


void solve(){
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int ans=0;
	ans+=min(k,a);
	k-=min(k,a);
	k-=min(k,b);
	ans-=min(k,c);
	cout<<ans;

}

int main(){
	fast_io
	int tc=1;
	//cin>>tc;
	while(tc--){solve();}
	return 0;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pb push_back
#define mp make_pair
bool isPrime(ll n) 
{ 
    
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
   
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
ll minthis(ll a, ll b){
if(a < b){
return a;
}
return b;
}
ll maxthis(ll a, ll b){
if(a > b){
return a;
}
return b;
}
int gcd(int a, int b){
    if( a<0 ) a = -a;
    if( b<0 ) b = -b;
    while( b!=0 ){
        a %= b;
        if( a==0 ) return b;
        b %= a;
    }
    return a;
}
 
int findLargestDivisor(int n) 
{ 
	int max = 1;
    for (int i = 2; i < n; i++) {        
        if(n %(i) == 0) { 
            max = i;
        } 
    }
    return max;     
} 
	 
 
ll power(ll x, ll y)  
{  
    ll temp;  
    if(y == 0)  
        return 1;  
    temp = power(x, y / 2);  
    if (y % 2 == 0)  
        return temp * temp;  
    else
    {  
        if(y > 0)  
            return x * temp * temp;  
        else
            return (temp * temp) / x;  
    }  
} 
bool sortbysec(const pair<int, int>& a, 
               const pair<int, int>& b) 
{ 
    return (a.second < b.second); 
} 


void solve(){
	int x , n;
	cin >> x >> n;
	int ans[101] = {};
	int check1 = 101,check2 = -1;
	for(int i = 0 ; i < n ; i++){
		int b;
		cin >> b;
		ans[b]++;
	}
	for(int i = x ; i <= 100 ; i++){
		if(ans[i] == 0){
			check1 = i;break;
		}
	}	
	for(int i = x ; i >= 0 ; i--){\
		if(ans[i] == 0){
			check2 = i;break;
		}
	}
	if(abs(check1-x) < abs(check2-x)){
		cout << check1 << "\n";
	}
	else if(abs(check1-x) == abs(check2-x)){
		cout << min(check1, check2) << "\n";		
	}
	else
	cout << check2 << "\n";
}

int main(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
		solve();
	}
    return 0; 
}




Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main(){
    int k;cin >> k;
    string s;cin >> s;
    if(s.length()<=k){
        cout << s <<endl;
        return 0;
    }
    else {
        for(int i=0;i<k;i++){
            cout << s[i];
        }
        cout << "..." << endl;
        return 0;

    }
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
  ll N;
  cin >> N;
  vector<float> A(N);
  ll i;
  float m=0;
  for(i=0;i<N;i++){
    cin >> A[i];
    m += 1.0/A[i];
  }
  cout << 1.0/m;
  
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	    	   
    	while (true){ 
    		int[]a = new int[2];
    		a[0] = scan.nextInt();
        	a[1] = scan.nextInt();
    		if(a[0] == 0 && a[1] ==0){
    			break;
    		}else{
    			java.util.Arrays.sort(a);
    			System.out.println(a[0]+" "+a[1]);
    		}
    	}
   }
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void yp(){cout<<"Yes"<<endl;}
void np(){cout<<"No"<<endl;}

int main(){
    int n;
    cin>>n;
    int t[n],x[n],y[n];bool flag=true;
    rep(i,n)cin>>t[i]>>x[i]>>y[i];
    int nx=0,ny=0,nt=0;
    rep(i,n){
        int xd=abs(x[i]-nx),yd=abs(y[i]-ny),td=t[i]-nt;
        if(xd+yd>td){
            flag=false;break;
        }
        if((td-xd-yd)%2){
            flag=false;break;
        }
        nx=x[i];ny=y[i];nt=t[i];
    }
    if(flag){yp();}else{np();}
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <cmath>

using namespace std;

int main() {
    long long x;
    cin>>x;
    int cnt = 0;
    long long y = 100;
    while(y<x){
        y=floor(y*1.01);
        cnt++;
    }
    cout<<cnt<<endl;

    return 0;
}

Measured memory_bytes: 3744
#include <iostream>

int main(void){
	using namespace std;
	int n, i, *p;
	cin >> n;
	p = new int[n];
	for(i = 0; i < n; i++){
		cin >> p[i];
	}
	for(i = n-1; i > 0; i--){
		cout << p[i] << " ";
	}
	cout << p[0] << endl;
	delete[] p;
	return 0;
}


Measured memory_bytes: 3128
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

//# include <ext/pb_ds/assoc_container.hpp>
//# include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 323;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int a[N];
vector < int > g[N];
int e[N][N];
int dp[N][N];
int ans[N];

int main () {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= n; ++j)
		    if(i != j)
				e[i][j] = k + 1;
	for (int i = 1; i <= m; ++i) {
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		e[x][y] = e[y][x] = min(z, e[x][y]);
	}

	for (int k = 1; k <= n; ++k)
		for (int i = 1; i <= n; ++i) {
			for (int j = 1; j <= n; ++j)
				e[i][j] = min(e[i][j], e[i][k] + e[k][j]);
		}


	for (int s = 1; s <= n; ++s) {
		for (int i = 1; i <= n; ++i)
			dp[s][i] = (i!=s ? inf : 0);
		deque < pair<int,int> > dq;
		dq.pb({k, s});
		while(dq.size()) {
			int v = dq.front().second;
			int L = dq.front().first;

			dq.pop_front();

			for (int i = 1; i <= n; ++i) if (e[v][i] <= L) {
				if(dp[s][i] > dp[s][v]) {
					dp[s][i] = dp[s][v];
					dq.push_front({L - e[v][i], i});
				}
			}

			L = k;
			for (int i = 1; i <= n; ++i) if (e[v][i] <= L) {
				if(dp[s][i] > dp[s][v] + 1) {
					dp[s][i] = dp[s][v] + 1;
					dq.pb({L-e[v][i], i});
				}
			}
		}
	}

	int q;
	scanf("%d", &q);

	while(q --) {
		int s, t;
		scanf("%d%d", &s, &t);
		int &ans = dp[s][t];
		printf("%d\n", (ans == inf ? -1 : ans));
	}

	       
	return Accepted;
}

// B...a

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

using namespace std;


int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n - 1; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            int bit;
            for (bit = 0; bit <= 10; ++bit)
                if (((i >> bit) & 1) != ((j >> bit) & 1))
                    break;
            printf("%d ", bit + 1);
        }
        printf("\n");
    }
}


Measured memory_bytes: 512
//AGC038A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
using namespace std;

int main(){
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	for(int j=0;j<h-b;j++){
		for(int i=0;i<a;i++){
			cout << "0";
		}
		for(int i=0;i<w-a;i++){
			cout << "1";
		}
		cout << endl;
	}
	for(int j=0;j<b;j++){
		for(int i=0;i<a;i++){
			cout << "1";
		}
		for(int i=0;i<w-a;i++){
			cout << "0";
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;

int main(void) {

    int N; cin >> N;
    map<string, int> color;
    int up3200 = 0;

    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        if (a < 400) {
            color["gray"]++;
        } else if (a < 800){
            color["brown"]++;
        } else if (a < 1200) {
            color["green"]++;
        } else if (a < 1600) {
            color["lblue"]++;
        } else if (a < 2000) {
            color["blue"]++;
        } else if (a < 2400) {
            color["yellow"]++;
        } else if (a < 2800) {
            color["orange"]++;
        } else if (a < 3200) {
            color["red"]++;
        } else {
            up3200++;
        }
    }

    int min = color.size();
    cout << (min == 0 ? 1 : min) << " " << min+up3200 << endl;

    return 0;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

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

    vector<bool> a(n+10);

    REP(i, n+10) {
        a[i] = false;
    }

    REP(i, m) {
        ll tmp;
        cin >> tmp;
        a[tmp] = true;
    }

    // a_n = a_(n-1) + a(n-2)
    vector<ll> ans(n+10);
    if (a[1] == false) {
        ans[1] = 1;
    } else {
        ans[1] = 0;
    }

    if (a[2] == false) {
        ans[2] = ans[1] + 1;
    } else {
        ans[2] = 0;
    }

    for (int i = 3; i <= n; ++i) {
        if (a[i] == false) {
            ans[i] = (ans[i-1] % MOD + ans[i-2] % MOD) % MOD;
        } else {
            ans[i] = 0;
        }
    }

    MSG(ans[n] % MOD)
}



Measured memory_bytes: 1152
#include<iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;

int main(void){
  string s;
  while(getline(cin,s)){
    string res;
    for(int i = 0 ; i < s.size() ; i ++){
      if(s[i] == '@'){
	i++;
	for(int j = 0 ; j <int(s[i] - '1') ; j ++){
	 res += s[i + 1];
	} 
      }else{
	res += s[i];
      }
    }
    cout<<res<<endl;
  }
}

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

int main() {
  int n;
  bool flag = false;
  cin >> n;
  vector<char> vec(n);
  
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
    if (vec.at(i)=='Y'){
    	flag = true;
    }
  }
  if (flag){
    cout << "Four" << endl;
  }
  else{
    cout << "Three" << endl;
  }   
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
using namespace std;
int main(){
    int h,w;
    int INF=100000000;
    cin >> h >> w;
    char s[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> s[i][j];
        }
    }
    int ans[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            ans[i][j] = INF; 
        }
    }

    int dx[8] = {0,0,-1,1,1,-1,1,-1};
    int dy[8] = {1,-1,0,0,1,-1,-1,1};
    int n,m;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(s[i][j]=='#'){
                for(int k=0;k<8;k++){
                    n = i + dx[k];
                    m = j + dy[k];
                    if(n>=0&&n<h&&m>=0&&m<w&&s[n][m]=='.'){
                        ans[n][m]++;
                    }
                }
            }    
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(s[i][j]=='#'){
                cout << s[i][j];
            }else{
                cout << ans[i][j]-INF;
            }
        }
        cout << endl;
    }

}


Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <list>
#include <ctime>
#include <memory.h>
#include <bitset>
#include <climits>
#include <iostream>
#include <stdlib.h>

#define F first
#define S second
#define endl "\n"
#define mp make_pair
#define pb push_back
#define bs 1000000007
#define pi 3.141592653589793
#define y1 kjdfshnvoavaofobiopj
using namespace std;

int k, found[15], save, num;
bool error;

int main(){
//freopen("input.txt", "r", stdin);
ios_base::sync_with_stdio(0);
cin.tie(0);

cin>>num>>k;
for(int i = 0; i < k; i++)
{
	int xs; cin>>xs;
	++found[xs];
}

while(1)
{
    save = num;
    error = false;
    while(save)
    {
        if(found[save%10] == 1)
            error = true;
        save /= 10;
    }
    if(error)
        ++num;
    else
        break;
}
cout<<num<<endl;

return 0;}


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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (int)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

vll binary_convert(ll n){
    vll s;
    ll size = 0;

    while(n / (ll)(pow(2,size)) > 0)size++;
    rep(i,size + 1){
        s.pb(n / (ll)(pow(2,i)));
        n %= (ll)(pow(2,i));
    }

    return s;
}

ll fib(ll n){
    vll a(n+1);
    a[0] = 1;
    a[1]  = 1;

    REP(i,2,n+1){
        a[i] = a[i-1] + a[i-2];
        a[i] %= mod;
    }

    return a[n-1];
}

int main()
{
    double w,h,x,y;
    cin >> w >> h >> x >> y;

    cout << (double)w*h/2 << " ";
    if(x == w/2 && y == h/2)cout << 1 << endl;
    else cout << 0 << 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 x = sc.nextInt();

        int ans = x;

        boolean flag = true;

        while (flag){
            int t = (int)Math.sqrt(ans);
//            System.out.println(t);
            int cnt = 0;
            for (int i=2; i<=t; i++){
                if (ans%i==0){
                    ans++;
                    break;
                }else {
                    cnt++;
                }
            }
            if (cnt==t-1) {
                flag = false;
            }
        }
        System.out.println(ans);

    }
}

Measured memory_bytes: 21844
#include<cstdio>
using namespace std;
int a[100005],n,m,x,y,i,ans;bool b[100005]={0,1};
int main(){
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++) a[i]=1;
	for(i=1;i<=m;i++){
		scanf("%d%d",&x,&y);
		if(b[x]){
			b[y]=1;
			if(a[x]==1) b[x]=0;
		}
		a[y]++,a[x]--;
	}
	for(i=1;i<=n;i++)
		if(b[i])
			ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
N = int(input())

dist = [[1 if s == '1' else float('inf') for s in input()] for _ in range(N)]

for i in range(N):
    dist[i][i] = 0

for k in range(N):
    for i in range(N):
        for j in range(N):
            if dist[i][j] > dist[i][k] + dist[k][j]:
                dist[i][j] = dist[i][k] + dist[k][j]

baseMod = [d % 2 for d in dist[0]]

for i in range(N):
    A = [0] * N
    for j, d in enumerate(dist[i]):
        A[j] = (d + baseMod[i]) % 2
    if A != baseMod:
        print(-1)
        exit()

ans = max([max(D) for D in dist]) + 1
print(ans)

Measured memory_bytes: 47836
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))


n = ii()
A = []
B = []

for _ in range(n):
    a,b = iim()
    A.append(a)
    B.append(b)
A.sort()
B.sort()

if n%2 == 1:
    ans = B[n//2]-A[n//2]+1
else:
    lmin = A[n//2-1]
    lmax = B[n//2-1]
    rmin = A[n//2]
    rmax = B[n//2]
    ans = (rmax+lmax) - (rmin+lmin) + 1
print(ans)

Measured memory_bytes: 25396
use std::io::Read;
fn main() {
    let n= {
        let inputstr = {
            let mut inputstr = String::new();
            std::io::stdin().read_to_string(&mut inputstr).unwrap();
            inputstr
        };
        let mut inputiter = inputstr.split_whitespace();
        let n =  inputiter.next().unwrap().parse::<usize>().unwrap();
        n
    };
    let ans = {
        let keta = (n as f64).log10() as usize + 1;
        let amari = 
            if keta % 2 == 1 {
                n - (10 as f64).powi(keta as i32 -1) as usize + 1 
            }else{
                0
            };
        let sum:usize = 
            (1..keta)
            .filter(|x| x %2 ==1)
            .map(|x|(10 as f64).powi(x as i32) as usize - (10 as f64).powi(x as i32 -1) as usize)
            .sum();
        amari + sum
    };
    println!("{}",ans);
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;


ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/******************************************
** A main function is start from here  ****
*******************************************/
int main(){
  string S;
  cin >> S;
  int len = S.size();
  int ans = 0;
  rep(i, len/2){
    if(S[i]!=S[len-1-i]) ans ++;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
ans = "1" + "0" * (n - 1)
changed_already = [0 for _ in range(n)]
for i in range(m):
    s, c = map(int, input().split())
    if changed_already[s - 1] != 0 and ans[s - 1] != str(c):
        print(-1)
        exit()
    changed_already[s - 1] = 1
    ans = ans[:s - 1]  + str(c) + ans[s:]
if n == 1 and m == 0:
    print(0)
    exit()
if len(str(int(ans))) != n:
    print(-1)
    exit()
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int a, b, t;
    cin >> a >> b >> t;

    cout << t/a * b << endl;
    return 0;
}

Measured memory_bytes: 256
S = input()
eda = []
flag = False
N = len(S)
if S[-1] == '1':
  flag = True
if S[0] == '0':
  flag = True
if S[-2] == '0':
  flag = True
for k in range((N-1)//2):
  if S[k] != S[-k-2]:
    flag = True
  if S[k] == '1':
    eda.append(k+1)
if N%2 == 0:
  if S[N//2 -1] == '1':
    eda.append(N//2)
if flag:
  print(-1)
  exit()
ans = []
eda.reverse()
before = eda.pop()
while eda:
  after = eda.pop()
  for k in range(before, after):
    ans.append((k, after))
  before = after
ans.append((before, before+1))
for k in range(before+2, N+1):
  ans.append((before+1, k))
while ans:
  item = ans.pop()
  print(item[0], item[1])

Measured memory_bytes: 22496
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;
    vector<ll> A(N + 1); ll sum = 0;
    REP(i, 0, N + 1) {
        cin >> A[i];
        sum += A[i];
    }

    if (N > 0 && A[0]) {
        cout << -1 << endl;
        return 0;
    }

    if (N == 0) {
        if (A[0] != 1) {
            cout << -1 << endl;
            return 0;
        } else {
            cout << 1 << endl;
            return 0;
        }
    }

    ll cur = 1, accum = 0, ans = 1;
    REP(i, 1, N) {
        // cout << "# i : " << i << ", cur : " << cur << ", A[i] : " << A[i] << endl;
        cur = cur * 2 - A[i];
        if (cur <= 0) {
            cout << -1 << endl;
            return 0;
        }
        accum += A[i];
        cur = min(sum - accum, cur);
        // cout << "--> sum : " << sum << ", accum : " << accum << " ==> cur : " << cur << endl;
        ans += cur + A[i];
    }
    if (cur * 2 - A[N] < 0) {
        cout << -1 << endl;
        return 0;
    }
    ans += A[N];

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

Measured memory_bytes: 4052
using System;
using System.Text;

namespace ConsoleApp3
{
	internal class Digit
	{
		public Digit()
		{
			Value = 0;
			Left = new Digit(1, null, this);
		}

		private Digit(int value, Digit left, Digit right)
		{
			if (value < 0 && value > 10) throw new ArgumentOutOfRangeException(nameof(value));
			Value = value;
			Left = left;
			Right = right;
		}

		public int Value { get; private set; }
		public Digit Left { get; private set; }
		public Digit Right { get; }


		private static void Reset(Digit d)
		{
			var piv = d;

			while (piv.Right != null)
			{
				if (piv.Value == 0) piv.Right.Value = 0;
				else piv.Right.Value = piv.Value - 1;

				piv = piv.Right;
			}
		}

		public void Next()
		{
			if (Left == null)
			{
				Left = new Digit(1, null, this);
				Reset(Left);
				return;
			}





			var tmp = Value + 1;

			if (Math.Abs(Left.Value - tmp) <= 1 && tmp < 10)
			{
				Value = tmp;
				Reset(this);
				return;
			}

			if (Left.Left == null && Left.Value < 9)
			{
				Left.Value += 1;
				Reset(Left);
				return;
			}

			Left.Next();
		}


		public override string ToString()
		{
			if (Right != null) throw new InvalidOperationException();
			var bld = new StringBuilder();

			var piv = this;


			while (piv.Left != null) piv = piv.Left;

			while (piv != null)
			{
				bld.Append(piv.Value);
				piv = piv.Right;
			}

			return bld.ToString();
		}
	}

	internal class Program
	{
		private static void Main(string[] args)
		{
			var k = int.Parse(Console.ReadLine());

			if (k <= 10)
			{
				Console.WriteLine(k);
			}
			else
			{
				var hoge = new Digit();
				for (var i = 0; i < k - 10; i++) hoge.Next();

				Console.WriteLine(hoge);
			}
		}
	}
}

Measured memory_bytes: 13140
#include <stdio.h>
long long e[100], f[100];
long long p = 1000000007;
long long n, t, g, y, x;
long long a[10000];
long long q[80000];
long long m[80000];
long long lcm, ans;
long long le, ri, md;
long long rui(long long rui_a, long long rui_b) {
	if (rui_b == 0)return 1;
	if (rui_b == 1)return rui_a % p;
	long long rui_c;
	rui_c = rui(rui_a, rui_b / 2);
	rui_c = rui_c * rui_c % p;
	if (rui_b % 2) {
		return rui_c * rui_a % p;
	}
	return rui_c;
}
int main() {
	scanf("%lld", &n);
	for (long long i = 0; i < n; i++) {
		scanf("%lld", a + i);
	}
	q[0] = 2;
	t = 1;
	for (long long i = 3; i < 1000100; i++) {
		g = 1;
		for (long long j = 0; j < t; j++) {
			if (i % q[j] == 0) {
				g = 0;
				break;
			}
			if (q[j] * q[j] > i)break;
		}
		if (g) {
			q[t] = i;
			t++;
		}
	}
	for (long long i = 0; i < n; i++) {
		x = a[i];
		t = 0;
		y = 0;
		while (x > 1) {
			if (x % q[t] == 0) {
				f[y] = 0;
				e[y] = t;
				while (x % q[t] == 0) {
					f[y]++;
					x /= q[t];
				}
				y++;
			}
			else {
				if (q[t] * q[t] > x)break;
				t++;
			}
		}
		if (x > 1) {
			ri = 78503;
			le = 0;
			while (ri - le > 1) {
				md = (le + ri) / 2;
				if (q[md] > x) {
					ri = md;
				}
				else le = md;
			}
			if (q[le] == x) {
				e[y] = le;
				f[y] = 1;
				y++;
			}
		}
		for (long long j = 0; j < y; j++) {
			if (m[e[j]] < f[j])m[e[j]] = f[j];
		}
	}
	lcm = 1;
	for (long long i = 0; i < 80000; i++) {
		lcm *= rui(q[i], m[i]);
		lcm %= p;
	}
	for (long long i = 0; i < n; i++) {
		ans += lcm * rui(a[i], p - 2) % p;
		ans %= p;
	}
	printf("%lld\n", ans % p);
}

Measured memory_bytes: 1408
import numpy as np
w, h, n = map(int, input().split())
box = np.ones((h, w))
for i in range(n):
    x, y, a = map(int, input().split())
    if a==1:
        box[:, :x] = 0
    elif a==2:
        box[:, x:] = 0
    elif a==3:
        box[:y, :] = 0
    elif a==4:
        box[y:, :] = 0
print(sum(sum(box)))

Measured memory_bytes: 21552
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

public:
    class proxy
    {
        std::ostream& cout;

    public:
        proxy() : cout(std::cout) {}
        ~proxy() { cout << '\n'; }
        template <class T>
        proxy& operator,(T&& val)
        {
            cout << ' ' << val;
            return *this;
        }
    };

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class T>
    proxy operator<<(T&& val)
    {
        cout << val;
        return {};
    }
};

int main()
{
    input in;
    output out;

    int N = in.read<int>();

    std::vector<int> A(N), r(N);
    in.read(A.begin(), N);

    int x = 0;
    for (int i : boost::irange(0, N)) x += A[i] * ((i % 2) ? -1 : 1);

    r[0] = x;
    std::cout << x << " ";

    for (int i : boost::irange(1, N)) {
        r[i] = 2 * (A[i - 1] - r[i - 1] / 2);
        std::cout << r[i] << " ";
    }

    return 0;
}


Measured memory_bytes: 2176
#include <cstring>
#include <cstdlib>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define ABS(a) ((a)<0?(-(a)):(a))
#define CS while(cases())
#define I(n) int n = gi()
#define II(n) n = gi()
#define L(n) ll n = gli()
#define LL(n) n = gli()
#define F(i, n) for (int i = 0; i < n; i++)
#define Fa(n, a) for (int i = 0; i < n; i++) a[i] = gi()
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

template<class T>
T gcd(T a, T b) {
    return (b == 0 ? a : gcd(b, a%b));
}

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int cases() {
    static int t = gi();
    return t--;
}

#define MD 1000000007

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    I(n);
    int r = 0;
    F(i, n) {
        I(x);
        if (i%2 == 0 && x%2)
            r++;
    }
    cout << r << endl;

    return 0;
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rapido ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"


void solve()
{
   string s;cin>>s;
   int n=s.size();
   if(s[n-1]=='s')
   s+="es";
   else
   s+="s";
   
   cout<<s<<endl;
}
int32_t main() 
{

    rapido;
    int t;
    //cin>>t;
    t=1;
    while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 3632