akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}
const int N=2e5+5;
pii a[N];
vector<int> dp[N];
int32_t main(){
    vector<int> zs;
    int nn,T,n=0;
    cin>>nn>>T;
    forn(i,nn){
        int x,y;
        cin>>x>>y;
        if(x)a[n++]={x,y};
        else zs.pb(y);
    }
    sort(a,a+n,[](const pii&p1,const pii&p2){
        return p2.f*(p1.s+1)<p1.f*(p2.s+1);
    });
    sort(zs.begin(), zs.end());
    dp[0]={0};
    forn(i,n){
        dp[i+1]=dp[i];
        dp[i+1].pb(T+1);
        forn(j,sz(dp[i])){
            upn(dp[i+1][j+1],dp[i][j]+1+a[i].f*(dp[i][j]+1)+a[i].s);
        }
        if(dp[i+1].back()>T)dp[i+1].pop_back();
    }
    int ans=0;
    forn(j,sz(dp[n])){
        if(dp[n][j]<=T){
            int r=dp[n][j],pot=j;
            for(int i:zs){
                if(r+i+1<=T){
                    r+=i+1;
                    pot++;
                }else{
                    break;
                }
            }
            upx(ans,pot);
        }
    }
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 105000
package main

import "os"
import "fmt"
import "bufio"
import "strconv"

func main() {
    var sc = bufio.NewScanner(os.Stdin)
    sc.Split(bufio.ScanWords)
    sc.Scan()
    n, _ := strconv.Atoi(sc.Text())
    a := []int{}
    for i := 0; i < n; i++ {
        sc.Scan()
        num, _ := strconv.Atoi(sc.Text())
        a = append(a, num)
    }

    a = sort(a)
    min := a[0]
    max := a[len(a) - 1]

    fmt.Printf("%d\n", max - min)
}

func sort(a []int) []int {
    for i := 0; i < len(a); i++ {
        for j := i + 1; j < len(a); j++ {
            if a[i] > a[j] {
                tmp := a[i]
                a[i] = a[j]
                a[j] = tmp
            }
        }
    }
    return a
}


Measured memory_bytes: 640
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define ll long long
#define INF 100000

// flip pair
template <typename A, typename B>
pair<B, A> flip_pair(pair<A, B> src) {
	return pair<B, A> (src.second, src.first);
}

// flip map
template <typename A, typename B>
multimap<B, A> flip_map(map<A, B> src) {
	multimap<B, A> dst;
	for(auto it = src.begin(); it != src.end(); ++it) {
		auto a = flip_pair(*it);
		dst.insert(a);
	}
	return dst;
}

// get frequency mapping from vector
template <typename Tval>
multimap<int, Tval> freq(vector<Tval> src) {
	map<Tval, int> counter;
	for(auto it = src.begin(); it != src.end(); ++it) {
		auto it2 = counter.find(*it);
		if(it2 != counter.end()) counter[*it]++;
		else counter[*it] = 1;
	}
	auto dst = flip_map(counter);
	return dst;
}

int main(){
	int N, T;
	int c[N], t[N];
	int mi = INF;
	cin>>N>>T;
	rep(i, N) {
		cin>>c[i]>>t[i];
		if (t[i] <= T) {
			mi = (mi > c[i])? c[i]:mi;
		}
	}
	if (mi == INF) cout<<"TLE";
	else cout<<mi;
	
}



Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define N 100005
#define pb push_back
int main()
{
	int k,x;
	cin>>k>>x;
	if(x<=k*500)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 384
n,k = gets.split.map(&:to_i)
r,s,p = gets.split.map(&:to_i)
str = gets.chomp
j = Array.new(n)
point = 0


str.length.times do |i|
    flag = true
    if i>=k
        if str[i] == str[i-k] and j[i-k] == true
            flag = false
        end
    end
    j[i] = flag
    if flag
        point += p if str[i] == 'r'
        point += r if str[i] == 's'
        point += s if str[i] == 'p'
    end
end

p point

Measured memory_bytes: 4732
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            long[] s = ReadLine().Split(' ').Select(long.Parse).ToArray();
            long N = s[0];
            long M = s[1];
            List<long> ls = new List<long>();
            ls.AddRange(ReadLine().Split(' ').Select(long.Parse).ToArray());
            Dictionary<long, long> input = new Dictionary<long, long>();
            for (int i = 0; i < M; i++)
            {
                long[] inp = ReadLine().Split(' ').Select(long.Parse).ToArray();
                if (input.ContainsKey(inp[1]))
                {
                    input[inp[1]] += inp[0];
                }
                else
                {
                    input.Add(inp[1], inp[0]);
                }

            }

            ls.Sort();
            var SortedInput = input.OrderByDescending(x => x.Key);
            
            int j = 0;//lsの見る場所
            foreach (var item in SortedInput)
            {
                long Valcnt = 0;
                while (item.Value - Valcnt > 0 && ls.Count > j)
                {
                    if (ls[j] < item.Key && ls.Count > j)
                    {
                        ls[j] = item.Key;
                        Valcnt++;
                    }
                    else
                    {
                        break;
                    }
                    j++;
                }
                if (ls.Count > j)
                {
                    if (ls[j] >= item.Key)
                    {
                        break;
                    }
                }
            }
            long ans = ls.Sum();
            WriteLine(ans);
        }
    }
}


Measured memory_bytes: 37844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <queue>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;
typedef pair<int, int> P;
const vector<int> di = {-1, 0, 1, 0};
const vector<int> dj = { 0, 1, 0, -1 };

int main() {
	
	int h, w;
	cin >> h >> w;
	vector<string> c(2 * h);
	rep(i, h) {
		cin >> c.at(i * 2);
		c.at(i * 2 + 1) = c.at(i * 2);
	}
	rep(i, 2 * h) {
		cout << c.at(i) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}

int ctoi(char c){return c - '0';}

bool isOk(ll key,ll value){
  return key >= value;
}

ll binary_search(vector<ll> a,ll key){
  ll ok = a.size()-1;
  ll ng = 0;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}

bool isPrime(ll n) {
	for (int i = 2; n >= i * i; ++i) {
		if(!(n % i))return false;
	}
  return true;
}
vector<ll> primes(ll n){
  vector<ll> v;
  for (ll i = 2; i*i <= n; ++i) {
    while(n%i==0){
      n/=i;
      v.pb(i);
    }
  }
  if(n != 1)v.pb(n);
  return v;
}


int main() {
  //cin.tie(0); ios::sync_with_stdio(0);
  int h,w;cin>>h>>w;
  vector<string> s(h);rep(i,h)cin>>s[i];
  vector<vector<int>> a(h,vector<int>(w,0));
  vector<vector<int>> b(h,vector<int>(w,0));

  rep(i,h){
    rep(j,w){
      if(i > 0)a[i][j] += a[i-1][j] + (s[i-1][j] == '.');
      if(j > 0)b[i][j] += b[i][j-1] + (s[i][j-1] == '.');
      if(s[i][j] == '#'){
        a[i][j] = 0;
        b[i][j] = 0;
      }
    }
  }
  vector<vector<int>> ar(h,vector<int>(w,0));
  vector<vector<int>> br(h,vector<int>(w,0));
  for(int i = h-2;i >= 0;--i){
    for(int j = w-2;j >= 0;--j){
      ar[i][j] += ar[i+1][j] + (s[i+1][j] == '.');
      br[i][j] += br[i][j+1] + (s[i][j+1] == '.');
      if(s[i][j] == '#'){
        ar[i][j] = 0;
        br[i][j] = 0;
      }
    }
  }
  int ans = 0;
  rep(i,h){
    rep(j,w){
      ans = max(ans,a[i][j]+b[i][j]+ar[i][j]+br[i][j]+(s[i][j]=='.'));
    }
  }

  print(ans);
  return 0;
}

Measured memory_bytes: 67200
class segtree():
    def segfunc(x,y):
        return min(x,y)
    #####単位元######
    ide_ele = -1
    n=1
    init_val=[0]*n
    #num:n以上の最小の2のべき乗
    num =2**(n-1).bit_length()
    seg=[ide_ele]*2*num
    
    def __init__(self,INIT_VAL,SEGFUNC,IDE_ELE):
        self.ide_ele=IDE_ELE
        self.init_val=[i for i in INIT_VAL]
        self.segfunc=SEGFUNC
        self.n=len(self.init_val)
        self.num =2**(self.n-1).bit_length()
        self.seg=[self.ide_ele]*2*self.num
 
        #set_val
        for i in range(self.n):
            self.seg[i+self.num-1]=self.init_val[i]    
        #built
        for i in range(self.num-2,-1,-1) :
            self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) 
        
    def update(self,k,x):
        k += self.num-1
        self.seg[k] = x
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
        
    def query(self,p,q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res

N,K=map(int,input().split())
A=[int(input()) for i in range(N)]
def solve1(A,K):
    INF=10**15
    MAX_A=300000
    G=segtree([0 for i in range(MAX_A+1)],max,-INF)
    dp=[0 for i in range(N)]
    dp[0]=1
    G.update(A[0],1)
    for i in range(1,N):
        #print([G.query(i,i+1) for i in range(12)])
        inf=max(0,A[i]-K)
        sup=min(MAX_A+1,A[i]+K+1)
        dp[i]=G.query(inf,sup)+1
        G.update(A[i],dp[i])
    #print(dp)
    return max(dp)

def solve2(A,K):
    N=len(A)
    dp=[1 for i in range(N)]
    for i in range(1,N):
        for j in range(i):
            if abs(A[j]-A[i])<=K:
                dp[i]=max(dp[i],dp[j]+1)
    #print(dp)
    return max(dp)

print(solve1(A,K))

Measured memory_bytes: 156488
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
signed main(){
  int a;
  string b;
  cin>>a>>b;
  int d,c=0;
  for(int i=1;i<a;i++){
    if(b[i]=='E')
      c++;
  }
  d=c;
  for(int i=1;i<a-1;i++){
    if(b[i]=='E')
      c--;
    if(b[i-1]=='W')
      c++;
    d=min(d,c);
  }
  c=0;
  for(int i=0;i<a-1;i++){
    if(b[i]=='W')
      c++;
  }
  d=min(c,d);
  cout<<d<<endl;
}

Measured memory_bytes: 900
#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>                                       
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <functional>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long

vector<int> v;
int n;
short dp[4][200][33000];
int solve(int i, int j, int res)
{
	if (i == 4)
	{
		if (res == n) return 1;
		else return 0;
	}
	if (j == v.size() || v[j] > res+n || res>n) return 0;
	if (dp[i][j][res] >= 0) return dp[i][j][res];
	return dp[i][j][res] = solve(i, j + 1, res) + solve(i + 1, j, res + v[j]);
}

int main()
{
	for (int i = 0;; i++)
	{
		v.push_back(i*i);
		if (i*i > 33000) break;
	}

	while (cin >> n, n)
	{
		REP(i, 4)REP(j, v.size())REP(k, n + 1) dp[i][j][k] = -1;
		cout << solve(0, 0, 0) << endl;
	}
	return 0;
}

Measured memory_bytes: 52420
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	double ans = 0.0;
	for (int i = 1; i < n+1; i++) {
		
		double x = i;
		double p = 1.0;
		while (x < k) {

			x *=2;
			p *= 0.5;
		}

		ans += p/(double)n;
	}

	cout << fixed << setprecision(10) << ans << endl;


	return 0;
}

Measured memory_bytes: 256
cnt = 0
n = int(input())
S = list(map(int, input().split()))

def mergeSort(S, left, right):
  if left+1 < right:
    mid = (left + right) // 2
    mergeSort(S, left, mid)
    mergeSort(S, mid, right)
    merge(S, left, mid, right)

def merge(S, left, mid, right):

  L = S[left:mid] + [10**10]
  R = S[mid:right] + [10**10]

  i,j = 0,0

  global cnt
  for k in range(left, right):
    if L[i] <= R[j]:
      S[k] = L[i]
      i += 1
    else:
      S[k] = R[j]
      j += 1
      cnt += len(L) -1 - i

mergeSort(S, 0, len(S))
print (cnt)


Measured memory_bytes: 27476
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
s = [None]*n
for i in range(n):
    s[i] = input()
    
def sub(i):
    res = True
    for j in range(n):
        if not all(s[(i+j)%n][(j+k)%n]==s[(i+j+k)%n][j] for k in range(n)):
            res = False
            break
    return res
ans = 0
for i in range(n):
    if sub(i):
        ans += n
print(ans)

Measured memory_bytes: 74652
n, k = map(int, input().split())
A = list(map(int, input().split()))

cnt = [[0, 0] for i in range(n)]
for i in range(n):
    a = A[i]
    for af in A[:i]:
        if af < a:
            cnt[i][0] += 1
    for al in A[i:]:
        if al < a:
            cnt[i][0] += 1
            cnt[i][1] += 1

ans = 0
for c in cnt:
    ans += (c[1]*k + c[0]*k*(k-1)//2) % (10**9+7)

print(ans % (10**9+7))


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

int main() {
	int a, b, c, d, n, count;
	
	while (cin >> n) {
		count = 0;
		for (a = 0;a < 10;a++) {
			for (b = 0;b < 10;b++) {
				for (c = 0;c < 10;c++) {
					for (d = 0;d < 10;d++) {
						if (a + b + c + d == n) count++;
					}
				}
			}
		}
		cout << count << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
import math
import heapq

n, m = map(int, input().split(" "))
a = list(map(int, input().split(" ")))

a_minus = [a[i] * (-1) for i in range(n)]

heapq.heapify(a_minus)

for i in range(m):
    value = heapq.heappop(a_minus)
    value /= 2
    heapq.heappush(a_minus, value)

count = 0
for i in range(n):
    value = heapq.heappop(a_minus) * -1
    count += math.floor(value)

print(count)


Measured memory_bytes: 105556
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long a;
    long b;
    std::cin >> a;
    std::cin >> b;
    long c = b - a;
    long sum = 0;
    for(int i = 1; i < c; i++){
        sum = sum + i;
    }
    long result = sum - a;
    std::cout << result << std::endl;
}


Measured memory_bytes: 888
#ABC166
N,M=map(int,input().split())
H =list(map(int,input().split()))  #展望台の標高
A = list(range(1,N+1))
for i in range(M):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        A[b-1] = 0
    elif H[a-1] < H[b-1]:
        A[a-1] = 0
    else:
        A[a-1] = 0
        A[b-1] = 0
print(N-A.count(0))

Measured memory_bytes: 20076
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;

int main()
{
	string number;


	while (1)
	{
		int a = 0;


		cin >> number;

		if (number == "0")break;

		for (int i = 0; i < number.size();i++)
		{
			a += number[i] - '0';
		}

		cout << a << endl;
	}

	return 0;
}

Measured memory_bytes: 3044
#include<bits/stdc++.h>
int main(){
  int h,w,a,b;
  std::cin>>h>>w>>a>>b;
  for(int i=0;i<b;i++){
    for(int j=0;j<a;j++){
      std::cout<<"1";
    }
    for(int j=a;j<w;j++){
      std::cout<<"0";
    }
    std::cout<<std::endl;
  }
  for(int i=b;i<h;i++){
    for(int j=0;j<a;j++){
      std::cout<<"0";
    }
    for(int j=a;j<w;j++){
      std::cout<<"1";
    }
    std::cout<<std::endl;
  }
}

Measured memory_bytes: 1280
#include <cmath>
#include <cstdio>
#include <vector>
#include <iterator>
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>
#include <stdio.h>
#include <functional>
#include <chrono>
using namespace std;

#define rep(i,s,n) for(ll i=s;i<(n);++i)
using ll = long long;
using pll = pair<ll, ll>;
constexpr ll INF = (1LL << 60);
constexpr ll MAX_INF = 9223372036854775807;
constexpr ll MOD = (1e9 + 7);
//constexpr ll MOD = (998244353);

using vl = vector<ll>;
using vvl = vector<vector<ll>>;

template<class T>
vector<vector<T>> vvt(T init, ll m, ll n) {
	vector<vector<T>> ans = vector<vector<T>>(m, vector<T>(n, init));
	return move(ans);
}

template<class T>
vector<T> vt(T init, ll n) {
	vector<T> ans = vector<T>(n, init);
	return move(ans);
}

template<class T>
T maxVec(vector<T>& v) {
	T ans = -INF;
	rep(i, 0, v.size()) {
		ans = max(ans, v[i]);
	}
	return ans;
}

// 素数判定
bool judge(ll n) {
	for (ll i = 2; i * i <= n; i++) if (n %= i)return false;
	return true;
}


template <class C>
void print(const C & c, std::ostream & os = std::cout)
{
	std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, ", "));
	os << std::endl;
}
/*
ll count(ll n,ll r) {
	ll ans = 0,check = 1;
	rep(i,0, r) {
		if ((n & check) > 0) {
			ans++;
		}
		check = check << 1;
	}
	return ans;
}
*/
bool sortreverse(ll a, ll b) {
	return a > b;
}


ll kiriage(ll a, ll b) {
	if (a % b == 0)return a / b;
	return a / b + 1;
}

ll n, m, t, q, s,k,h,w;

void warshall_floyd(ll v_num,vector<vector<long long>> &d) {
	for (long long k = 0; k < v_num; k++) {       // 経由する頂点
		for (long long i = 0; i < v_num; i++) {    // 始点
			for (long long j = 0; j < v_num; j++) {  // 終点
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


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

	vl kaijyo(n + 5), kaijyoinv(n + 5);
	kaijyo[0] = 1; kaijyoinv[0] = modinv(1, MOD);
	rep(i, 1, n + 5) {
		kaijyo[i] = kaijyo[i - 1] * i;
		kaijyo[i] %= MOD;
		kaijyoinv[i] = modinv(kaijyo[i], MOD);
	}
	ll ans = 0;
	rep(i, 0, min(n,k+1)) {
		ll zero = kaijyo[n] * kaijyoinv[n - i];
		zero %= MOD;
		zero *= kaijyoinv[i];
		zero %= MOD;
		ll irekata = kaijyo[n - 1] * kaijyoinv[n - i - 1];
		irekata %= MOD;
		irekata *= kaijyoinv[i];
		irekata %= MOD;
		irekata *= zero;
		irekata %= MOD;
		ans += irekata;
		ans %= MOD;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 3328
N,K,Q = map(int, input().split())
li = [0 for i in range(N)]
for i in range(Q):
    a = int(input())
    li[a-1] += 1
for i in range(N):
    if K - (Q-li[i]) <= 0:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 9996
#include <bits/stdc++.h>
#include <iostream>
#include <vector>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
typedef long long int ll;

#define min(x,y)(x<y?x:y)

 
using namespace std;

int ans = 999;

int func(int n,int res){
  int A[6]={ 59049, 6561, 729, 81, 9, 1};
  int B[9]={279936, 46656, 7776, 1296, 216, 36, 6, 1};
  int a,b,i;
  if(n <6){
    return ans=min(ans,res+n);
  }
 
  res++;
  for(i=0;A[i]>n;++i)1;a=A[i];
  for(i=0;B[i]>n;++i)1;b=B[i];
  func(n-a,res);
  func(n-b,res);
}

int main() {
	FAST;

	int N;
	cin >> N;

	cout << func(N,0);

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int total = 0;
		while (true) {
			if (n < 10) {
				total = n;
				break;
			} else {
				total += 9;
			}
			if (n < 100) {
				break;
			} else if (n < 1000) {
				total += n - 99;
				break;
			} else {
				total += 999 - 99;
			}
			if (n < 10000) {
				break;
			} else if (n < 100000) {
				total += n - 9999;
				break;
			} else {
				total += 99999 - 9999;
				break;
			}
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 23764
N, K = list(map(int, input().split()))
numbers = list(map(int, input().split()))

n_map = {}
for n in numbers:
    if n_map.get(n) is None:
        n_map[n] = 1
    else:
        n_map[n] += 1

sorted_map = sorted(n_map.values(), reverse=True)
max_num = sum(sorted_map)
min_num = sum(sorted_map[:K])
print(max_num - min_num)

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

int main() {
 int a , b ;
 cin >> a >> b;
 string ans = "Impossible";
  if(a%3 == 0)
    ans = "Possible";
  if(b%3 == 0)
    ans = "Possible";
  if((a+b)%3 == 0)
    ans = "Possible";
  
  cout << ans;
  
 
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
	int A=0,B=0,AB=0,O=0,x;
	char str[3];
	while(scanf("%d,%s",&x,str)!=EOF){
		if (!strcmp(str,"A"))
			A++;
		else if (!strcmp(str,"B"))
			B++;
		else if (!strcmp(str,"AB"))
			AB++;
		else if (!strcmp(str,"O"))
			O++;
	}
	printf("%d\n%d\n%d\n%d\n",A,B,AB,O);
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <map>
using namespace std;
int main() {
    int n;
    while (scanf("%d", &n) == 1) {
        map<int, int> m;
        for (int i = 0; i < n; i++) {
            int x;
            scanf("%d", &x);
            m[x]++;
        }
        int ans = 0;
        for (auto p : m) {
            if (p.second >= p.first)
                ans += p.second - p.first;
            else
                ans += p.second;
        }
        printf("%d\n", ans);
    }
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
set<string>st;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s;
		st.insert(s);
	}
	cout<<st.size();
	return 0;
} 

Measured memory_bytes: 19268
/*
    Name: *3 or /2 
    Author: FZSZ-LinHua
    Date: 2018 06 16
    Exec time: 2ms
    Memory usage: 256KB
    Score: 300
    Algorithm: Bit operation 
*/
# include "cstdio"
# include "iostream"

using namespace std;

inline int n_lowbit(int x){    //取出含有质因子2的个数 
    int count=0;
    while(x){
        if(x&1){
            return count; 
        }
        count++; 
        x>>=1; 
    }
    return count; 
} 

int
    ans, //记录答案 
    N, 
    a; 

int main(){
    scanf("%d",&N);
    while(N--){
        scanf("%d",&a);
        ans+=n_lowbit(a); //更新答案 
    }
    printf("%d",ans); 
    return 0; 
} 

Measured memory_bytes: 256
#include <iostream>

#define max(a, b) (a) > (b) ? (a) : (b)

using namespace std;

int main() {
    int N;
    cin >> N;
    int* A[2];
    for (int i = 0; i < 2; i++) {
        A[i] = (int*)malloc(sizeof(int) * N);
        for (int j = 0; j < N; j++) {
            cin >> A[i][j];
        }
    }

    int* D[2];
    for (int i = 0; i < 2; i++) {
        D[i] = (int*)malloc(sizeof(int) * N);
        for (int j = 0; j < N; j++) {
            D[i][j] = A[i][j];
            if (i == 0 && j == 0) continue;
            else if (i == 0) D[i][j] += D[i][j-1];
            else if (j == 0) D[i][j] += D[i-1][j];
            else D[i][j] += max(D[i][j-1], D[i-1][j]);
        }
    }

    cout << D[1][N-1];
    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;
	cin >> n >> m;
	vector<int> suki(m, 0);
	
	for(int i = 0; i < n; i++){
		int k;
		cin >> k;
		for(int j = 0; j < k; j++){
			int a;
			cin >> a;
			a--;
			suki.at(a)++;
		}
	}
	int ans = 0;
	for(int i = 0; i < m; i++){
		if(suki.at(i) == n) ans++;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
  
int parent(int i){
  return i / 2;
}
 
int left(int i){
  return 2 * i;
}
 
int right(int i){
  return 2 * i + 1;
}
 
int main(){
 
  int i,n,p,l,r;
  int A[250];
  
  scanf("%d",&n);
 
  for(i = 1;i <= n;i ++)
    {
      scanf("%d",&A[i]);
    }
 
  for(i = 1;i <= n;i ++)
    {
      printf("node %d: key = %d, ",i,A[i]);
 
      p = parent(i);
 
      if(p != 0)
	{
	  printf("parent key = %d, ",A[p]);
	}
 
      l = left(i);
 
      if(l <= n)
	{
	  printf("left key = %d, ",A[l]);
	}
 
      r = right(i);
 
      if(r <= n)
	{
	  printf("right key = %d, ",A[r]);
	}
 
      printf("\n");
    }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <vector>

using namespace std; 

namespace fastinput
{
	/** Interface */

	inline int readChar();
	template <class T = int> inline T readInt();
	template <class T> inline void writeInt(T x, char end = 0);
	inline void writeChar(int x);
	inline void writeWord(const char *s);

	/** Read */

	static const int buf_size = 16384;
	char buf[buf_size];
	int len = 0, pos = 0;

	inline int getChar() {
		if (pos == len)
			pos = 0, len = fread(buf, 1, buf_size, stdin);
		if (pos == len)
			return -1;
		return buf[pos++];
	}

	inline int readChar() {
		int c = getChar();
		while (c <= 32)
			c = getChar();
		return c;
	}

	template <class T>
	inline T readInt() {
		int s = 1, c = readChar();
		T x = 0;
		if (c == '-')
			s = -1, c = getChar();
		while ('0' <= c && c <= '9')
			x = x * 10 + c - '0', c = getChar();
		return s == 1 ? x : -x;
	}

	/** Write */

	static int write_pos = 0;
	static char write_buf[buf_size];

	inline void writeChar(int x) {
		if (write_pos == buf_size)
			fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
		write_buf[write_pos++] = x;
	}

	inline string readWord()
	{
		string tmp;
		tmp.push_back(readChar());
		char c;
		while ((c = getChar()) > 32)
			tmp.push_back(c);
		--pos;
		return tmp;
	}

	template <class T>
	inline void writeInt(T x, char end) {
		if (x < 0)
			writeChar('-'), x = -x;

		char s[24];
		int n = 0;
		while (x || !n)
			s[n++] = '0' + x % 10, x /= 10;
		while (n--)
			writeChar(s[n]);
		if (end)
			writeChar(end);
	}

	inline void writeWord(const char *s) {
		while (*s)
			writeChar(*s++);
	}

	struct Flusher {
		~Flusher() {
			if (write_pos)
				fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
		}
	} flusher;
}

const int N = 2e3 + 2;
long long t[N][N];

inline void add(int x1, int y1, int w)
{
	for (; x1 < N; x1 |= x1 + 1)
		for (int j = y1; j < N; j |= j + 1)
			t[x1][j] += w;
}

inline long long sum(int x1, int y1)
{
	long long tmp = 0;
	for (; x1 >= 0; x1 = (x1 & (x1 + 1)) - 1)
		for (int j = y1; j >= 0; j = (j & (j + 1)) - 1)
			tmp += t[x1][j];
	return tmp;
}

using namespace fastinput;

string s;
set <char> s1;

int main() 
{
	s = readWord();
	for (char c : s)
		s1.insert(c);
	if (s1.count('N') + s1.count('S') == 1)
		cout << "No";
	else if (s1.count('E') + s1.count('W') == 1)
		cout << "No";
	else
		cout << "Yes";

	return 0;
}

Measured memory_bytes: 764
// Author: getharshkumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    string s;
    cin >> s;
    ll n = s.size();
    vector<ll> p, ans(n);
    for (ll i = 0; i + 1 < n; i++)
        if (s[i] == 'R' && s[i + 1] == 'L')
            p.push_back(i);
    for (ll e : p)
    {
        ll r = 0, l = 0;
        for (ll i = e; s[i] == 'R' && ~i; i--)
            r++;
        for (ll i = e + 1; s[i] == 'L' && i < n; i++)
            l++;
        ans[e] = ans[e + 1] = (r + l) / 2;
        if ((l + r) % 2)
            if (r % 2)
                ans[e]++;
            else
                ans[e + 1]++;
    }
    for (ll e : ans)
        cout << e << " ";
    return 0;
}

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

int main(){
  int n,i;
  cin >> n;
  vector<pair<pair<string,int>,int>> p(n);
  for(i=0;i<n;i++){
    cin >> p.at(i).first.first >> p.at(i).first.second;
    p.at(i).first.second *= -1;
    p.at(i).second=i+1;
  }
  
  sort(p.begin(),p.end());
  for(i=0;i<n;i++){
    cout << p.at(i).second << endl;
  }
}

Measured memory_bytes: 3604
#include <stdio.h>

int main(){
	
	int H, W, i, j;
	
	while(scanf("%d%d",&H, &W))
	{
		if(H == 0 && W == 0)
		{
			break;
		}
	for(i=1; i <= H; i++)
	{
		for(j = 1; j <= W; j++)
		{
			printf("#");
		}
		printf("\n");
	}
	printf("\n");
	}
} 


Measured memory_bytes: 2624
/**Bismillahir Rahmanir Raheem
    Author:Refat(BSMRSTU)**/
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define pil pair<int,ll>
const int N = 2e5 + 5;
const int M = 1e9 + 7;
const double pi=2*acos(0.0);
const double esp=1e-9;
int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}

ll countpositive(vector<ll>vt,ll value) {
    ll ans=0ll;
    for(int i=0,j=(int)vt.size()-1; i<(int)vt.size()&&i<j; i++) {
        while(j>=0&&vt[i]*vt[j]>value)j--;
        if(i<j)
            ans+=(j-i);
    }
    return ans;
}

ll countnegative(vector<ll>vt1,vector<ll>vt2,ll value) {
    reverse(vt1.begin(),vt1.end());
    ll ans=0ll;
    for(int i=0,j=(int)vt2.size()-1; i<(int)vt1.size(); i++) {
        while(j>=0&&vt1[i]*vt2[j]>value)j--;

        ans+=(j+1);
    }
    return ans;
}
int main() {
    /// freopen("input.txt","r",stdin);
    /// freopen("output.txt","w",stdout);
    vector<ll>pos,neg,nneg;
    int test=1;
    ///scanf("%d",&test);
    for(int cs=1; cs<=test; cs++) {
        ll n,k,x;
        scanf("%lld %lld",&n,&k);
        for(int i=1; i<=n; i++) {
            scanf("%lld",&x);
            if(x>=0) {
                pos.push_back(x);
            } else {
                neg.push_back(x),nneg.push_back(-x);
            }
        }
        sort(pos.begin(),pos.end());
        sort(neg.begin(),neg.end());
        sort(nneg.begin(),nneg.end());
        ll l=-1e18,r=1e18,cnt,ans;

        while(l<=r) {
            ll mid=(l+r)>>1ll;
            if(mid>=0ll) {
                cnt=countpositive(pos,mid)+countpositive(nneg,mid)+(ll)pos.size()*(ll)neg.size();
            } else {
                cnt=countnegative(pos,neg,mid);
            }
            if(cnt>=k) {
                r=mid-1ll;
                ans=mid;
            } else if(cnt<k) {
                l=mid+1ll;
            }
        }
        printf("%lld\n",ans);
    }
    return 0;
}



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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll h, w, d; cin >> h >> w >> d;
    vector<vector<ll>> sum(d);
    map<ll, P> m;
    rep(i, h) {
        rep(j, w) {
            ll a; cin >> a;
            m[a] = make_pair(i, j);
        }
    }
    rep(i, d) {
        ll n = i+1, s = 0;
        sum[i].push_back(s);
        while(n <= h*w) {
            ll x, y, nx, ny; // 前のx,y 次のx,y
            x = m[n].first;
            y = m[n].second;
            nx = m[n+d].first;
            ny = m[n+d].second;
            ll dist = my_abs(x-nx) + my_abs(y-ny);
            s += dist;
            sum[i].push_back(s); // 累積
            n += d;
        }
    }

    ll q; cin >> q;
    rep(i, q) {
        ll l, r; cin >> l >> r;
        ll a = (l%d); // mod
        // どのvectorを使うか
        if(a == 0) a = d-1;
        else a = a-1;
        ll ans = sum[a][(r-a-1)/d] - sum[a][(l-a-1)/d];
        cout << ans << endl;
    }
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


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

int main()
{
    int n;
    cin>>n;
    int d[n];
    for(int i=0;i<n;i++)
        cin>>d[i];
    long long int s=0;
    for(int i=0;i<n-1;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            s += d[i]*d[j];
        }
    }
    cout<<s;
    return 0;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int X, Y;
	cin >> X >> Y;
	int ans = 1;
	int A = X;
	while (A * 2 <= Y)
	{
		A *= 2;
		ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    char c;
    cin>>c;
    cout<<char(('a'+c-'a'+1))<<endl;
    
}
return 0;
}

Measured memory_bytes: 256
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	int[] a = new int[10];
		
	Main(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
			for(int j=0;j<n;j++) {
				for(int i=0; i<10;i++) {
				a[i] = sc.nextInt();
			}
			System.out.println(solve());
		}
	}

	String solve() {
		int flag = 1;
		int b=0,c=0;
		for(int i=0;i<10;i++) {
			if(a[i]>b)b=a[i];
			else if(a[i]>c)c = a[i];
			else flag = 0;
		}
		
		if(flag==1)return "YES";
		else return "NO";
	}
	
	
	public static void main (String[] args) throws java.lang.Exception
	{
		new Main();
	}
}


Measured memory_bytes: 26368
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define v vector
#define len length()
#define fi first
#define se second
#define mt make_tuple
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define rep(i,n) for(ll i=0;i<n;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int M = 1e9+7;
int ll_max=1e6;
v<ll> fact;
//factorial
void factorial(ll n)
{
    fact[0] = 1;
    for (ll i = 1; i <=n; i++)
    {
        fact[i] = i * fact[i - 1];
        fact[i] %= M;
    }
}
// modular exponentiation 
ll binpow(ll val, ll deg)
{
    if (!deg)
        return 1 % M;
    if (deg & 1)
        return binpow(val, deg - 1) * val % M;
    ll res = binpow(val, deg >> 1);
    return (res * res) % M;
}
//combination
ll combination(ll n, ll i)
{
    ll res = fact[n]; 
    ll div = fact[n - i] * fact[i];
    div %= M;
    // using fermat little theorum
    div = binpow(div, M - 2); // modular inverse  
    return (res * div) % M; 
}

int main() {
	// your code goes here
	IOS;
	ll n,m,i;
	ll j,t,x,y,z,k,d;
	string s,T;
	cin>>s;
	cin>>T;
	ll count=0;
	rep(i,s.len){
	      if(s[i]!=T[i])
	      count++;
	}
	cout<<count;
	

	
	return 0;
}

Measured memory_bytes: 3800
#define		_CRT_SECURE_NO_WARNINGS

#include	<cstdio>

int main()
{
	int		N;
	int		A[1000];

	scanf("%d", &N);

	for (int i = 0; i < N; i++)
	{
		scanf("%d", &(A[i]));
	}

	for (int i = 1; i < N; i++)
	{
		for (int k = 0; k < N; k++)
		{
			if (k) printf(" ");
			printf("%d", A[k]);
		}
		printf("\n");

		int	v = A[i];
		int j = i - 1;

		while ((j >= 0) && (A[j] > v))
		{
			A[j + 1] = A[j];
			j--;
		}

		A[j + 1] = v;
	}

	for (int k = 0; k < N; k++)
	{
		if (k) printf(" ");
		printf("%d", A[k]);
	}
	printf("\n");

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  vector<vector<int>> shimei(N);
  vector<vector<int>> shougen(N);
  
  rep(i, N){
    cin >> a[i];
    rep(j, a[i]){
      int x, y;
      cin >> x >> y;
      shimei[i].push_back(x);
      shougen[i].push_back(y);
    }
  }
  
  int ans=0;
  for (int bit = 0; bit < (1 << N); ++bit){
    bool ok=true;
    rep(i, N){
      if (bit & (1<<i)){//bitのiビット目が1だったら, 0~2^N-1
        rep(j, a[i]){
          if((bit & (1<<shimei[i][j]-1)) && shougen[i][j]!=1){
            ok = false;
          }else if(!((bit & (1<<shimei[i][j]-1))) && shougen[i][j]==1){
            ok = false;
          }
        }//j
      }
    }//i
    if(ok) ans = 	max(ans, __builtin_popcount(bit));
  }//bit
  
  cout << ans;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define lamsort(v,p) sort(v.begin(),v.end(),[](p a, p b){return a.num < b.num;});
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
const long long INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, a, b; cin >> n >> a >> b;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    
    ll cnt = 0;
    int tel = (b-1)/a+1;
    rep(i,n-1) {
        if(v[i+1]-v[i]>=tel) cnt += b;
        else cnt += (v[i+1]-v[i])*a;
    }
    cout << cnt << endl;

    return 0;
}

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

const int M = 1e9+7;

int main() {
	int h , w , i , j , k , l;
	cin >> h >> w;
	int dp[h+1][w+1];
	string s[h+1];
	for(i=1;i<=h;i++) {
	    cin >> s[i];
	    reverse(s[i].begin() , s[i].end());
	    s[i] += '@';
	    reverse(s[i].begin() , s[i].end());
	}
	for(i=0;i<=h;i++) for(j=0;j<=w;j++) dp[i][j] = 0;
	for(i=1;i<=h;i++) {
	    for(j=1;j<=w;j++) {
	        if(i == 1 and j == 1) {
	            dp[i][j] = 1;
	            continue;
	        }
	        if(s[i][j] == '#') continue;
	        dp[i][j] = ( (dp[i-1][j] % M) + (dp[i][j-1] % M) ) % M;
	    }
	}
	cout << dp[h][w];
	return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dx[4] = {0,-1,0,1};
int dy[4] = {-1,0,1,0};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    s[k - 1] = tolower(s[k - 1]);
    cout << s << endl;

}

Measured memory_bytes: 3656
// abca29c.cpp : Typical Stairs
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

vector<int> v(100000+1,-1);

int calc(int i, int n){
	if(i>n) return 0;
	if(i==n) return 1;
	if(v[i]==-2) return 0;
	if(v[i]==-1) v[i] = (calc(i+1,n) + calc(i+2,n)) % MOD;
	return v[i];
}

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

    for(int i=0;i<m;i++){
		int a; cin>>a;
		v[a] = -2;
	}

	int ans = calc(0,n);

	cout<< ans <<endl;
}

Measured memory_bytes: 5376