akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i = 0; i < (n); i++)
#define REP(i,n) for(int i = 1; i < (n); i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n")

using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vii = vector<vi>;

const int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int dy[8] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1; 


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

  ll n, m;
  cin >> n >> m;
  if(n == 1 && m == 1){cout << 1 << endl; return 0;}
  ll mn = min(n,m);
  if(mn == 1){cout << max(n,m)-2 << endl; return 0;}
  if(mn == 2){cout << 0 << endl; return 0;}
  ll ans = n*m - ((n+m)*2-4);
  cout << ans << endl;
}

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

LD gao(int n,LD d,LD x)
{
    if(n==1) return (d*2+x)/2.0;
    LD d1=(d*(2*n-2)+(d+x*2)+(d*3+x*3));
    LD x1=x/d1*(2*n+4),cur=(d*n*2+x*n*(2*n-1))/(2.0*n);
    return cur+d1/(2.0*n)*gao(n-1,1.0,x1);
}

int main()
{
    int n,d,x;
    scanf("%d%d%d",&n,&d,&x);
    printf("%.10Lf\n",gao(n,d,x));
    return 0;
}

Measured memory_bytes: 18944
#include <stdio.h>

int main(void){
	int students[30] = {};
	int i, num;
	
	for (i = 0; i < 28; i++){
		scanf("%d", &num);
		students[num-1] = 1;
	}
	
	for (i = 0; i < 30; i++){
		if (students[i] == 0) printf("%d\n", i+1);
	}
	
	return 0;
}

Measured memory_bytes: 596
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    cnt = 0
    for v in a:
        if v % 2 != 0:
            cnt += 1
    print("YES" if cnt % 2 == 0 else "NO")


if __name__ == '__main__':
    slove()


Measured memory_bytes: 63472
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int v[3];
    rep(i,0,3)cin>>v[i];
    sort(v,v+3);
    int k; cin>>k;
    rep(i,0,k){
        v[2]*=2;
        //cout<<v[2]<<endl;   
    }
    cout<<v[0]+v[1]+v[2]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }


const long long MOD = 2019;

ll nyan(ll L, ll R) {
	ll res = 1e18;
	ll N = min(R+1, L+MOD+1);
	FOR(l, L, N) {
		FOR(r, l+1, N) {
			chmin(res, (l*r)%MOD);
			if (res == 0) return res;
		}
	}
	return res;
}

void solve(long long L, long long R){
	ll res = nyan(L, R);
	cout << res << "\n";
}

int main(){
    long long L;
    scanf("%lld",&L);
    long long R;
    scanf("%lld",&R);
    solve(L, R);
    return 0;
}


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

bool isOK(int n){
    int a[100];
    int i = 0;
    while(n > 0){
        a[i] = n % 10;
        n /= 10;
        i++;
    }

    for(int j = 0;j < i/2;j++){
        if(a[j] != a[i-j-1]){
            return false;
        }
    }
    return true;
}

int main(){
    int a, b;
    cin >> a >> b;

    int ans = 0;
    for(int i = a;i <= b;i++){
        if(isOK(i)) ans++;
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl              "\n"
#define pb              push_back
#define fir               first
#define sec               second
#define all(v)            ((v).begin()), ((v).end())
#define sz(v)            ((int)((v).size()))
#define ll              long long
#define ld              long double
#define lp(i, n)        for(int i = 0 ; (int)i<n ; i++)
#define loop(i, x, n)       for(int i=x ; (int)i<=n ; i++)
#define isPowerOfTwo(s) (!(s & (s-1)))
typedef vector<int> vi;
typedef deque<int> de;
void origi() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
}
int n, arr[100];
void tiranga() {
    cin >> n;
    lp(i, n)
        cin >> arr[i];
    ll Min = LONG_MAX;
    sort(arr, arr + n);
    loop(i, arr[0], arr[n - 1]) {
        ll sum = 0;
        lp(r, n)
            sum += pow(i - arr[r], 2);
        Min = min(Min, sum);
    }
    cout << Min;
}
int main() {
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
#else
#endif 
    origi();
    tiranga();
    //cout << sumOfDig(123654);
   // genLarge(10, 10);
   // genSmall(10);
   
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 300
#define M 10000000
using namespace std;
 
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int n,A[N],B[N],a[M+10],pri[M];
int mps[N][N],lk[N],vis[N];
map<int,int> Ms;
inline int find(int x)
{
	for(int i=1;i<=B[0];i++) if(!vis[i]&&mps[x][i])
	{
		vis[i]=1; if(!lk[i]||find(lk[i]))
		{
			lk[i]=x; return 1;
		}
	}
	return 0;
}
int main()
{
	a[1]=1; for(int i=2;i<=M;i++)
	{
		if(!a[i]) pri[++pri[0]]=i;
		for(int j=1;j<=pri[0]&&pri[j]*i<=M;j++)
		{
			a[pri[j]*i]=1; if(i%pri[j]==0) break;
		}
	}
	n=read();
	for(int i=1;i<=n;i++)
	{
		int x=read(); Ms[x]^=1; Ms[x+1]^=1;
	}
	map<int,int> ::iterator it=Ms.begin();
	for(;it!=Ms.end();it++) if(it->second)
	{
		if(it->first&1) A[++A[0]]=it->first;
		else B[++B[0]]=it->first;
	}
	for(int i=1;i<=A[0];i++) for(int j=1;j<=B[0];j++)
		if(!a[abs(A[i]-B[j])]) mps[i][j]=1;
	int ct=0; for(int i=1;i<=A[0];i++)
		memset(vis,0,sizeof vis),ct+=find(i);
	cout << ct+((A[0]-ct)/2+(B[0]-ct)/2)*2+(A[0]-ct)%2*3 << endl;
	return 0;
}

Measured memory_bytes: 43648
#include<iostream>
#include<vector>
#include<map>
using namespace std;
int main(){
  int n;
  cin >> n;
  map<int,int> mpod,mpev;
  int a,b;
  for(int i=0;i<n/2;i++){
    cin >> a >> b;
    mpod[a]++;
    mpev[b]++;
  }
  int mxodcn=0,mxevcn=0,mxod,mxev,seodcn=0,seevcn=0;
  for(auto itr=mpod.begin();itr!=mpod.end();itr++){
    if(mxodcn<itr->second){
      mxod=itr->first;
      seodcn=mxodcn;
      mxodcn=itr->second;
    }
    else if(seodcn<itr->second) seodcn=itr->second;
  }
  for(auto itr=mpev.begin();itr!=mpev.end();itr++){
    if(mxevcn<itr->second){
      mxev=itr->first;
      seevcn=mxevcn;
      mxevcn=itr->second;
    }
    else if(seevcn<itr->second) seevcn=itr->second;
  }
  if(mxod==mxev){
    if(mxodcn+seevcn<mxevcn+seodcn) cout << n-mxevcn-seodcn << "\n";
    else cout << n-mxodcn-seevcn << "\n";
  }
  else cout << n-mxodcn-mxevcn << "\n";

  
  return 0;
}


Measured memory_bytes: 4992
# -*- coding:utf-8 -*-

loop{
    a,b,c = STDIN.gets.split
    a = a.to_i
    a = a.to_i
    case b
    when '+' then
        ans = a.to_i + c.to_i
    when '-' then
        ans = a.to_i - c.to_i
    when '*' then
        ans = a.to_i * c.to_i
    when '/' then
        ans = a.to_i / c.to_i
    else
        break
    end

    puts ans
}

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

using namespace std;


bool d[10][10];

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

    int n, m;
    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        d[a][b] = true;
        d[b][a] = true;
    }

    vector<int> p;
    for (int i = 0; i < n; i++) {
        p.push_back(i);
    }

    int ans = 0;
    do {
        if (p[0] != 0) {
            continue;
        }
        bool ok = true;
        for (int i = 0; i < p.size() - 1 && ok; i++) {
            if (!d[p[i]][p[i+1]]) {
                ok=false;
            }

        }
        ans += ok;
    } while (next_permutation(p.begin(), p.end()));
    cout << ans;
}


Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        x: i64,
        n: usize,
        p_vec: [usize; n],
    }

    let mut d: [i64; 102] = [-1; 102];
    p_vec.iter().for_each(|p| {
        d[*p] = 1;
    });
    let mut ans: (i64, i64) = (9999999, -1);
    (0..=101).for_each(|i| {
        if d[i] != 1 {
            let dif = (x - i as i64).abs();
            ans = if ans.0 > dif {
                (dif, i as i64)
            } else if ans.0 == dif && ans.1 > i as i64 {
                (dif, i as i64)
            } else {
                ans
            };
        }
    });
    println!("{}", ans.1)
}


Measured memory_bytes: 2160
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    int H,W;
    cin >> H >> W;
    vector<string> v(H);
    for(int i = 0; i < H; ++i) cin >> v[i];

    for(int i = 1; i <= 2 * H; ++i){
        cout << v[(i + 1) / 2 - 1] << endl;
    }
    return 0;
}



Measured memory_bytes: 764
#include "bits/stdc++.h"
using namespace std;    
 
#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))    
#define OUT(P) cout << (P) << endl    
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl    
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;    
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)    
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)    
typedef long long ll;    
 
int sum_digits(int num);    
template <class T>    
vector<T> copy_vector(vector<T> vec);    
int gcd(int a, int b);    
 
int main() {    
    int n;
    cin >> n;
    vector<pair<string, pair<int, int>>> sp(n);
    for(int i=0; i<n; i++) {
        string s;
        int p;
        cin >> s >> p;
        sp[i].first = s;
        sp[i].second.first = p;
        sp[i].second.second = i + 1;
    }
    sort(sp.begin(), sp.end());
 
    int i=0;
    while(i != n) {
        pair<string, pair<int, int>> csp = sp[i];
        vector<pair<string, pair<int, int>>> tmp_l;
        tmp_l.push_back(csp);
        for(int j=i+1; j<n; j++) {
            if(sp[j].first == csp.first) {
                tmp_l.push_back(sp[j]);
            }
        }

        sort(tmp_l.begin(), tmp_l.end(), [](pair<string, pair<int, int>> &p1, pair<string, pair<int, int>> &p2){ return (p1.second.first > p2.second.first); });
        int tmp_size = tmp_l.size();
        for(int j = 0; j<tmp_size; j++) {
            cout << tmp_l[j].second.second << endl;
        }
        i+= tmp_size;
 
    }
    for(int i=0; i<n; i++) {
    }
 
    return 0;    
}    
 
/******************************/    
/***** DECRARED FUNCTIONS *****/    
/******************************/    
 
int sum_digits(int num) {    
    int rtn = 0;    
    while(num != 0) {    
        int tmp = num % 10;    
        rtn += tmp;    
        num /= 10;    
    }    
    return rtn;    
}    
 
// vectorのコピー    
template <class T>    
vector<T> copy_vector(vector<T> vec) {    
    vector<T> rtn;    
    rtn.reserve(vec.size());    
    copy(vec.begin(), vec.end(), back_inserter(rtn));    
    return rtn;    
}    
 
// ユークリウッドの互除法    
int gcd(int a, int b) {    
    if(b==0) return a;    
    else return gcd(b, a % b);    
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

int main() {
	int N;
	long long sum = 0;
	cin >> N;
	vector<int> vec(N);
	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);
	}
	sort(vec.begin(), vec.end());
	for (int i = 0; i < N; i++) {
		sum += vec.at(i);
	}
	cout << vec.at(0) << " " << vec.at(N - 1) << " " << sum << endl;
}


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

#define long long long int
using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<string> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    map<string, int> cnt;
    for (string s : a) cnt[s]++;
    int mx = 0;
    for (auto p : cnt) {
        mx = max(mx, p.second);
    }
    for (auto p : cnt) {
        if (p.second == mx) {
            cout << p.first << "\n";
        }
    }
    

    return 0;
}

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

int main()
{
  int N; cin >> N;
  bool ans = false;
  rep(a, 25){
    rep(b, 25){
      int sum = 4*a + 7*b;
      if(sum == N){
        ans = true;
      }
    }
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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


#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}


template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}


struct solve
{
	solve(){}
	ll operator()() {
		return 0;
	}
};

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

	for(;;)
	{
		int h, w, k;
		cin >> h >> w >> k;
		if(cin.fail()) break;
		vector<string> c(h);
		for(auto&m:c) cin >> m;

		int ans=0;
		for(int fy=0;fy<(1<<h);fy++)
		{
			for(int fx=0;fx<(1<<w);fx++)
			{
				int count=0;
				for(int y=0;y<h;y++)
				{
					if((fy>>y)&1) continue;
					for(int x=0;x<w;x++)
					{
						if((fx>>x)&1) continue;
						if(c[y][x]=='#') count++;
					}
				}
				if(count==k) ans++;
			}
		}

		cout << ans << "\n";
	}
	return 0;
}


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

int main(void) {
    std::ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    string s;
    while(cin >> s) {
        if(s[0] == s[1]) {
            if(s[1] == s[2]) cout << "Yes" << endl;
            else cout << "No" << endl;
        } else if(s[1] == s[2]) {
            cout << (s[3] == s[2] ? "Yes" : "No") << endl;
        } else cout << "No" << endl;
    }
}


Measured memory_bytes: 256
/* ADLS1_5_D:The Number of Inversions */
/* 20181122 AOJ */

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define N 200000

int L[N / 2 + 1], R[N / 2 + 1];
long long cnt;

void mergeSort(int *A, int n, int left, int right);
void merge(int *A, int left, int mid, int right);

int main(void) {
	int n, i;
	//int *A = (int *)malloc(sizeof(int) * N);
	int A[N];

	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d", &A[i]);
	}

	mergeSort(A, n, 0, n);
	
	printf("%ld\n", cnt);

	return 0;
}

void mergeSort(int *A, int n, int left, int right) {
	int mid;

	if(left + 1 < right) {
		mid = (left + right) / 2;
		mergeSort(A, n, left, mid);
		mergeSort(A, n, mid, right);
		merge(A, left, mid, right);
	}
}

void merge(int *A, int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	int i, j, k;

	i = j = 0;
	while(i < n1) {
		L[i] = A[left + i];
		i++;
	}
	while(j < n2) {
		R[j] = A[mid + j];
		j++;
	}

	i = j = 0;
	L[n1] = INT_MAX;
	R[n2] = INT_MAX;
	for(k = left; k < right; k++) {
		if(L[i] <= R[j]) {
			A[k] = L[i++];
		}else {
			A[k] = R[j++];
			cnt += n1 - i;
		}	
	}
}


Measured memory_bytes: 3292
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N; cin >> N;
    vector<string> W(N);
    char tmp;
    for(int i=0;i<N;i++) {
        cin >> W[i];
        if(i != 0) {
            if(tmp != W[i].at(0)) {
                cout << "No" << endl;
                return 0;
            }
        }
        tmp = W[i].at(W[i].size()-1);
    }

    int pre = W.size();
    sort(W.begin(), W.end());
    W.erase(unique(W.begin(), W.end()), W.end());
    
    if (pre != W.size()) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    return 0;

    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<map>
#include<stack>
#include<queue>
using namespace std;

int main()
{
	int i,j,n;
	long long a,sum;
	map<long long,long long> mp;
	map<long long,long long>::iterator iter;
	while(~scanf("%d",&n))
	{
		sum=0;
		mp.clear();
		for(i=1;i<=n;i++)
		{
			cin>>a;
			mp[a]++;
		}
		for(iter=mp.begin();iter!=mp.end();iter++)
		{
			if(iter->first<iter->second)
				sum+=(iter->second-iter->first);
			else if(iter->first>iter->second)
				sum+=iter->second;
		}
		printf("%lld\n",sum);
	}
	return 0;
}	

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

bool gochi(int k, int d) { return (k / 10 == 51) && d == 3; }

ll dp[20][2][1005][2];
int main() {
  string N;
  cin >> N;
  int len = N.size();
  dp[0][0][0][0] = 1;
  rep(i, len) rep(j, 2) rep(k, 1000) rep(l, 2) {
    int x = j ? 9 : N[i] - '0';
    rep(d, x + 1) dp[i + 1][j || d < x][k % 100 * 10 + d][l || gochi(k, d)] +=
        dp[i][j][k][l];
  }
  ll ans = 0;
  rep(j, 2) rep(k, 1000) ans += dp[len][j][k][1];
  cout << ans << endl;
  return 0;
}



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

using namespace std;

typedef long long ll;

struct data{
    int s, e;
    data(){}
    data(int s, int e): s(s), e(e){}
    bool operator<(const data &r)const{
        return e<r.e;
    }
} arr[100002];

int n;
int x[100002], l[100002];
int v = INT_MIN;
int ans;

int main(){
    scanf("%d", &n);
    for(int i=1; i<=n; i++){
        scanf("%d %d", &x[i], &l[i]);
        arr[i] = data(x[i]-l[i], x[i]+l[i]);
    }
    sort(arr+1, arr+n+1);
    for(int i=1; i<=n; i++){
        if(arr[i].s >= v) ans++, v = arr[i].e;
    }
    printf("%d", ans);
}


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

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

const ll INF = 1e15;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

const int MAX = 510000;
const int MOD = 1000000007;


vector<P> v;

int main(void) {
	int N; cin >> N;
	for (int i = 0; i < N; i++) {
		ll a, b; cin >> a >> b;
		v.push_back({ b,a });
	}
	sort(v.begin(), v.end());

	ll total = 0;
	for (int i = 0; i < N; i++) {
		ll T = v[i].first;
		total += v[i].second;
		if (T < total) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

}


Measured memory_bytes: 6512
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var s string
	fmt.Fscan(r, &s)

	ans := true

	for i := 0; i < len(s)/2; i++ {
		if s[i] != s[len(s)-i-1] {
			ans = false
		}
	}

	index1 := (len(s) - 1) / 2
	tmp1 := s[0:index1]
	for i := 0; i < len(tmp1)/2; i++ {
		if tmp1[i] != tmp1[len(tmp1)-i-1] {
			ans = false
		}
	}

	index2 := (len(s)+3)/2 - 1
	tmp2 := s[index2:]
	for i := 0; i < len(tmp2)/2; i++ {
		if tmp2[i] != tmp2[len(tmp2)-i-1] {
			ans = false
		}
	}

	if ans {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}

// Union-Find
type unionFind struct {
	d []int
}

func newUnionFind(n int) *unionFind {
	uf := new(unionFind)
	uf.d = make([]int, n)
	for i := 0; i < n; i++ {
		uf.d[i] = -1
	}
	return uf
}

func (uf *unionFind) find(x int) int {
	if uf.d[x] < 0 {
		return x
	}
	uf.d[x] = uf.find(uf.d[x])
	return uf.d[x]
}

func (uf *unionFind) unite(x, y int) bool {
	rootX := uf.find(x)
	rootY := uf.find(y)
	if rootX == rootY {
		return false
	}

	if uf.d[rootX] < uf.d[rootY] {
		uf.d[rootX] += uf.d[rootY]
		uf.d[rootY] = rootX
	} else {
		uf.d[rootY] += uf.d[rootX]
		uf.d[rootX] = rootY
	}

	return true
}

func (uf *unionFind) same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *unionFind) size(x int) int {
	return -uf.d[uf.find(x)]
}

// mod combination
func modpow(a, n, mod int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n = n / 2
	}
	return res
}

func modcomb(n, a, mod int) int {
	x := 1
	y := 1
	for i := 0; i < a; i++ {
		x = x * (n - i)
		x %= mod
		y = y * (i + 1)
		y %= mod
	}
	return x * modpow(y, mod-2, mod) % mod
}

func modfactorial(n, mod int) int {
	result := 1
	for i := 1; i <= n; i++ {
		result = (result * i) % mod
	}
	return result
}

// Utility

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}


Measured memory_bytes: 640
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
    int N, tmp, i;
    unsigned long long sum = 0;
    vector<int> a;
    scanf("%d", &N);
    for(i=0;i<3*N;i++){
        scanf("%d", &tmp);
        a.push_back(tmp);
    }
    sort(a.begin(), a.end());
    auto itr = a.end();
    for(i=0;i<N;i++){
        itr=itr-2;
        sum += *itr;
        
    }
    printf("%lld\n", sum);
    
    return 0;
}

Measured memory_bytes: 2420
import sys
import math
 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()

N = ni()
S = ns()
K = ni()-1
R = ""
s = S[K]
for i in range(N):
    if(S[i]!=s):
        R += "*"
    else:
        R += S[i]
print(R)



Measured memory_bytes: 3060
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
        List<Restaurant> list = new ArrayList<>();
        for(int i = 1; i <= n; i++){
            String city = sc.next();
            int score = sc.nextInt();
            list.add(new Restaurant(city, score, i));
        }
        Collections.sort(list);
        for(Restaurant res: list){
        	System.out.println(res.i);
        }
    }
}
class Restaurant implements Comparable<Restaurant>{
	String city;
    int score;
    int i;
    public Restaurant(String city, int score, int i){
    	this.city = city;
        this.score = score;
        this.i = i;
    }
    public int compareTo(Restaurant other){
    	int ans = city.compareTo(other.city);
        if(ans != 0){
        	return ans;
        }
        return Integer.compare(other.score, score);
    }
}

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

string w;

int main (){
    cin >> w;
    if (w == "Sunny") cout << "Cloudy" << '\n';
    else if (w == "Cloudy") cout << "Rainy" << '\n';
    else cout << "Sunny" << '\n';
    return 0;
}

Measured memory_bytes: 256
'use strict';
function main(input) {
  input = input.split("\n");
  const a = input[0];
  
  if (a[0] === a[1] && a[1] === a[2]) {
    console.log('No');
  } else {
    console.log('Yes');
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

typedef long long ll;
const int NMAX = 2e5 + 10;
const int MOD = 1e9 + 7;
int main(int argc, char const *argv[])
{
	int n,k;
	scanf("%d%d",&n,&k);
	vector<int> grade(n);
	vector<double>log(n-k+1);
	for(register int i = 0;i < n;i++)
		scanf("%d",&grade[i]);
	log[0] = 0;
	for(register int i = 0;i < k;i++)
		log[0] += log2(grade[i]);
	int pre_index = 0,pre=0;
	for(register int i = k;i < n;i++)
	{
		pre_index++;
		log[pre_index] = log[pre_index-1]+log2(grade[i])-log2(grade[pre]);
		pre++;
	}
	for(register int i = 0;i < n-k;i++)
		printf("%s\n",log[i+1]>log[i]?"Yes":"No" );
	return 0;
}

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

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

int n, m;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  if (m == n)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n,t,min=99999;
    int c[100000],a[100000];
    cin>>n>>t;
    for(int i=0;i<n;i++){
        cin>>c[i]>>a[i];
    }
    for(int i=0;i<n;i++){
        if(a[i]<=t && min>c[i])
        min=c[i];
    }
    if(min!=99999)
        cout<<min<<'\n';
    else{
        cout<<"TLE"<<'\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 7;
char s[maxx];
map <char, bool> vis;
char ans;

int main() {
	scanf("%s", s);
	int l = strlen(s);
	bool flg = 0;
	for(int i = 0; i < l; i++) vis[s[i]] = 1;
	for(char i = 'a'; i <= 'z'; i++) {
		if(!vis[i]) {
			flg = 1;
			ans = i;
			break;
		}
	}
	if(flg) putchar(ans);
	else puts("None");
}

Measured memory_bytes: 384
a,b,c,d=map(int,input().split())
n=int(input())

twoval=min(8*a,4*a+2*b,4*b,2*b+c,2*c,d)
oneval=min(4*a,2*b,2*a+b,c)

if n%2==0:
    print(twoval*(n//2))
else:
    print(oneval+twoval*((n-1)//2))
    


Measured memory_bytes: 3060
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define ll long long
#define fir first
#define sz(a) int((a).size())

signed main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n,k;
	cin>>n>>k;
	int a[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(i>k)
		{
			if(a[i]>a[i-k])
			{
				cout<<"Yes"<<endl;
			 } 
			 else
			 {
			 	cout<<"No"<<endl;
			 }
		}
	}
	return 0;
}


Measured memory_bytes: 4428
import java.util.*;

public class Main {
	static Scanner scan = new Scanner(System.in);
	
	public static void main(String[] args) {
		int d = scan.nextInt();
		int t = scan.nextInt();
		int s = scan.nextInt();
		
		if(d<=s*t) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
		
		
	}
	
	
	public static int gcd(int x,int y) {
		if(x%y == 0) {
			return y;
		}else {
			return gcd(y,x%y);
		}
	}
}
 





Measured memory_bytes: 35596
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cout<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}


typedef long long int64;


int main() {
    string s;
    cin >> s;
    int n = s.size();

    if (n == 2 && s[0] == s[1]) {
        cout << 1 << " " << 2 << endl;
        return 0;
    }

    for (int i=0; i<n-2; i++) {
        if (s[i] == s[i+1]) {
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }

        if (s[i+1] == s[i+2]) {
            cout << i+2 << " " << i+3 << endl;
            return 0;
        }

        if (s[i] == s[i+2]) {
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }

    cout << -1 << " " << -1 << endl;
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <utility>

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

int n, m;
int cave[1001][1001];
P dp[1000005];
bool prime[1000005];

P search(int x, int y, int val)
{
	int nx, ny;
	P ret = make_pair(0, -1);
	
	if(dp[val].first != -1) return dp[val];
	
	for(int v = -1; v <= 1; v++){
		nx = x + v, ny = y + 1;
		if(nx < 0 || nx >= 1001 || ny < 0 || ny >= 1001) continue;
		if(cave[nx][ny] > n) continue;
		ret = max(ret, search(nx, ny, cave[nx][ny]));
	}
	if(!prime[val]){
		ret.first++;
		if(ret.second == -1) ret.second = val;
	}
	
	return dp[val] = ret;
}

int main(void)
{
	int px = 500, py = 500, dir = 0, dir2;
	const int vx[4] = {1, 0, -1, 0}, vy[4] = {0, -1, 0, 1};
	
	int nx, ny;
	for(int i = 1; i <= 1001 * 1001 - 1; i++){
		cave[px][py] = i;
		px += vx[dir], py += vy[dir];
		dir2 = (dir+1)%4;
		if(cave[px + vx[dir2]][py + vy[dir2]] == 0) dir = dir2;
	}
	
	prime[1] = true;
	for(int i = 2; i < 1100; i++){
		if(!prime[i]){
			for(int j = 2 * i; j < 1000005; j += i) prime[j] = true;
		}
	}
	
	while(1){
		cin >> n >> m;
		if(n == 0 && m == 0) break;
		
		for(int i = 1; i <= n; i++) dp[i] = make_pair(-1, -1);
		
		int x, y;
		for(x = 0; x < 1001; x++){
			for(y = 0; y < 1001; y++){
				if(cave[x][y] == m) goto end;
			}
		}
		end:;
		
		P ans = search(x, y, m);
		if(ans.first == 0) ans.second = 0;
		cout << ans.first << " " << ans.second << endl;
	}
	
	return 0;
}

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

int main(){
  int k;
  cin >> k;
  int ans;
  if(k%2 == 0){
    ans = (k/2)*(k/2);
  }
  else{
    ans = ((k-1)/2)*(((k-1)/2)+1);
  }
  cout << ans << endl;
}

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

#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);++i)

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")

#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")

int A,B,H,M;
long double caliculate(long double degree){
  long double  a,b;
  a=A;
  b=B;
  return sqrt(pow(a,2.00) + pow(b,2.00) - (2*a*b*cos(degree)));
  
}

int main(void){
  cin >> A >> B >> H >> M;
  long double convert=M_PI/180.0;
  long double hour,minute,ans,degree;
  
  hour=(H+(double)M/60.00)*30.0;
  minute=M*6.0;
  if(hour>minute) degree=hour-minute;
  else degree=minute-hour;
  degree=degree*convert;
  ans=caliculate(degree);
  printf("%20.20Lf\n",ans);
  return 0;
}


Measured memory_bytes: 4152
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

int main() {
    int n;
    cin>>n;
    double ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        ans+=(double)1/a;
    }
    cout<<setprecision(10)<<1/ans<<endl;





    return 0;
}


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

int main() {
	int N, G = 1, C = 0;
	cin >> N;
	vector<int> vec(N, 0);
	for (int i = 0; i < N; i++) {
		cin >> vec.at(i);
	}

	for (int j = 0; j < N; j++) {
		G = vec.at(G-1);
		C++;
		if (G == 2) {
			break;
		}
	}

	if (G == 2) {
		cout << C << endl;
	}
	else {
		cout << -1 << endl;
	}
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cout<<fixed<<setprecision(10);
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int a,b,p,q,r;
  cin>>a>>b>>p>>q>>r;
  double sum=b*p-(b-a)*q;
  cout<<b+(sum/(q+r))<<endl;

  return 0;
}



Measured memory_bytes: 3260
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  ll a,b,c,d;cin>>a>>b>>c>>d;
  ll ans=max({a*c,a*d,b*c,b*d});
  cout<<ans<<endl;
}

Measured memory_bytes: 3636
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var s = next();
  var output = 0;
  for(var i = 0; i < N - 2; i++){
    if(s[i] == "A" && s[i + 1] == "B" && s[i + 2] == "C"){
      output++;
    }
  }
  myout(output);
}


Measured memory_bytes: 30004
#include<iostream>
using namespace std;
int main(){
	int X;
	cin >> X;
	if (X % 7 == 0){
		cout << "thu" << endl;
	}
	if (X % 7 == 1){
		cout << "fri" << endl;
	}
	if (X % 7 == 2){
		cout << "sat" << endl;
	}
	if (X % 7 == 3){
		cout << "sun" << endl;
	}
	if (X % 7 == 4){
		cout << "mon" << endl;
	}
	if (X % 7 == 5){
		cout << "tue" << endl;
	}
	if (X % 7 == 6){
		cout << "wed" << endl;
	}




	return 0;
}


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

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

  int res = 30;
  for (int i = 0; i < n; i ++ ) {
    int a; cin >> a;
    int cnt = 0;
    while (a % 2 == 0) {
      a /= 2;
      cnt++;
    }
    res = min(res, cnt);
  }
  cout << res << endl;
}

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

int main(void){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int f,t;
		scanf("%d%d",&f,&t);
		printf("%d",f);
		if(f<=5){
			if(t>f){
				while(f!=t){
					f++;
					printf(" %d",f);
				}
			}
			if(t<f){
				while(f!=t){
					f--;
					printf(" %d",f);
				}
			}
		}else if(f>5){
			if(f<t && t<=9){
				while(f!=t){
					f++;
					printf(" %d",f);
				}
			}else if(t==5){
				while(f!=9){
					f++;
					printf(" %d",f);
				}
				f=5;
				printf(" %d",f);
			}else{
				while(f!=9){
					f++;
					printf(" %d",f);
				}
				f=5;
				printf(" %d",f);
				if(t<5){
					while(f!=t){
						f--;
						printf(" %d",f);
					}
				}else{
					while(f!=0){
						f--;
						printf(" %d",f);
					}
					while(f!=t){
						f++;
						printf(" %d",f);
					}
				}
			}
		}
		printf("\n");
	}
    return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string s;
  cin>>s;
  for(int i=s.size()-1;i>0;i--){
    string t=s.substr(0,i);
    if(t.size()%2==0){
        string t1=t.substr(0,t.size()/2);
        string t2=t.substr(t.size()/2,t.size()/2);
        //cout<<t1<<endl<<t2<<endl;
        if(t1==t2){
            cout<<t.size()<<endl;
            return 0;
        }
    }
  }
}

Measured memory_bytes: 256
import math


nk = list(map(int, input().split()))
n = nk[0]
k = nk[1]
a = input().split()
min_i = a.index("1")
ans = 100000
for i in range(k):
    if (min_i - i) * (n - min_i + i - k) < 0:
        continue
    ans_i = math.ceil((min_i - i) / (k - 1)) + math.ceil((n - min_i + i - k) / (k - 1)) + 1
    if ans_i < ans:
        ans = ans_i
print(ans)


Measured memory_bytes: 10420
#include<stdio.h>
#include<string.h>
int main(void){
  int K, i, len;
  scanf("%d",&K);
  char S[101]={};
  
  scanf("%s",S);
  len = strlen(S);
  if(K<len){
    for(i=0; i<K;i++){
   		printf("%c",S[i]);
  	}
    printf("...");
  }
  if(K>=len){
        for(i=0; i<len;i++){
   		printf("%c",S[i]);
  	}
  }

  return 0;
}

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

using namespace std;

#define LL long int

const int MAX = 1e6;
const int MOD = 1e9+7;



int main(){
    int n;
    cin >> n;
    vector<int> d1(n);
    vector<int> d2(n);

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

    for(int i = 2; i < n; ++i){
        if(d1[i] == d2[i] && d1[i - 1] == d2[i - 1] && d1[i - 2] == d2[i - 2]){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 3632
using System;
namespace q1
{
  class q2
  {
    static void Main()
    {
      string[] n = Console.ReadLine().Split();
      int h = int.Parse(n[0]);
      int a = int.Parse(n[1]);
      if(h%a==0)
      {
        Console.WriteLine(h/a);
      }
      else
      {
        Console.WriteLine(h/a+1);
      }
    }
  }
}

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

int main(void)
{
	int N, T;
	cin >> N >> T;
	int *t = new int[N];
	long long sum = T;
	for (int i = 0; i < N; ++i) {
		cin >> t[i];
		if (i > 0) {
			if (t[i] - t[i - 1] > T)
				sum += T;
			else
				sum += t[i] - t[i - 1];
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 1024
MOD = 10**9 + 7

n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

w = 0
for i in range(n):
    if (n-1-i) - i <= 0:
        break
    w += (x[n-1-i] - x[i]) * ((n-1-i) - i)
    w %= MOD

h = 0
for i in range(m):
    if (m-1-i) - i <= 0:
        break
    h += (y[m-1-i] - y[i]) * ((m-1-i) - i)
    h %= MOD


ans = (w * h) % MOD

print(ans)


Measured memory_bytes: 18752
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<ctime>
#include<algorithm>
using namespace std;
const int MR=2000000;

long long p(int a,int k){
	long long ans=1,t=a;
	for(int i=0;i<k;i++){
		ans*=t;
	}
	return ans;
}

int main(){
	int n,k;
	cin>>n>>k;
	cout<< (long long)k*p(k-1,n-1) <<endl;
	return 0;
}



Measured memory_bytes: 256
A = input()
B = input()
C = input()
D = input()
E = input()

last = [0] * 5
last[0] = int(A[-1])
last[1] = int(B[-1])
last[2] = int(C[-1])
last[3] = int(D[-1])
last[4] = int(E[-1])

total = [0] * 5
total[0] = int(A)
total[1] = int(B)
total[2] = int(C)
total[3] = int(D)
total[4] = int(E)


compare = []
index = []
i = 0


def ceil(src, range):
    x = str(src)
    if x[-1] == "0":
        return src

    return ((int)(src / range) + 1) * range


for i in range(5):
    if last[i] == 0:
        last[i] = 9

min_number = min(last)
min_idx = last.index(min(last))


ans = 0
for j in range(5):
    ans += ceil(total[j], 10)

    if j == min_idx:
        ans -= ceil(total[j], 10)


ans = ans + total[min_idx]

print(ans)

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif

int N;

ll encode(int * v){
    ll res = 0;
    rep(i,N) res = res*12+v[i];
    return res;
}
void decode(ll v, int * a){
    rep(i,N){
        a[N-i-1] = v%12;
        v/=12;
    }
}

int main(){
    cin >> N;
    int init[15], goal[15];
    rep(i,N) cin >> init[i];
    rep(i,N) goal[i] = i+1;
    map<ll,int> x,y;
    ll ans = -1;
    {
        queue<pair<ll,int>> q;
        q.emplace(encode(init),0);
        x[encode(init)] = 0;
        while(q.size()){
            ll c,d;
            tie(c,d) = q.front();q.pop();
            int e[15];
            decode(c,e);
            if(x[c] < d) continue;
            if(d==4) continue;
            rep(i,N+1)rep(j,i){
                reverse(e+j,e+i);
                ll w = encode(e);
                if(x.count(w)==0){
                    q.emplace(w,d+1);
                    x[w] = d+1;
                }
                reverse(e+j,e+i);
            }
        }
    }
    {
        queue<pair<ll,int>> q;
        q.emplace(encode(goal),0);
        y[encode(goal)] = 0;
        while(q.size()){
            ll c,d;
            tie(c,d) = q.front();q.pop();
            int e[15];
            decode(c,e);
            if(y[c] < d) continue;
            if(d==4) continue;
            if(x.count(c)){
                ans = d+x[c];
                break;
            }
            rep(i,N+1)rep(j,i){
                reverse(e+j,e+i);
                ll w = encode(e);
                if(y.count(w)==0){
                    q.emplace(w,d+1);
                    y[w] = d+1;
                }
                reverse(e+j,e+i);
            }
        }
    }
    if(ans == -1) ans = 9;
    cout << ans << endl;
}

Measured memory_bytes: 36900
import io

nim=int(input())

t=list(map(int,input().split()))

m=int(input())

p=[0]*m

x=[0]*m

for i in range(m):
    p[i],x[i]=map(int,input().split())
fulltime=sum(t)
for i in range(m):
    print(fulltime-(t[p[i]-1]-x[i]))

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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX

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

int main(){

  string s;
  long long int k;
  cin >>s >> k;
  int len = s.size();

  rep(i, len){
    if(s[i] == 'a') continue;
    long long int buff = 'z' - s[i];
    if(k > buff){
      s[i] = 'a';
      k -= (buff + 1);
    }
  }

  if(k != 0){
    k %= 26;
    long long int buff = 'z' - s[len - 1];

    if(k > buff) s[len - 1] = 'a' + (k - buff);
    else s[len - 1] += k;
  }

  cout << s <<endl;
  return 0;
}


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

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

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

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

#define endl "\n"

template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

typedef long long lint;

using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m,ans=0;
	cin>>n>>m;
	vector<int>s(m,0);
	rep(i,m){
		int k;
		cin>>k;
		rep(j,k){
			int tmp;
			cin>>tmp;
			tmp--;
			s[i]|=(1<<tmp);
		}
	}
	vector<int>p(m);
	rep(i,m)cin>>p[i];
	rep(i,(1<<n)){
		bool flag=true;
		rep(j,m){
			if(!(pcount(i&s[j])%2==p[j]))flag=false;
		}
		if(flag)ans++;
	}
	cout<<ans<<endl;
}

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

template <typename T>
void print(const T &v);

vector<int> grid[105];
vector<bool> seen(105, false);
P ans[105];
int t = 0;

void dps(int now)
{
    seen[now] = true;
    ++t;
    ans[now].first = t;
    for (int next : grid[now])
    {
        if (seen[next])
        {
            continue;
        }
        dps(next);
    }
    ++t;
    ans[now].second = t;
}

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++)
        {
            int v;
            cin >> v;
            grid[u].push_back(v);
        }
    }
    for (int i = 1; i < n; i++)
    {
        if (!seen[i])
        {
            dps(i);
        }
    }
    for (int i = 1; i <= n; i++)
    {
        cout << i << ' ' << ans[i].first << ' ' << ans[i].second << endl;
    }
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 3156