akhauriyash/Code-Regression huggingface dataset:
#include<functional>
#include <algorithm>
#include  <iostream>
#include   <ctype.h>
#include   <cstring>
#include   <fstream>
#include    <cstdio>
#include    <vector>
#include    <string>
#include     <cmath>
#include     <deque>
#include     <stack>
#include     <queue>
#include      <list>
#include       <set>
#include       <map>
#define INF 0X7FFFFFFF
#define PI acos(-1.0)
typedef long long ll;
using namespace std;
const int N = 1e6;
inline int getint()
{
	int w = 0, q = 0;
	char c = getchar();
	while ((c<'0' || c>'9') && c != '-') c = getchar();
	if (c == '-') q = 1, c = getchar();
	while (c >= '0'&&c <= '9') w = w * 10 + c - '0', c = getchar();
	return q ? -w : w;
}
char s[1000];
int main() {
	char x;
	int cnt = 0;
	while (x = getchar()) {
		if (x == '\n') {
			break;
		}
		if (x == 'B') {
			if (cnt > 0) {
				cnt--;
			}
			continue;
		}
		s[cnt++] = x;
	}
	s[cnt] = '\0';
	printf("%s\n", s);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define NL            "\n"
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    string s;
    cin>>s;
    VSRT(s);
    if(s[0]=='a'&&s[1]=='b'&&s[2]=='c')
    {
        cout<<"Yes"<<NL;
        return 0;
    }
    cout<<"No"<<NL;
    return 0;
}


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

#define ll long long
#define mod 1000000007

using namespace std;

int a[200010];

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

    int ans = 10000000;

    for(int i=1;i<n;i++)
    {
        int temp = n-i;
        int temp1 = i;
        int sum = 0;

        while(temp)
        {
            sum += temp%10;
            temp /= 10;
        }

        while(temp1)
        {
            sum += temp1%10;
            temp1 /= 10;
        }

        if(ans > sum)
            ans = sum;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
inputs = readlines

def result(inputs)
  n = inputs[0].to_i

  str = 'Yes'
  words = []
  (1..n).each do |i|
    word = inputs[i].chomp.to_s
    if words.include?(word)
      str = 'No'
      break
    end

    last_word = words.last
    if last_word.nil?
      words << word
      next
    end
    str = 'No' if last_word[last_word.length - 1] != word[0]
    words << word
  end

  str
end

puts result(inputs)

Measured memory_bytes: 1788
#include<stdio.h>
 
int bubblesort(int n,int A[]){
    int i,j;
    int N=0;
    int a;
    for(i=0;i<n;i++){
        for(j=n-1;j>i;j--){
            if(A[j-1]>A[j]){
                a=A[j-1];
                A[j-1]=A[j];
                A[j]=a;
                N++;
            }
        }
    }
    for(i=0;i<n-1;i++){
        printf("%d ",A[i]);
    }
    printf("%d\n",A[i]);
    return N;
}
 
int main(){
    int i,n,A[100];
    n=3;
    for (i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }
    bubblesort(n,A);
 
    return 0;
}

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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

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

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

int main(void){
    COMinit();
    int N; ll M;
    cin >> N >> M;
    vector<pair<int, int>> yaku;
    int d = 2;
    int loop = ceil(sqrt(M));
    while(d <= loop){
        int cnt = 0;
        while(M % d == 0){
            M /= d;
            cnt++;
        }
        if(cnt > 0) yaku.push_back(make_pair(d, cnt));
        d++;
    }
    if(M > 1) yaku.push_back(make_pair(M, 1));

    ll ans = 1;
    rep(i, yaku.size()){
        int K = yaku[i].second;
        ans = ans*((((fac[N-1+K]*finv[N-1]) % MOD)*finv[K]) % MOD) % MOD;
    }
    cout << ans % MOD << endl;
    return 0;
}

Measured memory_bytes: 12288
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <numeric>

using namespace std;

int main() {
	int n,sum=0;
	vector<int> v;
	for (;;) {
		cin >> n;
		if (n == 0)break;
		v.resize(n);
		for (int i = 0; i < n; i++) {
			cin >> v[i];
		}
		sort(v.begin(), v.end());
		for (int i = 1; i < n - 1; i++) {
			sum += v[i];
		}

		cout << sum / (n - 2) << endl;
		sum = 0;
		
	}
}

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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int ll
//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//chcp 65001

signed main()
{
    int n;
    int count[100000]{};
 
    cin >> n;
    int m1;
    for (int i = 0; i < n; i++)
    {
        cin >> m1;
        count[m1]++;
        if (m1 - 1 >= 0)
            count[m1 - 1]++;
        if (m1 + 1 < 100000)
            count[m1 + 1]++;
    }
 
    int max = 0;
    for (int i = 0; i < 100000; i++)
    {
        if (count[i] > max)
            max = count[i];
    }
 
    cout << max << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (i = 0; i < (n); ++i)
using ll = long long;
//using P = pair<int, int>;
using namespace std;
int main()
{
  ll x, d, k;

  cin >> x >> k >> d;
  x = abs(x);
  ll ans;
  if (x / d > k)
  {
    ans = x - d * k;
  }
  else
  {
    ll e = x / d;
    k -= e;
    if (k % 2 == 1)
      ans = abs(x - d * (e + 1));
    else
      ans = x - e * d;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3604
#include <cassert>
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

typedef long long ll;


vector<int> vs[14];
int ps[10];

int main(void) {
  int n, m;
  cin >> n >> m;
  REP(i, m) {
    int k;
    cin >> k;
    REP(j, k) {
      int s;
      cin >> s;
      --s;
      vs[i].push_back(s);
    }
  }
  REP(i, m) {
    cin >> ps[i];
  }
  int res = 0;
  REP(pat, 1 << n) {
    bool bs[14];
    REP(i, n) {
      bs[i] = !!(pat & (1 << i));
    }
    bool ok = true;
    REP(i, m) {
      int cur = 0;
      REP(j, vs[i].size()) {
        if(bs[vs[i][j]]) {
          cur++;
        }
      }
      if(cur % 2 != ps[i]){
        ok = false;
        break;
      }
    }
    if(ok) {
      ++res;
    }
  }
  cout << res << endl;
    
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef pair<string,string> P;
typedef pair<int,string> C;
#define F first
#define S second
int main(){
  int n;
  int i,j,k;
  while(cin >> n,n){
    vector<P> v;
    P p;
    for(i=0;i<n;i++) {
      cin >> p.F >> p.S;
      v.push_back(p);
    }
    queue<C> q;
    C c,b;
    int o=-1;
    c.F=0;cin >> c.S;
    string s,g;cin >> g;
    q.push(c);
    while(!q.empty()){
      c=q.front();q.pop();
      //cout << c.F << c.S << endl;
      if(c.S==g){
	o=c.F;
	break;
      }
      if(c.S.size()>=g.size()) continue;
      for(i=0;i<n;i++){
	b.F=c.F+1;b.S=c.S;
	if(b.S.find(v[i].F)==-1) continue;
	int pos = b.S.find(v[i].F);
	while(pos != -1){
	  b.S.replace(pos, v[i].F.size(), v[i].S);
	  pos = b.S.find(v[i].F, pos + v[i].S.size());
	}
	q.push(b);
      }
    }
    cout << o << endl;
  }
  return 0;
}

Measured memory_bytes: 1576
h,w=map(int,input().split())
G=[]
white=0
for _ in range(h):
    s=input()
    white+=s.count('.')
    G.append(s)

vis=[[0]*w for _ in range(h)]
vis[0][0]=1

from collections import  deque
que=deque([(0,0,1)])

move=[(1,0),(-1,0),(0,1),(0,-1)]

while len(que)>0:
    ni,nj,c=que.popleft()
    for di,dj in move:
        mi,mj=ni+di,nj+dj
        if 0<=mi<h and 0<=mj<w and G[mi][mj]=='.' and vis[mi][mj]==0:
            vis[mi][mj]=c+1
            que.append((mi,mj,c+1))

print(white-vis[-1][-1]) if vis[-1][-1]!=0 else print(-1)

Measured memory_bytes: 40304
#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
//#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define LL long long
using namespace std;
int main()
{
	int n,m,x,ans1=0,ans2=0;
	cin>>n>>m>>x;
	vector <int> a(m);
	rep(i,m) cin>>a[i];
	for(int i=x-1;i>0;i--)
	{
		for(int j=0;j<m;j++)
		{
			if(a[j]==i)
			{
				ans1++;
				break;
			}
		}
	}
	for(int i=x+1;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(a[j]==i)
			{
				ans2++;
				break;
			}
		}
	}
	cout<<min(ans1,ans2);
    rt0;
}

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

MOD = 10 ** 9 + 7

d = dict()

for i in range(2, N+1):
    for j in d.keys():
        while i % j == 0:
            i //= j
            d[j] += 1
    if i != 1:
        d[i] = 1

ans = 1
for i in d.values():
    ans *= (i+1)
    ans %= MOD

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <numeric>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
    string S;
    cin >> S;
    int acnt = 0;
    int bcnt = 0;
    int ccnt = 0;
    REP(i, 3){
        if(S[i] == 'a')
            acnt++;
        else if(S[i] == 'b')
            bcnt++;
        else if(S[i] == 'c')
            ccnt++;
    }
    if(acnt == 1 && bcnt == 1 && ccnt == 1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

struct NODE{
	int to,cost,ticket;
	NODE(int to,int cost,int ticket) : to(to) , cost(cost) , ticket(ticket) {};
	NODE(){}
};
bool operator < (const NODE &a,const NODE &b){
	return a.cost > b.cost;
}

int main(){
	int n,m;
	while(cin >> n >> m && n){
		vector< vector<NODE> > g(n);
		int wf[2][100][100]={};
		for(int i = 0 ; i < 2 ; i++)
			for(int j = 0 ; j < 100 ; j++)
				for(int k = 0 ; k < 100 ; k++)
					wf[i][j][k] = 0;

		for(int i = 0 ; i < m ; i++){
			int a,b,c;
			cin >> a >> b >> c;
			a--,b--;
			g[a].push_back(NODE(b,c,0));
			g[b].push_back(NODE(a,c,0));
			wf[0][a][b] = wf[0][b][a] = 1;
		}
		for(int i = 0 ; i < n ; i++){
			for(int j = 0 ; j < n ; j++){
				for(int k = 0 ; k < n ; k++){
					wf[1][j][k] |= wf[0][j][i] & wf[0][i][k]; 
				}
			}
		}
		for(int i = 0 ; i < n ; i++){
			for(int j = 0 ; j < n ; j++){
				if(wf[1][i][j]){
					g[i].push_back(NODE(j,0,1));
					
				}
			}
		}
		
		priority_queue<NODE> Q;
		Q.push(NODE(0,0,1));
		int done[100][2] = {};
		while(Q.size()){
			NODE q = Q.top(); Q.pop();
			if( done[q.to][q.ticket]++ ) continue;
			else done[q.to][q.ticket] = true;
			if( q.to == n - 1 ){
				cout << q.cost << endl;
				break;
			}
			for(int i = 0 ; i < g[q.to].size() ; i++)
				if( q.ticket - g[q.to][i].ticket >= 0 )
					Q.push(NODE(g[q.to][i].to,q.cost+g[q.to][i].cost,q.ticket - g[q.to][i].ticket));
			
		}
		
		
	}
}

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

int N;
string A, B, C;

int main() {
    cin >> N >> A >> B >> C;

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (A[i]!=B[i] && B[i]!=C[i] && C[i]!=A[i]) {
            ans += 2;
        }
        else if (A[i]==B[i] && B[i]==C[i]) {
            continue;
        }
        else {
            ans++;
        }
    }

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


Measured memory_bytes: 256
package main

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

func main() {
	nextReader = newScanner()

	N := nextInt()
	X := nextInt()

	ls := nextInts(N)
	count := 0
	ds := make([]int,N+1)
	ds[0] = 0

	for i := 1; i< len(ls)+1;i++{
		di := ds[i-1] + ls[i-1]
		ds[i] = di
	}

	for _, di := range ds{

		if di <= X {
			count++
		}
	}


	fmt.Println(count)
}

var nextReader func() string

func newScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var A = ReadLine().Split().Select(int.Parse).ToArray();
        var ans = 0;
        for (int i = 0; i < N; i++)
        {
            ans += (int)Math.Log(A[i] & -A[i],2);
        }
        WriteLine(ans);
    }
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    if(a > b){
        cout << a * 2 - 1 << endl;
    }
    else if(a == b){
        cout << a + b << endl;
    }
    else{
        cout << b * 2 - 1 << endl;
    }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
using ld = long double;
 
constexpr ll MOD = 1000000007;

#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " (" << x.first << " : " << x.second << ")" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "["; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "(" << obj.first << ", " << obj.second << ")"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print_sim_py(void) {cout << endl;}
template <class Head> void print_sim_py(Head&& head) {cout << head;print_sim_py();}
template <class Head, class... Tail> void print_sim_py(Head&& head, Tail&&... tail) {cout << head << " ";print_sim_py(forward<Tail>(tail)...);}
 
#define print(...) print_sim_py(__VA_ARGS__);
#else
#define print(...);
#endif


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

    ll x;

    cin >> x;
    
    cout << !x << endl;
 
    return 0;
}



Measured memory_bytes: 3640
N, M = map(int, input().split())
H = list(map(int,input().split()))
michi = [0]*N
hikui = [0]*N
good = 0

for _ in range(M):
    A, B = map(int, input().split())
    michi[A - 1] += 1
    michi[B - 1] += 1
    if H[A - 1] > H[B - 1]:
        hikui[A - 1] += 1
    if H[B - 1] > H[A - 1]:
        hikui[B - 1] += 1

for i in range(N):
    if michi[i] == hikui[i]:
        good += 1

print(good)


Measured memory_bytes: 20004
#include <stdio.h>
int main (void){
int a,b,c,d,e,k;
scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&k);
int q=0;
if(b-a>k){
    q=1;
}else if(b-a<k){
    if(c-a>k){
        q=1;
    }else if(c-a<k){
        if(d-a>k){
            q=1;
            }else if(d-a<k){
                if(e-a>k){
                    q=1;
                }
            }
        }
    }

if(c-b>k){
    q=1;
}else if(c-b<k){
    if(d-b>k){
        q=1;
    }else if(d-b<k){
        if(e-b>k){
            q=1;
        }
    }
}
if(d-c>k){
    q=1;
}else if(d-c<k){
    if(e-c>k){
        q=1;
    }
}
if(e-d>k){
    q=1;
}
if(q==1){
    printf(":(");
}else{
    printf("Yay!");
}
}

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

#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 popcount(n) (__builtin_popcountll(n))

using namespace std;

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 ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:


const int limit = 100010;
vector<int> graph[limit];
set<int> ans;
int n,k;

int dfs(int v,int p,int d){

	if(graph[v].size()==0){
		ans.insert(v);
		return d;
	}

	int ret = 1 << 20;
	for(auto &v2:graph[v]){
		if(v2==p) continue;
		ret = min(ret,dfs(v2,v,d+1));
	}

	if(ret - d < k) ans.insert(v);

	return ret;
}

int a[limit];

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

	rep(i,n){
		cin >> a[i];
		a[i]--;
		if(a[i]>=0) graph[a[i]].push_back(i);
	}

	rep(i,n){
		if(a[i]==-1){
			dfs(i,-1,0);
			ans.insert(i);
		}
	}

	cout << ans.size() << endl;

	return 0;
}

Measured memory_bytes: 21432
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<ll> v32;
typedef vector<vector<ll> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 1e9+7 ;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 1e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define vvv64 vector<vv32>
#define vvvv64 vector<vvv32>
 
ll exp(ll n, ll e)
{
    if (e==0)
        return 1;
    ll temp=exp((n*n)%MOD,e/2);
    return e%2==0 ? temp : (temp*n)%MOD;
}
void norm(ll &n)
{
    n%=MOD;
    n+=MOD;
    n%=MOD;
}


void solve()
{
    ll h,n;
    cin>>h>>n;
    ll sum=0;
    for (int i=1; i<=n; i++)
    {
        ll temp;
        cin>>temp;
        sum+=temp;
    }
    if (sum>=h)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}
 
int main() {
    fast_cin();
    int t=1;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
n=int(input())

w=list(map(int,input().split()))
a=[]

for i in range(n-1):
    s_1=0
    s_2=0
    ans=0
    for j in range(n):
        if i >= j:
            s_1 +=w[j]
        else:    
            s_2 +=w[j]
            
        ans=abs(s_1-s_2) 

    a.append(ans)
        
print(min(a))   

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int h, w;
  cin >> h >> w;
  char c[h][w], c2[2 * h][2 * w];

  rep(i, h) rep(j, w) cin >> c[i][j];

  rep(i, 2 * h) rep(j, w) c2[i][j] = c[i / 2][j];

  rep(i, 2 * h) {
    rep(j, w) { cout << c2[i][j]; }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MAX_N = 200005;
ll A[MAX_N],S[MAX_N];
map<ll,ll> c;

int main()
{
	ll N,K;
	cin >> N >> K;
	rep(i,N)
	{
		cin >> A[i];
		A[i]--;
		S[i+1] = (S[i] + A[i]) % K;
	}
	ll ans = 0;
	for (ll j = 0; j <= N; ++j)
	{
		ans += c[S[j]];
		if (j >= K-1) c[S[j-K+1]]--;
		c[S[j]]++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 19240
sub a{my$r=++$u[$_];$u[$_]or$r+=&a for@$_;$r}
<>=~$";map{push@$_,$_[--$|]for@_=glob}<>;
$a=a++$_;$a-=$-=$a-a++$_;
print$`*~-$`/2-$'-$a*($`-$a)

Measured memory_bytes: 143872
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let k: usize = iterator.next().unwrap().parse().unwrap();
    let n: usize = iterator.next().unwrap().parse().unwrap();

    let a: Vec<isize> = (0..n)
        .map(|_| iterator.next().unwrap().parse().unwrap())
        .collect::<Vec<isize>>();

    let mut diffs: Vec<isize> = vec![0; n];
    for i in 0..(n - 1) {
        diffs[i] = a[i + 1] - a[i];
    }

    diffs[n - 1] = a[0] + (k as isize - a[n - 1]);

    diffs.sort();
    diffs.pop();

    let ans: isize = diffs.iter().sum();

    return ans.to_string();
}


Measured memory_bytes: 10492
/*
    Question link: https://cf17-final.contest.atcoder.jp/tasks/cf17_final_d
*/

#include<iostream>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<cstring>
#include<limits>
#include<cmath>

#define LL long long
#define mp make_pair 
#define pb push_back
#define f first
#define s second


using namespace std;

const int MX = numeric_limits<int>::max();

struct par{
    int h;
    int p;
}v[5005];


bool cmp(par a, par b){
          return a.h + a.p < b.h + b.p; 
       }

int dp[5005][5005];



int main(){
    
    int n, ans = 0;
    cin >> n;

    for(int i = 0; i <= n; i++)
        for(int j = 0; j <= n; j++)
                 dp[i][j] = MX;


    for(int i = 1; i <= n; i++){
         cin >> v[i].h >> v[i].p;
      }
    
    sort(v + 1, v + n + 1, cmp);

    for(int i = 0; i <= n; i++) dp[i][0] = 0;

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
             
               dp[i][j] = dp[i-1][j];
               
               if(dp[i-1][j-1] <= v[i].h){
                    dp[i][j] = min(dp[i][j], dp[i-1][j-1] + v[i].p);
                 }
           }
        } 

    
    for(int j = 1; j <= n; j++) if(dp[n][j] != MX) ans = j;

    
    cout << ans;
 
     
    return 0;
  }



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

using namespace std; 

int h[100005], dp[100005]; 

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

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

	dp[0] = 0; 
	dp[1] = abs(h[1] - h[0]); 

	for(int i = 2; i < n; i++){
		dp[i] = min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2]); 
	}

	cout << dp[n - 1] << endl; 
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N,sum=0,ans=0;
  cin>>N;
  vi A(N),B(N);
  cin>>A[0];
  rep(i,1,N){
    int X;
    cin>>X;
    A[i]=A[i-1]+X;
    }
  rep(i,1,N){
    int X;
    cin>>X;
    B[i]=B[i-1]+X;
    sum+=X;
    }
  int X;
  cin>>X;
  sum+=X;
  rep(i,0,N)
    ans=max(ans,A[i]+sum-B[i]);
  cout<<ans;
  }


Measured memory_bytes: 256
n,p,i,a[51];main(){for(;~scanf("%d",&n),n;){for(a[n]=p=i=0;i<n;i++)scanf("%d",a+i);for(i=1;i<=n;i++)if(a[i-1]-a[i]+1)i-p-1?printf(n-i?"%d-%d ":"%d-%d\n",a[p],a[i-1]):printf(n-i?"%d ":"%d\n",a[p]),p=i;}exit(0);}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n,i,k=0,m=1000;
  cin>>n;
  vector<int64_t> a(n);
  for(i=0;i<n;i++) cin>>a.at(i);
  i=0;
  while(i<n-1){
    while(i<n-1&&a.at(i)>=a.at(i+1)) i++;
    if(i<n-1){
      k=m/a.at(i);
      m%=a.at(i);
    }
    while(i<n-1&&a.at(i)<=a.at(i+1)) i++;
    m+=k*a.at(i);
    k=0;
  }
  cout<<m<<endl;
}

Measured memory_bytes: 3628
#pragma GCC optimize(2)
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#define lowbit(n) n & (-n)
#define ls x<<1
#define rs x<<1|1
#define clc(a, b) memset(a, b, sizeof(a))
#define Buff ios::sync_with_stdio(false)
#define rush() int Case = 0; int T; scanf("%d", &T);  while(T--)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define per(i, a, b) for(int i = a; i >= b; i --)
#define reps(i, a, b) for(int i = a; b; i ++)
#define read(a) scanf("%d", &a)
#define readd(a) scanf("%lf", &a)
#define readl(a) scanf("%lld", &a)
#define readc(a) scanf("%c", &a)
#define reads(a) scanf("%s", a)
#define sqr(x) x*x
#define pb push_back
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int>PII;
const int mod = 1e9 + 7;
const double eps = 1e-6;
const int N = 3e5+7;
int b[N];
struct BIT //binary index tree
{
    int t[N],n;
    int a[N];
    #define lowbit(x) (x&(-x))
    void init(int n_)
    {
        n=n_;
        for(int i=1;i<=n;i++)
            t[i] = a[i] = 0;
    }
    int query(int l,int r)
    {
        int res=a[r];
        while(r>l) //t[i]维护 [i-lowbit(i)+1,i]的最值
        {
            for(--r;r-lowbit(r)>=l;r-=lowbit(r))// r-lowbit(r)+1>=l return max t[r],query(l,r-low(r))
                res=max(res,t[r]);              // r-lowbit(r)+1<l return max a[r],query(l,r-1)
            res=max(res,a[r]);
        }
        return res;
    }
    void modify(int x,int v)
    {
        a[x]=v;
        while(x<=n)
        {
            t[x]=a[x];
            for(int i=1,j=lowbit(x);i<j;i<<=1)// y+( lowbit(y)=2^i) =x
                t[x]=max(t[x],t[x-i]);        // 对pos=x的修改需要考虑其维护的(x-lowbit(x),x]区间里的数对该区间最值贡献
            x+=lowbit(x); //转移至包含该区间的下一个位置
        }
    }
};
BIT tree;
int main()
{
    Buff;
    int n, k, maxv = 1, res = 0;
    cin >> n >> k;
    rep(i, 1, n)
    {
        cin >> b[i];    b[i] ++;
        maxv = max(maxv, b[i]);
    }
    tree.init(maxv);
    rep(i, 1, n)
    {
        int l = max(1, b[i]-k);
        int r = min(maxv, b[i]+k);
        int t = tree.query(l, r);
//        cout <<"t:"<< t <<endl;
        res = max(res, t + 1);
        tree.modify(b[i], t+1);
    }
    cout << res <<endl;
    return 0;
}


Measured memory_bytes: 6704
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<class T1, class T2> inline void chkmin(T1 &x, const T2 &y) {if (x > y) x = y;}
template<class T1, class T2> inline void chkmax(T1 &x, const T2 &y) {if (x < y) x = y;}
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define mp make_pair
#define pb push_back
#define read(FILENAME) freopen((string(FILENAME) + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((string(FILENAME) + ".out").c_str(), "w", stdout);
const int MAXN = 2029;


int n;
string s;
vector<int> g[MAXN];
int dist[MAXN];
int cnt = 0;


void dfs(int u, int pr) {
	for (auto h: g[u]) {
		if (pr == h) {
			continue;
		}
		dist[h] = dist[u] + 1;
		dfs(h, u);
	}
	if (s[u] == '1') {
		cnt += dist[u];
	}
}


int cnts[MAXN];


int dfs1(int u, int pr) {
	cnts[u] = 0;
	if (s[u] == '1') {
		cnts[u]++;
	}
	int cur = 0;
	vector<pair<int, int> > st;
	for (auto h: g[u]) {
		if (pr == h) {
			continue;
		}
		int kek = dfs1(h, u);
		st.pb({kek, h});
		cnts[u] += cnts[h];
		cur += kek;
	}
	if (st.empty()) {
		if (s[u] == '1') {
			return dist[u];
		}
		return 0;
	}
	int ans = 0;
	if (s[u] == '1') {
		ans += dist[u];
	}
	for (auto &x: st) {
		ans += dist[u] * cnts[x.second];
		x.first -= dist[u] * cnts[x.second];
		cur -= dist[u] * cnts[x.second];
	}
	sort(all(st));
	if (st.back().first <= cur - st.back().first) {
		ans += cur % 2;
	} else {
		int kek = 2 * st.back().first;
		for (auto x: st) {
			kek -= x.first;
		}
		ans += kek;
	}
	return ans;
}


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//read("input");
	cin >> n;
	cin >> s;
	for (int i = 0; i < n - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	int res = 1e9;
	for (int i = 0; i < n; i++) {
		int sums = 0;
		int kek = 0;
		int pos = -1;
		for (auto h: g[i]) {
			cnt = 0;
			dist[h] = 1;
			dfs(h, i);
			chkmax(kek, cnt);
			if (kek == cnt) {
				pos = h;
			}
			sums += cnt;
		}
		//cout << sums << ' ' << i << endl;
		if (sums % 2 == 0 && kek <= sums / 2) {
			chkmin(res, sums / 2);
		} else {
			if (sums % 2 == 0) {

				if (res > sums / 2) {
					int f = dfs1(pos, i);
					int ft = sums - kek;
					if (f <= ft) {
						chkmin(res, sums / 2);
					}
				}
			}
		}
	}
	if (res > 1e8) {
		res = -1;
	}
	cout << res << '\n';
	return 0;
}


Measured memory_bytes: 640
import java.util.BitSet;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		BitSet prime = prime(1000000);
		while(true){
			int a = in.nextInt();
			int d = in.nextInt();
			int n = in.nextInt();
			if(a == 0) return;
			int count = 0;
			while(count < n){
				if(prime.get(a)) count++;
				a+=d;
			}
			System.out.println(a-d);
		}
	}
	
	public static BitSet prime(int max){
		BitSet prime = new BitSet(max);
		prime.set(2, max);
		for(int i=prime.nextSetBit(2); i!=-1; i=prime.nextSetBit(i+1)){
			for(int j=2; j*i<=max; j++){
				prime.clear(j*i);
			}
		}
		return prime;
	}
}

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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

int main(int argc, char **argv)
{
	ll N; cin >> N;
	string s; cin >> s;
	
	map<char, ll>m;
	for (auto &e : s)
	{
		++m[e];
	}

	ll res{1};
	for (auto &p : m)
	{
		(res *= (p.second + 1)) %= MOD;
	}

	std::cout << (res +  MOD- 1) % MOD << std::endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define N ((ll)(2e6+100))
#define MAX ((ll)(1e18+100))
#define ARRS ((ll)(2e6+100))
#define MOD ((ll)(1e9+7))
#define pb push_back

ll n;
ll a[ARRS];
bitset<5000000> dp;

int main(){
	cin>>n;
	ll s=0;
	for(int i=0; i<n; i++)cin>>a[i],s+=a[i];
	dp[0]=1;
	for(int i=0; i<n; i++)
		dp|=(dp<<a[i]);

	ll c=0,t=0;
	ll pas=s;
	for(int i=1; i<5000000; i++){
		if(dp[i])
			if(abs(s-2*i)<=abs(s-2*pas))
				pas=i;
	}
	cout<<pas;
}


Measured memory_bytes: 2048
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		int ans=0;
		for(int i=0; i<n; i++){
			int a=sc.nextInt();
			if(a>=k){
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 47052
#include <bits/stdc++.h>
using namespace std;
const int N=65;
const double eps=1e-9;
int n,k;
double x[N],y[N],c[N],r[N];
double dis(pair<double,double> a,pair<double,double> b) {
    return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
vector<pair<double,double> > cal(double x1,double y1,double r1,double x2,double y2,double r2) {//两圆交点
    x1-=x2,y1-=y2;
    double S=x1*x1+y1*y1,a=(S+r2*r2-r1*r1)/2,D=S*r2*r2-a*a;
    if(S==0)return {};
    if(D<0) return {};
    double A1=a*x1,B1=y1*sqrt(D);
    double A2=a*y1,B2=x1*sqrt(D);
    return {{(A1+B1)/S+x2,(A2-B2)/S+y2},{(A1-B1)/S+x2,(A2+B2)/S+y2}};
}
bool check(double t) {
    for(int i=0;i<n;i++) r[i]=t/c[i];
    vector<pair<double,double> > vec;
    for(int i=0;i<n;i++) {
        vec.push_back({x[i],y[i]});
        for(int j=i+1;j<n;j++) {
            auto v=cal(x[i],y[i],r[i],x[j],y[j],r[j]);
            for(auto it:v) vec.push_back(it);
        }
    }
    for(auto it:vec) {
        int cnt=0;
        for(int i=0;i<n;i++) {
            if(r[i]+eps>=dis(it,{x[i],y[i]})) cnt++;
        }
        if(cnt>=k) return true;
    }
    return false;
}
int main() {
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++) {
        scanf("%lf%lf%lf",&x[i],&y[i],&c[i]);
    }
    double L=0,R=1000010;
    for(int i=0;i<100;i++) {
        double mid=(L+R)/2;
        if(check(mid)) R=mid;
        else L=mid;
    }
    printf("%.6lf\n",R);
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

typedef long long ll;
const ll MOD = 1000000007;
ll fact[112345] = {1};
ll bit[112345];
int str[112345];

int main(){
	for(int i = 1; i < 112345; ++i) fact[i] = fact[i - 1] * i % MOD;
	for(;;){
		int n;
		scanf("%d", &n);
		if(!n) return 0;

		for(int i = 0; i < n; ++i) str[i] = i;

		int r;
		scanf("%d", &r);
		for(int i = 0; i < r; ++i){
			int s, t;
			scanf("%d%d", &s, &t);
			int tmp = str[s - 1];
			str[s - 1] = str[t - 1];
			str[t - 1] = tmp;
		}

		//for(int i = 0; i < n; ++i) printf("%d ", str[i]); putchar('\n');

		for(int i = 1; i <= n; ++i) bit[i] = 0;

		ll ans = 0;
		
		for(int i = 0; i < n; ++i){
			ll count = str[i];

			for(int j = str[i] + 1; j; j -= j & -j) count -= bit[j];

			ans = (ans + fact[n - i - 1] * count) % MOD;

			for(int j = str[i] + 1; j <= n; j += j & -j) ++bit[j];
		}

		printf("%lld\n", ans);
	}
}



Measured memory_bytes: 3784
// READ & UNDERSTAND
// ll, int overflow, array bounds
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n;
	map<string,int>mp;
	string s;
	cin >> n;
	while(n--){
		cin >> s;
		mp[s]++;
	}
	cout << mp.size() << endl;
}	


Measured memory_bytes: 19280
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)

string S;
int K;
int num[100010];

signed main(){
	cin>>S>>K;
	REP(i,S.size()){
		num[i]=(int)(S[i]-'a');
	}
	REP(i,S.size()){
		if(num[i]!=0&&26-num[i]<=K){
			K-=26-num[i];
			num[i]=0;
		}
	}
	if(K>0){
		num[S.size()-1]=(num[S.size()-1]+K)%26;
	}
	REP(i,S.size()){
		cout<<(char)('a'+num[i]);
	}
	cout<<endl;
	return 0;
}


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

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

    int ans;
    cin >> ans;
    rep(i, n - 1) {
        int a;
        cin >> a;
        ans = __gcd(ans, a);
    }

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


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<cstring>
#include<stdio.h>
#include<string>
#include<math.h>

using namespace std;

typedef long long ll;
typedef double db;

 ll mod = 1e9 + 7;

 ll a[10000][2];

int main() {
	ll n;
	int count = 0;
	cin >> n;
	ll s = 0;
	if (n == 2)s--;
	for (ll i = 2; i * i <= n;i++) {
		if (n%i == 1) {
			if ((n - 1) / i == i)s++;
			else s += 2;
		
		}
		else if (n%i == 0) {
			a[count][0] = i;
			a[count][1] = n / i;
			count++;
		}
	}
	for (int j = 0; j < count; j++) {
		while (a[j][1] >= a[j][0]) {
			if (a[j][1] % a[j][0] == 1){
				s++; break;
		}
			else if (a[j][1] % a[j][0] == 0)a[j][1] = a[j][1] / a[j][0];
			else break;
		}
		if (a[j][1] == 1)s++;
	}
	cout << s+2;
    return 0;
}

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

const int MAX = 7368791;

int sieveOfEratosthenes(int m, int n) {
  auto primes = vector<int>(MAX + 1, 0);
  for (int i = 2; i <= MAX; ++i) primes[i] = i;
  for (int i = m; i <= MAX; ++i) {
    if (primes[i]) {
      for (int j = i; j <= MAX; j += i) primes[j] = 0;
      if (!n) return i;
      --n;
    }
  }
  return -1;
}

int main() {
  int m, n;
  while (cin >> m >> n, m) {
    cout << sieveOfEratosthenes(m, n) << endl;
  }
  return 0;
}



Measured memory_bytes: 31864
n = int(input())
table = [[0 for _ in range(9)] for _ in range(9)]
 
for i in range(1, n+1):
    s = str(i)
    f, l = s[0], s[-1]
    if "0" in [f, l]: continue
    table[int(f)-1][int(l)-1] += 1
 
ans = 0
for i in range(9):
    for j in range(9):
        ans += table[i][j] * table[j][i]
 
print(ans)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;

int n,tot=1,fuck=0,ans=1;

map<pair<int,int>,int> m;
map<pair<int,int>,int>::iterator it;

int quick_power(int a,int b)
{
	int res=1ll;
	for (;b;b=b>>1,a=(a*a)%mod)
	{
		if (b&1)  res=(res*a)%mod; 
	}
	return res;
}

signed main()
{
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		int u,v,now;
		cin>>u>>v;
		
		if (u==0&&v==0)
		{
			fuck++;
			continue;
		}
		now=__gcd(u,v);
		u/=now,v/=now;
		
		if (u<0)  u=-u,v=-v;
		m[make_pair(u,v)]++;
	}
	for (it=m.begin();it!=m.end();it++)
	{
		if (it->second==0)  continue;
		int x=it->first.first,y=it->first.second;
		int p=quick_power(2,m[make_pair(x,y)])%mod;
		
		y=-y;
		if (y<0)  x=-x,y=-y;
		
		if (m.count(make_pair(y,x)))
		{
			p=(p+quick_power(2,m[make_pair(y,x)])-1)%mod;
			m[make_pair(y,x)]=0;
		}
		ans=(ans*p)%mod;
	}
	cout<<((ans+fuck-1)%mod+mod)%mod<<endl;
	
	return 0;
}

Measured memory_bytes: 16072
#include<iostream>
#include<stdio.h>

int main()
{
	int a, b, c;
	int rect = 0, rhombus = 0;
	
	while( scanf( "%d,%d,%d", &a, &b, &c ) != EOF ){
		if( a == b ){
		 	rhombus++;
		}
		else if( a * a + b * b == c * c ){
			rect++;
		}
	}
	
	std::cout << rect << std::endl;
	std::cout << rhombus << std::endl;

 	return 0;
}

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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

ll pCount(int x){
  if(x==0) return 1;
  return pCount(x-1)*2 + 1;
}

ll allCount(int x){
  if(x==0) return 1;
  return allCount(x-1)*2 + 3;
}


signed main() {
  ll n,k;
  cin >> n >> k;
  
  ll count = 0;
  if(k%2==0){
    ll c = k/2;
    ll k2Count = (n-c)/k + 1;

    if(n<c){
      k2Count = 0;
    }

    //全部おなじ数。
    count += k2Count;
    
    //二つ同じ数。3パターン
    if(k2Count>1){
      count += k2Count*(k2Count-1)*3;
    }
    
    //3つ異なる数
    if(k2Count>2){
      count += k2Count*(k2Count-1)*(k2Count-2);
    }
  }

  // kの倍数の個数
  ll kCount = n/k;
  count += kCount;
  if(kCount>1){
    count += kCount*(kCount-1)*3;
  }
  
  if(kCount>2){
    count += kCount*(kCount-1)*(kCount-2);
  }

  cout << count << endl;
  
  return 0;
}



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

int main()
{
  int N,L;cin>>N>>L;
  
  int min=1000;
  int min_i=0;
  for (int i=1;i<=N;i++)
  {
    if (min > abs(L+i-1)) 
    {
      min = abs(L+i-1);
      min_i= i;
    }
  }
  
  int sum=0;
  for (int i=1;i<=N;i++)
  {
    sum += L+i-1; 
  }
  sum -= (L+min_i-1);
  cout<<sum<<endl;
   
}

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

typedef struct {
	int price;
	int stock;
} store;

int comp(const void* a, const void* b);

int main() {
	int n, m, i, next;
	long long int cnt;
	store ab[100000];

	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++) {
		scanf("%d%d", &ab[i].price, &ab[i].stock);
	}

	qsort(ab, n, sizeof(store), comp);

	cnt = 0;
	for (i = 0; i < n; i++) {
		if (ab[i].stock < m) {
			cnt += (long long int)ab[i].price * ab[i].stock;
			m -= ab[i].stock;
		}
		else {
			cnt += (long long int)ab[i].price * m;
			m = 0;
			break;
		}
	}

	printf("%lld", cnt);
	return 0;
}

int comp(const void* a, const void* b) {
	return ((store*)a)->price - ((store*)b)->price;
}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main() {
    int n;
    scanf("%d", &n);
    vector<int> a(n + 2);
    a[0] = 0, a[n + 1] = 0;
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    int max_cost = 0;
    rep(i, n + 1) max_cost += abs(a[i] - a[i + 1]);
    for(int i = 1; i <= n; i++){
        int ans = 0;
        ans = max_cost - (abs(a[i - 1] - a[i]) + abs(a[i] - a[i + 1])) + abs(a[i + 1] - a[i - 1]);
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 3804
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <deque>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)

#define rdi(i) ll i; scanf("%lld", &i)
#define rds(s) string s; cin >> s
#define rdc(c) char c; cin >> c

#define INF 10000000000

ll calc(const vector<ll> & is, const vector<ll> & js, const vector<ll> & ks)
{
    ll result = 0;
    for (auto iti = is.begin(); iti != is.end(); ++iti) {
        for (auto itj = upper_bound(js.begin(), js.end(), *iti); itj != js.end(); ++itj) {
            auto itk = upper_bound(ks.begin(), ks.end(), *itj);
            if (itk == ks.end()) {
                continue;
            }
            auto tmp = *itj + (*itj - *iti);
            auto it = lower_bound(ks.begin(), ks.end(), tmp);
            if (it != ks.end() && *it == tmp) {
                result += max(0ll , (ll)(ks.end() - itk - 1));
            } else {
                result += ks.end() - itk;
            }
        }
    }
    return result;
}

int main()
{
    ll n;
    string s;
    cin >> n >> s;
    vector<ll> rs, gs, bs;
    rep(i, n) {
        switch (s[i]) {
        case 'R':
            rs.push_back(i);
            break;
        case 'G':
            gs.push_back(i);
            break;
        case 'B':
            bs.push_back(i);
            break;
        }
    }
    ll result = 0;
    result += calc(rs, gs, bs);
    result += calc(gs, bs, rs);
    result += calc(bs, rs, gs);
    result += calc(rs, bs, gs);
    result += calc(gs, rs, bs);
    result += calc(bs, gs, rs);
    cout << result;
    return 0;
}

Measured memory_bytes: 3224
N,L=map(int,input().split())
taste=[0]*N; abs_taste=[0]*N;
for i in range(N):
  taste[i]=L+i
  abs_taste[i]=abs(L+i)
for i in range(N):
  if abs_taste[i]==min(abs_taste) :
    min_i=i
    break
print(sum(taste)-taste[min_i])

Measured memory_bytes: 9184