akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

A,B=LI()
print('Yes' if A%2 and B%2 else 'No')


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */
const int INF = 1 << 30;
const int MAX = 500000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
struct Node {
    Node *parent, 
         *left, 
         *right;
    int key;
};

Node *root, *NIL;

/* function */
void insert(int value);
Node* find_bin_tree(int target);
void preorder(Node* v);
void inorder(Node* v);

/* main */
int main(){

    // main
    int n, val;
    cin >> n;
    string man;
    for (int i = 0; i < n; i++) {
        cin >> man;
        if (man == "print") {
            inorder(root); cout << '\n';
            preorder(root); cout << '\n';
        }
        else {
            cin >> val;
            if (man == "insert") {
                insert(val);
            }
            else {
                Node* ret_node = find_bin_tree(val);
                if (ret_node != NIL)
                    cout << "yes" << '\n';
                else
                    cout << "no" << '\n';
            }
        }
    }

}

Node* find_bin_tree(int target) {

    Node* x = root;
    while (x != NIL) {
        if (target == x->key) {
            return x;
        }
        else if (target < x->key) {
            x = x->left;
        }
        else {
            x = x->right;
        }
    }
    return x;
}

void insert(int value) {

    // init Node
    Node* z = new Node();
    z->parent = NIL;
    z->left = NIL;
    z-> right = NIL;

    Node* y = NIL;  // parent of x(root)
    Node* x = root; // root of 'T'

    while (x != NIL) {
        y = x; // set parent
        if (value < x->key) {
            x = x->left;
        }
        else {
            x = x->right;
        }
    }

    z->parent = y;
    z->key = value;

    if (y == NIL) {  // 'T' is empty
        root = z;
    }
    else if (value < y->key) {
        y->left = z;  // z is y's left
    }
    else if (value > y->key) {
        y->right = z;  // z is y's right
    }
}

void preorder(Node* v) {
    if (v != NIL) {
        cout << ' ' << v->key;
        preorder(v->left);
        preorder(v->right);
    }

}

void inorder(Node* v) {
    if (v != NIL) {
        inorder(v->left);
        cout << ' ' << v->key;
        inorder(v->right);
    }
}



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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<ll, int> ll_i;
struct edge { int v, w, h; };
const int INF = INT_MAX / 2;
const int MOD = 1e9 + 7;

int main() {
	string s; cin >> s;
	int N = s.length();
	s = "0" + s + "0";
	vector<bool> a(N + 1);
	rep(i, N + 1) a[i] = (s[i] != s[i + 1]);
	int mi = N;
	rep(i, N + 1) if (a[i]) mi = min(mi, max(i, N - i));
	cout << mi << endl;
}


Measured memory_bytes: 512
N = int(input())
h = list(map(int,input().split()))

dp = [0]*N
dp[0] = 0
dp[1] = abs(h[0]-h[1])

for i in range(2,N):
  a = dp[i-1] + abs(h[i]-h[i-1])
  b = dp[i-2] + abs(h[i]-h[i-2])
  dp[i] = min(a,b)
print(dp[N-1])

Measured memory_bytes: 13928
def abc127c():
    N, M = (int(s) for s in input().split(" "))
    max = 0
    min = N + 1
    for i in range(0, M):
        L, R = (int(s) for s in input().split(" "))
        if L > max:
            max = L
        if R < min:
            min = R
    a = min - max + 1
    answer = a if a >= 0 else 0
    print(answer)
abc127c()


Measured memory_bytes: 3316
import sys,bisect
input=sys.stdin.readline
n,h=map(int,input().split())
B=[]
Amax=0
for _ in range(n):
    a,b=map(int,input().split())
    Amax=max(a,Amax)
    B.append(b)
B.sort()
BB=B[bisect.bisect_left(B,Amax):]
cnt=0

while h>0:
    if BB:
        b=BB.pop()
        h-=b
        cnt+=1
    else:
        if h%Amax==0:
            cnt+=h//Amax
        else:
            cnt+=(h//Amax)+1
        h=0

print(cnt)

Measured memory_bytes: 7888
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
def gcd( x, y ):
    while y != 0:
        x, y = y, x%y
    return x

def coprime(a, b):
    return gcd(a, b) == 1

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

    # divisors.sort()
    return divisors
A , B = map(int , input().split())
#A = 100000000000
#B = 50000000000
#print(make_divisors(A))

gcd_value = gcd(A , B)
cd = []
div = make_divisors(gcd_value)

for i in range(len(div)):
    if A % div[i] == 0 and B % div[i] == 0 and is_prime(div[i]):
        cd.append(div[i])
print(len(cd) + 1)

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

class Program
{
    public static void Main()
    {
        while(true)
        {
            int[] d = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if(d[0] == 0 && d[1] == 0)break;
            
            for(int i = 0; i < d[0];i++)
            {
                for(int j = 0; j < d[1];j++)
                {
                    if(i == 0 || i == d[0] - 1 || j == 0 || j == d[1] - 1)
                    {
                        Console.Write("#");
                    }else
                    {
                        Console.Write(".");
                    }
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 18408
#include<bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int a,  b;
    cin >> a >> b;
    int ans =0;
    for(int i = a; i <= b; i++) {
        int s1, s2, s3, s4, s5;
        s1 = i % 10;
        s2 = i  / 10 % 10 ;
        s3 =  i/ 10 / 10 % 10;
        s4 =  i/ 10 / 10 / 10 % 10;
        s5 =  i/ 10 / 10 / 10 / 10 % 10;
        if(s1 == s5 && s2 == s4) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
import heapq

q = int(input())
ans = []
mini = 0
left, right = [], []
cnt = 0
mid = None
for _ in range(q):
    qi = input()
    if qi == '2':
        if cnt%2 == 0:
            ans.append([-left[0], mini])
        else:
            ans.append([mid, mini])
    else:
        kind, a, b = map(int, qi.split())
        if cnt%2 == 1:
            mini += abs(mid-a) + b
            heapq.heappush(left, -min(mid, a))
            heapq.heappush(right, max(mid, a))
            mid = None
        else:
            if cnt == 0:
                mid = a
                mini = b
                cnt += 1
                continue
            l = -heapq.heappop(left)
            r = heapq.heappop(right)
            if a <= l:
                mini += l-a + b
                heapq.heappush(left, -a)
                heapq.heappush(right, r)
                mid = l
            elif a <= r:
                mini += b
                heapq.heappush(left, -l)
                heapq.heappush(right, r)
                mid = a
            else:
                mini += a-r + b
                heapq.heappush(left, -l)
                heapq.heappush(right, a)
                mid = r
        cnt += 1

for i, j in ans:
    print(i, j)

Measured memory_bytes: 28576
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <iomanip>

#include<stdio.h>
#include<math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

using namespace std;

int main(){

  int x[10000]={0};
  int y[10000]={0};
  double d1=0,d2=0,d3=0,d4=0;
  int n=0;
  int i;

  cin >>n;

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

  //p=1
  for(i=0;i<n;i++){
    d1+=fabs(x[i]-y[i]);
  }
  cout <<fixed <<d1 <<endl;

  //p=2
  for(i=0;i<n;i++){
    d2+=fabs(x[i]-y[i])*fabs(x[i]-y[i]);
  }
  d2=sqrt(d2);
  cout <<fixed <<d2 <<endl;

  //p=3
  for(i=0;i<n;i++){
    d3+=fabs(x[i]-y[i])*fabs(x[i]-y[i])*fabs(x[i]-y[i]);
  }
  d3=pow(d3,1.0/3.0);
  cout <<fixed <<d3 <<endl;

  //p=???
  for(i=0;i<n;i++){
    if(fabs(x[i]-y[i])>d4) d4=fabs(x[i]-y[i]);
  }
  cout <<fixed <<d4 <<endl;


  return 0;
}

Measured memory_bytes: 1360
def main():
    N = int(input())
    A = list(map(int,input().split()))

    count = -1
    flag = True
    while flag:
        count = count +1
        for i in A:
            if i%2!=0:
                flag = False
        if flag: A = [i/2 for i in A]
    print(str(count))

main()

Measured memory_bytes: 3060
d = {"1": [".", ",", "!", "?", " "], "2": ["a", "b", "c"], "3": ["d", "e", "f"],
     "4": ["g", "h", "i"], "5": ["j", "k", "l"], "6": ["m", "n", "o"],
     "7": ["p", "q", "r", "s"], "8": ["t", "u", "v"], "9": ["w", "x", "y", "z"]}

n = int(input())
m = [input() for _ in range(n)]
for line in m:
    ans = []
    for cs in line.split("0"):
        if cs == "":
            continue
        index = len(cs) % len(d[cs[0]]) - 1
        ans.append(d[cs[0]][index])
    print("".join(ans))

Measured memory_bytes: 7728
#include <cstdio>
using namespace std;
const int N = 2e5 + 1;

int n, k, a[N];

int main(){
	scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; i++) scanf("%d", a + i);
	for(int i = k + 1; i <= n; i++)
		puts(a[i] > a[i - k] ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 2404
def main():
    n=int(input())
    a = list(map(int,input().split()))
    sp=0
    sm=0
    cntp=0
    cntm=0
    for i in range(n):
        sp+=a[i]
        sm+=a[i]
        if abs(sp)>=1 and sp//(abs(sp))==(-1)**i:
            sp+=0
        else:
            cntp+=abs(sp)+1
            sp=(-1)**i
        if abs(sm)>=1 and sm//(abs(sm))==(-1)**(i+1):
            sm+=0
        else:
            cntm+=abs(sm)+1
            sm=(-1)**(i+1)
    print(min(cntp,cntm))
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 63216
fun main(args: Array<String>) {
    var (A, B, C, D) = readLine()!!.split(" ").map { it.toInt() }
    when {
        A + B > C + D -> println("Left")
        A + B == C + D -> println("Balanced")
        A + B < C + D -> println("Right")
    }
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;

int main() {
    i32 n, k;
    cin >> n >> k;
    
    i32 m = n-1;
    i32 l = (n-1) * (n-2) / 2;
    if (k > l) {
        cout << -1 << endl;
        return 0;
    }

    vector<vector<i32>> g(n);
    for (i32 i = 1; i < n; i++) {
        g[0].push_back(i);
    }

    for (i32 i = 1; i < n; i++) {
        for (i32 j = i+1; j < n; j++) {
            if (l == k) break;
            g[i].push_back(j);
            m++, l--;
        }
    }

    cout << m << endl;
    for (i32 i = 0; i < n; i++) {
        for (auto& e : g[i]) {
            cout << i+1 << " " << e+1 << endl;
        }
    }
}


Measured memory_bytes: 384
#ifndef LOCAL
#pragma GCC optimize ("O3")
#endif
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define mor > muu & operator << (
#define R22(r) sim > typename \
  enable_if<1 r sizeof dud<c>(0), muu&>::type operator<<(c g) {
sim > struct rge { c b, e; };
sim > rge<c> range(c h, c n) { return {h, n}; }
sim > auto dud(c* r) -> decltype(cerr << *r);
sim > char dud(...);
struct muu {
#ifdef LOCAL
stringstream a;
~muu() { cerr << a.str() << endl; }
R22(<) a << boolalpha << g; ris; }
R22(==) ris << range(begin(g), end(g)); }
sim, class b mor pair < b, c > r) { ris << "(" << r.first << ", " << r.second << ")"; }
sim mor rge<c> u) {
  a << "[";
  for (c i = u.b; i != u.e; ++i)
    *this << ", " + 2 * (i == u.b) << *i;
  ris << "]";
}
#else
sim mor const c&) { ris; }
#endif
muu & operator()() { ris; }
};
#define imie(r...) "[" #r ": " << (r) << "] "
#define imask(r...) "[" #r ": " << bitset<8 * sizeof(r)>(r) << "] "
#define arr(a, i) "[" #a imie(i) ": " << a[i] << "] "
#define arr2(a, i, j) "[" #a imie(i) imie(j) ": " << a[i][j] << "] "
#define debug (muu() << __FUNCTION__ << "#" << __LINE__ << ": ")

using ld = long double;

const int N = 3e3 + 7;
int n;
ld rozk[N];
ld pom[N];

int main() {
    cin >> n;
    rozk[0] = 1.;
    for (int i = 1; i <= n; ++i) {
        ld p;
        cin >> p;
        
        for (int j = 0; j < i; ++j) {
            pom[j + 1] += p * rozk[j];
            pom[j] += (1.0 - p) * rozk[j];
        }
        
        for (int j = 0; j <= i; ++j) {
            rozk[j] = pom[j];
            pom[j] = 0.;
        }
    }
    
    ld wyn = 0.;
    for (int i = 0; i <= n; ++i) {
        if (i > n - i) wyn += rozk[i];
    }
    cout.precision(15);
    cout << fixed << wyn << endl;
    return 0;
}


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

int main()
{
    char cnum[10];
    string ss;
    int num[10][10];
    while(cin >> ss)
    {
        //cin >>cnum[0]>>cnum[1]>>cnum[2]>>cnum[3]>>cnum[4]>>cnum[5]>>cnum[6]>>cnum[7]>>cnum[8]>>cnum[9];
        if(cin.eof())break;
        for(int i=0;i<10;i++)
        {
            num[0][i] = (int)ss[i] - (int)'0';
        }
        for(int i=1;i<10;i++)//ツ行
        {
            for(int j=0;j<10-i;j++)
            {
                num[i][j] = (num[i-1][j]+num[i-1][j+1])%10;
            }
        }
        cout << num[9][0] << endl;
    }
    return 0;
}

Measured memory_bytes: 0
S = input()
acgt = ['A', 'C', 'G', 'T']
ans = 0
for i in range(len(S)):
    for j in range(i + 1, len(S) + 1):
        for s in S[i : j]:
            if s not in acgt:
                break
        else:
            ans = max(ans, len(S[i : j]))
            
print(ans)

Measured memory_bytes: 3060
using System;

namespace _0028
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] X = new int[100];
            int[] output = new int[100];
            int most=0;
            while (true)
            {
                string input = Console.ReadLine();
                if (input == null)
                {
                    break;
                }
                else
                {
                    X[(int.Parse(input) - 1)]++;
                }
            }
            for(int i=0;i<100;i++)
            {
                output[i] = X[i];
            }
            Array.Sort(X);
            most = X[99];
            for (int i = 0; i < 100; i++)
            {
                if(output[i]==most)
                {
                    Console.WriteLine(i + 1);
                }
            }
        }
    }
}

Measured memory_bytes: 9176
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <regex>
#include <set>
#include <cmath>
#include <sstream>
#include <numeric>
#include <set>

using namespace std;

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

    int count = 0;

    for(int i =0, j =s.size() -1; i < s.size() / 2; i++, j--)
    {
        if(s[i] != s[j])
        {
            count++;
        }
    }
    
    std::cout << count;

    return EXIT_SUCCESS;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    EACH(x,vec) is >> x;
    return is;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
    return os << p.first << " " << p.second;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    REP(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    REP(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

vector<vector<ll>> G;
vector<bool> used;
vector<ll> order;
ll next_order = 0;
vector<P> ans;

void add_ans(ll a, ll b) {
    if (a > b) swap(a, b);
    ans.pb({a, b});
}
ll dfs(ll v, ll prev) {
    ll res = order[v] = next_order++;
    EACH(to, G[v]) {
        if (to == prev) continue;
        if (order[to] >= 0) {
            res = min(res, order[to]);
        }
        else {
            ll low = dfs(to, v);
            if (low > order[v]) add_ans(v, to);
            res = min(res, low);
        }
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, m; cin >> n >> m;
    vector<ll> g(n);
    G.resize(n);
    REP(i, m) {
        ll a, b; cin >> a >> b;
        G[a].pb(b);
        G[b].pb(a);
    }
    order.assign(n, -1);
    dfs(0, -1);
    sort(ALL(ans));
    EACH(p, ans) {
        cout << p << endl;
    }
}

Measured memory_bytes: 5588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  
  int n,m;
  cin >>n>>m;
  pair<ll, ll> p[n];
  ll a[n],b[n];
  for(int i=0; i<n; i++) cin >>a[i]>>b[i];
  for(int i=0; i<n; i++){
  	p[i].first=a[i];
    p[i].second=b[i];
  }
  sort(p,p+n);
  
  int i=0;
  ll sum=0;
  while(m){
  	if(m>=p[i].second){ m-=p[i].second; sum+=p[i].first*p[i].second;}
    else {sum+=m*p[i].first; m=0;} 
    i++;
  }
  
  
  cout << sum << endl;

}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
int n;
vector<ll> v(200100);
int main(){
    cin >> n;
    ll s=0;
    for(int i=0; i<n; i++){
        cin >> v[i];
        s = s^v[i];
    }
    for(int i=0; i<n; i++){
        cout << (s^v[i]) << " ";
    }
    cout << "\n";
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int a, b;
  cin >> a >> b;
  int n;
  cin >> n;
  int s[1001] = {};
  int m[10001], h[10001];
  rep(i, 0, n) cin >> m[i] >> h[i];
  rep(i, 0, n) {
    rep(j, 0, h[i] - m[i]) {
      s[j + m[i]] = 1;
    }
  }
  rep(i, a, b) {
    if(s[i]) {
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
}



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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>s1;

	s1[0]='2';
	s1[1]='0';
	s1[2]='1';
	s1[3]='8';

	cout<<s1<<endl;

}


Measured memory_bytes: 256
li = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K = int(input())

print(li[K-1])


Measured memory_bytes: 2940
/*
sonu_verma1
*/
#include <bits/stdc++.h>
// For policy based data structure
/*#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> */
using namespace std;
/*using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set;*/
 
#define MD 1000000007
#define X first
#define Y second
#define pb push_back
#define debug(val, ch) cout <<val <<ch
#define FOR(i, st, en, ch) for(register int i = (st); i <= (en) ; i += (ch))
#define RFOR(i, st, en, ch) for(register int i = (st); i >= (en) ; i -= (ch))
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
 
typedef long long int ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<int, bool> pib;
typedef pair<bool, int> pbi;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
/*********************************************************************/
void test(int r)
{
    string s,t;
    cin>>s>>t;
    int n=s.size(),m=t.size();
    vector<vector<int>>dp(n+1,vector<int>(m+1,0));
    int i,j;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=m;j++)
        {
            if(s[i-1]==t[j-1])
            {
                dp[i][j]=dp[i-1][j-1]+1;
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    string ans;
    int mx=dp[n][m];
    i=n;j=m;
    while(i>0&&j>0&&dp[i][j]>0)
    {
        if(dp[i-1][j]==dp[i][j])
            i--;
        else if(dp[i][j-1]==dp[i][j])
            j--;
        else
        {
            ans.push_back(s[i-1]);
            if(dp[i-1][j]>dp[i][j-1])
                i--;
            else
                j--;
        }
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
    

}
/***********************************************************************/
int main()
{
    fast();
    int t=1,r;
    // cin>>t;
    for(r=1;r<=t;r++)
        test(r);
    return 0;
}

Measured memory_bytes: 38512
#include <stdio.h>
 
#define MAX 25
 
typedef struct{
  int l,r,par;
} node;
 
node N[MAX];
 
void init(int);
void Preorder(int);
void Inorder(int);
void Postorder(int);
 
int main(){
  int n,i,id,l,r;
  int p;
   
  scanf("%d" ,&n); 
  init(n);  
 
  for(i = 0 ; i < n ; i++){
    scanf("%d%d%d" ,&id ,&l ,&r);
 
    if(l != -1){
      N[id].l = l;
      N[l].par = id;
    }
    if(r != -1){
      N[id].r = r;
      N[r].par = id;
    }
  }
 
  for(i = 0 ; i < n ; i++){
    if(N[i].par == -1){
      p = i;
      break;
    }
  }
  
  puts("Preorder");
  Preorder(p);
  puts("");
 
  puts("Inorder");
  Inorder(p);
  puts("");
 
  puts("Postorder");
  Postorder(p);
  puts("");
 
  return 0;
}
 
void init(int n){
  int i;
 
  for(i = 0 ; i < n ; i++){
    N[i].par = N[i].l = N[i].r = -1;
  }
}
 
void Preorder(int p){
  if(p != -1){
    printf(" %d" ,p);
    Preorder(N[p].l);
    Preorder(N[p].r);
  }
}
 
void Inorder(int p){
  if(p != -1){
    Inorder(N[p].l);
    printf(" %d" ,p);
    Inorder(N[p].r);
  }
}
 
void Postorder(int p){
  if(p != -1){
    Postorder(N[p].l);
    Postorder(N[p].r);
    printf(" %d" ,p);
  }
}


Measured memory_bytes: 1964
package main

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

func solve() {
	s := scanString()
	w := scanInt()
	for i, c := range s {
		if i%w == 0 {
			fmt.Printf("%c", c)
		}
	}
	fmt.Println()
	return
}

var sc = bufio.NewScanner(os.Stdin)

func scanString() string {
	sc.Scan()
	return sc.Text()
}
func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanString(), 64)
	return f
}
func Permute(nums []int) [][]int {
	n := factorial(len(nums))
	ret := make([][]int, 0, n)
	permute(nums, &ret)
	return ret
}
func permute(nums []int, ret *[][]int) {
	*ret = append(*ret, makeCopy(nums))

	n := len(nums)
	var i, j int
	for {
		for i = n - 2; i >= 0; i-- {
			if nums[i] < nums[i+1] {
				break
			}
		}
		if i < 0 {
			return
		}
		for j = n - 1; ; j-- {
			if nums[j] > nums[i] {
				break
			}
		}
		nums[i], nums[j] = nums[j], nums[i]
		for k, l := i+1, n-1; k < l; {
			nums[k], nums[l] = nums[l], nums[k]
			k++
			l--
		}
		*ret = append(*ret, makeCopy(nums))
	}
}

func factorial(n int) int {
	ret := 1
	for i := 2; i <= n; i++ {
		ret *= i
	}
	return ret
}

func pow(n, m int) int {
	ret := 1
	for i := 0; i < m; i++ {
		ret *= n
	}
	return ret
}

func makeCopy(nums []int) []int {
	return append([]int{}, nums...)
}
func gcd(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func eratosthenes(n int) []int {
	search := make([]bool, n+1)
	ans := []int{}
	for i := 2; i < n+1; i++ {
		search[i] = true
	}
	for i := 2; i*i < n+1; i++ {
		for j := 2; i*j < n+1; j++ {
			search[i*j] = false
		}
	}
	for i := 2; i < n; i++ {
		if search[i] {
			ans = append(ans, i)
		}
	}
	return ans
}

func main() {
	sc.Split(bufio.ScanWords)
	solve()
}


Measured memory_bytes: 640
#include <iostream>
#include<string.h>
using namespace std;
int main()
{
	char str1[100],str2[100],str3[100];
	int count;
	cin>>str1>>str2;
	int m=strlen(str1);
	for(int i=0;i<m;i++)
	{
		str3[i]=str1[i];
	}
	for(int i=0;i<m;i++)
	{
		count=0;
		for(int j=1;j<m;j++)
		{
			str1[j]=str3[j-1];	
		}
		str1[0]=str3[m-1];
		for(int i=0;i<m;i++)
		{
			str3[i]=str1[i];
		}
		for(int i=0;i<m;i++)
		{
			if(str1[i]==str2[i])
			{
				count++;
			}
		}
		if(count==m)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

void dfs(vector<vector<int>>& g, vector<int>& color, int pre) {
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t; cin >> s >> t;
    int n = s.length();
    int ans = 0;
    for(int i = 0; i < n; ++ i) {
        if(s[i]!=t[i]) ++ ans;
        //ans += (s[i]!=t[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3768
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars, // トークンを Vec<char> として読む
        t: Chars
    }

    let ans = {
        let mut ans = 0;
        for i in 0..s.len() {
            if s[i] != t[i] {
                ans += 1;
            }
        }
        ans
    };

    println!("{}",ans)
}


Measured memory_bytes: 4008
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAbcOfABC solver = new AAbcOfABC();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAbcOfABC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char[] s = in.next().toCharArray();
            Arrays.sort(s);
            boolean answer = String.valueOf(s).equals("abc");

            out.println(answer ? "Yes" : "No");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>


typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

int gcd(int a, int b) {
	int c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

map<string, int> memo;

using P=pair<int, int>;

struct Clock {
	int hour, minute, second;
	void set(int h, int m, int s) {
		hour = h; minute = m; second = s;
	}
	string to_str() {
		string h, m, s;
		h = to_string(hour);
		m= to_string(minute);
		s= to_string(second);
		if (h.size() < 2) h = "0" + h;
		if (m.size() < 2) m = "0" + m;
		if (s.size() < 2) s = "0" + s;
		return h + ":" + m + ":" + s;
	}
	void shift(int diff_second) {
		int h, m;
		h = diff_second / 3600;
		m = diff_second / 60;
		diff_second %= 60;
		second += diff_second;
		
	}
};
int main() {
	//sort(a.begin(),a.end());
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) cout << "Yes";
	else cout << "No";

	return 0;
}









Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <stack>

using std::vector;
using std::printf;
using std::cout;
using std::endl;
using std::string;
using std::cin;
using std::pair;
using std::sort;

#define i64t long long int
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

template<typename T>
void dump(vector<T> vec) {
    for (auto x : vec) {
        std::cout << x << " ";
    }
    std::cout << std::endl;
}

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

const i64t MOD = 1000000007;

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

    int tmp;
    vector< vector<int> > shops(N, vector<int>(10, 0));
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 10; ++j) {
            cin >> tmp;
            shops[i][j] = tmp;
        }
    }

    vector< vector<int> > profits(N, vector<int>(11, 0));
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j <= 10; ++j) {
            cin >> tmp;
            profits[i][j] = tmp;
        }
    }

    vector<int> earn(1024, 0);
    int cnt, tmp_earn;
    for (int guhehe = 1; guhehe <= 1023; ++guhehe) {
        int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
        i0 = (guhehe & (1 << 0)) >> 0;
        i1 = (guhehe & (1 << 1)) >> 1;
        i2 = (guhehe & (1 << 2)) >> 2;
        i3 = (guhehe & (1 << 3)) >> 3;
        i4 = (guhehe & (1 << 4)) >> 4;
        i5 = (guhehe & (1 << 5)) >> 5;
        i6 = (guhehe & (1 << 6)) >> 6;
        i7 = (guhehe & (1 << 7)) >> 7;
        i8 = (guhehe & (1 << 8)) >> 8;
        i9 = (guhehe & (1 << 9)) >> 9;

        // printf("%d %d %d %d %d %d %d %d %d %d\n", i0, i1, i2, i3, i4,
        //                                           i5, i6, i7, i8, i9);

        tmp_earn = 0;
        for (int n = 0; n < N; ++n) {
            cnt = 0;
            cnt += i0 * shops[n][0];
            cnt += i1 * shops[n][1];
            cnt += i2 * shops[n][2];
            cnt += i3 * shops[n][3];
            cnt += i4 * shops[n][4];
            cnt += i5 * shops[n][5];
            cnt += i6 * shops[n][6];
            cnt += i7 * shops[n][7];
            cnt += i8 * shops[n][8];
            cnt += i9 * shops[n][9];
            tmp_earn += profits[n][cnt];
        }
        earn[guhehe] = tmp_earn;
    }

    int earn_max = earn[1];
    for (int i = 2; i < 1024; ++i) {
        if (earn_max < earn[i]) {
            earn_max = earn[i];
        } 
    }

    // dump<int>(earn);

    printf("%d\n", earn_max);
    
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
typedef long long ll;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string S;
  deque<char> q;
  cin >> S;
  for (int i=0; i<S.size(); i++) {
    q.push_back(S[i]);
  }
  int Q, T, F;
  char C;
  cin >> Q;
  int dir = 0;
  for (int query=0; query<Q; query++) {
    cin >> T;
    if (T == 1) {
      dir = 1 - dir;
      continue;
    }
    cin >> F >> C;
    F--;
    if ((dir ^ F) == 0) q.push_front(C);
    else q.push_back(C);
  }
  if (dir == 0) {
    while(!q.empty()) {
      char c = q.front();
      cout << c;
      q.pop_front();
    }
  } else {
    while(!q.empty()) {
      char c = q.back();
      cout << c;
      q.pop_back();
    }
  }
  cout << endl;
}

Measured memory_bytes: 976
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MX = 1e10 + 10;;
unsigned long long fac[200001];

#include <math.h>
#define PI 3.14159265358979323846264338327950L

long long gcd(long long a, long long b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
long long lcm(long long a, long long b) {
    return (a * b) / gcd(a, b);
}
long long digits(long long m) {
    long long cnt = 0;
    while (m) {
        cnt++;
        m /= 10;
    }
    return cnt;
}

unsigned long long power(unsigned long long x, unsigned long long y){
    unsigned long long res = 1;
    x = x % MOD;

    while (y > 0) {
        // If y is odd, multiply x with result 
        if (y & 1)
            res = (res * x) % MOD;

        // y must be even now 
        y = y >> 1; // y = y/2 
        x = (x * x) % MOD;
    }
    return res;
}
unsigned long long modInverse(unsigned long long n) {
    return power(n, MOD - 2);
}

long long nCr(long long n, long long r) {
    if (r > n) return 0;
    return (fac[n] * modInverse(fac[r]) % MOD * modInverse(fac[n - r]) % MOD) % MOD;
}

long long bfs(vector<int> g, queue<int> q) {
    return 1ll;
}

int main() {

    string s;
    cin >> s;
    bool ok = true;
    for (int i = 0; i < 3; i++) {
        if (s[i] == s[i + 1]) ok = false;
    }
    if (ok) cout << "Good";
    else cout << "Bad";
    
    return 0;
}

Measured memory_bytes: 3632
"""
N=int(input())

print(800*N-int(N/15)*200)
"""
"""
N=int(input())
S=input()

max_n=0
temp=0
for strng in S:
	if strng=="I":
		temp+=1
		if max_n<temp:
			max_n=temp
	else:
		temp-=1
print(max_n)
"""
"""
N=int(input())

Q=1000000007
p=1
for i in range(1,N+1):
	p*=i
	p=p%Q
print(p%Q)
"""


n=int(input())
S=[input() for i in range(n)]
alphabet_dict={chr(97+i):100 for i in range(26)}
for s in S:
	temp={chr(97+i):0 for i in range(26)}
	for i in s:
		temp[i]+=1

	for key in alphabet_dict.keys():
		if alphabet_dict[key]>temp[key]:
			alphabet_dict[key]=temp[key]
result=""
alphabet=[chr(97+i) for i in range(26)]
for item in alphabet:
	for i in range(alphabet_dict[item]):
		result+=item
if result=="":
	print("\n")
else:
	print(result)

"""
(N,M) = [int(i)for i in input().split()]

if N>int(M/2):
	print(int(M/2))
else:
	hoge=int(M/2)-N
	print(N+int(hoge/2))
"""
"""
(N,A,B) = [int(i)for i in input().split()]
X=[int(i) for i in input().split()]

hirou=0
for i in range(N-1):
	length=X[i+1]-X[i]
	if length*A <= B:
		hirou+=length*A
	else:
		hirou+=B
print(hirou)

"""

"""
(n,m) = [int(i)for i in input().split()]
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]

def func(left_idx,right_idx,under_idx,upper_idx):
	menseki=(x[right_idx]-x[left_idx])*(y[upper_idx]-y[under_idx]) % 1000000007
	x_len=right_idx - left_idx
	y_len=upper_idx - under_idx
	ret=menseki * (x_len-2) * (y_len-2)
	
	for i in range(left_idx,right_idx):
		for j in range(under_idx,upper_idx):
			ret= (ret+func(left_idx,i,under_idx,j)+func(i,right_idx,under_idx,j)+func(left_idx,i,j,upper_idx)+func(right_idx,i,under_idx,j)) % 1000000007
	return ret
menseki=(x[n-1]-x[0])*(y[m-1]-y[0]) % 1000000007
#区切り方 (n-2)*(m-2)
print(menseki)
result = menseki*(n-2) % 1000000007
result *= (m-2)
result %= 1000000007


print(func(0,n-1,0,m-1))
"""

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
string s;
int q;


int SegTree[1<<20];
void init()
{
   for(int i = 0;i<n;i++)
   {
      int j = i+(1<<19);
      SegTree[j] = 1<<(s[i]-'a');
      while(j)
      {
         SegTree[j/2] |= SegTree[j];
         j/=2;
      }
   }
}

void update(int i,char c)
{
   i += 1<<19;
   SegTree[i] = 1<<(c-'a');
   while(i/=2)
   {
      SegTree[i] = SegTree[i*2]|SegTree[i*2+1];
   }
}

int get(int i,int j)
{
   i += 1<<19;
   j += 1<<19;
   j++;
   int res = 0;
   while(1)
   {
      if(i%2)
      {
         res |= SegTree[i];
         i++;
      }
      if(j%2)
      {
         res |= SegTree[j-1];
         j--;
      }
      if(i==j)break;
      i/=2;
      j/=2;
      
   }
   //cout<<bitset<10>(res)<<endl;
   int a = 0;
   while(res)
   {
      if(res%2)
      {
         a++;
      }
      res /= 2;
   }
   return a;
}

int main()
{
	cin >> n >> s >> q;
   init();
   while(q--)
   {
      int op;
      cin >> op;
      if(op==1)
      {
         int i;char c;
         cin >> i >> c;
         update(i-1,c);
      }
      else
      {
         int i,j;
         cin >> i >> j;
         cout<<get(i-1,j-1)<<endl;
      }
   }

}

Measured memory_bytes: 4996
#include <bits/stdc++.h>
using namespace std;
int st = -1;
int e = -1;
int main (){
  string s;
  cin >> s;
  
  for (int i; i<s.size(); i++){
    if (st < 0 and s.at(i) == 'A') st = i;
    
    if (s.at(i) == 'Z') e = i;
  }
  cout << e-st+1 << endl;
}

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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = (1LL<<31)-1;
const int mod = 1e9 + 7;

struct SegmentTree {
  vector<int> data;
  int sz;
  SegmentTree(int n) {
    sz = 1; while(sz < n) sz <<= 1;
    data.resize(2*sz-1, inf);
  }
  void update(int k, int x) {
    k += sz-1;
    data[k] = x;
    while(k > 0) {
      k = (k-1) / 2;
      data[k] = min(data[2*k+1], data[2*k+2]);
    }
  }
  int query(int a, int b, int k, int l, int r) {
    if(r <= a || b <= l) return inf;
    if(a <= l && r <= b) return data[k];
    return min(query(a, b, 2*k+1, l, (l+r)/2),
	       query(a, b, 2*k+2, (l+r)/2, r));
  }
  int query(int a, int b) {
    return query(a, b, 0, 0, sz);
  }
};

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, q;
  cin >> n >> q;
  SegmentTree seg(n);
  rep(i, q) {
    int com, x, y;
    cin >> com >> x >> y;
    if(com == 0) seg.update(x, y);
    else cout << seg.query(x, y+1) << endl;
  }

  return 0;
}

Measured memory_bytes: 4852
/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/

import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int sum = 0;
		sum = n + (n * n)+ (n * n * n);
		System.out.println(sum);
	}
}


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

int main() {
	int n, k;
	cin >> n >> k;
	int h[100010];
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	sort(h, h + n);
	int ans = 1e9;
	for (int i = 0; i < n - k + 1; i++) {
		ans = min(abs(h[i] - h[i + k - 1]), ans);
	}
	cout << ans << endl;
	return 0;
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(c) (c).begin(), (c).end()

template <class Func>
struct Fix {
    Func f;
    template <class... Args>
    decltype(auto) operator()(Args&&... args) const {
        return f(*this, forward<Args>(args)...);
    }
};
template <class Func>
Fix<std::decay_t<Func>> fix(Func&& f) {
    return {forward<Func>(f)};
}

using Graph = vector<vector<int>>;

int main() {
    int N, M; cin >> N >> M;
    Graph G(N);
    REP(i, M) {
        int x, y; cin >> x >> y; --x; --y;
        G[x].emplace_back(y);
    }

    // dp[v]: vから始まる有向パスの長さの最大値
    vector dp(N, int());
    vector visited(N, false);

    auto dfs = fix([&](auto&& self, int v) -> void {
        if (visited[v]) return;
        visited[v] = true;

        for(int child : G[v]) {
            self(child);
            dp[v] = max(dp[v], dp[child] + 1);
        }
    });
    REP(v, N) dfs(v);

    int ans = 0;
    REP(v, N) ans = max(ans, dp[v]);
    cout << ans << '\n';
}


Measured memory_bytes: 11960
from string import ascii_lowercase

s = input()
K = int(input())

sub_set = set()
append_cnt = 0

for top_c in ascii_lowercase:
    for idx, c in enumerate(s):
        if c == top_c:
            for i in range(1, 6):
                sub_set.add(s[idx:idx+i])
    if len(sub_set) >= K:
        break

print(sorted(sub_set)[K-1])

Measured memory_bytes: 3772
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<deque>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvi;

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define REP(i, n)  for(int i=0; i<(int)(n); i++)
#define REPS(i, n)  for(int i=1; i<=(int)(n); i++)
#define PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n); i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1e9;
const long long LLINF = 1e18;
const int MOD = 1000000007;
const int MSIZE = 100000;
const double Pi = 3.14159265358979323146;

int main(){
  int n, k; cin >> n >> k;
  vector<int> vec(n, 0);
  REP(i, k){
    int d;  cin >> d;
    REP(j, d){
      int a;  cin >> a;
      a--;
      vec[a]++;
    }
  }
  int ans = 0;
  REP(i, n){
    if(vec[i]==0) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<ll,ll>;
using um = unordered_map<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    char C;
    cin>>C;
    if(C>='a'&&C<='z')prt('a');
    else prt('A');

    return 0;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<c-d+b<<" "<<d+c-a<<" "<<a-d+b<<" "<<b+c-a<<endl;
	return 0; 
}

Measured memory_bytes: 256