akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    int A[200010]; 
    int num[N+1] = {0};
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        ++num[A[i]];
    }
    int c = 0;
    for(int i = 0; i <= N; i++){
        if(num[i] != 0) c++;
    }
    sort(num, num + N + 1);
    int sum = 0;
    int j = 0;
    for(int i = 0; i <= N; i++){
        if(num[i] != 0){
            if(j >= c - K) break;
            sum += num[i];
            j++;
        }
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 5196
from collections import deque
n=int(input())
E=[0]*n
for _ in range(n):
    u,k,*V=map(int,input().split())
    E[u-1]=V
d=[-1]*n
d[0]=0
todo=deque([1])
while todo:
    now=todo.popleft()
    for v in E[now-1]:
        if d[v-1]==-1:
            todo.append(v)
            d[v-1]=d[now-1]+1
for i in range(n):
    print(i+1,d[i])


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

#define ll long long
typedef vector<ll> vi;

int main(){
    ll N,M,tmp;
    ll ans;
    vi arr;
    vi diff;
    cin >> N >> M;
    for(ll i=0;i<M;i++){
        cin >> tmp;
        arr.push_back(tmp);
    }
    sort(arr.begin() ,arr.end());
    for(ll i = 0 ; i < M-1 ; i++){
        diff.push_back(arr[i+1] - arr[i]);
    }
    sort(diff.begin() ,diff.end());

    for(ll i = 0 ; i < M-1-N+1 ; i++){
        ans += diff[i];
    }
    cout << ans << endl;





}

Measured memory_bytes: 2548
import java.util.Scanner;

class Main {

    static int ans = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int a[] = new int[m];
        int b[] = new int[m];
        int mvMap[][] = new int[n][n];
        for (int i = 0; i < m; i++) {
            // indexになおす
            a[i] = sc.nextInt() - 1;
            b[i] = sc.nextInt() - 1;
            mvMap[a[i]][b[i]] = 1;
            mvMap[b[i]][a[i]] = 1;
        }
        boolean visited[] = new boolean[n];
        for (int i = 0; i < n; i++) {
            visited[i] = false;
        }
        visited[0] = true;
        bfs(0, visited, mvMap);
        System.out.println(ans);

        sc.close();
    }

    static void bfs(int spos, boolean[] visited, int[][] mvMap) {
        int viscnt = 0;
        for (int i = 0; i < visited.length; i++) {
            if (visited[i]) {
                viscnt++;
            }
        }
        if (viscnt == visited.length) {
            ans++;
            return;
        }
        for (int i = 0; i < mvMap.length; i++) {
            if (mvMap[spos][i] == 1 && !visited[i]) {
                // exsits path and not visited
                visited[i] = true;
                bfs(i, visited, mvMap);
                visited[i] = false;
            }
        }
    }
}


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

int main() {
	long int a, b;
	cin >> a >> b;
	if(a==b) {
	    cout << '0' << endl;
	}
	else {
	    if((a+b)%2==0) {
	        cout << (a+b)/2 << endl;
	    }
	    else {
	        cout << "IMPOSSIBLE" << endl;
	    }
	}
	return 0;
}

Measured memory_bytes: 256
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int n;
    cin >> n;
    cout << (n*n*n);
    
	return 0;
    
}

Measured memory_bytes: 8832
using System;
class P
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    double sum = 0.0;
    double maxValue = 0.0;
    for (int i = 0; i < N; i++) {
      double v = double.Parse(Console.ReadLine());
      sum += v;
      maxValue = Math.Max(maxValue, v);
    }
    Console.WriteLine(sum-(maxValue/2));
  }
}

Measured memory_bytes: 13140
//
//  akjbef.cpp
//
//
//  Created by Takuto on 15/6/3.
//
//

#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

int main(){
    double w;
    string S;
    
    while(EOF!=scanf("%lf",&w)){
        
        
        if(w<=48.00)
            S = "light fly";
        else if(w<=51.00)
            S = "fly";
        else if(w<=54.00)
            S = "bantam";
        else if(w<=57.00)
            S = "feather";
        else if(w<=60.00)
            S = "light";
        else if(w<=64.00)
            S = "light welter";
        else if(w<=69.00)
            S = "welter";
        else if(w<=75.00)
            S = "light middle";
        else if(w<=81.00)
            S = "middle";
        else if(w<=91.00)
            S = "light heavy";
        else
            S = "heavy";
        
        cout << S << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1236
from bisect import bisect_right
n = int(input())
d = {}
amax = 0
for a in map(int, input().split()):
  if a in d:
    d[a] += 1
  else:
    d[a] = 1
amax = max(d.keys())
t = 1
valids = []
while t < 2 * amax:
  t *= 2
  valids.append(t)
result = 0
while True:
  prev = result
  keys = list(sorted(d.keys(), reverse = True))
  for x in keys:
    if x not in d:
      continue
    t = valids[bisect_right(valids, x)] - x
    while True:
      if t not in d:
        break
      if x == t and d[x] == 1:
        break
      result += 1
      if d[x] == 1:
        del d[x]
      else:
        d[x] -= 1
      if d[t] == 1:
        del d[t]
      else:
        d[t] -= 1
      if x not in d:
        break
  if prev == result:
    break
print(result)

Measured memory_bytes: 44560
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(std::vector<T>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}


void solve(void)
{
  int A,B,C;
  cin>>A>>B>>C;
  cout<<(A^B^C)<<endl;
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

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


int main(){
 string T;
  int ans=0;
  cin >> T;
  rep(i,T.size()){
    if(T.at(i)=='?')
      T.at(i)='D';
 
  }
  cout << T << endl;

}

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

//#define int long long
//#define ll int long long
#define REP(i,n) for(int i=0;i<n;i++)
//#define ALL(vec) (vec).begin(),(vec).end()
//#define vint vector<int>
//#define pint pair<int,int>
//#define vpint vector<pint>
/*
int par[100002];
int rnk[100002];
void init(int n){REP(i,n){par[i]=i;rnk[i]=0;}}
int find(int x){if(par[x]==x){return x;}else{return par[x]=find(par[x]);}}
void unite(int x,int y){x=find(x);y=find(y);if(x==y)return;if(rnk[x]<rnk[y]){par[x]=y;}else{par[y]=x;if(rnk[x]==rnk[y])rnk[x]++;}}
bool same(int x,int y){return find(x)==find(y);}
*/

long double n,m,d;

signed main(){
    cin>>n>>m>>d;
    long double ans=(m-1)/n;
    if(d>0)ans*=2*(n-d)/n;
    cout<<fixed<<ans<<endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize "trapv"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand rng
#define fios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define M_PI 3.14159265358979323846
typedef long long ll;



int main() {

	ll n;
	cin >> n;
	// ll tn = n;
	ll dlen = 1;
	ll comb = 26;
	while(n > comb) {
		n -= comb;
		comb *= 26;
		dlen++;
	}
	// n = tn;
	comb /= 26;
	string ans = "";
	// ll curp = dlen - 1;
	ll chr = n - 1;
	while(comb > 0) {
		chr = n / comb;
		ans += ('a' + chr);
		n -=  chr * comb;
		comb /= 26;
	}
	// ans += ('a' + chr);
	if(ans.back() > 'a' && dlen >= 1) ans.back()--;
	else 
	for(int i = dlen-1; i > 0; i--) {
		if(ans[i] <= 'a') {
			ans[i] = 'z';
			ans[i-1]--;
		} else {
			break;
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 3660
import java.util.*;
import java.math.*;

public class Main {
	public static int x, maxn, d;
	public static void main(String ards[])
	{
		Scanner cin = new Scanner(System.in);
		int[] a = new int[]{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};
		int k = cin.nextInt();
        System.out.println(a[k-1]);
	}
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
const int N=3*100000+5;
int aa[N],bb[N],cc[N];
bool cmp(int x,int y)
{ 
	return x>y;
}
int main() 
{
	int i,x,y,a,b,c;
	cin>>x>>y>>a>>b>>c; 
	for(i=0;i<a;i++) 
		cin>>aa[i];
	for(i=0;i<b;i++)
		cin>>bb[i];
	for(i=0;i<c;i++) 
		cin>>cc[i];
	sort(aa,aa+a,greater<int>());
	sort(bb,bb+b,greater<int>());
	for(int i=0;i<x;i++) 
		cc[c+i]=aa[i];
	for(int i=0;i<y;i++) 
		cc[c+x+i]=bb[i];
	sort(cc,cc+c+x+y,greater<int>());
	long long ans=0;
	for(int i=0;i<x+y;i++) ans+=cc[i];
		cout<<ans;
}

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

signed main(){

//	vector<int> a(n);

  string s;

  cin >> s;

  int a,z;

  for(int i=0;i<s.length();i++ ){
    if(s[i]=='A'){
      a = i+1;
      for(int j=i;j<s.length();j++){
        if(s[j] == 'Z'){
          z = j+1;
        }
      }
      break;
    }
  }

//  cout << "a:" << a << " z:" << z << endl;
  cout << z-a+1 << endl;

}

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



int main(){
     int n;
     cin>>n;
     vector<int>v(n,0);
     vector<vector<long long>>dp(n,vector<long long>(n,0));
int c=0;
int x=0,y=0;
     for(int i=0;i<n;i++){
          cin>>v[i];
     }
     
     for(int i=0;i<n;i++){
          dp[i][i]=(long long)v[i];
     }
     
     for(int i=n-1;i>=0;i--){
          for(int j=0;j<n;j++){
               if(i<j){
                    dp[i][j]=max((long long)v[i]-dp[i+1][j],(long long)v[j]-dp[i][j-1]);
               // cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
               }
               
          }
     }
     cout<<dp[0][n-1]<<endl;
}

Measured memory_bytes: 73724
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    ll K, A, B;
    cin >> K >> A >> B;
    if (B - A > 2) {
        ll num = (K - (A - 1)) / 2;
        ll ans = A + num * (B - A) + (K - (A - 1)) % 2;
        cout << ans << endl;
    } else {
        cout << K + 1 << endl;
    }
}


Measured memory_bytes: 256
N,K=list(map(int,input().split(" ")))
A=list(map(int,input().split(" ")))
dp=[0]*N
for i in range(1,N):
  buf=10**100
  for j in range(1,K+1):
    if i-j<0:
      break
    buf=min((buf,dp[i-j]+abs(A[i-j]-A[i])))
  dp[i]=buf
 
print(dp[N-1])

Measured memory_bytes: 54224
n = int(input())
A, B = map(list,zip(*[map(int,input().split()) for i in range(n)]))
A.sort()
B.sort()
if n&1:
	print(B[n//2]-A[n//2]+1)
else:
	print(B[n//2]+B[n//2-1]-(A[n//2]+A[n//2-1])+1)

Measured memory_bytes: 113384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*
 <url:https://www.ioi-jp.org/joi/2007/2008-yo-prob_and_sol/2008-yo-t4/2008-yo-t4.html>
 ñ‚ëËï∂============================================================
 Ç†Ç»ÇΩÇÕêØãÛÇÃé ê^ÇÃíÜÇ©ÇÁêØç¿ÇíTÇµÇƒÇ¢ÇÈÅD
 é ê^Ç…ÇÕïKÇ∏ÅCíTÇµÇΩÇ¢êØç¿Ç∆ìØÇ∂å`ÅEå¸Ç´ÅEëÂÇ´Ç≥ÇÃê}å`Ç™ÇøÇÂÇ§Ç«àÍÇ¬ä‹Ç‹ÇÍÇƒÇ¢ÇÈÅD
 ÇΩÇæÇµÅCé ê^ÇÃíÜÇ…ÇÕêØç¿Çç\ê¨Ç∑ÇÈêØà»äOÇ…ó]ï™Ç»êØÇ™é Ç¡ÇƒÇ¢ÇÈâ¬î\ê´Ç™Ç†ÇÈÅD
 
 ê}ó™
 
 ó·Ç¶ÇŒÅCê} 1 ÇÃêØç¿ÇÕê} 2 ÇÃé ê^Ç…ä‹Ç‹ÇÍÇƒÇ¢ÇÈÅiä€Ç≈àÕÇÒÇ≈é¶ÇµÇΩÅjÅD
 ó^Ç¶ÇÁÇÍÇΩêØç¿ÇÃêØÇÃç¿ïWÇ x ï˚å¸Ç… 2ÅC y ï˚å¸Ç… Å|3 ÇæÇØïΩçsà⁄ìÆÇ∑ÇÈÇ∆é ê^ÇÃíÜÇÃà íuÇ…Ç»ÇÈÅD
 
 íTÇµÇΩÇ¢êØç¿ÇÃå`Ç∆é ê^Ç…é Ç¡ÇƒÇ¢ÇÈêØÇÃà íuÇ™ó^Ç¶ÇÁÇÍÇΩÇ∆Ç´ÅC
 êØç¿ÇÃç¿ïWÇé ê^ÇÃíÜÇÃç¿ïWÇ…ïœä∑Ç∑ÇÈÇΩÇﬂÇ…ïΩçsà⁄ìÆÇ∑ÇÈÇ◊Ç´ó ÇìöÇ¶ÇÈÉvÉçÉOÉâÉÄÇèëÇØÅD
 =================================================================
 âê‡=============================================================
 
 êØç¿Çç\ê¨Ç∑ÇÈêØÇÕç≈ëÂm := 200å¬ÅAé ê^Ç…é Ç¡ÇƒÇ¢ÇÈêØÇÕç≈ëÂn := 1000å¬ÅAÇªÇµÇƒêßñÒÇÕ10s
 ç≈èâÇÃàÍì_ÇÃêØÇåàÇﬂë≈ÇøÇµÇƒ, èáî‘Ç…íTÇµÇΩÇ¢êØç¿Ç™ç≈èâÇÃàÍì_ÇÃêØÇ©ÇÁëäëŒìIÇ»ãóó£Ç…ë∂ç›Ç∑ÇÈÇ©íTÇπÇŒÇÊÇ¢
 íTçıéûä‘ÇÕlog n Ç≈Ç†ÇÈÇÃÇ≈ëçåvéZó ÇÕO(mnlog n) ÅAê‚ëŒä‘Ç…çáÇ§
 
 ================================================================
 */
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int m;
    while(cin >> m,m){
        vector<pii> ps1(m);
        for (int i = 0; i < m;i++) cin >> ps1[i].first >> ps1[i].second;
        int n; cin >> n;
        vector<pii> ps2(n);
        for (int i = 0; i < n;i++) cin >> ps2[i].first >> ps2[i].second;
        
        int idx;
        bool f = false;
        for (int i = 0; i < n;i++) {
            idx = i;
            for (int j = 1; j < m;j++) {
                int nx = ps2[idx].first + (ps1[j].first - ps1[j - 1].first);
                int ny = ps2[idx].second + (ps1[j].second - ps1[j - 1].second);
                auto next_it = find(ps2.begin(), ps2.end(), make_pair(nx, ny));
                if (next_it == ps2.end())break;
                idx = next_it - ps2.begin();
                if (j == m - 1) {
                    cout << ps2[i].first - ps1[0].first << " " << ps2[i].second - ps1[0].second << endl;
                    f = true;
                }
            }
            if (f)break;
        }
    }
    return 0;
}



Measured memory_bytes: 3196
#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#ifndef bits/stdc++.h
  #include <bits/stdc++.h>
#endif /* end of include guard */

using namespace std;


#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

int main(){
  int n, m;
  cin >> n >> m;
  if(n == 1)
  {
    cout << m << endl;
    return 0;
  }
  // int tmp = ceil(pow(m, 0.5));
  int tmp = ceil(m / 2);

  for (int i = tmp; i >= 1; i--) {
    if(m % i == 0 && m / i >= n)
    {
      cout << i << endl;
      return 0;
    }
  }

}


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

signed main()
{
	ios::sync_with_stdio(false);
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&a!=c) cout<<"Yes"<<endl;
	else if(b==c&&b!=a) cout<<"Yes"<<endl;
	else if(c==a&&c!=b) cout<<"Yes"<<endl;
	else cout<<"No"<<endl; 
	return 0;
}

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

int main(){
  int n;
  cin >>n;
  if(n%10==3) cout << "bon" << endl;
  else if(n%10==0 || n%10==1 || n%10==6 || n%10==8) cout << "pon" << endl;
  else cout << "hon" << endl;
  return 0;
}

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



int main() {
  int n, k;
  cin >> n >> k;
  
  vector<int> prices(n);
  rep(i, n) {
    cin >> prices.at(i);
  }
  
  sort(prices.begin(), prices.end());
  int ans=0;
  rep(i, k) {
    ans += prices.at(i);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <queue>
using namespace std;
int n;
map<string,vector<string> > tbl;
set<string> T;
map<string,bool> used;

void solve(string s){
  queue<string> Q;
  Q.push(s);
  while(Q.size()){
    string u = Q.front(); Q.pop();
    if(used[u]) continue;
    used[u]=true;
    if(tbl[u].empty()) T.insert(u);
    else
      for(string v : tbl[u])
	Q.push(v);
  }
}

int main(){
  while(cin>>n,n){
    tbl.clear();
    T.clear();
    used.clear();
    string key0="";
    for(int i=0;i<n;++i){
      string s;
      cin >> s;
      for(int j=0;j<s.length();++j)
	if(s[j]==':' || s[j]==',' || s[j]=='.') s[j]=' ';
      string key;
      stringstream ss;
      ss<<s;
      ss >> key;
      if(key0=="") key0=key;
      string tmp;
      while(ss >> tmp) tbl[key].push_back(tmp);
    }
    solve(key0);
    cout << T.size() << endl;
  }

  return 0;
}

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

int main(void){
    
    bool isFirst = true;
    char midC;
    while(true){
        
        int H,W;
        cin >> H >> W;
        
        if (H==0 && W == 0) break;
        
        // 2度目以降の枠の場合、前に改行を加える
        if (isFirst) isFirst = false;
        else cout << endl;
        
        
        for(int r = 0; r < H; r++){
            for(int c = 0; c < W; c++){
                if ((r+c) % 2 == 0) cout << "#";
                else cout << ".";
            }
            cout << endl;
        }
    }
    cout << endl;
    return 0;
}



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

const int mod = 1e9 + 7;

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

    for(int i=0; i<s.length(); i++){
        s[i] += n;
        if(s[i] > 90) s[i] -= 26;
    }

    cout << s << endl;

    // char c = 'A';
    // for(int i=0; i<=64; i++){
        
    //     cout << i << ":" << (char)(c + i) << " "<< c + i << endl;
    // }    
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,x[5];
    cin>>a>>b;
    x[0]=a+b;
    x[1]=a-b;
    x[2]=a*b;
    sort(x,x+3);
    int max=x[0];
    for(int i=1;i<=2;i++)
    {
        if(max<x[i])
            max=x[i];
    }
    cout<<max<<endl;

  return 0;

}


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

d = 2
ans = 0

while d * d <= n:
    if n % d != 0:
        d += 1
        continue
    
    z  = d
    
    while n % z == 0:
        n //= z
        z *= d
        ans += 1
        
    while n % d == 0:
        n /= d

if n != 1:
    ans += 1
    
print(ans)

Measured memory_bytes: 9256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
set<string> cat, rabbit;

bool isCat(string S) {
    //cerr << S << endl;
    if(cat.find(S) != cat.end()) return true;
    if(rabbit.find(S) != rabbit.end()) return false;
    if(S == "") return true;
    if(S[0] != 'm' || S.back() != 'w') {
        rabbit.insert(S);
        return false;
    }
    int n = S.size();
    for(int i = 1; i + 1 < S.size(); i++) {
        if(S[i] != 'e') continue;
        if(!isCat(S.substr(1, i - 1))) continue;
        if(!isCat(S.substr(i + 1, n - i - 2))) continue;
        cat.insert(S);
        return true;
    }
    rabbit.insert(S);
    return false;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    if(isCat(S)) cout << "Cat" << endl;
    else cout << "Rabbit" << endl;
    return 0;
}



Measured memory_bytes: 7388
#include <iostream>
#include <sstream>
#include <set>
#include <cstring>
using namespace std;

int n, k;
string t[12];
bool used[12];
set<string> ans;

string itos(int x){
  stringstream ss;
  ss << x;
  return ss.str();
}

void dfs(int cnt, string s){
  if(cnt == k){
    ans.insert(s);
    return;
  }

  for(int i = 0; i < n; i++){
    if(used[i]) continue;
    used[i] = true;
    dfs(cnt + 1, s + t[i]);
    used[i] = false;
  }
}

int main(){
  while(cin >> n >> k, n || k){
    for(int i = 0; i < n; i++){
      int x;
      cin >> x;
      t[i] = itos(x);
    }
    ans.clear();
    memset(used, 0, sizeof(used));
    dfs(0, "");
    cout << ans.size() << endl;
  }
}

Measured memory_bytes: 1476
import java.util.*;

public class Main {
    public static void main(String[] args){
        ABC161C();
    }
    private static void ABC161C() {
        // no comment, no error check
        final int INPUT_LINES_CNT = 1;
        final String DATA_SPLIT_SPACE = " ";

        ArrayList<String> inputLines = getStdInMultiLines(INPUT_LINES_CNT);

        if (inputLines.size() == 0) {
            System.out.println(0);
            return;
        }
        
        String outputStr = "0";
        try {
            List<String> inputLineList= 
            Arrays.asList((inputLines.get(0)).split(DATA_SPLIT_SPACE));

            long min = Long.valueOf(inputLineList.get(0));
            long k = Long.valueOf(inputLineList.get(1));

            min = min <= k ? min : min % k ;
            min = min > 0 ? Math.abs(min - k) < min ? Math.abs(min - k) : min : 0;
            outputStr = String.valueOf(min);
        }
        catch (Exception ex) {
            outputStr = "0";
        }

        System.out.println(outputStr);
        return;
    }

    private static int getStdInNum() {
        String line1 = getStdInSingleLine();
        if (isNumber(line1)) {
            return Integer.parseInt(line1);
        }
        return 0;
    }

    private static ArrayList<String> getStdInMultiLines() {
        int cnt = 0; 
        int max = 0;

        Scanner cin = new Scanner(System.in);
        ArrayList<String> list = new ArrayList<String>();
        for (;cin.hasNext();) {
            list.add(cin.nextLine());
            if (cnt++ == 0) {
                max = Integer.parseInt((list.get(0)).split(" ")[0]);
            }
            else if (cnt == max + 1) {
                break;
            }
        }
        cin.close();
        return list;
    }
    private static ArrayList<String> getStdInMultiLines(int inputLinesCnt) {
        int cnt = 0; 

        Scanner cin = new Scanner(System.in);
        ArrayList<String> list = new ArrayList<String>();
        for (;cin.hasNext();) {
            list.add(cin.nextLine());
            if (++cnt == inputLinesCnt) {
                break;
            }
        }
        cin.close();
        return list;
    }

    private static String getStdInSingleLine() {
        Scanner cin = new Scanner(System.in);

        for (;cin.hasNext();) {
            cin.close();
            return cin.nextLine();
        }

        cin.close();
        return "";
    }

    private static boolean isNumber(String val) {
        try {
            Integer.parseInt(val);
            return true;
        }
        catch (NumberFormatException nfex) {
            return false;
        }
    }

    private static List<Integer> toArrayInteger(List<String> array) {
        try {
            List<Integer> list = new ArrayList<Integer>(array.size());
            for (int i = 0; i < array.size(); i++) {
                list.add(Integer.valueOf(array.get(i)));
            }
            return list;
        }
        catch (NumberFormatException nfex) {
            return new ArrayList<Integer>();
        }
    }
}


Measured memory_bytes: 25044
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

    # 開催日数
    D = int(input())
    # 満足度の下がりやすさ
    C = list(map(int, input().split()))
    # 得られる満足度
    S = [ list(map(int, input().split())) for _ in range(D) ]
    # 最後に開かれた日付
    last = [0]*26

    def cp(d, j):
        c = 0
        for i in range(26):
            if i == j:
                last[i] += 1
            c += C[i] * (d - last[i])
            if i == j:
                last[i] -= 1
        return c

    for i in range(D):
        score_list = [
            S[i][j] - cp(i+1, j) for j in range(26)
        ]
        max_score = max(score_list)
        max_index = score_list.index(max_score)
        last[max_index] += 1
        print(max_index + 1)


main()

Measured memory_bytes: 9408
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std ;

vector<vector<pair<double,ll> > >g;
set < pair<double,ll> > myset;
const double MAX = 100000000000010;

ll dis[1312][3];

int main()
{
   cin>>dis[0][0]>>dis[0][1]>>dis[1][0]>>dis[1][1];
   ll n;
   cin>>n;
   g.resize(n+104);
   for(int i=2;i<n+2;i++)
    {
        cin>>dis[i][0]>>dis[i][1]>>dis[i][2];
    }
    for(int i=0;i<n+2;i++)
    {
        for(int j=0;j<n+2;j++)
        {
            if(j!=i)
            {

                double pp=sqrt((dis[i][0]-dis[j][0])*(dis[i][0]-dis[j][0])+(dis[i][1]-dis[j][1])*(dis[i][1]-dis[j][1]));
                pp-=(dis[i][2]+dis[j][2]);
                if(pp<0)pp=0;
                g[i].pb(mp(pp,j));
            }
        }
    }


    int s = 0;
    vector<long double> d ;
    d.resize(n+104,MAX);
    d[s] = 0;

    myset.insert (make_pair (d[s], s));
    while (!myset.empty()) {
        ll v = myset.begin()->second;
        myset.erase (myset.begin());

            for (ll j=0; j<g[v].size(); ++j) {
                    ll to = g[v][j].second;
                    double len = g[v][j].first;
                    if (d[v] + len < d[to]) {
                        myset.erase (make_pair (d[to], to));
                        d[to] = d[v] + len;

                        myset.insert (make_pair (d[to], to));
                    }
                }
            }
    cout<<setprecision(10) << fixed << d[1]<<endl;

}


Measured memory_bytes: 16384
#include<stdio.h>
int main(){
  int h,w,i,j,odd=0;
  scanf("%d%d",&h,&w);
  int a[h+1][w+1];
  int change[h*w+1][4];
  for(i=1;i<=h;i++)
    for(j=1;j<=w;j++){
      scanf("%d",&a[i][j]);
      if(a[i][j]%2==1)
        odd++;
    }
  odd-=odd%2;
  int check=0,count=0;
  i=1;
  while(i<=h){
    for(j=1;j<=w;j++){
      if(check==odd)
        break;
      if((a[i][j]+check)%2==1){
        change[count][0]=i;
        change[count][1]=j;
        if(j==w){
          change[count][2]=i+1;
          change[count][3]=j;
        }
        else{
          change[count][2]=i;
          change[count][3]=j+1;
        }
        count++;
        if(check%2==0)
          check++;
      }
      else if(check%2==1)
        check++;
    }
    i++;
    for(j=w;j>=1;j--){
      if(check==odd)
        break;
      if((a[i][j]+check)%2==1){
        change[count][0]=i;
        change[count][1]=j;
        if(j==1){
          change[count][2]=i+1;
          change[count][3]=j;
        }
        else{
          change[count][2]=i;
          change[count][3]=j-1;
        }
        count++;
        if(check%2==0)
          check++;
      }
      else if(check%2==1)
        check++;
    }
    i++;
  }
  printf("%d\n",count);
  for(i=0;i<count;i++)
    printf("%d %d %d %d\n",change[i][0],change[i][1],change[i][2],change[i][3]);
  return 0;
}


Measured memory_bytes: 6912
def solve():

    for i in range(N+1):
        for j in range(N+1):
            k = (Y - (10000*i + 5000*j)) / 1000
            if i+j+k == N and k>=0:
                print(i, j, int(k))
                exit()
    print(-1, -1, -1)

if __name__=="__main__":
    N, Y = list(map(int, input().split()))
    solve()


Measured memory_bytes: 3060
from fractions import gcd
a,b,c,d = map(int,input().split())
 
e = c*d//gcd(c,d)
A = (a-1)//c + (a-1)//d - (a-1)//e
B = b//c + b//d -b//e
print(b - a + 1 + A - B)

Measured memory_bytes: 5048
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 1000000000000
#define fr first
#define sc second
using vl =vector<ll>;
using vvl =vector<vl>;
const ll md = 998244353;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    cout << !(n&1) << "\n";
    return 0;
}

Measured memory_bytes: 3688
n, k = map(int, input().split())

ab = [[int(i) for i in input().split()] for _ in range(n)]

if k <= 1:
    ans = 0
    for a, b in ab:
        if a <= k:
            ans += b
    print(ans)
    exit()

d = 2
for i in range(31):
    if k < d:
        d //= 2
        break
    d *= 2

ans = 0
for a, b in ab:
    if a | k <= k:
        ans += b

while d > 0:
    temp_k = (k - d) | (d - 1)
    temp_ans = 0
    for a, b in ab:
        if a | temp_k <= temp_k:
            temp_ans += b
    ans = max(ans, temp_ans)
    #print(d, temp_k, temp_ans)
    d //= 2

print(ans)


Measured memory_bytes: 21112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

struct ConvexHullTrick {
    struct Line {
        long long a, b;
        long long get(long long x) { return a * x + b; }
    };
    deque<Line> que;
    bool check(Line a, Line b, Line c) {
        return (b.b - c.b) * (b.a - a.a) <= (a.b - b.b) * (c.a - b.a);
    }
    void add(long long a, long long b) {
        Line l{a, b};
        while(que.size() > 1 && check(que[que.size() - 2], que.back(), l))
            que.pop_back();
        que.push_back(l);
    }
    long long query(long long x) {
        if(que.empty()) return INT64_MAX;
        while(que.size() > 1 && que[0].get(x) >= que[1].get(x))
            que.pop_front();
        return que[0].get(x);
    }
};

int main() {
  ll n,c;
  cin >> n >> c;
  vec h(n);
  for(ll i=0;i<n;i++) {
    cin >> h[i];
  }
  ConvexHullTrick cht;
  vec dp(n);
  cht.add(-2*h[0],h[0]*h[0]);
  for(ll i=1;i<n;i++) {
    dp[i]=cht.query(h[i])+h[i]*h[i]+c;
    cht.add(-2*h[i],h[i]*h[i]+dp[i]);
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 8544
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;


bool isInTriangle(double x[3], double y[3], double xp, double yp)
{
	double c[3];
	for (int i = 0; i < 3; ++i)
		c[i] = (x[(i+1)%3]-x[i]) * (yp - y[i]) - (y[(i+1)%3]-y[i]) * (xp - x[i]);

	return c[0] > 0 && c[1] > 0 && c[2] > 0
		|| c[0] < 0 && c[1] < 0 && c[2] < 0;
}

int main()
{
	while (true)
	{
		int n;
		scanf("%d\n", &n);
		if (n == 0)
			break;

		double x[100];
		double y[100];
		for (int i = 0; i < n; ++i)
			scanf("%lf,%lf\n", x+i, y+i);

		int res = 0;
#define SUCC(w) ((w+1) % n)
		for (int i = 0; i < n; ++i)
		{
			double xp = x[i];
			double yp = y[i];
			bool isOutOfAnyTriangles = true;
			for (int a = SUCC(i); a != i; a = SUCC(a))
			{
				for (int b = SUCC(a); b != i; b = SUCC(b))
				{
					for (int c = SUCC(b); c != i; c = SUCC(c))
					{
						double xx[] = { x[a], x[b], x[c] };
						double yy[] = { y[a], y[b], y[c] };
						if (isInTriangle(xx, yy, xp, yp))
						{
							isOutOfAnyTriangles = false;
							goto End;
						}
					}
				}
			}
End:
			if (!isOutOfAnyTriangles)
				++res;
		}
		printf("%d\n", res);
	}

	return 0;
}

Measured memory_bytes: 872
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int P = 1e9 + 7;
ll power(ll x, ll t) {
	ll ret = 1;
	for(; t; t >>= 1, x = x * x % P) {
		if(t & 1) {
			ret = ret * x % P;
		}
	}
	return ret;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s;
	int n;
	cin >> n >> s;
	vector<vector<ll> > dp(n + 1, vector<ll> (n + 1, 0));
	dp[0][0] = 1;
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j <= n; ++j) {
			dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * 2) % P;
			dp[i + 1][max(j - 1, 0)] = (dp[i + 1][max(j - 1, 0)] + dp[i][j]) % P;
		}
	}
	ll ans = dp[n][s.size()], inv = power(2, P - 2);
	for(int i = 0; i < s.size(); ++i) {
		ans = ans * inv % P;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 195840
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int s = scanner.nextInt();
        int s1 = s / 100;
        int s2 = s % 100;

        boolean isMonth1 = isMonth(s1);
        boolean isMonth2 = isMonth(s2);

        String result;
        if (isMonth1) {
            result = isMonth2 ? "AMBIGUOUS" : "MMYY";
        } else if (isMonth2) {
            result = "YYMM";
        } else {
            result = "NA";
        }
        System.out.println(result);
    }

    private static boolean isMonth(int num) {
        return 1 <= num && num <= 12;
    }
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll R;
    cin >> R;
    cout << OF64 << 2.0 * R * M_PI << endl;
    return 0;
}

Measured memory_bytes: 3780
#include <iostream>
using namespace std;
int main(void){
    char a,b,c;
    char a2 , b2 ,c2;
    cin >> a >> b >> c;
    cin >> a2 >> b2 >> c2;
    
    if(a==c2&&b==b2&&c==a2){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    
    
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

/*

*/

ll n,m=0,sum=0;

int main(void){
	cin>>n;
	rep(i,n){
		ll a;
		cin>>a;
		sum+=a;
		m=max(m,a);
	}
	cout<<sum-m/2<<endl;
	return 0;
}

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

N = int(input())
dv1 = make_divisors(N)
dv2 = sorted(dv1, reverse=True)
dv = min([dv1[i]+dv2[i] for i in range(len(dv1))])
print(dv-2)


Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define soja(i,a,n) for(ll i=a;i<=n;i++)
#define ulta(i,n,a) for(ll i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define ve vector<ll>
#define se set<ll>
#define pll vector<pair<ll,ll>>
#define ma map<ll,ll>
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const string space=" ";
int main()
{
    fast;
    bool fg=0;
    ll n,m,t,f=0,s=0;
    cin>>n;
    cin>>m>>t;
    soja(i,m,t)
    {
        if(i%n==0)
        {
            fg=1;
            break;
        }
    }
    if(fg==1)
        cout<<"OK"<<endl;
    else
        cout<<"NG"<<endl;
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)




int main() {
  ll N, X, T;
  cin >> N >> X >> T;
  //vector<ll> a(N);
  //vector<vector<int>> data(3, vector<int>(4));
  if (N % X ==0) cout << ((N / X)) * T << endl;
  else cout << ((N / X) +1) * T << endl;

  return 0;
}


Measured memory_bytes: 3632
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
l=[]
x=0#b[i]より大きいa[i]の数
y=0#b[i]より小さいa[i]の数
z=0#負数の総和
for i in range(n):
    if a[i]>=b[i]:
        x+=1
        l.append(a[i]-b[i])
    else:
        y+=1
        z+=a[i]-b[i]
l.sort(reverse=True)

#print(x,y,z,l)
if x==n:
    print(0)
    exit()
ans=y
for i in range(x):
    z+=l[i]
    ans+=1
    if z>=0:
        print(ans)
        exit()
if z<0:
    print(-1)

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

using namespace std;

typedef long long ll;
typedef pair<int,int> p;


int main()
{
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  int maxv = max({a, b, c});
  for (int i = 0; i < k; i++){
    maxv *= 2;
  }

  if (a >= b && a >= c) {
    a = maxv;
  }else if (b >= a && b >= c){
    b = maxv;
  }else{
    c = maxv;
  }

  cout << a + b + c << endl;
  return 0;
}


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

#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using ll = long long;
const int H = 105, W = 8;
const ll MOD = 1e9 + 7;

int h, w, k;
ll dp[H][W], fib[10];

void pre() {
	fib[0] = 0, fib[1] = 1;
	for (int i = 2; i < 10; ++i) fib[i] = fib[i - 1] + fib[i - 2];
	int sum = 0;
	for (int i = 0; i < 10; ++i) {
		sum += fib[i];
		fib[i] = sum;
	}
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin >> h >> w >> k;
	dp[0][0] = 1;
	pre();
	
	for (int i = 1; i <= h; ++i) {
		for (int j = 0; j < w; ++j) {
			for (int l = -1; l <= 1; ++l) {
				int width = j + l;
				if (width >= 0 && width < w) {
					// Left slots avail, right slots avail
					ll la = j, ra = w - j - 1;
					--la, --ra;
					if (l == -1) --la;
					if (l == 1) --ra;
					la = max(0ll, la), ra = max(0ll, ra);
					la = fib[la] + 1, ra = fib[ra] + 1;
					
					ll toAdd = ((dp[i - 1][width] % MOD) * la) % MOD;
					toAdd *= ra, toAdd %= MOD;
					
					dp[i][j] = (dp[i][j] + toAdd) % MOD;
				}
			}
		}
	}
	
	cout << dp[h][k - 1] % MOD;
}


Measured memory_bytes: 3648
//Daniel Grzegorzewski
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

int n, k;
string s;

int main() {
  init_ios();
  cin >> n >> k >> s;
  --k;
  s[k] += 'a'-'A';
  cout<<s<<"\n";
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 10007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------
int n,a[2000];
//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    cin>>n;
    REP(i,0,n)cin>>a[i];

    int sum=0;
    REP(i,0,n)sum+=a[i];

    bitset<2001*2001>dp;

    dp.set(0);

    REP(i,0,n){
        dp|=dp<<a[i];
    }

    REP(i,(sum+1)/2,2001*2001){
        if(dp[i]){
            cout<<i<<endl;
            return 0;
        }
    }
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------

































Measured memory_bytes: 1920
mod=1e9+7
import sys
input=sys.stdin.readline

if __name__ == '__main__':
    N,M=list(map(int,input().split()))
    S=list(map(int,input().split()))
    T=list(map(int,input().split()))
    sum=[[0 for i in range(M+1)] for j in range(N+1)]
    dp=[[0 for i in range(M+1)] for j in range(N+1)]

    for i in range(N):
        for j in range(M):
            if S[i]==T[j]:
                dp[i+1][j+1]+=sum[i][j]+1
                dp[i+1][j+1]%=mod
            else:
                dp[i + 1][j + 1] =0

            sum[i+1][j+1]=sum[i][j+1]+sum[i+1][j]-sum[i][j]+dp[i+1][j+1]
            sum[i + 1][j + 1]%=mod


    ans=sum[N][M]+1
    print(int(ans))



Measured memory_bytes: 237448
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author indy256
 */

#include <bits/stdc++.h>

using namespace std;

void solve(istream &in, ostream &out) {
    int n;
    in >> n;

    vector<vector<pair<int, int>>> xy(n);
    for (int i = 0; i < n; ++i) {
        int a;
        in >> a;
        for (int j = 0; j < a; ++j) {
            int x, y;
            in >> x >> y;
            xy[i].emplace_back(x - 1, y);
        }
    }

    int res = 0;
    for (int mask = 0; mask < 1 << n; ++mask) {
        bool ok = true;
        for (int i = 0; i < n; ++i) {
            if ((mask & (1 << i)) == 0)continue;
            for (int j = 0; j < xy[i].size(); ++j) {
                if (xy[i][j].second == 1 ^ (mask & (1 << xy[i][j].first)) != 0) {
                    ok = false;
                }
            }
        }
        if (ok) {
            res = max(res, __builtin_popcount(mask));
        }
    }
    out << res << '\n';
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solve(in, out);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

int p[105000];
long long s[105000];

int main(){
    p[0] = p[1] = 1;
    for(int i = 2;i * i <= 105000;i++){
	if(p[i])continue;

	for(int j = i * i;j < 105000;j+=i){
	    p[j] = 1;
	}
    }
    int r = 1;
    for(int j = 0;j <= 105000;j++){
	if(p[j] == 0){
	    s[r] = s[r - 1] + j;
	    r++;
	}
    }
    int n;
    while(cin >> n, n){
	cout << s[n] << endl;
    }
    return 0;
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#define INFILE freopen("input.txt", "r", stdin)
#else
#define debug(x)
#define INFILE
#endif

#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll INF = 1LL << 60;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

ll dp[100010];

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> h(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &h[i]);
  }
  Fill(dp, INF);
  dp[0] = 0;

  REP(i, 1, N) {
    ll s1 = i - 1 < 0 ? INF : abs(h[i - 1] - h[i]);
    ll s2 = i - 2 < 0 ? INF : abs(h[i - 2] - h[i]);
    if (i > 0) chmin(dp[i], dp[i - 1] + s1);
    if (i > 1) chmin(dp[i], dp[i - 2] + s2);
  }

  cout << dp[N - 1] << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 1792