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

#define FOR(i, j, k) for(int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

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

template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
    for(T &x : vec)
        is >> x;
    return is;
}

#define OFFSET 100000

vi es[300010];

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

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

    REP(i, m) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        es[u].push_back(v + OFFSET);
        es[u + OFFSET].push_back(v + OFFSET * 2);
        es[u + OFFSET * 2].push_back(v);
    }

    int s, t;
    cin >> s >> t;
    s--;
    t--;

    int d[300010];
    REP(i, 300010) d[i] = (1 << 30);

    priority_queue<pii, vector<pii>, greater<pii>> pq;
    pq.push(make_pair(0, s));
    while(!pq.empty()) {
        auto p = pq.top();
        pq.pop();

        for(auto v : es[p.second]) {

            if(d[v] != (1 << 30))
                continue;

            int dd = p.first + 1;
            d[v] = dd;
            pq.push(make_pair(dd, v));
        }
    }

    if(d[t] != (1 << 30)) {
        cout << d[t] / 3 << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 17792
import sys
 
lines = sys.stdin.read().rstrip().split("\n")
n, m = [int(x) for x in lines[0].split(" ")]
 
result = set(lines[1].split(" ")[1:])
 
if len(lines) == 2:
  print(len(result))
else:
  for x in lines[2:]:
    result = result & set(x.split(" ")[1:])
  print(len(result))
  

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

static const auto fast_io = [] {
 ios_base::sync_with_stdio(false); 
 cin.tie(nullptr); cout.tie(nullptr); 
 return nullptr;
}();

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int rnd() {
 return uniform_int_distribution<int> (1, (int) 1e9) (rng);
}

template<class A> 
A rnd(A x, A y) {
 return uniform_int_distribution<A> (x, y) (rng);
}

string to_string(string s) {
 return '"' + s + '"';
}

string to_string(const char* ch) {
 return to_string((string)ch);
}

string to_string(char ch) {
 return (string)"'" + ch + (string)"'";
}

string to_string(bool b) {
 return (b ? "true" : "false");
}

template<class A, class B>
string to_string(pair<A, B> p) {
 return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template<class A>
string to_string(A a) {
 string res = "{";
 bool first = true;
 for(const auto& x: a) {
  if(first == false) res += ", ";
  first = false;
  res += to_string(x);
 }
 res += "}";
 return res;
}

template<class A, class B, class C>
string to_string(priority_queue<A, B, C> a) {
 vector<A> res;
 while(a.empty() == false) {
  res.push_back(a.top());
  a.pop();
 }
 reverse(res.begin(), res.end());
 return to_string(res);
}

template<class A>
string to_string(priority_queue<A> a) {
 vector<A> res;
 while(a.empty() == false) {
  res.push_back(a.top());
  a.pop();
 }
 reverse(res.begin(), res.end());
 return to_string(res);
}

template<class A>
string to_string(stack<A> a) {
 vector<A> res;
 while(a.empty() == false) {
  res.push_back(a.top());
  a.pop();
 }
 return to_string(res);
}

template<class A>
string to_string(queue<A> a) {
 vector<A> res;
 while(a.empty() == false) {
  res.push_back(a.front());
  a.pop();
 }
 return to_string(res);
}

vector<string> __vector_tuple;
template<int index, class... A>
struct print_tuple {
 auto operator() (tuple<A...> a) {
  __vector_tuple.push_back(to_string(get<index>(a)));
  print_tuple<index-1, A...>{}(a);
 }
};

template<class... A>
struct print_tuple<0, A...> {
 auto operator() (tuple<A...> a) {
  __vector_tuple.push_back(to_string(get<0>(a)));
 }
};

template<class... T>
string to_string(tuple<T...> a) {
 const int ttsz = tuple_size<decltype(a)>::value;
 print_tuple<ttsz-1, T...>{}(a);
 string __ss = to_string(__vector_tuple);
 __vector_tuple.clear();
 return __ss;
}

void debug() {cerr << "]\n";}

template<class H, class... T>
void debug(H head, T... tail) {
 cerr << to_string(head) << " ";
 debug(tail...);
}

#ifdef LOCAL
 #define debug(...) cerr << "[" << #__VA_ARGS__ << " ] = ["; debug(__VA_ARGS__);
#else 
 #define debug(...) 
#endif

typedef long long int ll;

int main()
{
 int r,g,b;
 cin >> r >> g >> b;
 int k;
 cin >> k;
 while(k && g <= r) g *= 2, k--;
 while(k && b <= g) b *= 2, k--;
 if(g > r && b > g) cout << "Yes\n";
 else cout << "No\n";
 return 0;
}


Measured memory_bytes: 3656
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())
ls = make_divisors(n)
pairs = []
for i in ls:
    pair = (i, n//i)
    pairs.append(pair)
count = []
for pair in pairs:
    count.append(pair[0] + pair[1] - 2)
print(min(count))

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, m;
void solve(){
	cin >> n >> m;
	
	int ans = 0, mi = INF, mm;
	for(int i = 0; i < n; i++){
		ans += m+i;
		if(chmin(mi, abs(m+i))) mm = m+i;
	}
	cout << ans-mm << endl;
}

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	long long i, j, k, N, M, ans[50] = { 0 }, a[50], b[50];

	cin >> N; cin >> M;
	for (i = 0; i < M; i++) {
		cin >> a[i];
		cin >> b[i];
	}

	for (i = 0; i < M; i++) {
		for (j = 1; j <= N; j++) {
			if (a[i] == j)
				ans[j-1]++;
			if (b[i] == j)
				ans[j-1]++;
		}
	}

	for (i = 0; i < N; i++)
		cout << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var x, n, ans int
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &x, &n)

	if n == 0 {
		fmt.Println(x)
		return
	}

	sp := make([]string, n)
	ip := make([]int, n)
	a := make([]bool, 102) // 0 ~ 101
	scanner.Scan()
	sp = strings.Split(scanner.Text(), " ")
	for i, v := range sp {
		ip[i], _ = strconv.Atoi(v)
		a[ip[i]] = true
	}
	fmt.Fprintln(os.Stderr, a)

	for i := 0; i < 101; i++ {
		if x-i >= 0 && !a[x-i] {
			ans = x - i
			break
		} else if x+i < 103 && !a[x+i] {
			ans = x + i
			break
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1852
/*************************************************************************
  >         File: E.cc
  >       Author: Yuan Lei
  >         Mail: yuanlei@indeed.com
  > Created Time: Sat Apr  8 21:05:30 2017
*************************************************************************/
#include <vector>
#include <cstdio>
#include <bitset>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <cstring>
#include <cassert>
#include <numeric>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <string>
#include <iostream>
#include <algorithm>
#include <functional>
#include <iomanip>

#define L (x << 1)
#define R (x << 1 | 1)
#define MID ((l + r) >> 1)
#define LC L, l, MID 
#define RC R, MID + 1, r

constexpr int N = 2e5;

struct Tree {
  std::string s;
  int a[N << 2];

  Tree(std::string s = "") {
    this->s = s;
    build(1, 1, s.size());
  };

  int get(int a, int b) {
    return (a + b) % 3;
  }

  void build(int x, int l, int r) {
    if (l > r) return ;
    if (l == r) {
      a[x] = s[l - 1] - 'A' + 1;
    } else {
      build(LC), build(RC);
      a[x] = get(a[L], a[R]);
    }
  }

  int query(int x, int l, int r, int ql, int qr) {
    if (ql <= l && qr >= r) return a[x];
    else {
      if (ql > MID) return query(RC, ql, qr);
      if (qr <= MID) return query(LC, ql, qr);
      return get(query(LC, ql, qr), query(RC, ql, qr));
    }
  }
}T[2];

int main() {
  std::ios::sync_with_stdio(0);
  std::string s[2];
  for (int i = 0; i < 2; ++i) std::cin >> s[i], T[i] = Tree(s[i]);
  int n;
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    int a, b, c, d;
    std::cin >> a >> b >> c >> d;
    int x = T[0].query(1, 1, s[0].size(), a, b);
    int y = T[1].query(1, 1, s[1].size(), c, d);
    x == y ? puts("YES") : puts("NO");
  }

  return 0;
}


Measured memory_bytes: 9936
#include<iostream>
using namespace std;
int main()
{
	
	
	int n;
	cin>>n;
	int m=n%10;
	if(m==3)
	cout<<"bon";
	else if(m==0||m==1||m==6||m==8)
	cout<<"pon";
	else
	cout<<"hon";
	
	
	
	
	
	
	return 0;
 } 

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VL a(n);
	rep(i, n) cin >>a[i];
	
	ll ans = accumulate(all(a), 0LL);
	cout << ans-n <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

const char* p = "ACGT";
int main() {
  string s; cin >> s;
  lli n = s.size();
  lli ans = 0;
  for (lli i=0; i<n; ++i) {
    lli a = 0;
    for (lli j=i; j<n; ++j) {
      bool ok = false;
      for (lli k=0; k<4; ++k) {
        char c = p[k];
        if (c == s[j]) ok = true;
      }
      if (!ok) break;
      ++a;
      ans = max(ans, a);
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

ll dp[100005];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	ll w;
	cin >> n >> w;
	rep(i, 100005) dp[i] = 1e18;
	dp[0] = 0;
	rep(i, n){
		ll a;
		int b;
		cin >> a >> b;
		for(int j = 100000 - b; j >= 0; j--){
			dp[j + b] = min(dp[j + b], dp[j] + a);
		}
	}
	int ans;
	rep(i, 100001) if(dp[i] <= w) ans = i;
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 1024
#include <iostream> 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define MAX 1000001
ll prime[MAX];
long long mod;

ll rec(vector<vector<ll> >& dp,vector<ll>& arr,int n,int i,int k,int w)
{
  ll ans=0;
  if(i>=n)
    return 0;

  if(dp[i][k]!=-1)
    return dp[i][k];


  if(k!=0)
  ans=max(rec(dp,arr,n,i+1,w,w),arr[i]+rec(dp,arr,n,i+1,k-1,w));
  else
  ans=max(rec(dp,arr,n,i+1,k,w),rec(dp,arr,n,i+1,w,w));

  return dp[i][k]=ans;

}

ll t[400008];
void build(vector<ll>& a, int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = a[tl];
    } else {
        int tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2+1, tm+1, tr);
        t[v] = max(t[v*2] ,t[v*2+1]);
    }
}

ll maxi(int v, int tl, int tr, int l, int r) {
    if (l > r) 
        return 0;
    if (l == tl && r == tr) {
        return t[v];
    }
    int tm = (tl + tr) / 2;
    return max(maxi(v*2, tl, tm, l, min(r, tm)) ,maxi(v*2+1, tm+1, tr, max(l, tm+1), r));
}



void update(int v, int tl, int tr, int pos, ll new_val) {
    if (tl == tr) {
        t[v] = new_val;
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2] ,t[v*2+1]);
    }
}

int main() { 
char c;

cin>>c;

if(c>='A'&&c<='Z')
  cout<<'A';
else
  cout<<'a';

return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int arr[101];
vector<int>res;

int main(){
  int n;
  cin >> n;
  for(int i=1;i<=n;i++){
    cin >> arr[i];
  }
  for(int i=-100;i<=100;i++){
     int ress=0;
     for(int j=1;j<=n;j++){
         int numb=arr[j]-i;
         int sqr=pow(numb,2);
         ress+=sqr;
     }
    res.push_back(ress);
  }

  sort(res.begin() , res.end());
  //for(int i=0;i<res.size();i++)
    //cout << res[i] <<endl;
  cout << res[0] <<endl;

  return 0;
}


Measured memory_bytes: 256
# coding: utf-8
from math import factorial
N, P = map(int, input().split())
A = list(map(int, input().split()))
odd, even = 0, 0
for i in range(N):
    if A[i] % 2 == 0:
        even += 1
    else:
        odd += 1
ans = 0
if P == 0:
    for i in range(0, odd+1, 2):
        ans += factorial(odd) // (factorial(i) * factorial(odd-i)) * 2**even
else:
    for i in range(1, odd, 2):
        ans += factorial(odd) // (factorial(i) * factorial(odd - i)) * 2**even
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
using namespace std;
pair<int, int> v[100005];
int n;
int main() {
    DAU
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> v[i].first;
        v[i].second = i;
    }
    sort(v + 1, v + n + 1);
    for (int i = 1; i <= n; ++i)
        cout << v[i].second << ' ';
    PLEC
}


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

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

const long long INF = 1LL << 60;

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
      cin >> vec.at(i);
  }
  vector<long long> dp(N);
  for(int i = 0; i < N; i++){
    dp.at(i) = INF;
  }
  dp.at(0) = 0;
  for(int i = 1; i < N; i++){
     for(int j = 1; j <= K; j++){
         if(i >= j) chmin(dp.at(i), dp.at(i-j) + abs(vec.at(i-j) - vec.at(i)));
     }
  }
  cout << dp.at(N-1) << endl; 
}


Measured memory_bytes: 1408
# from collections import defaultdict
import sys, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, M = read_int()

jobs = [[] for _ in range(M + 1)]
for i in range(N):
    d, r = read_int()
    if d <= M:
        jobs[d].append(-r)


hq = []
heapq.heapify(hq)

def solve():
    ans = 0
    for i in range(1, M + 1):
        for j in jobs[i]:
            heapq.heappush(hq, j)
        if hq:
            ans += - heapq.heappop(hq)
    return ans

if __name__ == "__main__":
    print(solve())

Measured memory_bytes: 23752
#include<bits/stdc++.h>
using namespace std;
                       ///****   Hasebul Hassan Chowdhury ***////
#define ms(a,v)        memset(a,v,sizeof a)
#define lll            long long
#define FOR(i,a,b)     for(int i=a;i<=b;i++)
#define fast           ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Read           freopen("input.txt", "r", stdin)
#define Write          freopen("output.txt", "w", stdout)
#define INF            1e18


void solve()
{
   char a;
   cin>>a;
   if(a>='A'&&a<='Z') cout<<"A"<<endl;
   else cout<<"a"<<endl;
}


int main()
{
    fast
    #ifndef ONLINE_JUDGE
    //Read;
    //Write;
    #endif
    //int t; cin>>t; while(t--) solve();
    solve();

}


Measured memory_bytes: 3616
S = input()

if len(S) == 1:
    print(1)
    exit()
    
INF = 10 ** 10
dp_1 = [-INF] * len(S)
dp_2 = [-INF] * len(S)

dp_1[0] = 1
dp_2[1] = 1

if S[0] != S[1]:
    dp_1[1] = 2
    
for i,s in enumerate(S[2:],2):
    x = dp_2[i-1] + 1
    if S[i-1] != S[i]:
        x = max(x,dp_1[i-1] + 1)
    dp_1[i] = x
    
    x = dp_1[i-2] + 1
    if S[i-3:i-1] != S[i-1:i+1]:
        x = max(x,dp_2[i-2] + 1)
    dp_2[i] = x
    
answer = max(dp_1[-1], dp_2[-1])
print(answer)

Measured memory_bytes: 19220
#include<bits/stdc++.h>
using namespace std;
struct Set
{
	int a,b,c,d;
	Set():a(-1),b(-1),c(-1),d(-1){}
	Set(int x,int y,int z,int u):a(x),b(y),c(z),d(u){}
	void update(int x,int y)
	{
		if(y==c||y==d)return;
		if(a<x)b=a,d=c,a=x,c=y;
		else if(b<x)b=x,d=y;
	}
	void update(Set x){update(x.a,x.c);update(x.b,x.d);}
}s[1<<20];
int n,a[1<<20];
int main()
{
	scanf("%d",&n);
	for(int i=0;i<(1<<n);i++)scanf("%d",a+i),s[i]=Set(a[i],-1,i,-1);
	for(int i=0;i<(1<<n);i++)
		for(int j=0;j<n;j++)
			if(~i&(1<<j))s[i^(1<<j)].update(s[i]);
	int ans=0;
	for(int i=1;i<(1<<n);i++)printf("%d\n",ans=max(ans,s[i].a+s[i].b));
	return 0;
}


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

typedef long long ll;

int main() {
    int N, R;
    cin >> N >> R;
    if (N >= 10) cout << R << endl;
    else cout << R + 100 * (10 - N) << endl;
    // R = ans - 100 * (10 - N)
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#define ll long long
#define MD 1000000007
#define mod(n) ((n%MD+MD)%MD)
#define max(x, y) (x>y? x : y)
#define min(x, y) (x<y? x : y)
#define mul3(x, y, z) (mod(mod(x*y)*z)) 

ll perm(ll n, ll r){
    ll res = 1;
    for(ll i=0;i<r;i++){
        res = mod(res*(n-i));
    }
    return res;
}

ll modpow(ll x, ll y){
    ll res = 1;
    while(y>0){
        if(y&1) res = mod(res*x);
        x = mod(x*x);
        y >>= 1;
    }
    return res;
}

ll inv(ll n){
    return modpow(n, MD-2);
}

ll fact[1000000*2] = {1};
ll factinv[1000000*2] = {1};
ll conb(ll n, ll r){
    return mul3(fact[n], factinv[r], factinv[n-r]);
}

ll pow25[1000000*2] = {1};
ll pow26[1000000*2] = {1};


int main(){
    ll K;
    char S[1000000];
    scanf("%lld%s", &K, S);
    // end input

    ll s_len = 0;
    for(;s_len<(ll)1e6;s_len++){
        if(!S[s_len]) break;
    }

    for(ll i=1;i<K+s_len;i++){
        fact[i] = mod(fact[i-1]*i);
        factinv[i] = inv(fact[i]);
        pow25[i] = mod(pow25[i-1]*25);
        pow26[i] = mod(pow26[i-1]*26);
    }
    
    ll ans = 0;
    for(ll i=K;i>=0;i--){
        ll t = mul3(conb(s_len+i-1, i), modpow(25, i), modpow(26, K-i));
        ans = mod(ans + t);
    }
    printf("%lld\n", ans);

    return 0;
}



Measured memory_bytes: 65208
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		UnionFindTree uft = new UnionFindTree(n);
		for (int i = 0; i < m; i++) {
		    uft.unite(sc.nextInt() - 1, sc.nextInt() - 1);
		}
		HashSet<Integer> cities = new HashSet<>();
		int count = 0;
		for (int i = 0; i < n; i++) {
		    int x = uft.find(i);
		    if (i != x) {
		        cities.add(x);
		    } else {
		        count++;
		    }
		}
		int cityCount = cities.size();
		int vilCount = count - cityCount;
		System.out.println(Math.abs(cityCount - vilCount));
	}
	
	static class UnionFindTree {
	    int[] parents;
	    
	    public UnionFindTree(int size) {
	        parents = new int[size];
	        for (int i = 0; i < size; i++) {
	            parents[i] = i;
	        }
	    }
	    
	    public int find(int x) {
	        if (parents[x] == x) {
	            return x;
	        } else {
	            return parents[x] = find(parents[x]);
	        }
	    }
	    
	    public void unite(int x, int y) {
	        int xx = find(x);
	        int yy = find(y);
	        if (xx == yy) {
	            return;
	        }
	        parents[xx] = yy;
	    }
	}
}



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

int main(){
  
  int N;
  string S,T;
  
 cin >> N;
  cin >> S >> T;
  
  for(int i=0;i<N; i++){
   cout << S.at(i) << T.at(i); 
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int a[1000000];
int main()
{	int n,sum=3; cin>>n;
	if(n==3) return !printf("2 5 63");
	if(n==4) return !printf("2 5 20 63");
	if(n==5) return !printf("2 5 20 30 63");
	a[1]=2; a[2]=3; a[3]=4; a[4]=6;
	for(rint i=1;;i++)
	for(rint j=i*4+1;j<=i*4+4;j++)
	{	a[j]=a[j-4]+6; (sum+=a[j])%=6;
		if(j==n)
		{	int ban=0; if(sum==3||sum==5) ban=9; if(sum==2) ban=8;
			for(rint k=1;k<=n;k++) if(a[k]!=ban) printf("%d ",a[k]);
			if(sum==2||sum==3) printf("%d ",a[j]-a[j]%6+6);
			if(sum==5) printf("%d ",a[j]-a[j]%6+4);
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 384
// https://atcoder.jp/contests/abc172/tasks/abc172_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N;
  cin >> N;

  VL ds(N + 1);

  rep1(i, N) {
    rep1(j, N) {
      if (i * j > N) break;
      ++ds[i * j];
    }
  }

  ll res = 0;

  rep1(i, N) { res += i * ds[i]; }

  cout << res << "\n";
}


Measured memory_bytes: 81348
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <sstream>
#include <cmath>
using namespace std;
const int inf =0x3f3f3f3f;
typedef long long LL;
const int MAXN=100010;
const int mod=1000000007;
LL fact[MAXN];
void init()
{
    fact[0]=1;
    for(int i=1;i<=100005;i++)
        fact[i]=fact[i-1]*i%mod;
}
int main()
{
    int n;
    init();
    while(~scanf("%d", &n))
    {
        printf("%lld\n", fact[n]%mod);
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long 
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int h, w;
const int o = 620;

inline bool check(int x, int y){
	return 0 <= x and x < w and
	       0 <= y and y < h;
}

int solve(vector<string>& f_in, int t){
    vector<vi> f(h, vi(w));
    rep(y, h){
    	rep(x, w){
    		if(f_in[y][x] == '#') f[y][x] = 1;
    	}
    }

    vector<vi> tbl(o*3, vi(o*3));

    rep(yy, h){
    	rep(xx, w){
    		if(not f[yy][xx]) continue;
    		rep(k, 1, o){
    			int x = xx + k, y = yy - k;
    			if(not check(x, y)) break;
    			if(not f[y][x]) continue;

    			tbl[o+ y -t][o+ xx - k +t] += 1;
    			tbl[o+ yy - 2*k - 1 +t][o+ xx + 1 -t] -= 1;

    			tbl[o+ yy + k -t][o+ x +t] += 1;
    			tbl[o+ yy - 1 +t][o+ xx + 2*k + 1 -t] -= 1;
    		}
    	}
    }

    rep(yy, 1, o*3){
    	rep(k, 1, yy + 1){
    		int y = yy - k, x = k;
    		tbl[y][x] += tbl[y + 1][x - 1];
    	}
    }
    int ret = 0;
    rep(y, h){
    	rep(x, w){
    		ret += tbl[o+y][o+x] * f[y][x];
    	}
    }

    return ret;
}

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

    cin >> h >> w;
    vector<string> f_in(h); for(auto& e : f_in) cin >> e;

    int res = solve(f_in, true);
    rep(y, h) reverse(_all(f_in[y]));
    res += solve(f_in, false);

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 28248
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

struct Query {
    int l, r, i;
    Query(int l, int r, int i): l(l), r(r), i(i){}
};

template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};

int main(){
    int n, q;
    cin >> n >> q;
    vector<int> c(n);
    rep(i, n) cin >> c[i];
    vector<Query> query;
    rep(qi, q) {
        int l, r;
        cin >> l >> r;
        l--; r--;
        query.eb(l, r, qi);
    }
    auto comp = [](Query a, Query b) {
        return a.l<b.l;
    };
    sort(whole(query), comp);
    reverse(whole(query));
    vector<int> ans(q);
    vector<int> pi(n+1, -1);
    vector<P> p;
    rep(i, n) {
        int prev = pi[c[i]];
        if (prev!=-1) {
            p.emplace_back(prev, i);
        }
        pi[c[i]] = i;
    }
    BIT<int> bit(n+5);
    sort(whole(p));
    reverse(whole(p));
    int index = 0;

    rep(i, q) {
        int l = query[i].l;
        int r = query[i].r;
        int qi = query[i].i;
        while (index<p.size()) {
            if (p[index].first<l) break;
            bit.add(p[index].second, 1);
            index++;
        }
        int a = bit.sum(r);
        ans[qi] = r - l + 1- a;
    }

    rep(i, q) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 22820
import numpy as np
N,K=input().split()
N = int(N)
K = int(K)
e = [0]*N

for i in range(N):
    e[i] = int(input())

#for i in range(N):
#    for j in range(N):      
#        if e[i] < e[j]:
#            tmp = e[i]
#            e[i] = e[j]
#            e[j] = tmp

e = list(sorted(e))

f = [0]*(N - K + 1)
for i in range(N-K+1):
    f[i] = e[K + i - 1] - e[i]

print(np.min(np.array(f)))

Measured memory_bytes: 20732
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>

using namespace std;
using ll = long long;


int main() {
    string str;
    cin >> str;
    int ans=10000;
    for(int i=0;i<str.size();i++){
        int cnt=0,temp=0;
        for(int j=0;j<str.size();j++){
            if(str[j]==str[i]){
                temp = max(temp,cnt);
                cnt=0;
            }
            else    cnt++;
        }
        temp=max(temp,cnt);
        ans = min(temp,ans);
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
def heian():
    x,y = map(int, input().split())
    mata = int(input())
    Vert = [['T' for i in range(x+1)] for j in range(y+1)]
    Horiz = [['T' for i in range(x+1)] for j in range(y+1)]
    for i in range (x+1):
        Vert[0][i] = 'F'
    for i in range (y+1):
        Horiz[i][0] = 'F'
    for i in range(mata):
        a, b, c, d = map(int, input().split())
        if a==c and b<d:
            Vert[d][c] = 'F'
        elif a==c and b>d:
            Vert[b][a] = 'F'
        elif b==d and a>c:
            Horiz[b][a] = 'F'
        else:
            Horiz[d][c] = 'F'
    route =  [[0 for i in range(x+1)] for i in range(y+1)]
    route[0][0] = 1
    for i in range (x+1):
        for j in range(y+1):
            if Vert[j][i] == 'T':
                route[j][i] += route[j-1][i]
            if Horiz[j][i] == 'T':
                route[j][i] += route[j][i-1]
    if route[y][x] > 0:
            return route[y][x]
    else:
        return 'Miserable Hokusai!'
for i in range(n):
    print(heian())


Measured memory_bytes: 5620
#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    int a[n];
    int pre;
    for (pre = 0; pre < n; pre++)
    {
        scanf("%d", &a[pre]);
    }

    int num = 0;
    int flag = 1;
    while (flag)
    {
        flag = 0;
        int j;
        for (j = n - 1; j >= 1; j--)
        {
            if (a[j] < a[j - 1])
            {
                int temp = a[j];
                a[j] = a[j - 1];
                a[j - 1] = temp;
                flag = 1;
                num++;
            }
        }
    }
    for (pre = 0; pre < n; pre++)
    {
        printf("%d", a[pre]);
        if (pre < n - 1)
        {
            printf(" ");
        }
    }
    printf("\n%d\n", num);
    return 0;
}

// 1 bubbleSort(A, N) // N 個の要素を含む 0-オリジンの配列 A
// 2   flag = 1 // 逆の隣接要素が存在する
// 3   while flag
// 4     flag = 0
// 5     for j が N-1 から 1 まで
// 6       if A[j] < A[j-1]
// 7         A[j] と A[j-1] を交換
// 8         flag = 1


Measured memory_bytes: 2140
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.141592653289793;
using namespace std;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
#define lld long double
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> vp;
typedef vector<tuple<ll, ll, ll>> vt;
//vector<vector<ll>> vv(n, vector<ll>(n));

int main()
{
	ll n, a, b;
	cin >> n >> a >> b;
	if (a > b || (n == 1 && a != b)) cout << 0 << endl;
	else cout << (n - 2)*(b - a) + 1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
long long int X;
int main(){
	cin >> X;
	for(long long int i=-1000;i<=1000;i++){
		for(long long int j=-1000;j<=1000;j++){
			if(i*i*i*i*i-j*j*j*j*j == X) {cout << i << " " << j << endl; return 0;}
		}
	}
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    ll T;
    cin >> T;
    ll t, tb = 0;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        cin >> t;
        ans += min(T, t-tb);
        tb = t;
    }
    ans += T;
    cout << ans << endl;
}

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

using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<ld, ld>
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second

int main() {
  cin.sync_with_stdio(false);

  int n;
  cin >> n;

  string s;
  cin >> s;

  deque<char> ans;
  int open = 0;
  for (auto it : s) {
    if (it == '(') {
      open++;
    } else {
      if (!open) {
        ans.push_front('(');
      } else {
        open--;
      }
    }
    ans.pb(it);
  }

  while (open) {
    ans.pb(')');
    open--;
  }

  for (auto it : ans) {
    cout << it;
  }

  return 0;
}

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

int main() {
	int n;
	cin>>n;
	int k;
	cin>>k;
	if(n==0)
	cout<<0;
	else
	{
	long long int a[n+1];
	long long int dp[n+1];
	for(int i=1;i<=n;i++)
	cin>>a[i];
	dp[1]=0;
	dp[2]= abs(a[2]-a[1]);
	for(int i=3;i<=n;i++)
	{
	    int x= INT_MAX;
	    int y;
	    for(int j=1;j<=k;j++)
	    {
	        if(j<i)
	        {
	        y= dp[i-j] + abs(a[i]-a[i-j]);
	        x= min(x,y);
	        }
	    }
	    dp[i] = x;
	}
	cout<<dp[n];
	}
	return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws InterruptedException {
		FastScanner fs=new FastScanner();
		int n=fs.nextInt();
		long d=fs.nextLong();
		d*=d;
		int c=0;
		for (int i=0; i<n; i++) {
			long x=fs.nextInt(), y=fs.nextInt();
			if (x*x+y*y<=d) c++;
		}
		System.out.println(c);
	}
	
	void sort(int[] a) {
		ArrayList<Integer> list=new ArrayList<>();
		for (int i:a) list.add(i);
		Collections.sort(list);
		for (int i=0; i<a.length; i++) a[i]=list.get(i);
	}
	
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		
		public String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
			
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
		
		public long[] readLongArray(int n) {
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
	}

}


Measured memory_bytes: 55052
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
ll inf=1e10;

int main(){
  ll N,C,K,T[100000];
  cin>>N>>C>>K;
  for (int i(0);i<N;i++) cin>>T[i];
  sort(T,T+N);
  ll cnt(0);
  ll now(0);
  ll left(T[0]);
  ll ans(0);
  for (int i(0);i<N;i++){
    now = T[i];
    cnt++;
    if (now - left == K){
      ans++;
      left = T[i+1];
      cnt = 0;
    }else if (now - left > K){
      ans++;
      left = T[i];
      cnt = 1;
    
    } else if (cnt == C){
      ans++;
      left = T[i+1];
      cnt = 0;
    }
  }
  if (cnt != 0) ans++;
  cout << ans << endl;
  return 0;
}


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

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

  sort(a.begin(), a.end());

  vector<ll> confs;
  int index = 0;
  for (int i = n - 2; i > 0; i--) {
    confs.push_back(a[i]);
    confs.push_back(a[i]);
  }

  ll ans = a[n - 1];
  for (int i = 0; i < n - 2; i++) {
    ans += confs[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 9024
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

ll gcd(ll a, ll b);
ll power(ll n, ll k);
ll inv(ll n);
ll genfact(ll n, ll k);
ll fact(ll n);
ll nck(ll n, ll k);

int main(void){
  int x;
  cin >> x;
  if (x == 3 || x == 5 || x == 7)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
}

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

ll power(ll n, ll k){
  ll res = 1;
  while(k > 0){
    if (k & 1) 
      res = res * n % MOD;
    n = n * n % MOD;
    k >>= 1;
  }
  return res;
}

ll genfact(ll n, ll k){

  ll res = 1;
  while (k >= 0){
    res = (res * (n - k)) % MOD;
    k--;
  }

  return res;
}

ll inv(ll n){
  return power(n, MOD - 2);
}

ll fact(ll n){
  return genfact(n, n - 1);
}

ll nck(ll n, ll k){
  if (k == 0)
    return 1;
  if (n <= 0)
    return 0;

  return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,c,k,temp,ans=1;
	cin>>n>>c>>k;
	vector<int> x;
	for(int i=0;i!=n;++i){
		cin>>temp;
		x.push_back(temp);
	}
	sort(x.begin(),x.end());
	int cur=x[0],count=1;
	for(int i=1;i!=n;++i){
		//cout<<i<<' '<<count<<' '<<cur<<' '<<ans<<endl;
		if(count<c && (x[i]-cur)<=k)
			++count;
		else{
			++ans;
			cur=x[i];
			count=1;
		}
	}
	cout<<ans<<endl;
}








Measured memory_bytes: 892
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int t = sc.nextInt();
		if(X-t > 0) {
			System.out.println(X - t);
		} else {
			System.out.println("0");
		}

	}
}

Measured memory_bytes: 22356
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define Yes() cout << "Yes" << endl;
#define YES() cout << "YES" << endl;
#define No() cout << "No" << endl;
#define NO() cout << "NO" << endl;
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;

int main() {

    int a,b,c;
    cin >> a >> b;
    
    c = (a+b)/2;

    if ((a+b) % 2 == 0) cout << c << endl;
    else cout << "IMPOSSIBLE" << endl;
    



    return 0;
}   

Measured memory_bytes: 256
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
// #include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define INF 1050000000;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

ll dp[100000 + 10][3];

int main() //input->compute->output
{
        int N;
        cin >> N;
        string m = "";
        vector<vector<int>> h(100000 + 10, vector<int>(3));
        rep(i, N)
        {
                rep(j, 3)
                {
                        cin >> h[i][j];
                }
        }

        rep(i, 3)
        {
                dp[0][i] = h[0][i];
        }

        rep2(i, 1, N)
        {
                rep(j, 3)
                {
                        rep(k, 3)
                        {
                                if (k != j)
                                {
                                        dp[i][k] = max(dp[i - 1][j] + h[i][k], dp[i][k]);
                                }
                        }
                }
        }
        cout << max({dp[N - 1][0], dp[N - 1][1], dp[N - 1][2]}) << endl;
        return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
const int SIZE=1*1e5;
const LL INF=1<<30;
const LL p=7+1e9;
LL DP[SIZE];
LL calc(LL x){
	LL ans=0;
	while(x){
		ans+=x%10;
		x/=10;
	}
	return ans;
}
LL solve(){
	LL N;
	REP(i,SIZE) DP[i]=INF;
	cin >> N;
	if(N==100000) return 1;
	DP[N]=0;
	PQ qu;
	qu.push(pr(0,N));
	while(!qu.empty()){
		LL now=qu.top().second,dist=qu.top().first;
		qu.pop();
		if(dist!=DP[now]) continue;
		FOR(j,0,5)
			FOR(k,1,10){
				LL i=pow(10,j)*k;
				string ne=to_string(now+N*i);
				LL next=stoi(ne.substr(0,5));
				LL ndist=dist;
				if(ne.size()>=6) ndist+=stoi(ne.substr(5,10));
				if(ndist<DP[next]){
					DP[next]=ndist;
					qu.push(pr(ndist,next));
				}
			

		}
	}
	LL ans=INF;
	REP(i,SIZE){
		ans=min(ans,DP[i]+calc(i));
	}
	return ans;
}
int main(){
	cout << solve() << endl;
	return 0;
}

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

#define MAX 100005

int who[MAX];

int main() {
	int n, k, lm = MAX;

	cin >> n >> k;

	int a[n];

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

		if (a[i] < lm) lm = a[i];
	}

	for (int i = 0;i < lm;i++) who[i] = 2;

	for (int i = lm;i <= k;i++) {
		for (int j = 0;j < n;j++) {
			if (i - a[j] < 0) continue;
			if (who[i - a[j]] == 2)  { who[i] = 1; break; }
		}	

		if (who[i] == 0) who[i] = 2;
	}

	if (who[k] == 1) cout << "First"; else cout << "Second";

	
}


Measured memory_bytes: 640
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long 
using namespace std; 

const long long N = 1e6 + 100, OO = 1e18, M = 1e9 + 7, M2 = 998244353, sq = 31622, lg = 23;
typedef pair <int, int> pii;

int32_t main() {
	use_fast;
	int n, k, ans = 0;
	cin >> n >> k;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if(x >= k)
			ans++;
	}
	cout << ans << endl;
	return 0;
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ... 
*/

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

#define M 1000000007
#define FOR(i, s, n) for (ll i = (s); i < (n); ++i)
#define FORALL(i, n) for (ll i = 0; i < (n); ++i)
#define MOD 1000000007
#define ff first
#define ss second
#define pll pair<long long, long long>
#define fast ios_base::sync_with_stdio(false)
#define countbits(x) __builtin_popcount(x)
#define pb(x) push_back((x))
#define vll vector<ll>
#define all(x) x.begin(),x.end()
#define print(x) cout << x << endl
#define debug print("reaching\n")
#define mll map<ll,ll>
#define lsb(i) i&(-i)
#define printv(x)            \
    FORALL(i, x.size())      \
    {                        \
        cout << x[i] << ' '; \
    }                        \
    cout << endl            \
;
#define input(v,x)  \
    FORALL(i,n)     \
    {               \
        cin>>v[i];  \
    }               \
;
#define printm(m) \
    for(auto i: m){\
        cout<<i.ff<<' '<<i.ss<<endl;        \
    }\
;
long long pow2(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = ((res%MOD) * (a%MOD))%MOD;
        a = ((a%MOD) * (a%MOD));
        b >>= 1;
    }
    return res;
}

int main()
{
    fast;
    // #ifndef ONLINE_JUDGE
    // // freopen("input.txt", "r", stdin);
    // // freopen("output.txt", "w", stdout);
    // #endif

    int t=1;
    // cin>>t;
    // ll tot=t;
    while(t--){
    	ll n;
    	cin>>n;
    	mll m;

    	ll temp = n;
    	for(int i = 2; i<=sqrt(n);i++){
    		while(n%i==0){
    			m[i]++;
    			n/=i;
    		}
    	}
    	if(n!=1) m[n]++;
    	n = temp;
    	int ans= 0;
    	for(auto i : m){
    		// cout<<i.first<<endl;
    		ll j = i.first;
    		ll x = 1;
    		while(1){
    			if(x>i.second) break;
    			ll num = (ll)pow(j,x);
    			// cout<<n<<' '<<num<<endl;
    			if(n%num==0){
    				n/=num;
    				ans++;
    			}
    			else{
    				break;
    			}
    			x++;
    		}
    	}
    	print(ans);
    }
    return 0;
}


Measured memory_bytes: 4060
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        String s = sc.next();
        
        if(a >= 3200){
            System.out.println(s);
        }else{
            System.out.println("red");
        }
    }
}

Measured memory_bytes: 21844
h,w=map(int,input().split())
lis=[]
outp=[[0 for i in range(w)] for j in range(h)]
outs=[""]*h
for i in range(h):
    lis.append(input())
for i in range(h):
    for j in range(w):
        if(lis[i][j]=="#"):
            for k in range(-1,2):
                for l in range(-1,2):
                    if(i+k>=0 and i+k<h and j+l>=0 and j+l<w):
                        outp[i+k][j+l]+=1
for i in range(h):
    for j in range(w):
        if(lis[i][j]=="#"):
            outs[i]+="#"
        else:
            outs[i]+=str(outp[i][j])
for i in range(h):
    print(outs[i])

Measured memory_bytes: 3064
def partition(a, p ,r)
  x =a[r]
  i = p-1
  p.upto(r-1) do |j|
    if a[j]<=x
      i += 1
      tmp  = a[i]
      a[i] = a[j]
      a[j] = tmp
    end
  end
  tmp  = a[r]
  a[r] = a[i+1]
  a[i+1] = tmp
  return i+1
end

n = STDIN.gets.to_i
a = STDIN.gets.split(' ').map { |i| i.to_i }

q = partition(a, 0, a.length-1)

a.each_with_index do |value, i|
  if i==q
    print "[#{value}] "
  elsif i==a.length-1
    print "#{value}\n"
  else
    print "#{value} "
  end
end

Measured memory_bytes: 16808