akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules! input_byline {
    ($($r:tt)* ) => {
        let stdin = std::io::stdin();
        let mut q = std::collections::VecDeque::new();
        let mut next = || {
            if q.is_empty() {
                let mut s = String::new();
                stdin.read_line(&mut s);
                for v in s.split_whitespace() {
                    q.push_back(v.to_string());
                }
            }
            q.pop_front().unwrap()
        };
        input_inner!{next, $($r)*}
    };

}

#[allow(unused_macros)]
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

trait Printable {
    fn p(&self);
}

impl<T: std::fmt::Display> Printable for T {
    fn p(&self) {
        println!("{}", self);
    }
}

impl<T: std::fmt::Display> Printable for [T] {
    fn p(&self) {
        for i in 0..self.len() {
            if i != 0 {
                print!(" ");
            }
            print!("{}", self[i]);
        }
        println!("");
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        a: f64,
        b: f64,
        x: f64,
    }

    let PI = std::f64::consts::PI;

    let s = x / a;
    if s > a * b / 2.0 {
        let x = (s - a * b / 2.0) * 2.0 / a;
        println!("{}", 90.0 - 180.0 * (a / (b - x)).atan() / PI);
    } else {
        let x = s * 2.0 / b;
        println!("{}", 90.0 - 180.0 * (x / b).atan() / PI);
    }
}


Measured memory_bytes: 4352
#pragma GCC optimize("-O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Main();
#ifdef ConanYu
#include "local.hpp"
#else
#define debug(...) do { } while(0)
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main();
}
#endif

void Main() {
  string s, t; cin >> s >> t;
  int ans = 0;
  for(int i = 0; i < int(s.size()); i++) {
    if(s[i] == t[i]) {
      ans++;
    }
  }
  cout << ans << "\n";
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextInt();
  if (N % 2 == 1) {
    vector<int> A(N), B(N);
    REP(i, N) {
      A[i] = nextInt();
      B[i] = nextInt();
    }
    sort(ALL(A));
    sort(ALL(B));
    int mi = A[(N)/2];
    int ma = B[(N)/2];
    int ans = ma - mi + 1;
    cout << ans << endl;
    return 0;
  }
  if (N % 2 == 0) {
    vector<int> A(N), B(N);
    REP(i, N) {
      A[i] = nextInt();
      B[i] = nextInt();
    }
    sort(ALL(A));
    sort(ALL(B));
    int a = A[(N-1)/2];
    int b = B[(N-1)/2];
    int c = A[N/2];
    int d = B[N/2];
    int ans = 0;
    if (b+c <= a+d) {
      ans = ((b+d) - (a+c)) + 1;
    } else {
      // cout << a << " " << b << " " << c << " " << d << endl;
      // cout << "[" << a+c << ", " << a+d << "] [" << b+c << ", " << b+d << "]" << endl;
      // ans += ((a+d) - (a+c)) + 1;
      // ans += ((b+d) - (b+c)) + 1;
      // ans -= ((b+c) - (a+d)) - 1;
      ans = ((b+d) - (a+c)) + 1;
      // cout << "atti" << endl;
    }
    cout << ans << endl;
    return 0;
  }
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 4880
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<string>
#include<time.h>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;

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


ll COM(ll x) {
    return x * (x - 1) / 2;
}


int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    map<ll, ll> cnt;
    map<ll, ll> conb;
    rep(i, n) {
        cin >> a[i];
        cnt[a[i]] += 1;
    }
    ll sum = 0;
    for (auto itr = cnt.begin(); itr != cnt.end(); ++itr) {
        conb[itr->first] = COM(itr->second);
        sum += conb[itr->first];
    }
    rep(i, n) {
        ll res = sum - conb[a[i]] + COM(cnt[a[i]] - 1);
        cout << res << endl;
    }
    return 0;
}



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

#define debug(n) cerr << #n << ':' << n << endl;

using namespace std;

using  ll = long long;

template<class T,class U>
using umap = unordered_map<T,U>;

template<class T>
using uset = unordered_set<T>;

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

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


int main(){
  string s; cin >> s;
  switch(s[0]){
  case 'S':cout << "Cloudy" << endl; break;
  case 'C':cout << "Rainy" << endl; break;
  case 'R':cout << "Sunny" << endl; break;
  }
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        x,a,b=map(int,input().split())
        if a>=b: return 'delicious'
        elif b-a<=x: return 'safe'
        else: return 'dangerous'
    print(main())

    
resolve()

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#define T 1001
#define M 1000000007
#define E e[x][i]
#define S e[x].size()
using namespace std;
typedef long long ll;
ll func(int);
int N,s,t;
string n[T];
vector<int> e[T];
 
main(){
  cin>>N;
  for(int i=0;i<N;i++) cin>>n[i];
  for(int i=0;i<N-1;i++) cin>>s>>t,e[s-1].push_back(t-1);
  cout<<func(0)%M<<endl;
}

ll func(int x){
  ll res=0;
  if(!e[x].size()){
    if(n[x]=="E") return 1;
    if(n[x]=="E?") return 2;
  }
  if(n[x][0]=='E'){
    res++;
    for(int i=0;i<S;i++) res*=func(E);
    if(n[x]=="E?") res++;
  }
  if(n[x][0]=='A'){
    for(int i=0;i<S;i++) res+=func(E);
    if(n[x]=="A?") res++;
  }
  if(n[x][0]=='R'){
    res++;
    for(int i=0;i<S;i++) res*=(1+func(E));
    if(n[x]=="R") res--;
  }
  return res%M;
}

Measured memory_bytes: 1372
"""
---アルゴリズム概要---
Mを素因数分解する。
各素因数をa1 ~ an をどの場所にいくつ納めるかを考えれば、それが答えになる。
"""
import math
from collections import Counter
N,M = map(int,input().split())
a = []
def prime_factorize(n):
        while n % 2 == 0:
            a.append(2)
            n //= 2
        f = 3
        while f * f <= n:
            if n % f == 0:
                a.append(f)
                n //= f
            else:
                f += 2
        if n != 1:
            a.append(n)
        return a

prime_factorize(M)
#次に各要素の配置パターン数を求めて累積していく。
#combination関数を定義する
def combination(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

factors = Counter(a)
ans = 1
for k,v in factors.items():
    ans *= combination(N+v-1,v)

print(ans%(10**9+7))

Measured memory_bytes: 114396
#include <iostream>
#include <map>

using namespace std;

int main()
{
    int n;
    cin >> n;
    std::string s;
    cin >> s;

    for(int i=0; i<s.size(); i++){
        char tmp = s[i];
        tmp += n;
        if(tmp > 90){
            tmp -= 90;
            tmp += 64;
        }
        s[i] = tmp;
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <string.h>
#include <cstdarg>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;


// Extended Print Func
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& input){
    os << "[ ";
    REP(i, input.size()){
        os << input[i];
        if (i < input.size()-1) { os << " "; }
    }
    os << " ]";
    return os;
}
void print() { std::cout << "\n"; }
template<class T, class... A> void print(const T& first, const A&... rest) { std::cout << first << " "; print(rest...); }
template<class... A> void print(const A&... rest) { print(rest...); }

ll A[1001][1001];
ll done[1001];
ll ne[1001];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  memset(done,0,sizeof(done));
  ll N;
  cin >> N;

  REP(i,N){
      REP(j,N-1){
          cin >> A[i][j]; A[i][j]--;
          ne[i] = 0;
      }
  }

  
  ll day = 0;
  for(;;) {
      bool is_match = false;
      day++;
      REP(i,N){
          if (done[i] == day) continue;
          ll opp = A[i][ne[i]];
          if (done[opp] == day) continue;
          if (ne[i]<N-1 && ne[opp]<N-1 && i==A[opp][ne[opp]]) {
              is_match = true;
              ne[i]++; ne[opp]++;
              done[i]=day; done[opp]=day;
          }
      }
      if (!is_match) {
          day--;
          break;
      }
  }

  REP(i,N){
      if (ne[i] != N-1){
          cout << -1 << "\n";
          return 0;
      }
  }
  
  std::cout << day << "\n";  
  return 0;
}

Measured memory_bytes: 8064
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define all(x) x.begin(),x.end()
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1'000'000'000'000'000'000ll;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
int main()
{
    fast();
    string s;
    cin>>s;
    if(s[0]==s[1] or s[1]==s[2] or s[2]==s[3])
        cout<<"Bad";
    else
        cout<<"Good";
}

Measured memory_bytes: 256
N = int(input())
MOD = 10 ** 9 + 7

memo = [{} for _ in range(N + 1)]

def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i - 1], t[i] = t[i], t[i - 1]
        if ''.join(t).count('AGC') >= 1:
            return False
    return True


def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in 'AGCT':
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret

print (dfs(0, 'TTT'))

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

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

  
  vector<int> ant(N);
  rep(i,N){
  cin >> ant.at(i);
  
  }
  
  int X = 0;
  rep(i,N){
    if(ant.at(i)%2 == 1){
      if(i%2 == 0){
    X++;
      }
    }
  }

  cout << X << endl;
  
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        "\n"
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;


int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
ll n;
cin>>n;
cout<<3.141593*2*n<<endl;
return 0;
}

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

int main(){
  int n;
  cin>>n;
  map<int,int> a;
  rep(i,n){
    int A; cin>>A;
    a[A]++;
  }
  int ans=-1;
  rep(x,100010){
    int now_ans=0;
    now_ans=a[x-1]+a[x]+a[x+1];
    ans=max(ans,now_ans);
  }
  cout<<ans<<endl;
}


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

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

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

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

const int N = 305;

double p[N][N][N], ev[N][N][N];

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

    vector<int> cnt(4);

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

    p[cnt[1]][cnt[2]][cnt[3]] = 1;

    for(int c = n; c >= 0; c--) {
        for(int b = n; b >= 0; b--) {
            for(int a = n; a >= 0; a--) {

                int k = a + b + c;

                if(k == 0)
                    continue;
                if(k > n)
                    continue;

                // double p_waste = (double) (n - k) / n;
                // double ev_waste = p_waste / (1 - p_waste) + 1;
                ev[a][b][c] += p[a][b][c] * (double) n / k;//ev_waste;

                if(a) {
                    double p_go = (double) a / k;
                    p[a - 1][b][c] += p[a][b][c] * p_go;
                    ev[a - 1][b][c] += ev[a][b][c] * p_go;
                }

                if(b) {
                    double p_go = (double) b / k;
                    p[a + 1][b - 1][c] += p[a][b][c] * p_go;
                    ev[a + 1][b - 1][c] += ev[a][b][c] * p_go;
                }

                if(c) {
                    double p_go = (double) c / k;
                    p[a][b + 1][c - 1] += p[a][b][c] * p_go;
                    ev[a][b + 1][c - 1] += ev[a][b][c] * p_go;
                }
            }
        }
    }

    cout << setprecision(12) << fixed; 
    cout << ev[0][0][0] << endl;

    return 0;
}

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



int main(){
  ll n,k,s=0,min=10e9,b=0,N;
  cin >> n >> k;
  vector<ll>a(n);
  for(int i=0;  i<n; i++){
    cin >> a[i];
    if(a[i]>=0) s++;
  }
  sort(a.begin(),a.end());
  
  for(int i=0; i<n; i++){
    ll M = pow(pow(min,2),0.5);
    ll A = pow(pow(A,2),0.5);
    if(M>=A){
      min = a[i];
      b = i;
    }
  }
  
  ll ans = 1;
  N = n;
  
  
  
  if(s<k && k%2==1 && (k-s)%2==1){
    if(k%2 == 1){
      ans = a[b];
      a[b]= 10e9;
      sort(a.begin(),a.end());
      N--;
      k--;
    }
    
  priority_queue<ll,vector<ll>,greater<ll>>que;
    
  for(int i=0; i<N-1; i+=2){
    if(a[i]<0 && a[i+1]>=0){
      que.push(a[i]*a[i+1]);
      continue;
    }
    if(a[i]<0){
      continue;
    }
    ll x = a[i]*a[i+1];
    que.push(x);
  }
  
  for(int i=N-1; i>0; i-=2){
    if(a[i]>0){
      continue;
    }
    ll x = a[i]*a[i-1];
    que.push(x);
  }
  
 
    while(k>=2){
    ll y = que.top();
    que.pop();
    y%=mod;
    ans*=y;
    ans%=mod;
    k-=2;
 
    }
    
  }
  
  else{
  if(k%2==1){
    ans = a[n-1];
    N--;
    k--;
  }
  
  priority_queue<ll>que;
  
  for(int i=0; i<N-1; i+=2){
    if(a[i+1]>0){
      break;
    }
    ll x = a[i]*a[i+1];
    que.push(x);
  }
  
  for(int i=N-1; i>0; i-=2){
    if(a[i-1]<0 && a[i]>=0){
      que.push(a[i]*a[i-1]);
      continue;
    }
    if(a[i-1]<0){
      break;
    }
    ll x = a[i]*a[i-1];
    que.push(x);
  }
  
 
    while(k>=2){
    ll y = que.top();
    que.pop();
    y%=mod;
    ans*=y;
    ans%=mod;
    k-=2;
 
    }
  }
  
  if(ans<0)ans=mod+ans;
  //cout << min << endl;
  cout << ans << endl;
}
       
        
      
  
    

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

namespace Contest
{
    class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            
            int personCount = input[0];
            int point = input[1];
            int quizCount = input[2];
            int[] person = new int[personCount];
            for(int i = 0; i < person.Length; i++)
            {
                person[i] += point - quizCount;
            }
            for(int i = 0; i < quizCount; i++)
            {
                int a = int.Parse(Console.ReadLine());
                person[a - 1]++;
            }

            foreach(var p in person)
            {
                if(p <= 0)
                {
                    Console.WriteLine("No");
                }
                else
                {
                    Console.WriteLine("Yes");
                }
            }
        }

    }
}


Measured memory_bytes: 17884
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()

for i in range(3):
	print(S[i], end = "")
print("8",end = "")
for i in range(4,10):
	print(S[i], end = "")
print()


Measured memory_bytes: 5396
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
int main() {
  ll a,ans;
  cin>>a;
  ll b=sqrt(a);
  for(ll i=b;i>0;i--){
    if(a%i==0){
      ans=i+a/i-2;
      cout<<ans;
      return 0;
    }
  }
}

Measured memory_bytes: 3680
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

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

using namespace std;

#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()

#define mp make_pair
#define in insert
#define er erase
#define con continue
#define pb push_back
#define sc scanf
#define pr printf
#define ub upper_bound
#define lb lower_bound
#define s second
#define f first
#define int long long

const long long infl = 1e18; 
const int N = 3e5 + 300, N2 = 2e3, inf = 1e9 + 200;

set <int> S;
vector <int> g;
int n, m, k;
int a[N];
string ss;

main (){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	int mx = 0;
	for (int i = 0; i < m; i++){
		cin >> a[i];
		if(i != 0) mx = max(mx, a[i] - a[i - 1]);
	}
	mx = max(mx, n - a[m - 1] + a[0]);
	cout << n - mx;
	return 0;
}












Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int32_t main(){
	int n;
	cin>>n;
	if(n<=6){
		cout<<1;
		return 0;
	}
	int ans = (2*n-1)/11+1;
	if((2*n-2)/11 != (2*n-1)/11){
		ans--;
	}
	cout<<ans;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	pp := make(PP, n)
	for i := 0; i < n; i++ {
		pp[i].x = getNextFloat64(scanner)
		pp[i].y = getNextFloat64(scanner)
	}

	sort.Sort(pp)

	xx := make([]float64, n*2+1)
	yy := make([]float64, n*2+1)
	for i := 0; i < n*2; i++ {
		xx[i+1] = xx[i] + pp[i%n].x
		yy[i+1] = yy[i] + pp[i%n].y
	}

	max := 0.0
	for i := 0; i < n; i++ {
		for j := 1; j <= n; j++ {
			r := math.Sqrt(math.Pow(xx[i+j]-xx[i], 2) + math.Pow(yy[i+j]-yy[i], 2))
			if max < r {
				max = r
			}
		}
	}

	fmt.Fprintln(writer, max)
	writer.Flush()
}

// Point ...
type Point struct {
	x, y float64
}

func (p Point) cross(other *Point) float64 {
	return p.x*other.y - p.y*other.x
}

func (p Point) orthant() int {
	if p.x > 0 && p.y >= 0 {
		return 1
	}
	if p.x <= 0 && p.y > 0 {
		return 2
	}
	if p.x < 0 && p.y <= 0 {
		return 3
	}
	if p.x >= 0 && p.y < 0 {
		return 4
	}
	return 0
}

func (p Point) compare(other Point) bool {
	if p.orthant() == other.orthant() {
		return p.cross(&other) > 0
	}
	return p.orthant() < other.orthant()
}

type PP []Point

func (a PP) Len() int           { return len(a) }
func (a PP) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a PP) Less(i, j int) bool { return a[i].compare(a[j]) }


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

int main() {
	int n, a[100];
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int j = n-1; j > 0; j--)cout << a[j] << ' ';
	cout << a[0]<<endl;
}


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

using namespace std;


int main() {
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        int l,r;
        cin >> l >> r;
        ans += (r-l+1);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3600
N,P = map(int,input().split())
from collections import Counter
def factorize(n) :
    d = Counter()
    m = 2
    while m*m <= n :
        while n%m == 0 :
            n //= m
            d[m] += 1
        m += 1
    if n > 1 :
        d[n] += 1
    return d

factors = factorize(P)
ans = 1
for k,v in factors.items() :
    a = v//N
    ans *= k**a
print(ans)


Measured memory_bytes: 3316
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = na()

    a.sort()

    idx = 0

    tmp_size = a[0]
    for i in range(1, n):
        if tmp_size >= (a[i] + 1) // 2:
            tmp_size += a[i]
            continue
        else:
            tmp_size += a[i]
            idx = i

    print(n - idx)


if __name__ == '__main__':
    main()


Measured memory_bytes: 16404
//{{{
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
#define REP(i, n) for (int i = 0; i < int(n); ++i)
#define REPE(i, a, b) for (int i = (a); i <= int(b); ++i)
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define BR putchar('\n')
#define MS0(ar) memset(ar, 0, sizeof(ar))
#define MS1(ar) memset(ar, -1, sizeof(ar))
#define F first
#define S second
#define MP make_pair
#define MT make_tuple
#define IO(name) freopen(name".in", "r", stdin);freopen(name".out", "w", stdout)

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef complex<double> CD;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VL;

void R(int &x) { scanf("%d", &x); }
void R(LL &x) { scanf("%lld", &x); }
void R(ULL &x) { scanf("%llu", &x); }
void R(double &x) { scanf("%lf", &x); }
void R(LD &x) { scanf("%Lf", &x); }

template <typename T> void R(T &t) { cin >> t; }
template <typename A, typename B> void R(pair<A, B> &x) {
  R(x.F);
  R(x.S);
}

template <typename T> void R(vector<T> &ar) {
  for (auto &it : ar)
    R(it);
}

template <typename T, typename... Args> void R(T &t, Args &... args) {
  R(t);
  R(args...);
}

void W(const char &c) { putchar(c); };
void W(const int &x) { printf("%d", x); }
void W(const LL &x) { printf("%lld", x); }
void W(const ULL &x) { printf("%llu", x); }
void W(const double &x) { printf("%lf", x); }
void W(const LD &x) { printf("%Lf", x); }

template <typename T> void W(const T &t) { cout << t; }
template <typename T> void W(const vector<T> &ar) {
  for (size_t i = 0; i < ar.size(); ++i) {
    W(ar[i]);
    putchar(" \n"[i + 1u == ar.size()]);
  }
}
template <typename T, typename... Args>
void W(const T &t, const Args &... args) {
  W(t);
  W(args...);
}
#define BR putchar('\n')

template <typename T> void Min(T &x, T v) { x = min(x, v); }
template <typename T> void Max(T &x, T v) { x = max(x, v); }
//}}}
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int maxn = 100010;

int main() {
  string s;
  cin >> s;
  int ans = 0;
  REP(i, s.size()) {
    if (i & 1) ans += s[i] == 'g';
    else ans -= s[i] == 'p';
  }
  W(ans, '\n');
  return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <string>
typedef long long ll;

int main() {
    ll N;
    std::cin >> N;

    ll move_count,j,can_split;
    ll best_move_count=1000000000000;

    for(ll i=1;(i*i)<= N;i++){
        if((N%i) == 0){
            can_split = i;
            j = N/can_split;
            move_count = can_split + j -2;
            if(move_count < best_move_count){
                best_move_count = move_count;
            }
        }
        //std::cout << i << N << can_split << std::endl;
    }

    std::cout << best_move_count << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}
ll ketawa(ll a){ll r=0;while(a){r+=a%10;a/=10;}return r;}


int main(){
  ll n,k;
  cin >> n >> k;
  if(k==1 || n==k){
    cout << 0 << endl;
  }else{
    n = n % k;
    cout << min(n,k-n) << endl;
  }
}


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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  while (k--) {
    int d;
    cin >> d;
    while (d--) {
      int x;
      cin >> x;
      --x;
      ++a[x];
    }
  }
  cout << count(begin(a), end(a), 0) << '\n';
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int a = 0;
  for (int i = 0; i < S.size(); i++){
    if (i % 2 == 0 && S[i] == '0'){
      a++;
    }
    if (i % 2 == 1 && S[i] == '1'){
      a++;
    }
  }
  int b = 0;
  for (int i = 0; i < S.size(); i++){
    if (i % 2 == 0 && S[i] == '1'){
      b++;
    }
    if (i % 2 == 1 && S[i] == '0'){
      b++;
    }
  }
  cout << min(a, b);
}

Measured memory_bytes: 512
# python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def lprint(l): print(*l, sep='\n')
def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

H,W = imn()

s = [input() for _ in range(H)]
dp = [[INF for _ in range(W)] for _ in range(H)]
dp[0][0] = 0
if s[0][0] == '#': dp[0][0] = 1

for i in range(H):
    for j in range(W):
        if i+1 < H:
            cnt = dp[i][j]
            if s[i][j] == "." and s[i+1][j] == "#":
                cnt += 1 
            dp[i+1][j] = min(dp[i+1][j], cnt)
        if j+1 < W:
            cnt = dp[i][j]
            if s[i][j] == "." and s[i][j+1] == "#":
                cnt += 1
            dp[i][j+1] = min(dp[i][j+1], cnt)
print(dp[-1][-1])

Measured memory_bytes: 5420
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<utility>

using namespace std;

int n;

char student[10010];

double cal(int m,int e,int j)
{
	double ave = (double)(m + e + j) / 3;

	return ave;
}

int main(void)
{
	while (cin >> n, n)
	{
		for (int i = 0; i < n; i++)
		{
			int m, e, j;

			cin >> m >> e >> j;

			if (m==100||e==100||j==100)
			{
				student[i] = 'A';

				continue;
			}
			if (((double)(m+e)/2)>=90)
			{
				student[i] = 'A';

				continue;
			}

			if (cal(m,e,j)>=80)
			{
				student[i] = 'A';

				continue;
			}

			if (cal(m, e, j) >= 70)
			{
				student[i] = 'B';

				continue;
			}

			if (cal(m, e, j) >= 50)
			{
				if (m>=80||e>=80)
				{
					student[i] = 'B';

					continue;
				}
			}

			student[i] = 'C';

		}

		for (int i = 0; i < n; i++)
		{
			cout << student[i] << endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 3000
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

int res[26],tmp[26];
int n,m;
char s[100];

int main(){
	For(i,0,26) res[i]=(1<<30)-1;
	n=IN();
	For(i,0,n){
		scanf("%s",s);
		m=strlen(s);
		memset(tmp,0,sizeof(tmp));
		For(j,0,m) tmp[s[j]-'a']++;
		For(j,0,26) res[j]=min(res[j],tmp[j]);
	}
	For(i,0,26) For(j,0,res[i]) putchar(i+'a');
	puts("");
}

Measured memory_bytes: 256
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

// NewDoublyLinkedList returns initialized DoublyLinkedList
func NewDoublyLinkedList() *DoublyLinkedList {
	nilEntry := Entry{}
	nilEntry.prev = &nilEntry
	nilEntry.next = &nilEntry

	dll := &DoublyLinkedList{
		nilEntry: &nilEntry,
	}
	return dll
}

// Entry for DoublyLinkedList
type Entry struct {
	value int
	prev  *Entry
	next  *Entry
}

// NewEntry is constructor
func NewEntry(value int) *Entry {
	return &Entry{
		value: value,
		prev:  nil,
		next:  nil,
	}
}

// DoublyLinkedList based on three arrays
type DoublyLinkedList struct {
	nilEntry *Entry
}

func (dll *DoublyLinkedList) toString() {
	first := true
	current := dll.nilEntry.next
	for current != dll.nilEntry {
		// fmt.Println(current)
		if first {
			fmt.Print(current.value)
			first = false
		} else {
			fmt.Printf(" %v", current.value)
		}
		current = current.next
	}
	fmt.Print("\n")
}

func (dll *DoublyLinkedList) insert(x int) {
	newEntry := &Entry{
		value: x,
		prev:  dll.nilEntry,
		next:  dll.nilEntry.next,
	}
	(dll.nilEntry.next).prev = newEntry
	dll.nilEntry.next = newEntry
	newEntry.prev = dll.nilEntry
}

func (dll *DoublyLinkedList) findFirst(x int) *Entry {
	current := dll.nilEntry.next
	for current != dll.nilEntry {
		if x == current.value {
			return current
		}
		current = current.next
	}
	return dll.nilEntry
}

func (dll *DoublyLinkedList) delete(x int) (bool, int) {
	target := dll.findFirst(x)
	if target == dll.nilEntry {
		return false, -1
	}
	target.prev.next = target.next
	target.next.prev = target.prev
	return true, target.value
}

func (dll *DoublyLinkedList) deleteFirst() int {
	target := dll.nilEntry.next
	target.prev.next = target.next
	target.next.prev = target.prev
	return target.value
}

func (dll *DoublyLinkedList) deleteLast() int {
	target := dll.nilEntry.prev
	target.prev.next = target.next
	target.next.prev = target.prev
	return target.value
}

func main() {
	scanner.Split(bufio.ScanWords)

	dll := NewDoublyLinkedList()

	nCommands := nextInt()
	for i := 0; i < nCommands; i++ {
		command := nextString()
		if command == "insert" {
			x := nextInt()
			dll.insert(x)
		} else if command == "delete" {
			x := nextInt()
			dll.delete(x)
		} else if command == "deleteFirst" {
			dll.deleteFirst()
		} else if command == "deleteLast" {
			dll.deleteLast()
		}
		// fmt.Println(command, dll.toString())
	}
	dll.toString()
}



Measured memory_bytes: 47400
#include<iostream>
#include<cstring>
using namespace std;
int main() {
	char str[] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZDEFGHIJKLMNOPQRSTUVWXYZABC" };
	char str2[1000] = { NULL };
	cin >> str2;
	int len = strlen(str2);
	for (int i = 0; i < len; i++) {
		for (int j = 25; j < 53; j++) {
			if (str2[i] == 'Z') {
				str2[i] = 'W';
				break;
			}
			else if (str2[i] == str[j]) {
				str2[i] = str[j - 26];
				break;
			}
		}
	}
	for (int i = 0; i < len; i++) {
		cout << str2[i];
	}
	cout << endl;
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k,q;
    cin>>n>>k>>q;
    int a[n];
    for(int i=0;i<n;i++){
        a[i]=k;
    }
    map<int,int> m;
    for(int i=1;i<=n;i++){
        m[i]=0;
    }
    for(int i=0;i<q;i++){
        int temp;
        cin>>temp;
        m[temp]++;
    }
    for(int i=0;i<n;i++){
        a[i]=a[i]+m[i+1]-q;
    }
    
    for(int i=0;i<n;i++){
         if(a[i]>0)
         cout<<"Yes"<<endl;
         else
         cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <math.h>
#include <string>
#include <vector>

using namespace std;


 int main (){
 int n=0,bonus[60],sum=0,num=0,back=100;

cin>>n;

 for (int i=0;i<3;i++){

	 if (i==2) n--;

	 for (int j=0;j<n;j++){
		 int num=0;
		cin>>num;
		if(i==0){
			bonus[num-1]=0;
			if (num==back+1){
				bonus[back-1]=1;
			}
			back=num;
		}
		else if(i==1){
			sum+=num;
			
		}
		else if(i==2){
			if(bonus[j]==1){
				sum+=num;
				
			}		
		
		}	 
	 }
 }
 cout<<sum<<endl;
	

 return 0;
 
 }

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

using namespace std;

typedef long long ll;
typedef pair< ll, ll > pll;
typedef pair< int, int > pii;

const double pi = 3.14159265358979323846;

// #define fio() cin.tie(0); ios::sync_with_stdio(false);
// 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; }
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define TG0 get< 0 >
#define TG1 get< 1 >
#define TG2 get< 2 >
#define F first
#define S second
#define VL vector< ll >

// to_string(123)
// atoi("123"); atoi(s.c_str());
// "abc".size()
// s.find('+') == string::npos
// 1e18

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

  ll K;
  cin >> K;

  string S;
  cin >> S;

  for (ll i = 0; i < S.length(); i++) {
    cout << S[i];

    if (S.length() != K && K <= i + 1) {
      cout << "...";
      break;
    }
  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s; cin >> s;
	reverse(s.begin(), s.end());
	string ans = s.substr(8);
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
	return 0;                                              
}
	


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

using namespace std;

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

    int N;cin>>N;
    vector<int> W(N);
    for (int i = 0; i < N; i++) {
        int v; cin>>v;
        if (i == 0)
            W[i] = v;
        else
            W[i] = W[i-1] + v;
    }
    int ans = numeric_limits<int>::max();
    for (int i = 0; i < N; i++) {
        ans = min(ans, abs(W.back() - (W[i]*2)));
    }
    cout << ans << endl;


    return 0;
}



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

using namespace std;
#define MV 10000
#define INF 1e9

struct edge{int to,cost;};
vector <edge> G[MV];
bool used[MV];
int V,E;
int d[MV];
int prim(){
  
  for(int i = 0;i < V;i++){
    d[i] = INF;
    used[i] = false;
  }
  d[0] = 0;
  used[0] = true;
  
  for(int i = 0;i < G[0].size();i++)
    d[G[0][i].to] = G[0][i].cost;

  int num = 0;

  for(int j = 0;j < V;j++){
    int m = -1;
    for(int i = 0;i < V;i++){
      if(used[i] == false && (m == -1 || d[m] > d[i]))
	m = i;
    }
    if (m == -1)
      break;
    used[m] = true;
    num += d[m];
    for(int i = 0;i < G[m].size();i++)
      d[G[m][i].to] = min(d[G[m][i].to],G[m][i].cost);
  }
  return num;
}

int main(){
  int first;
  cin >> V >> E;
  for(int i = 0;i < E;i++){
    int f,t;
    edge e;
    cin >> f >> e.to >> e.cost;
    G[f].push_back(e);
    /*
      G[f]??????f????????§????????????????´???????????????????
     */
    t = e.to;
    
    e.to = f;
    G[t].push_back(e);
  }

  int fl = prim();
  cout << fl << endl;
  
  
}

Measured memory_bytes: 5968
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
ll GCD(ll a, ll b){
    return b ? GCD(b, a%b) : a;
}
ll LCM(ll a, ll b){
    return a/GCD(a,b)*b;
}
int main(){
    ll N,K;
    cin>>N>>K;
    pair<ll,ll> nums[N];
    rep(i,N) cin>>nums[i].F>>nums[i].S;
    sort(nums,nums+N);
    ll cnt=0;
    rep(i,N){
        if(cnt+nums[i].S>=K){
            cout<<nums[i].F<<endl;
            break;
        }
        cnt+=nums[i].S;
    }
    
}


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

int main(){
	int k;
	string s;

	cin >> k >> s;

	if(k < s.size()){
		cout << s.erase(k) << "..." << endl;
	}

	else{
		cout << s << endl;
	}
}



Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
vi P;
vvi s(1000);
ll n,m;
ll ans=0;
void dfs(ll depth,ll now){
  if(depth==n){
    bool hoge=true;
    for(int i=0;i<m;i++){
      ll cnt=0;
      for(auto a:s[i]){
	if(now&BITLE(a-1)){
	  cnt++;
	}
      }
      //  cout<<now<<" "<<P[i]<<" "<<i<<" "<<cnt%2<<endl;
      if(cnt%2!=P[i])hoge=false;
    }
    if(hoge)ans++;
    return;
  }
  dfs(depth+1,now+BITLE(depth));
  dfs(depth+1,now);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
 cin>>n>>m;
  for(int i=0;i<m;i++){
    ll k;cin>>k;
    for(int j=0;j<k;j++){
      ll a;cin>>a;
      s[i].pb(a);
    }
  }
  P.resize(m);
  for(int i=0;i<m;++i){
    cin>>P[i];
  }
  dfs(0,0);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

// 素数判定O(√n)
bool is_prime(int n){
for(int i=2;i*i<=n;i++){
    if(n%i==0) return false;
}
return n!=1; //1の場合は除外
}

// 約数の列挙O(√n)
vector<ll> divisor(ll n){
vector<ll> res;
for(ll i=1LL;i*i<=n;i++){
    if(n%i==0){
        res.push_back(i);
        if(i!=n/i) res.push_back(n/i);
    }
}
sort(res.begin(), res.end());
return res;
}

// 素因数分解O(√n)
map<int,int> prime_factor(int n){
    map<int,int> res;
    for(int i=2;i*i<=n;i++){
        while(n%i==0){
            ++res[i];
            n/=i;
        }
    }
    if(n!=1) res[n]=1;
    return res;
}

int prime[100010];     // i番目の素数
bool isprime[100010];   // isprime[i]がtrueならiは素数

// n以下の素数の数を返す
int eratos(int n){
    int p=0;
    for(int i=0;i<=n;i++) isprime[i]=true;
    isprime[0]=isprime[1]=false;
    for(int i=2;i<=n;i++){
        if(isprime[i]){
            prime[p++]=i;
            for(int j=2*i;j<=n;j+=i) isprime[j]=false;
        }
    }
    return p;
}

int main(){
	int n;
    cin>>n;
    for(int i=1;i<=9;i++){
        if(n%i==0 && n/i<=9){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

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

int main() {
  string s;
  cin >> s;
  if(s[0] == '1') {
    cout << 9;
  }
  else {
    cout << 1;
  }
  if(s[1] == '1') {
    cout << 9;
  }
  else {
    cout << 1;
  }
  if(s[2] == '1') {
    cout << 9;
  }
  else {
    cout << 1;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main() {
	char a[2];
	a[0] = 0;
	a[1] = 0;
	scanf("%s", a);
	printf("%c\n", a[0] + 1);
	return 0;
}

Measured memory_bytes: 128