akhauriyash/Code-Regression huggingface dataset:
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

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

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	s := readString()
	t := readString()
	s += s
	if strings.Contains(s, t) {
		println("Yes")
	} else {
		println("No")
	}
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
     
int main(){
  int n,id=1,nv,ch,index,syuryo=1;
       
  scanf("%d\n",&n);
   
  int *A = new int[100040];
  bool *B = new bool[100040];
  int *C = new int[100040];
  string *D = new string[100040];
  int st,ed;
  for(int i=0;i<=100040;i++){
    A[i]=0; // hukasa
    C[i]=-1; // oya
    B[i]=false; //false nara ko wo motte inai
  }
  for(int i=0;i<n;i++){
    scanf("%d",&id);
      
    getline(cin,D[id]);
   
    syuryo=1;
    for(int r=1;r<=D[id].length();r++){
      if(D[id][r] == ' '){
    syuryo = r-1; // String no iti gime
    break;
      }
    }
     
    index = atoi(D[id].substr(1,syuryo).c_str()); 
  
    if(index != 0)B[id]=true;
         
  
    if(index != 0){
      st = syuryo+2;   
      for(int d = syuryo+2;d<=D[id].length();d++){
    if(D[id][d] == ' ' || d == D[id].length()){
      A[atoi(D[id].substr(st,d-st).c_str())]=A[id]+1;
      C[atoi(D[id].substr(st,d-st).c_str())]=id;
      if(B[atoi(D[id].substr(st,d-st).c_str())]){
        int st2=3;
          
        for(int j = syuryo+2;j<=D[atoi(D[id].substr(st,d-st).c_str())].length();j++){
            
          if(D[atoi(D[id].substr(st,d-st).c_str())][j] == ' ' || j == D[atoi(D[id].substr(st,d-st).c_str())].length()){
        A[atoi(D[atoi(D[id].substr(st,d-st).c_str())].substr(st2,j-st2).c_str())]=A[atoi(D[id].substr(st,d-st).c_str())]+1;
        st2=j+1;
          }
        }
      }
      st = d+1;
    }
      }
        
    }
      
  }
       
   
       
  for(int i=0;i<n;i++){
    printf("node %d: parent = %d, depth = %d, ",i,C[i],A[i]);
    int cou=0;
    if(C[i] == -1){printf("root, [");}
    else if(!B[i])printf("leaf, [");
    else printf("internal node, [");
      
  
    syuryo=1;
    for(int r=1;r<=D[i].length();r++){
      if(D[i][r] == ' '){
    syuryo = r-1;
    break;
      }
    }
    index = atoi(D[i].substr(1,syuryo).c_str());
      
    st=syuryo+2;
    if(index != 0){     
      for(int j=syuryo+2;j<=D[i].length();j++){
    if(D[i][j] == ' ' || D[i].length() == j ){
      printf("%d",atoi(D[i].substr(st,j-st).c_str()));
      if(j != D[i].length())printf(", ");
      st=j+1;
    }
      }
    }
    printf("]\n");
  }
       
  delete [] A;
  delete [] B;
  delete [] C;
  delete [] D;
  return 0;
}


Measured memory_bytes: 9880
import sys
import itertools


def resolve(in_):
    H, W, M = map(int, next(in_).split())
    targets = tuple(tuple(map(int, line.split())) for line in in_)
    
    target_h = {}
    target_w = {}
    target_hw = set()
    for h, w in targets:
        target_h[h] = target_h.setdefault(h, 0) + 1
        target_w[w] = target_w.setdefault(w, 0) + 1
        target_hw.add((h, w))

    max_h = max(target_h.values())
    max_w = max(target_w.values())

    h_set = {h for h, v in target_h.items() if max_h == v}
    w_set = {w for w, v in target_w.items() if max_w == v}

    ans = max_h + max_w - 1
    for hw in itertools.product(h_set, w_set):
        if hw not in target_hw:
            ans += 1
            break
    
    return ans


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()


Measured memory_bytes: 120528
n,k,q = input().split(' ')
n = int(n)
k = int(k)
q = int(q)
unchi = [k-q]*n
for i in range(q):
    a = int(input())-1
    unchi[a] += 1
for i in unchi:
    if i <= 0:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 6584
#include<cstdio>
#include<cstdlib>
using namespace std;
int n,a;
int main()
{
	scanf("%d%d",&n,&a);
	a=a*2+1;
	if(n%a) a=n/a+1;
	else a=n/a;
	printf("%d\n",a);
	return 0;
} 

Measured memory_bytes: 128
#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int n;
	cin >> n;
	int m = 0;
	for (int i = 0; i < 10; i++) {
		int temp = (i == 9) ? n : (n % int(pow(10, i + 1)));
		m += temp / (int(pow(10, i)));
	}
	cout << ((n % m) ? "No" : "Yes") << endl;
	return 0;
}



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

int main() {
  int n;
  cin>>n;
  bool ans=false;
  vector<int> p(n),q;
  rep(i,n){
    cin>>p[i];
  }
  q=p;
  sort(p.begin(),p.end());
  if(q==p){
    ans=true;
  }
  rep(i,n){
    rep(j,i){
      vector<int>r=q;
      r[i]=q[j];
      r[j]=q[i];
      if(r==p){
        ans=true;
      }
    }
  }
  if(ans){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int w, h, n; std::cin >> w >> h >> n;
  int x1 = 0, x2 = w, y1 = 0, y2 = h;
  rep(i, n) {
    int x, y, a; std::cin >> x >> y >> a;
    if (a == 1) chmax(x1, x);
    else if (a == 2) chmin(x2, x);
    else if (a == 3) chmax(y1, y);
    else chmin(y2, y);
  }
  int ww = x2 - x1, wh = y2 - y1;
  if (ww <= 0 || wh <= 0)
    std::cout << 0 << "\n";
  else
    std::cout << ww * wh << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define p pair<int, int>
using namespace std;

int main() {
    int n;
    cin >> n;
    string s[n];
    vector<int> t(n);
    for (int i = 0; i < n; i++) cin >> s[i] >> t[i];
    string x;
    cin >> x;
    bool f = false;
    int sum = 0;
    for (int i = 0; i < n; i++) {
        if (f) sum += t[i];
        if (s[i] == x) f = true;
    }
    cout << sum << endl;
    return 0;
}

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

int W,n,w[1001],v[1001];
int dp[1001];

int main(){
  int a = 0;
  while(cin >> W,W){
    cin >> n;
    for(int i=0;i<n;i++) scanf("%d,%d",&v[i],&w[i]);
    
    memset(dp,-1,sizeof(dp)); dp[0] = 0;
    for(int i = 0;i < n;i++){
      for(int j = W;j > 0;j--){
	if(j < w[i]) dp[j] = dp[j];
	else dp[j] = max(dp[j],dp[j - w[i]] + v[i]);
      }
    }
    
    int *maxi = max_element(dp,dp+W+1);
    cout << "Case " << ++a << ":" << endl;
    cout << *maxi << endl << maxi - dp << endl;
  }
}

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

int main(){
ll n,m;
cin >> n >> m;
ll x,y;
vector<ll>num(n);
for (ll i = 0; i < m; i++){
  cin >> x >> y;
  num[x-1]++;
  num[y-1]++;
}

for (ll i = 0; i < n; i++)
{
  cout << num[i] << endl;
}

}

Measured memory_bytes: 256
N, M, K = map(int, input().split())

MOD = 10 ** 9 + 7

def combination(n, m):
    c = 1
    m = min(n-m, m)
    for i in range(m):
        c = c * (n-i) * pow(m-i, MOD-2, MOD) % MOD
    return c

pattern = combination(N*M-2, K-2)

def diff_x_pattern(val):
    ret = 0
    for d in range(1, val):
        ret += ((val - d) * d) % MOD
    return ret

ans = (M * M * diff_x_pattern(N)) % MOD
ans += (N * N * diff_x_pattern(M)) % MOD
print((ans*pattern)%MOD)


Measured memory_bytes: 3064
N,F = [int(i) for i in input().split()]

itemsets = []

for l in range(N):
    items = input().split()
    M = int(items.pop(0))
    
    items.sort()

    for i in range(len(items)):
        for j in range(i+1, len(items)):
            itemsets.append(items[i] + " " + items[j])

itemsets.sort()
    
cnt = 1
ans = []
if F > 1:
    ans.append("")
    for i in range(1, len(itemsets)):
        if itemsets[i] == itemsets[i-1]:
            cnt = cnt + 1
            if cnt >= F and itemsets[i] != ans[-1]:
                ans.append(itemsets[i])
        else:
            cnt = 1
    ans.pop(0)
else:
    ans = itemsets

print(len(ans))
for i in range(len(ans)):
    print(ans[i])
    


Measured memory_bytes: 5988
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		// 1行目個数、2行目の複数の数字を配列に格納
		//   3
		//   1 2 3
		int N = Integer.parseInt(br.readLine());
		String[] ss0 = br.readLine().trim().split(" ", 0);
		int[] ii0 = new int[N];
		for(int i = 0; i < N; i++){
			ii0[i] = Integer.parseInt(ss0[i]);
		}

		int ans = 1;
		int katamuki = 0;
		for(int i = 0; i < N-1; i++){
			if (ii0[i] == ii0[i+1]) { continue; }
			if (ii0[i] >  ii0[i+1]) {
				if( katamuki >= 0) { katamuki = 1; }
				if( katamuki <  0) {
					ans += 1;
					katamuki = 0;
				}
			}
			if (ii0[i] <  ii0[i+1]) {
				if( katamuki <= 0) { katamuki = -1; }
				if( katamuki >  0) {
					ans += 1;
					katamuki = 0;
				}
			}
		}

		//checkInput(ii0);
		
        System.out.println(ans);
        return;
    }


}


Measured memory_bytes: 37716
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vstr=vector<string>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define _GLIBCXX_DEBUG
int main()
{
    string s;
    cin>>s;
    bool can=true;
    rep(i,s.size()){
        if(i%2){
            if(s[i]=='R'){
                can=false;
                break;
            }
        }
        else{
            if(s[i]=='L'){
                can=false;
                break;
            }
        }
    }
    if(can)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int mod = 1e9 + 7;

// O(N * K^2)

void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}
void sub_self(int& a, int b) {
    a -= b;
    if(a < 0) {
        a += mod;
    }
}

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    vector<int> dp(k + 1);
    // dp[i] - the number of ways such that we used i candies so far
    dp[0] = 1;
    for(int child = 0; child < n; ++child) {
        int up_to;
        scanf("%d", &up_to);
        vector<int> fake(k + 1);
        for(int used = k; used >= 0; --used) {
            int tmp = dp[used];
            int L = used + 1;
            int R = used + min(up_to, k - used);
            if(L <= R) {
                add_self(fake[L], tmp);
                if(R + 1 <= k) {
                    sub_self(fake[R+1], tmp);
                }
            }
            //~ for(int i = L; i <= R; ++i) {
                //~ add_self(dp[i], tmp);
            //~ }
        }
        int prefix_sum = 0;
        for(int i = 0; i <= k; ++i) {
            add_self(prefix_sum, fake[i]);
            add_self(dp[i], prefix_sum);
        }
    }
    printf("%d\n", dp[k]);
}


Measured memory_bytes: 1148
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long i = Math.round(Math.pow(n, 0.5));
		while(n % i != 0) {
			i--;			
		}
		long ii = n/i;
		System.out.println((ii + i - 2));
		sc.close();
	}
}


Measured memory_bytes: 23764
#if 0
20?????????????????£???

????????????????????????1????????????????????¨??????????????¨????????????????????????????´????????????????????????????
#endif



#include <iostream>
using namespace std;

int main() {
  int n,w;
  cin >> n;
  cin >>w;
  int v[n+10],c[n+10];
  int t;

  for(int i=1;i<n+1;i++){ //????´?
    cin >> v[i];
    cin >> c[i];
    //cout<<v[i]<<" "<<c[i]<<endl;
    }

    int ans[n+10][w+10];
    for (int i=0; i<n+1; i++) {
    for (int j=0; j<w+1; j++) {
      if ((i == 0)||(j == 0)) {
	ans[i][j]=0;
      } else if (j-c[i] < 0) {
	ans[i][j]=ans[i-1][j];
      } else {
	ans[i][j]=max(v[i]+ans[i][j-c[i]], ans[i-1][j]);
      }
    }
  }
  cout<< ans[n][w]<< endl;
}

Measured memory_bytes: 7024
A,B=map(int,input().split())
X=0
if A >= B :
    X = X+A
    A = A-1
else:
    X= X+B
    B= B-1

if A >= B :
    X = X+A
    A = A-1
else:
    X= X+B
    B= B-1
print(X)        


Measured memory_bytes: 2940
import sys
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
n, m = MI()
lr = [LI() for _ in range(m)]
l = lr[0][0]
r = lr[0][1]
for i in range(1, m):
    if lr[i][0] < l and lr[i][1] < l:
        print(0)
        exit()
    if r < lr[i][0] and r < lr[i][1]: 
        print(0)
        exit()
    if l <= lr[i][0] <= r:
        l = lr[i][0] 
    if l <= lr[i][1] <= r:
        r = lr[i][1]
print(r - l + 1)


Measured memory_bytes: 56412
from collections import defaultdict as dd
from math import factorial as f

def nCr(n, r):
    return int(f(n) / (f(r) * f(n-r)))
    
N = int(input())
lisA = list(map(int, input().split()))

lisB = [0]
m = 0
for e in lisA:
    m += e
    lisB.append(m)

d = dd(int)

for e in lisB:
    d[e] += 1

ans = 0
for e in d.values():
    if e > 1:
        ans += nCr(e,2)

print(ans)


Measured memory_bytes: 41728
//Bismillahir-Rahmanir-Rahim
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int llu;
#define f1(i,n) for(i=1;i<=n;i++)
#define f(i,n) for(i=0;i<n;i++)
#define Max 100009
#define pb push_back
#define mp make_pair
using namespace std;
int main()
{
     ll n,i,j,t,m=0,T,ans=0,r,k,p=0,q,x,y,l;
         cin>>n;
         ll a[n];
         f(i,n)
         cin>>a[i];
         m=a[0];
         for(i=1;i<n;i++)
         {
             if(a[i]<m){
                ans+=m-a[i];
                }
                else if(a[i]>m)
                {
                    m=a[i];
                }
         }
         cout<<ans<<endl;
}













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

vector<int> hate(10);

bool suki(int n){
  bool ok=1;
  while(n>0){
    if(hate[n%10]==1)ok=0;
    n/=10;
  }
  return ok;
}

int main(){
  int n,k;
  cin>>n>>k;
  rep(i,10){
    hate[i]=0;
  }
  rep(i,k){
    int l; cin>>l;
    hate[l]=1;
  }
  int ans;
  while(true){
    int tmp=n;
    bool ok;
    ok=suki(tmp);
    if(ok){
      ans=n; 
      break;
    }
    n++;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3588
#include <stdio.h>

int main(void){
    long long N, m, x, i;
    scanf("%lld", &N);
    m=N-1;
    for (i=1; i*i<=N; i++) {
        if (N%i==0) {
            x=i+(N/i)-2;
            // printf("%d: %d\n", i, x);
            if (x<m) m=x;
        }
    }
    printf("%lld", m);
    return 0;
}


Measured memory_bytes: 256
'use strict'
function Main(input){
  input=input.split(/\s+/);
  for(let i=0;i<input.length;i++)
    input[i]=parseInt(input[i]);
  var N=input.shift();
  var M=input.shift();
  var num_down=[];
  for(let num=9;num>0;num--)
    if(input.indexOf(num)!==-1)
      num_down.push(num);
  var costList=[
    Infinity,//添字0はスキップ
    2,//1を作るマッチの本数
    5,//2
    5,//3
    4,//4
    5,//5
    6,//6
    3,//7
    7,//8
    6,//9
  ];
  var cost=[];
  for(let i=0;i<M;i++)
    cost[i]=costList[num_down[i]];
  var maximumOrder=[0,-Infinity];
  for(let i=1;i<8;i++)
    maximumOrder[-i]=-Infinity;
  var candidate;
  var c;
  for(let i=2;i<N+1;i++){
    candidate=[];
    for(let j=0;j<M;j++){
      c=cost[j];
      candidate[j]=maximumOrder[i-c]+1;
    }
    maximumOrder[i]=Math.max.apply(null,candidate);
  }
  var order=maximumOrder[N];
  var str='';
  while(N>0)
    for(let j=0;j<M;j++){
      c=cost[j];
      if(maximumOrder[N-c]===maximumOrder[N]-1){
        str=str+num_down[j];
        N=N-c;
        break;
      }
    }
  console.log(str);
}

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

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

// main
int main(){
    int N;
    cin >> N;
    set<int> mochi;

    for(int i = 0; i < N; ++i){
        int x;
        cin >> x;
        mochi.insert(x);
    }

    cout << mochi.size() << "\n";

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


def solve():
    N = Scanner.int()
    if N == 1:
        print(0)
        return
    fact = factorization(N)
    ans = 0
    for f in fact:
        t = f[1]
        i = 1
        while t - i >= 0:
            ans += 1
            t -= i
            i += 1
    print(ans)


def main():
    # sys.stdin = open("sample.txt")
    # print('YNEOS'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 10988
import sys
input = sys.stdin.readline


n = int(input())

GRAPH = {i:[] for i in range(1, n + 1)}
EDGES = []
COLORS = {(0, 1):0}
for _ in range(n - 1):
    a, b = map(int, input().split())
    GRAPH[a].append(b)
    GRAPH[b].append(a)
    EDGES.append((a, b))
    COLORS[(a, b)] = 0

PREV = {1:0}
Q = [1]
while Q:
    now = Q.pop(0)
    for vertex in GRAPH[now]:
        if vertex == PREV[now]:
            continue
        next = vertex
        PREV[next] = now
        Q.append(next)

Q = [1]
while Q:
    now = Q.pop(0)
    prev = PREV[now]
    a, b = min(now, prev), max(now, prev)
    used = COLORS[(a, b)]
    
    color = 1
    for vertex in GRAPH[now]:
        if vertex == prev:
            continue
        next = vertex
        a, b = min(now, next), max(now, next)
        if color == used:
            color += 1
            COLORS[(a, b)] = color
            color += 1
        else:
            COLORS[(a, b)] = color
            color += 1
        Q.append(next)

print(max(COLORS.values()))
for edge in EDGES:
    print(COLORS[edge])


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

struct rest{
    string S;
    int score;
    int i;
};

int func(struct rest &p1, struct rest &p2){
    if(p1.S != p2.S){
        return p1.S <= p2.S;
    }else{
        return p1.score >= p2.score;
    }
}

int main(){
    int N;
    struct rest lst[110];
    string S;
    int P;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> S >> P;
        lst[i] = rest{S, P, i+1};
    }
    sort(lst, lst+N, func);
    for(int i=0;i<N;i++){
        cout << lst[i].i << '\n';
    }
    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;

int main(){
  int n,m,l;cin >> n >> m >> l;
  int a[n][m],b[m][l];
  rep(i,n)rep(j,m)cin >> a[i][j];
  rep(i,m)rep(j,l)cin >> b[i][j];
  for(int i=0;i<n;++i){
    for(int j=0;j<l;++j){
      ll sum = 0;
      for(int k=0;k<m;++k){
        sum += a[i][k]*b[k][j];
      }
      if(j == l-1)cout << sum << endl;
      else cout << sum << " ";
    }
  }
  return 0;
}


Measured memory_bytes: 3164
#include <cstdio>
#include <iostream>

using namespace std;

char data1[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char data2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char mozi;
int flag=0;

int main(){
	while(flag == 0){
		scanf("%c",&mozi);
		if(mozi == ' '){
			printf(" ");
		}else if(mozi == '.'){
			printf(".");
		}else if(mozi == '\n'){
			printf("\n");
			flag = 1;
		}else{
			for(int i=0;i<26;i++){
				if(data1[i] == mozi){
					printf("%c",data2[i]);
					break;
				}
			}
		}
	}

}

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

int main(){
    int n;
    cin >> n;
    for (int i=1; i<n+1; i++){
        int x = i;
        if ( x%3 == 0 ){
            cout << " " << i;
            continue;
            }
        while(x){
            if ( x%10 == 3 ){
                cout << " " << i;
                break;
            }
            x /= 10;
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include <string>
#include <algorithm>
#include <cstdlib> 

using namespace std;
int main()
{
	int n;
	cin >> n;
	int a[100002] = {};
	int b[100002] = {};
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		b[i]=a[i];
	}
	//偶数回目の合計が正
	long long eve = 0,sum=0, odd = 0;;
	for (int j = 0; j < n; j++) {
		if (j % 2 == 0 && sum + a[j] <=0) {
			eve += abs(a[j]+ sum)  + 1;
			a[j] = abs(sum) + 1;
		}
		if (j % 2 == 1 && sum +a[j] >=0) {
			eve += a[j] + sum + 1;
			a[j] = -abs(sum)-1;
		}
		sum += a[j];
		
		//cout << a[j] << " " <<eve << " " <<sum << endl;
	}
	//cout << endl;
	//奇数回目が正
	sum = 0;
	for (int k = 0; k < n; k++) {
		if (k % 2 == 0 && sum + b[k] >= 0) {
			odd += abs(b[k] + sum) + 1;
			b[k] = -abs(sum) - 1;
			
		}
		if (k % 2 == 1 && sum + b[k] <= 0) {
			odd += abs(sum + b[k]) + 1;
			b[k] = abs(sum) + 1;
		}
		sum += b[k];
		//cout << b[k] << " " <<odd << " " << sum<<endl;
	}
	//cout << endl;
	cout << min(odd, eve) << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
typedef long long ll;
int main()
{
    int n;
    cin >> n;
    if(n % 1000 == 0) printf("0\n");
    else printf("%d\n", 1000 - (n - n / 1000 * 1000) );
}


Measured memory_bytes: 3748
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll M = pow(10, 9) + 7;

vector<ll> fac(1000001);  //n!(mod M)
vector<ll> ifac(1000001); //k!^{M-2} (mod M)
ll mpow(ll x, ll n)
{ //x^n(mod M)
    ll ans = 1;
    while (n != 0)
    {
        if (n & 1)
            ans = ans * x % M;
        x = x * x % M;
        n = n >> 1;
    }
    return ans;
}
//conbination
ll comb(ll a, ll b)
{ //aCb(mod M)
    if (a == 0 && b == 0)
        return 1;
    if (a < b || a < 0)
        return 0;
    ll tmp = ifac[a - b] * ifac[b] % M;
    return tmp * fac[a] % M;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    fac[0] = 1;
    ifac[0] = 1;
    for (ll i = 0; i < 1000000; i++)
    {
        fac[i + 1] = fac[i] * (i + 1) % M;              // n!(mod M)
        ifac[i + 1] = ifac[i] * mpow(i + 1, M - 2) % M; // k!^{M-2} (mod M)
    }
    ll n;
    vector<ll> a, ans;
    cin >> n;
    a.resize(n + 1);
    ans.resize(n + 1);
    map<int, int> m;
    rep(i, n + 1)
    {
        cin >> a[i];
        m[a[i]]++;
    }
    ll two;
    rep(i, n)
    {
        if (m[i + 1] == 2)
        {
            two = i + 1;
        }
    }
    ll dist = 0;
    bool check = false;
    rep(i, n + 1)
    {
        if (a[i] == two && !check)
        {
            dist += i;
            check = true;
        }
        else if (a[i] == two)
        {
            dist += n - i;
        }
    }
    for (ll i = 1; i <= n; i++)
    {
        ans[i] = comb(n + 1, i);
        ans[i] -= comb(dist, i - 1);
        ans[i]=(ans[i]+MOD)%MOD;
    }
    rep(i, n)
    {
        cout << ans[i+1] << "\n";
    }
    cout<<1<<"\n";
}


Measured memory_bytes: 23168
import sys
sys.setrecursionlimit(10**9)

def main():
    S = input()
    N = len(S)
    MOD = 10**9+7

    S = [int(s) if s!="?" else -1 for s in S ]
    dp = [[0] * 13 for _ in range(N+1)]

    s = S[0]
    if s == -1:
        for j in range(10):
            dp[0][j] += 1
    else:
        dp[0][s%13] += 1
    for i in range(1,N):
        s = S[i]
        X = [s]
        if s == -1:
            X = range(10)

        for j in range(0,13):
            ten_j = j*10
            for x in X:
                k = (ten_j+x)%13
                dp[i][k] += dp[i-1][j]
                dp[i][k] %= MOD

    # print(dp)
    print(dp[N-1][5])



if __name__ == "__main__":
  main()

Measured memory_bytes: 64572
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long k,q,i,j,n,x,m,a,A;cin>>k>>q;
  	int d[k];
	for(i=0;i<k;i++)cin>>d[i];
	for(i=0;i<q;i++){
		cin>>n>>x>>m;a=x%m;
		for(j=0;j<k;j++)a+=((d[j]+m-1)%m+1)*((n-2+k-j)/k);
		A=n-1-a/m;cout<<A<<endl;
	}
}

Measured memory_bytes: 384
h=int(input())
count=1
ans=1
v=h
import math
while True:
    temp=math.floor(v/2)
    if temp==0:
        #count=count*2
        #ans+=1
        #ans+=count
        break
    v=temp
    ans+=1
    
print(int((1-2**(ans))/(1-2)))




Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
    int N, A, B, sumA, sumB, sum, m = 1000;
    cin >> N;
    for(int a = 1; a < N; a++){
        A = a;
        B = N - A;
        sumA = 0;
        sumB = 0;
        for(int i = 0; i < 7; i++){
            sumA += A % 10;
            sumB += B % 10;
            A /= 10;
            B /= 10;
        }
        sum = sumA + sumB;
        if(sum < m) m = sum;
    }
    cout << m << endl;
}

Measured memory_bytes: 3580
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>

using namespace std;
typedef pair<int,bool> Pair;

int main(){

  int a;
  string s;
	
  cin >> a;
  cin >> s;
	
  cout << (a >= 3200 ? s : "red") << endl;

  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define rep(i,a,b) for(int i=a; i<b; i++)
#define dep(i,a,b) for(int i=a; i>=b; i--)
#define ALL(x)	(x).begin(), (x).end()
using namespace std;
const long long INF = 1e18 , MAXN =1e5, MOD = 1e9 + 7,N=1000010;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,k;cin>>n>>k;
	vector<int>stone;
	rep(i,0,n){
		int x;cin>>x;stone.pb(x);
	}
	vector<ll>ans;
	ans.pb(0);
	rep(i,1,n)ans.pb(INF);
	//ans.pb(abs(stone[0]-stone[1]));
	rep(i,0,n){
		int j=i+1;
		while (j<n&&j<=i+k){
			ans[j]=min(ans[j],ans[i]+abs(stone[i]-stone[j]));
			j++;
		}
	}

	cout<<ans.back()<<"\n";
return 0;
}


Measured memory_bytes: 1784
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


def main():
    n,k = LI()
    a = sorted(LI())
    sa = sum(a)
    if sa < k:
        return n
    if sa - a[0] < k:
        return 0

    mi = 0
    ma = n-1

    def f(m):
        am = a[m]
        if am >= k:
            return True

        t = [False] * (k-am)
        t[0] = True
        tl = len(t)
        for i in range(n):
            if i==m:
                continue
            ai = a[i]
            for j in range(tl-1,-1,-1):
                if not t[j]:
                    continue
                if k <= j+ai:
                    continue
                if j+ai >= tl:
                    return True

                t[j+ai] = True

        return False

    while mi < ma:
        m = (mi+ma) // 2
        if f(m):
            ma = m
        else:
            mi = m+1

    return mi


print(main())


Measured memory_bytes: 68220
#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 n, d;

int main() {
  cin >> n >> d;
  int x[n + 10][d + 10];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < d; ++j) {
      cin >> x[i][j];
    }
  }

  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int subtot = 0;
      for (int k = 0; k < d; ++k) {
        subtot += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
      }
      double subtotsq = sqrt(subtot);
      if (floor(subtotsq) == subtotsq) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n,m = [int(i) for i in input().split()]

if n % 2 == 1:
  a=1
  b=2*m

  for _ in range(m):
    print(a, b)
    a += 1
    b -= 1
else:
  a = 1
  th = n-1
  count = 0
  half = n//2
  flag = True
  while True:
    if flag and th <= half:
      th -= 1
      flag = False
    count += 1
    print(a, a+th)
    a += 1
    th -= 2
    if count == m:
      break

Measured memory_bytes: 69584
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001




int main() {
    int N; cin >> N;
    vector<int> H(N);
    for(int &h:H){
        cin >> h;
    }
    
    int mx = 0;
    int cur = 0;
    for(int i=0; i<N-1; i++){
        if(H[i+1]<=H[i]) cur++;
        else {
            mx = max(cur, mx);
            cur = 0;
        }
    }
    mx = max(mx, cur);
    cout << mx << endl;
    return 0;
}



Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;

#define ll long long
#define rep(i,n) for(int i = 0;i < (n); i++)
#define mod 1000000007
#define chmax(x,y) x=max(x,y)
 
//2020/9/16 @ST

int d[3005][3005] = { 0 };
ll dp[3005][3005][4] = { 0 };

int main() {
	int r, c, k;
	cin >> r >> c >> k;
	rep(i, k) {
		int rk, ck, vk;
		cin >> rk >> ck >> vk;
		d[rk - 1][ck - 1] = vk;
	}
	rep(i, r)	rep(j, c) {
		for (int l = 2; l >= 0; l--) {
			chmax(dp[i][j][l + 1], dp[i][j][l] + d[i][j]);
		}
		rep(l, 4) {
			chmax(dp[i + 1][j][0], dp[i][j][l]);
			chmax(dp[i][j + 1][l], dp[i][j][l]);
		}
	}
	ll ans = 0;
	rep(l, 4)chmax(ans, dp[r - 1][c - 1][l]);
	cout << ans << endl;
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        while (a % 2 == 0) {
            a /= 2;
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define _USE_MATH_DEFINES
#include <cmath>

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

using namespace std;
typedef long long ll;

struct Node {
   int   key;
   Node *l, *r, *p;
};

Node *root, *NIL;

void insert(int k) {
   Node *y = NIL;
   Node *x = root;
   Node *z;

   z = (Node *)malloc(sizeof(Node));
   z->key = k;
   z->l = NIL;
   z->r = NIL;

   while (x != NIL) {
      y = x;
      if (z->key < x->key) x = x->l;
      else x = x->r;
   }
   z->p = y;
   if (y == NIL)
      root = z;
   else{
      if (z->key < y->key)
         y->l = z;
      else
         y->r = z;
   }
}

bool find(int k) {
   Node *x = root;

   while (x != NIL) {
      if (k < x->key)
         x = x->l;
      else if (x->key < k)
         x = x->r;
      else
         return(true);
   }
   return(false);
}

void inorder(Node *u) {
   if (u == NIL) return;

   inorder(u->l);
   printf(" %d", u->key);
   inorder(u->r);
}

void preorder(Node *u) {
   if (u == NIL) return;

   printf(" %d", u->key);
   preorder(u->l);
   preorder(u->r);
}

int main() {
   int  n, x;
   char s[10];

   cin >> n;
   rep(i, n) {
      scanf("%s", s);
      if (s[0] == 'i') {
         scanf("%d", &x);
         insert(x);
      }
      else if (s[0] == 'f') {
         scanf("%d", &x);
         cout << (find(x) ? "yes" : "no") << endl;
      }
      else{
         inorder(root);
         printf("\n");
         preorder(root);
         printf("\n");
      }
   }
   return(0);
}



Measured memory_bytes: 21968
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
#include<math.h>


int main(void){
    int N, K;
    scanf("%d %d", &N, &K);

    int temp, i;
    int distance = 0;
    for(i=0; i<N; i++) {
        scanf("%d", &temp);
        if(temp < (double)K / 2.0) {
            distance += temp;
        }
        else{
            distance += K - temp;
        }
    }
    printf("%d\n", distance * 2);
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<long long, long long> P;
typedef pair<P, P> L;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 998244353

int N;
int X[200], Y[200];
int p2[201];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  rep(i, N) cin >> X[i] >> Y[i];
  p2[0] = 1;
  for (int i=1; i<=200; i++) p2[i] = (2LL*p2[i-1]) % MOD;

  int s = N+1;
  rep(i, N) {
    rep(j, i) {
      int x1 = X[i], y1 = Y[i], x2 = X[j], y2 = Y[j];
      int a = y1-y2, b = -(x1-x2), c = -(a*x1 + b*y1);
      bool uniq = true;
      int n = 0;
      rep(k, N) {
        int x = X[k], y = Y[k];
        if (a*x+b*y+c != 0) continue;
        n++;
        // j(min) - k - i(max)
        if (k < j || k > i) {
          uniq = false;
          break;
        }
      }
      if (!uniq) continue;
      s += (p2[n]-n-1+MOD)%MOD;
      s %= MOD;
    }
  }
  cout << (p2[N]-s+MOD)%MOD << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = unsigned long long;
int main(int argc, char const *argv[]) {
  ll a,b,x;
  cin>>a>>b>>x;
  ll d=b/x-a/x;
  if(a%x==0)  d++;
  cout<<d<<endl;
  return 0;
}


Measured memory_bytes: 256
alp = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
N = int(input())
S = input()
r = ''

n = len(S)
for j in range(0, n):
    k = alp.index(S[j])
    x = (k + N) % 26
    r = r + alp[x]

print(r)

Measured memory_bytes: 3064
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()

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

for d in range(x + 2):
	for s in [-1, 1]:
		a = x + s * d
		if a not in p:
			print(a)
			exit()

Measured memory_bytes: 8952
fun main(arr: Array<String>) {
    val n = readLine()!!.toInt()
    val (d,x) = readLine()!!.split(" ").map { it.toInt() }
    val ans = (1..n).map { readLine()!!.toInt().let { d / it + Math.min(1, d%it) } }.sum() + x
    println(ans)
}

Measured memory_bytes: 37984
#include <iostream>
#include <vector>

std::pair<int, int> get_point(int i, int j, int d, int N)
{
    std::pair<int, int> p[] = {
        {i, N - j - 1},
        {N - i - 1, j},
        {N - i - 1, N - j - 1}
    };
    return p[d];
}

int main()
{
    int C, N;
    std::cin >> C >> N;
    
    int count = 0;
    std::vector<std::vector<int>> p(N, std::vector<int>(N));
    
    for (int i = 0; i < N; i++) {
        std::string in;
        std::cin >> in;
        for (int j = 0; j < N; j++) {
            p[i][j] = in[j] - '0';
            count += 6;
        }
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < 3; k++) {
                auto np = get_point(i, j, k, N);
                int ni = np.first, nj = np.second;
                if (p[i][j] == p[ni][nj]) {
                    count -= 2;
                }
            }
        }
    }

    int res = count == 0;
    for (int i = 0; i < C - 1; i++) {
        int D;
        std::cin >> D;
        for (int j = 0; j < D; j++) {
            int r, c;
            std::cin >> r >> c;
            r--; c--;
            p[r][c] = p[r][c] ^ 1;
            for (int k = 0; k < 3; k++) {
                auto np = get_point(r, c, k, N);
                int ni = np.first, nj = np.second;
                if (p[r][c] == p[ni][nj]) {
                    count -= 4;
                } else {
                    count += 4;
                }
            }            
        }

        if (count == 0) {
            res++;
        }
    }

    std::cout << res << std::endl;

    return 0;
}

Measured memory_bytes: 6800
#include<iostream>
#include<utility>
#include<algorithm>
#include<string>

using namespace std;

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

bool restaurant(pair<pair<string, int>, int> a, pair<pair<string, int>, int> b){
    if (a.first.first != b.first.first) {
        return a.first.first < b.first.first;
    }else{
        return a.first.second > b.first.second;
    }
}

int main(){
    int n;
    cin >> n;
    pair<pair<string, int>, int> p[n];
    rep(i, n) {
        cin >> p[i].first.first >> p[i].first.second;
        p[i].second = i + 1;
    }
    sort(p, p + n, restaurant);
    rep(i, n) cout << p[i].second << endl;

}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)

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

struct edge {
	int to,cost;
	edge(int t,int c):to(t),cost(c) {}
};

int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int ddx[]={1,1,1,0,-1,-1,-1,0},ddy[]={1,0,-1,-1,-1,0,1,1};

ll mypow(ll x,ll n,ll m) {	//xのn乗をmで割った余り
	if(n==0) return 1;
	if(n%2==0) return mypow(x*x%m,n/2,m);
	else return x*mypow(x,n-1,m)%m;
}

//-----------------------------------------------------------------------------

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

	int a,b,c; cin>>a>>b>>c;
	if(c>=a&&c<=b) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){
  if(b == 0)
    return a;
  else
    return gcd(b,a % b);
}
ll lcm(ll a,ll b){
  ll g = gcd(a,b);
  return a / g * b;
}
 
int main(void){
  int N;
  cin >> N;
  
  ll ans = 1LL;
  
  for(int i=0;i<N;i++){
    ll t;
    cin >> t;
    ans = lcm(ans,t);
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
	int A , B;
	scanf("%d", &A);
	scanf("%d", &B);
	int cnt = 0;
	cnt = (B - 1) / (A - 1);
	if ((B - 1) % (A - 1) > 0){
		cnt++;
	}
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 128
import numpy as np
N = int(input())
X = np.array(list(map(int, input().split())), dtype=int)
idx = np.argsort(X)
Xs = np.sort(X)
ans = [None for _ in range(N)]
for i in range(N // 2):
    ans[idx[i]] = Xs[N // 2]
for i in range(N // 2, N):
    ans[idx[i]] = Xs[N // 2 - 1]
for i in range(N):
    print(ans[i])

Measured memory_bytes: 34152
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
import math
num=[]
temp=[]
ans=float("inf")
for i in range(n):
    num.append(t-0.006*h[i])
for i in range(n):
    temp.append(abs(num[i]-a))
ans=min(temp)
for i in range(n):
    if ans==temp[i]:
        print(i+1)
        


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

int main(){
  string s;
  cin>>s;

  string tmpb,tmp;
  long long int ans=0,len=0;
  len=s.length();
  
  rep(i,0,len){
    tmp=s[i];
    if(i==0){tmpb=tmp;continue;}
    if(tmpb==tmp){
      ans++;
      if(tmpb=="0"){tmpb="1";}
      else{tmpb="0";}
      continue;
    }
    tmpb=tmp;
  }

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

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

int GCD(int a, int b) {
	if (a < b) swap(a, b);
	a = a % b; return (a == 0 ? b : GCD(a, b));
}

int main() {
	int a, b;
	while (cin >> a >> b) cout << GCD(a, b) << endl;
	return 0;
}


Measured memory_bytes: 3068
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
const int INF=1e9;

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

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  int N;
  cin>>N;
  vector<int>x(N),y(N),h(N);
  for(int i=0;i<N;i++)cin>>x[i]>>y[i]>>h[i];
  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      int H=1;
      bool ok=true;
      for(int k=0;k<N;k++){
        if(H==1&&h[k]>0)H=h[k]+abs(x[k]-i)+abs(y[k]-j);
      }
      for(int k=0;k<N;k++){
        if(max(H-abs(x[k]-i)-abs(y[k]-j),0)!=h[k])ok=false;
      }
      if(ok){
        cout<<i<<" "<<j<<" "<<H<<endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,j,count=0,N,tmp;
  int A[100];

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  
 
  for(i=0;i<N-1;i++){
    for(j=N-1;j>i;j--){
      if(A[j]<A[j-1]){
	tmp=A[j];
	A[j]=A[j-1];
	A[j-1]=tmp;
	count++;
      }
    }
  }
    
  for(i=0;i<N;i++){
    printf("%d",A[i]);
    if(i!=N-1)printf(" ");
  }
  printf("\n%d\n",count);

  return 0;
}

Measured memory_bytes: 604