akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

int N;
int A[100010];
int ans;

int main(){
	scanf("%d" , &N);
	repp(i,0,N){
		int x;
		scanf("%d" , &x);
		++A[x];
		if(A[x] > 1) ++ans;
	}
	printf("%d\n" , N - (ans + 1) / 2 * 2);
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const double PI=3.14159265358979323846;



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


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 1000000000000000;
#define all(v) v.begin(), v.end()


int main(){
  ll N,a=0,b=0,c=0,d=0;
  cin >> N;
  rep(i,N){
    string S;
    cin >> S;
    if(S=="AC") a++;
    else if(S=="WA") b++;
    else if(S=="TLE") c++;
    else d++;
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;
}

Measured memory_bytes: 3632
N = int(input())
xy = [list(map(int,input().split())) for _ in range(N)]
    
R = []
e = 1e-5
for x,y in xy:
    R.append([x,y])
    R.append([-x,-y])
    R.append([y,-x])
    R.append([-y,x])
    R.append([x+e,y+e])
    R.append([-x-e,-y-e])
    R.append([y+e,-x-e])
    R.append([-y-e,x+e])
    R.append([x+e,y-e])
    R.append([-x-e,-y+e])
    R.append([y-e,-x-e])
    R.append([-y+e,x+e])
    R.append([x-e,y+e])
    R.append([-x+e,-y-e])
    R.append([y+e,-x+e])
    R.append([-y-e,x-e])
    R.append([x-e,y-e])
    R.append([-x+e,-y+e])
    R.append([y-e,-x+e])
    R.append([-y+e,x-e])

ans = 0
for Rx,Ry in R:
    X = 0
    Y = 0
    for x,y in xy:
        if Rx*x+Ry*y > 0:
            X += x
            Y += y
    ans = max(ans,(X**2+Y**2)**0.5)

print(ans)


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

string s;

long long dfs(int n, long long score)
{
	if (n == s.size()) return score;
	if (n == 0) return dfs(1, s[n] - '0');
	long long res = score * pow(2, s.size() - n - 1);
	res += dfs(n + 1, score * 10 + s[n] - '0');
	res += dfs(n + 1, s[n] - '0');
	return res;
}

void solve()
{
	cin >> s;
	cout << dfs(0, 0) << "\n";
}

int main()
{
	solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define scl(n) scanf("%lld", &n)
#define pcl(n) printf("%lld\n", n)
#define pcl1(n) printf("%lld ", n)
#define dev(x) cout << #x << " " << x << " ";
#define PTT pair<ll, ll>

map<ll, ll> mp, mp1;
map<ll, ll>::iterator itr;

int main()
{
    ll n, t, c;
    scl(n);
    scl(t);
    vector<PTT> v;
    PTT p;
    for (int i = 0; i < n; i++)
    {
        scl(p.second);
        scl(p.first);
        v.push_back(p);
    }
    sort(v.begin(), v.end());
    
    ll mn = 1e10;
    for (int i = 0; i < n; i++)
    {
        if (v[i].first <= t)
        {
            mn = min(v[i].second, mn);
        }
        else
        {
            break;
        }
    }
    if (mn >=1000000)
    {
        cout << "TLE" << endl;
    }
    else
    {
        cout << mn << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<string>
#include<algorithm>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <utility> 
#define rep(i, n) for(int i = 0;i < n;i++)
using namespace std;

using ll = long long;

vector< vector<int> > g;
vector<int> depth_f;
vector<int> depth_s;



int main()
{
	int n;
	cin >> n;
	g.resize(n);
	depth_f.resize(n);
	depth_s.resize(n);

	rep(i,n) {
		depth_f[i] = -1;
		depth_s[i] = -1;
	}

	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	queue <int> q;
	depth_f[0] = 0;
	q.push(0);

	while (!q.empty()) {
		int nd = q.front();
		q.pop();

		rep(i,g[nd].size()) {
			if (depth_f[g[nd][i]] < 0) {
				depth_f[g[nd][i]] = depth_f[nd] + 1;
				q.push(g[nd][i]);
			}
		}
	}


	depth_s[n-1] = 0;
	q.push(n-1);
	while (!q.empty()) {
		int nd = q.front();
		q.pop();

		rep(i, g[nd].size()) {
			if (depth_s[g[nd][i]] < 0) {
				depth_s[g[nd][i]] = depth_s[nd] + 1;
				q.push(g[nd][i]);
			}
		}
	}

	
	int f = 0;
	int s = 0;


	rep(i, n) {
		if (depth_s[i] >= depth_f[i]) {
			f++;
		}
		else {
			s++;
		}
	}

	if (f > s) {
		cout << "Fennec" << endl;
	}
	else {
		cout << "Snuke" << endl;
	}





	return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    if(a==1){
        if(b==2){
            cout<<3;
        }else{
            cout<<2;
        }
    }else if(a==2){
        if(b==1){
            cout<<3;
        }else{
            cout<<1;
        }
    }else{
        if(b==1){
            cout<<2;
        }else{
            cout<<1;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
int main() {
	ll store, bottle,total_price=0;
	cin >> store >> bottle;
	vector<pair<ll, ll> > prices(store);
	ll i,ans=0;
	for (i = 0; i < store; ++i) {
		cin >> prices[i].first>>prices[i].second;
	}
	sort(prices.begin(), prices.end());
	for (i = 0; i < store; ++i) {
		bottle -= prices[i].second;
		if (bottle < 0) {
			total_price += prices[i].first * (prices[i].second + bottle);
			break;
		}
		else {
			total_price += prices[i].first * prices[i].second;
		}
	}
	
	cout << total_price << endl;
	return 0;
}

Measured memory_bytes: 1792
b = [10000]*26

def check(s):
    tmp = [0]*26
    for i in s:
        tmp[ord(i)-97] += 1
    
    for i in range(26):
        b[i] = min(b[i],tmp[i])
    

n = int(input())

for _ in range(n):
    check(input())


ans = ""

for i in range(26):
    ans += chr(97+i)*b[i]

print(ans)

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

using lint = long long;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<vector<T>>;
template <typename T> using VVV = vector<vector<vector<T>>>;
#define rep(i, n) for(int i = 0; i < int(n); i++)
#define repu(i, a, b, s) for(int i = int(a); i < int(b); i += int(s))
#define repd(i, a, b, s) for(int i = int(a); i > int(b); i += int(s))
#define endl "\n"
constexpr lint INF = 2e18;
constexpr lint MOD = 1e9 + 7;

void solve() {
    int A, B;
    cin >> A >> B;
    cout << (A - 1) * (B - 1) << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}

Measured memory_bytes: 3612
n = int(input())
h = list(map(int, input().split()))
p0, p1 = 0, abs(h[1] - h[0])
for i in range(2, n):
    p2 = min(p1 + abs(h[i] - h[i - 1]), p0 + abs(h[i] - h[i - 2]))
    p0, p1 = p1, p2
print(p1)


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;

template<i64 M>
struct modint {
    i64 x;

    constexpr modint(const i64 y = 0) noexcept : x(y >= 0 ? y % M : (M - (-y) % M) % M) {}

    constexpr modint operator-() const noexcept { return modint(-x); }
    constexpr modint operator+(const modint &rhs) const noexcept { return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const noexcept { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const noexcept { return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const noexcept { return modint(*this) /= rhs; }

    constexpr modint &operator+=(const modint &rhs) noexcept {
        x += rhs.x;
        if (x >= M) x -= M;
        return *this;
    }

    constexpr modint &operator-=(const modint &rhs) noexcept {
        if (x < rhs.x) x += M;
        x -= rhs.x;
        return *this;
    }

    constexpr modint &operator*=(const modint &rhs) noexcept {
        x = x * rhs.x % M;
        return *this;
    }

    constexpr modint &operator/=(const modint &rhs) noexcept {
        i64 a = rhs.x, b = M, u = 1, v = 0;
        while (b > 0) {
            i64 t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        *this *= u;
        return *this;
    }

    friend ostream &operator<<(ostream &os, const modint &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, modint &a) {
        i64 t;
        is >> t;
        a = modint(t);
        return is;
    }
};

constexpr i64 MOD = 1e9 + 7;
using m64 = modint<MOD>;

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

    m64 tsum = 0, bsum = 0;
    m64 ans = 0;
    for (i32 i = 0; i <= n+1; i++) {
        if (i >= k) ans += tsum - bsum + 1;
        tsum += n - i, bsum += i;
    }

    cout << ans << endl;
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};


int main(){
  
  string s;
  cin >> s;
  ll res1 = 0,res2 = 0;
  for(int i = 0;i < s.size();i++){
    if(i & 1){
      if(s[i] == '0')res1++;
      else res2++;
    }else{
      if(s[i] == '0')res2++;
      else res1++;
    }
  }
  cout << min(res1,res2) << endl;
  



  return 0;
}


Measured memory_bytes: 512
let print_array l =
  Array.fold_left (fun x y -> (if x = "" then "" else x^" ")^(string_of_int y)) "" l |> print_endline;;
let to_list s = Str.split (Str.regexp_string " ") s |> List.map (fun x -> int_of_string x) |> Array.of_list;;

let sort a =
  let len = Array.length a in
  let rec loop ct = function
      i when i = len -> ct
    | i -> let rec loop2 ct2 = function
               j when j = i -> ct2
             | j -> let swap =
                      if a.(j) < a.(j-1) then
                          let temp = a.(j-1) in
                          a.(j-1) <- a.(j); a.(j) <- temp; 1
                      else 0 in
                    loop2 (ct2+swap) (j-1)
           in loop (loop2 ct (len-1)) (i+1)
  in loop 0 0;;

let _ = read_int () and
    a = read_line () |> to_list;;
let () =
  let ct = sort a in
  print_array a;print_int ct;print_newline ();;

Measured memory_bytes: 2256
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
    int n,m;
    cin >> n >> m;
    map<int,int> mp;
    REP(i,0,2*m){
      	int tmp;
      	cin >> tmp;
      	mp[tmp]++;
    }
    //処理
    //出力
    REP(i,1,n+1) cout << mp[i] << ENT;
    return 0;
}

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


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define get_bit(n, i) (((n) >> (i)) & 1)
#define set_bit(n, i) ((n = ((1 << i) | n))))
#define del_bit(n, i) ((n) &= (~((1) << (i))))
#define flip_bit(n, i) ((n) ^= ((1) << (i)))

#define fast_io ios_base::sync_with_stdio(true);cin.tie(nullptr);cout.tie(nullptr);
#define sqr(x) (x) * (x)
#define sz(n) (n.size())

const int uinf = INT_MIN;
const int inf  = INT_MAX;

inline int bitscnt(int src) { int ans = 0; while(src <<= 1) ans++; return ans; }
inline bool ifpow2(int src) { return !(src & (src - 1)); }
inline int log2(int src) { int ans = 0; while (src >>= 1) ans++; return ans; }
inline void fast_swap(ll &a, ll &b) { a = a ^ b; b = b ^ a; a = a ^ b; }
inline void fast_swap(int &a, int &b) { a = a ^ b; b = b ^ a; a = a ^ b; }
inline int bin_pow(int a, int n) { int res = 1; while (n) { if (n & 1) res = res * a; a *= a; n >>= 1;} return res; }

//
const int arr = 7000;
/*

int  dp[1 + arr];
bool good[1 + arr][1 + arr];

int kek(string str, int n) {
  for (int i = 0; i < n; ++i) {
    good[i][i] = true;
  }
  for (int len = 2; len <= n; ++len) {
    for (int i = 0; i < n - len + 1; ++i) {
      int j = i + len - 1;
      if (len == 2)
        good[i][j] = bool(str[i] == str[j]);
      else good[i][j] = bool((str[i] == str[j]) && good[i + 1][j - 1]);
}
  }
  for (int i = 0; i < n; ++i) {
    if (good[0][i])
      dp[i] = 0;
    else {
      dp[i] = inf;
      for (int j = 0; j < i; ++j) {
        if (good[j + 1][i] == true && dp[j] + 1 < dp[i])
          dp[i] = dp[j] + 1;
      }
    }
  }
  return dp[n - 1];
}

*/

double calc(int x, int t) {
  return t - 1.0 * x * 0.006;
}

main () {
  #ifdef MartinLeshko
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  fast_io;
  int n, t, A;
  cin >> n >> t >> A;
  vi a(n);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    a[i] = x;
  }
  int ans = 0;
  double prev = calc(a[0], t);
  for (int i = 1; i < n; ++i) {
    if (fabs(A - calc(a[i], t)) < fabs(A - prev)) {
      ans = i;
      prev = calc(a[i], t);
    }
  }
  cout << ++ans << "\n";
  exit(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define __builtin_popcount __builtin_popcountll

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; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
    os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const map<S, T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

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


int T, n, m;
string s;

int main(int argc, char *argv[]){
    ios::sync_with_stdio(false);
    while(cin >> s >> m){
        vector<pll> dp(m);
        dp[0] = pll(1, 0);
        REP(i, s.size()) {
            vector<pll> nxt(m + 1);
            int x = s[i] - '0';
            REP(j, m) {
                dp[j].first %= MOD;
                dp[j].second %= MOD;
                REP(k, 10) {
                    if (x == k) {
                        nxt[(j + k) % m].first += dp[j].first;
                    }
                    if (k < x) {
                        nxt[(j + k) % m].second += dp[j].first;
                    }
                    nxt[(j + k) % m].second += dp[j].second;
                    if ((j + k) % m == 0) {
                    }
                }
            }
            swap(dp, nxt);
        }
        cout << (dp[0].first + dp[0].second + MOD - 1) % MOD << endl;
    }
    return 0;
}


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

int main() {
  int n, sum = 0;
  cin >> n;
  vector<int> l(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i];
    sum += l[i];
  }
  for (int i = 0; i < n; i++) {
    if (sum - l[i] <= l[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = 1e8;
const double PI = 3.14159265358979323846;
typedef long long ll;

int main(void) {
  int n, h[100009];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> h[i];
  int dp[100009] = {INF};
  dp[0] = 0;
  dp[1] = abs(h[0] - h[1]);
  for (int i = 2; i < n; i++) {
    dp[i] =
        min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]));
  }
  cout << dp[n - 1] << endl;
  return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
import java.lang.Math;

public class Main{
    public static void main(String[] args){

        Scanner scan = new Scanner(System.in);
        int a=scan.nextInt();
        int b=scan.nextInt();

        int c=Math.abs(a)-Math.abs(b);
        int d=Math.abs(c);
         
         if(c>0){
             if(a>0) d++;
             if(b>0) d++;
         }else{
             if(a<0) d++;
             if(b<0) d++;
         }
         System.out.println(d);
    }
}


Measured memory_bytes: 9684
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second
#define int long long

typedef long long lli;
typedef pair<int, int> pii;

const int maxn = 85;

int n;
int a[maxn];

void read_input()
{
    cin >> n;
    for(int i = 1; i <= n; ++i)
        cin >> a[i];
}

void solve()
{
    int cur = 1000;
    int ans = cur;
    stack<pii> stk;
    for(int i = 1; i <= n; ++i)
    {
        while(!stk.empty() && a[i] <= stk.top().fi)
        {
            cur += stk.top().fi * stk.top().se;
            stk.pop();
        }
        while(!stk.empty() && a[i] >= stk.top().fi)
        {
            cur += a[i] * stk.top().se;
            stk.pop();
        }
        ans = max(ans, cur);
        stk.push(pii(a[i], cur / a[i]));
        cur %= a[i];
    }
    cout << ans << '\n';
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}



Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits.h>
using namespace std;
using P=pair<int,int>;
using ll=long long;

int main(){
    string s;
    int k;
    cin>>k>>s;
    if(s.size()<=k)cout<<s<<endl;
    else cout<<s.substr(0,k)<<"..."<<endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define console
using namespace std;
#ifndef console
ifstream fin("data.in");
ofstream fout("data.out");
#else
#define fin cin
#define fout cout
#endif
#define usain_bolt() (ios_base::sync_with_stdio(false), \
fin.tie(NULL), fout.tie(NULL))
typedef long long ll;
int main()
{
    usain_bolt();
    ll x, y;
    fin >> x >> y;
	if (y % 2 != 0) fout << "No";
	else if (x * 4 < y || x * 2 > y) fout << "No";
	else fout << "Yes";
#ifndef console
    fin.close(), fout.close();
#endif
    return 0;
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define de(x) cout << #x << "=" << x << ", "
#define dd cout << '\n';
#define XinAi ios::sync_with_stdio(0), cin.tie(0);
#define F first
#define S second
#define int long long
using namespace std;
typedef pair<int,int> pii;

string s;

inline int ispa (int l, int r)
{
    for (l--,r--; l<r; l++, r--)
        if (s[l] != s[r]) return 0;
    return 1;
}

signed main()
{
    cin >> s;
    int n = s.size();
    cout << (ispa(1,n) && ispa(1, (n-1)/2) && ispa((n+3)/2, n)? "Yes" : "No") << '\n';
}

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


    class Program
    {
        static void Main()
        {
            int a = 0, b = 0, c = 0, d = 0, e;
            int Out = 0;

        //e = int.Parse(Console.ReadLine());
        e = 1;
        /*
            for (int i = 0; i < e; i++)
            {
                string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
                a = int.Parse(str[0]);  //数値で受け取りたい場合は変換する
                //b = int.Parse(str[1]);
                //c = int.Parse(str[2]);
                //d = int.Parse(str[3]);
            }
            */
        a = int.Parse(Console.ReadLine());
        b = int.Parse(Console.ReadLine());
        Out = 2*b - a;


            Console.WriteLine(Out);
        }
    }

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

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

    string divide[4] = {"dream", "dreamer", "erase", "eraser"};

    reverse(S.begin(),S.end());
    for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());

    bool can2 = true;

    for(int i = 0; i < S.size();){
        bool can = false;
        for(int j = 0 ; j <4; j++){
            if(divide[j] == S.substr(i,divide[j].size())){
                i += divide[j].size();
                can = true;
            }
        }

        if(!can){
            can2 = false;
            break;
        } 
    }

    if (can2) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 3728
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int k= 1;
        HashMap<String,Integer> hashMap = new HashMap<>();
        hashMap.put("SUN",7);
        hashMap.put("MON",6);
        hashMap.put("TUE",5);
        hashMap.put("WED",4);
        hashMap.put("THU",3);
        hashMap.put("FRI",2);
        hashMap.put("SAT",1);
        String s1;
        String s2;
        int a,b;
        while(k-->0){
            a=s.nextInt();
            System.out.println(a*a);
        }
    }

    private static int binary_search(
            int arr[], int l,
            int h, int x)
    {
        while (l <= h) {
            int mid = (l + h) / 2;
            if (arr[mid] <= x)
                l = mid + 1;
            else
                h = mid - 1;
        }
        return h;
    }
    static int gcd(int a, int b)
    {
        if(b==0) {
            return a;
        }
        return gcd(b,a%b);
    }
    private static boolean isPrime(int n) {
        if (n == 2)
            return true;
        else if ((n % 2 == 0 && n > 2) || n < 2)
            return false;
        else {
            for (int i = 3; i <= (int) Math.sqrt(n); i += 2) {
                if (n % i == 0)
                    return false;
            }
            return true;
        }


    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

Measured memory_bytes: 27088
# include <cstdio>
# include <algorithm>
# include <cstring>
# include <cmath>
# include <climits>
# include <iostream>
# include <string>
# include <queue>
# include <vector>
# include <set>
# include <map>
# include <cstdlib>
# include <stack>
# include <ctime>
using namespace std;

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define mct(a,b) memset(a,b,sizeof(a))
# define gc getchar()
typedef long long ll;
const int N=1005;
const int inf=0x7fffffff;
const double eps=1e-7;
template <typename T> void read(T &x){
	x=0;int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
	x*=f;
}
int n,a[N];

int main()
{
	read(n);
	Rep(i,1,n)read(a[i]);
	double val=0;
	Rep(i,1,n)val+=1./a[i];
	printf("%lf\n",1./val);
	return 0;
}

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

using namespace std;
int n=0;
int x;


void solve(){
}

int main(){
    while(1){
        cin >> x;
        if(x == 0){break;}
        n++;
        cout << "Case " << n << ": " << x << endl;
    }

    return 0;
}


Measured memory_bytes: 3008
using System;
using System.Linq;

namespace V0018{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            Console.WriteLine(sr.Next<int>(5).OrderByDescending(x => x).ToJoinedString());
            //---------------------------------
        }
    }

    public static class ExMethod{
        public static string ToJoinedString<T>(
            this System.Collections.Generic.IEnumerable<T> src, string sep = " "){
            var sb = new System.Text.StringBuilder();
            foreach(var s in src){
                sb.Append(s);
                sb.Append(sep);
            }
            return sb.ToString().TrimEnd(sep.ToCharArray());
        } 
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = Console.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }
    }
}

Measured memory_bytes: 10420
#include <iostream>

using namespace std;

int main(){
    string s;
    int a = 0, b = 0, c = 0, d = 0;
    cin >> s;
    for(int i=0; i<s.length(); i++){
        if(i%2 == 0 && s[i]=='0') a++;
        if(i%2 == 0 && s[i]=='1') b++;
        if(i%2 != 0 && s[i]=='0') c++;
        if(i%2 != 0 && s[i]=='1') d++;
    }
    cout << min(a+d, b+c);
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()
#define INF 2000000000

int n, k;
vector<int> twi(18, 1);

int twice(int x) {
    int i=0;
    while (twi.at(i)*x < k) {
        i++;
    }
    return i;
}

int main() {
    rep(i,17) twi.at(i+1) = twi.at(i)*2;
    scanf("%d %d", &n, &k);
    double ans = 0;
    for (int i=1; i<=n; i++) {
        double c = 1;
        rep(j,twice(i)) c /= 2;
        ans += c;
    }
    ans /= n;
    printf("%.12lf\n", ans);
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math : abs;
import core.stdc.stdlib : exit;

void main()
{
	auto A = to!int(split(readln())[0]);
	auto B = to!int(split(readln())[0]);
	auto C = to!int(split(readln())[0]);
	auto D = to!int(split(readln())[0]);
	
	writeln( (A < B ? A : B) + (C < D ? C : D) );
}

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

int main(){
  string str;
  cin >> str;
  int size = str.size();
  vector<int> vec;
  int num;
  string ss;
  for(int i=0;i<size;i++){
    ss = str.at(i);
    num = stoi(ss);
    vec.push_back(num);
  }
  int result = vec.at(0);
  string s = to_string(result);

  for(int bit=0;bit<(1<<3);bit++){
    
    for(int i=0;i<3;i++){
      int input;
      string inp;
      if(bit<<i&100){
        result += vec.at(i+1);
        s += "+";
        s += to_string(vec.at(i+1));
      }else{
        
        result -= vec.at(i+1);
        s += "-";
        s += to_string(vec.at(i+1));
      }
    }
    if(result==7){
      s += "=7";
      cout << s << endl;
      break;
    }else{
      s = to_string(vec.at(0));
      result = vec.at(0);
    }
  }
}

Measured memory_bytes: 256
//Littleboy123 Template 1.1

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

//pragmas
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

#define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define COUT(a) cout << (a) << '\n'
#define MEM(a,b) memset((a), (b), sizeof((a)))
#define MAX(a,b) (a) = max((a), (b))
#define MIN(a,b) (a) = min((a), (b))
#define nl '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)

void init(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

//End of template

int main(){
	init();

	//debug
	/*
	ifstream in("input.in");
	streambuf *cinbuf = std::cin.rdbuf();
	cin.rdbuf(in.rdbuf());

	ofstream out("out.txt");
	streambuf *coutbuf = std::cout.rdbuf();
	cout.rdbuf(out.rdbuf());
	*/
	//end debug

	int n;
	cin >> n;
	int ans = 0;
	int l, r;
	FOR(i, 0, n){
		cin >> l >> r;
		ans += (r-l)+1;
	}
	cout << ans << nl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n,c=0;
    cin>>n;
    char arr[n];
    for (int i=0;i<n;i++)
    {
        cin>>arr[i];
        c++;
        if(arr[i]==arr[i-1])
          c--;
    }

    cout<<c;
    return 0;
}


Measured memory_bytes: 384
import numpy as np 
H, W = map(int,input().split())

data = []
for i in range (H):
    temp = list(input())
    data.append(temp)

data = np.array(data)

h_true = []
for i in range (H):
    if (('#' not in data[i])  & ('.' in data[i])) == True:
        h_true.append(i)

w_true = []
for j in range (W):
    if (('#' not in data[:,j])  & ('.' in data[:,j])) == True:
        w_true.append(j)

data = np.delete(data,h_true,0)
data = np.delete(data,w_true,1)

for k in range (data.shape[0]):
    print(''.join(data[k]))


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

int main()
{
    int a, b;
    cin >> a >> b;
    if(a > b)
        cout << "a > b" << endl;
    else if(a < b)
        cout << "a < b" << endl;
    else
        cout << "a == b" << endl;
    return 0;
}

Measured memory_bytes: 1156
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i];
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
////@formatter:on
//endregion


int32_t main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    make(int, n);
    int mn = n;
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        make(int, num);
        mn = min(mn, num);
        if (mn == num){
            cnt++;
        }
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int x,a,*p,*q;
    
    scanf("%d %d",&x,&a);
    
    p=&a;
    q=&x;
    
    if(*q<*p){
        printf("0\n");
    }
    
    else{
        printf("10\n");
    }
    
    
    
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL<<60;

// 1. input
// 2. f = 0 (if v is a leaf), else f = max{(f(nv) + 1}
// 3. 更新順序がよくわからない -> 各点をすべて調べる

// 入力
int N, M;
vector<vector<int> > G; // グラフ


// memorization
int dp[101010];

// f = 0 (if v is a leaf), else f = max{(f(nv) + 1}
int f(int v){
    
    if (dp[v] != -1) return dp[v]; //すでに更新済み
    
    int result = 0;
    
    for (auto nv : G[v]){
        
        chmax(result, f(nv)+1);
    }
    
    // memorization
    return dp[v] = result;
}

int main(){
    
    cin >> N >> M;
    
    G.assign(N, vector<int>());
    
    // 1. input
    for (int i = 0; i < M; i++){
        int x, y;
        cin >> x >> y;
        x--, y--;
        
        G[x].push_back(y);
    }
    
    
    for (int i = 0; i < N; i++) dp[i] = -1;
    // 3. 更新順序がよくわからない -> 各点をすべて調べる
    int ans = 0;
    for (int i = 0; i < N; i++) chmax(ans, f(i)); // 2. f = 0 (if v is a leaf), else f = max{(f(nv) + 1}
    
    cout << ans << endl;
}





Measured memory_bytes: 8192
L, R = map(int, input().split())
l=L%2019
r=R%2019
if l > r:
    x=l
    l=r
    r=x
ans=2018
for i in range(l,r+1):
    for j in range(i+1,r+1):
        x=(i*j)%2019
        #print(i,j)
        if x<ans:
            ans=x
if R-L>2018:
    ans=0
print(ans)

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, M; cin >> N >> M;
    if (N == M){cout << "Yes" << endl;} else {cout << "No" << endl;}
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main(){
  int N, X;
  cin >> N >> X;
  int L[N];
  int D[N+2];

  REP(i, 0, N)
    cin >> L[i];

  D[1] = 0;
  REP(i, 2, N+2)
    D[i] = D[i-1] + L[i-2];

  int ans = 0;
  REP(i, 1, N+2){
    if(D[i] <= X)
      ans++;
  }

  cout << ans << endl;

  return 0;
}


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

using P = pair<int, int>;
using ll = long long;

struct edge {
    int from, to;
};

using edges = std::vector<edge>;
using graph = std::vector<edges>;

void add_edge(graph& g, int from, int to) {
    g[from].push_back((edge){from, to});
}


class lca {
public:
    lca(graph& g, int root)
        : V(g.size()),
          log_V(0),
          depth_(V, 0)
    {
        for(int v = V; v > 0; v /= 2) {
            ++log_V;
        }
        parent.assign(log_V, std::vector<int>(V, 0));
        dfs(g, root, -1, 0);
        for(int k=0; k+1 < log_V; ++k) {
            for(int v=0; v<V; ++v) {
                if(parent[k][v] < 0) {
                    parent[k+1][v] = -1;
                } else {
                    parent[k+1][v] = parent[k][parent[k][v]];
                }
            }
        }
    }

    void dfs(graph const& g, int v, int p, int d) {
        parent[0][v] = p;
        depth_[v] = d;
        for(int i=0; i<g[v].size(); ++i) {
            if(g[v][i].to != p) {
                dfs(g, g[v][i].to, v, d+1);
            }
        }
    }

    int depth(int v) const {
        return depth_[v];
    }

    int query(int u, int v) {
        if(depth_[u] > depth_[v]) {
            std::swap(u, v);
        }
        for(int k=0; k<log_V; ++k) {
            if((depth_[v] - depth_[u]) >> k & 1) {
                v = parent[k][v];
            }
        }
        if(u == v) {
            return u;
        }
        for(int k=log_V - 1; k>=0; --k) {
            if(parent[k][u] != parent[k][v]) {
                u = parent[k][u];
                v = parent[k][v];
            }
        }
        return parent[0][u];
    }

private:
    int V, log_V;
    std::vector<vector<int>> parent;
    std::vector<int> depth_;
};

int main() {
    int n;
    cin >> n;
    graph g(n);
    for(int i=1; i<n; ++i) {
        int p;
        cin >> p;
        p--;
        add_edge(g, p, i);
    }
    for(int i=0; i<n; ++i) {
        sort(g[i].begin(), g[i].end(), [](auto const& e1, auto const& e2) {
            return e1.to < e2.to;
        });
    }
    vector<int> v(n);
    int id = 0;
    {
        queue<int> que;
        que.push(0);
        v[0] = 0;
        while(!que.empty()) {
            int u = que.front();
            que.pop();
            for(auto& e : g[u]) {
                v[++id] = e.to;
                que.push(e.to);
            }
        }
    }
    lca l(g, 0);
    ll res = 0;
    for(int i=0; i<n-1; ++i) {
        int p = l.query(v[i], v[i+1]);
        res += l.depth(v[i]) + l.depth(v[i+1]) - 2*l.depth(p);
    }
    cout << res << endl;
}


Measured memory_bytes: 18628
import java.util.*;
public class Main {
  
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Q = sc.nextInt();
    String S = sc.next();
    int[] l = new int[Q];
    int[] r = new int[Q];
    for (int i = 0; i < Q; i++) {
      l[i] = sc.nextInt();
      r[i] = sc.nextInt();
    }
    
    int[] c = new int[N+1];
    c[1] = 0;
    for (int i = 1; i < S.length(); i++) {
      char c1 = S.charAt(i-1);
      char c2 = S.charAt(i);
      if (c1 == 'A' && c2 == 'C') {
        c[i+1] = c[i] + 1;
      } else {
        c[i+1] = c[i];
      }
    }

    for (int i = 0; i < Q; i++) {
      System.out.println(c[r[i]] - c[l[i]]);
    }
  }
}

Measured memory_bytes: 79816
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2019-12-18 21:55:05
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;
template<class T> ostream& operator<<(ostream& os, vector<T>& _) { os << '{'; for (T& x : _) { os << x; if (&x != &_.back()) os << ','; } os << '}'; return os; }
template<class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#else
#define debug(_) 1728
#endif

class RollingHash {
 public:
  using ull = unsigned long long;
  RollingHash(const std::string& s) : s_(s) { Initialize(); }
  std::pair<ull, ull> GetHash(int left, int right) {
    ull ret0 =
        (hash0_[right] - hash0_[left] * power0_[right - left] % mod0_ + mod0_) %
        mod0_;
    ull ret1 =
        (hash1_[right] - hash1_[left] * power1_[right - left] % mod1_ + mod1_) %
        mod1_;
    return {ret0, ret1};
  }

 private:
  const std::string s_;
  static ull base0_;
  static ull base1_;
  static constexpr ull mod0_ = 2020202077;
  static constexpr ull mod1_ = 2020202111;
  std::vector<ull> hash0_;
  std::vector<ull> hash1_;
  static std::vector<ull> power0_;
  static std::vector<ull> power1_;
  static std::mt19937_64 mt_;
  void Initialize() {
    size_t n = s_.size();
    hash0_.assign(n + 1, 0);
    hash1_.assign(n + 1, 0);
    for (size_t i = 0; i < n; ++i) {
      hash0_[i + 1] = (hash0_[i] * base0_ + s_[i]) % mod0_;
      hash1_[i + 1] = (hash1_[i] * base1_ + s_[i]) % mod1_;
    }
    while (power0_.size() <= n) {
      power0_.emplace_back(power0_.back() * base0_ % mod0_);
      power1_.emplace_back(power1_.back() * base1_ % mod1_);
    }
  }
};

std::mt19937_64 RollingHash::mt_(
    std::chrono::steady_clock::now().time_since_epoch().count());
unsigned long long RollingHash::base0_ = std::uniform_int_distribution<ull>(
    2, RollingHash::mod0_)(RollingHash::mt_);
unsigned long long RollingHash::base1_ = std::uniform_int_distribution<ull>(
    2, RollingHash::mod1_)(RollingHash::mt_);
std::vector<unsigned long long> RollingHash::power0_{1};
std::vector<unsigned long long> RollingHash::power1_{1};

void ABC141_E() {
  int n; cin >> n;
  string s; cin >> s;
  RollingHash rh(s);

  auto ok = [&](int x) -> bool{
    for (int i = 0; i + 2 * x <= n; ++i) {
      for (int j = i + x; j + x <= n; ++j) {
        if (rh.GetHash(i, i + x) == rh.GetHash(j, j + x)) {
          return true;
        }
      }
    }
    return false;
  };

  int low = 0, high = n / 2 + 1;

  while (high - low > 1) {
    int mid = (low + high) >> 1;
    if (ok(mid)) {
      low = mid;
    } else {
      high = mid;
    }
  }

  cout << low << '\n';
}

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

  ABC141_E();

  return 0;
}

Measured memory_bytes: 520
/**
 * 
 * @param {string} input 
 */
function main(input) {
  var inputList = input.split("\n");
  var n = Number(inputList[0]);
  var list = inputList[1].split(" ");
  var max = 0;
  var sum = 0;
  for(i=0; i<n; i++){
    if(max < Number(list[i])){
      max = Number(list[i]);
    }
    sum += Number(list[i]);
  }

  if(max < (sum-max)){
    console.log("Yes");
  }else{
    console.log("No");
  }
}

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


Measured memory_bytes: 7372
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

ll ps[100005];

void solve()
{
    IN(n, m);
    ll sum = 0;
    ll pen = 0;
    rep(i, m)
    {
        ll p; string s; cin >> p >> s;
        if (s == "WA" && ps[p] != -1) ps[p]++;
        else if (ps[p] != -1)
        {
            pen += ps[p];
            sum++;
            ps[p] = -1;
        }
    }
    cout << sum << " " << pen << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
int main() {
	int i, count[4] = {0};
	char s[3];

	while (scanf(" %d,%2s ", &i, s) != EOF) {
		if (s[0] == 'A' && s[1] == '\0') {
			count[0] += 1;
		}
		else if (s[0] == 'B' && s[1] == '\0') {
			count[1] += 1;
		}
		else if (s[0] == 'A' && s[1] == 'B') {
			count[2] += 1;
		}
		else {
			count[3] += 1;
		}
	}
	for (i = 0; i < 4; i++) {
		printf("%d\n", count[i]);
	}
	return 0;
}

Measured memory_bytes: 600