akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int H, W;
vector<string>vec;

int main(void)
{
	cin >> H >> W;
	for (int i = 0; i < H; ++i)
	{
		string s; cin >> s;
		vec.push_back(s);
	}
	auto b = [&](int i, int j) {
		if (i < 0 || j < 0 || i >= H || j >= W)return 0;
		else return (vec[i][j] == '#') ? 1 : 0;
	};
	int dx[] = { -1,-1,-1,0,0,1,1,1 };
	int dy[] = { -1,0,1,-1,1,-1,0,1 };
	for (int i = 0; i < H; ++i)
	{
		for (int j = 0; j < W; ++j)
		{
			if (vec[i][j] == '.')
			{
				vec[i][j] = '0';
				for (int d = 0; d < 8; ++d) {
					vec[i][j] += b(i + dx[d], j + dy[d]);
				}
			}
		}
	}
	for (string s : vec)cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  long long m,n;
  scanf("%lld%lld",&m,&n );
  long long r = 1000000007;
  int b[32];
  long long na =n;
  int i = 0;
  while ( na != 0) {
      b[i] = na % 2;
      na /= 2;
      i++;
  }
  long long a[32];
  a[0] = m;
  for (int j = 1; j < i ; j++) {
    a[j] = a[j - 1] * a[j - 1];
    a[j] = a[j] % r;
  }
  long long ans = 1;
   for (int j = 0; j < i; j++) {
      if (b[j] != 0) {
        ans *= a[j];
        ans = ans % r;
      }
   }
   printf("%lld\n",ans );
   return 0;
}


Measured memory_bytes: 2104
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC123D
{
    class MainClass
    {

        static int[] xyzk;
        static long[] a;
        static long[] b;
        static long[] c;

        public static void Main(string[] args)
        {

            xyzk = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
            a = Array.ConvertAll(Console.ReadLine().Split().ToArray(), long.Parse);
            b = Array.ConvertAll(Console.ReadLine().Split().ToArray(), long.Parse);
            c = Array.ConvertAll(Console.ReadLine().Split().ToArray(), long.Parse);


            var alst = a.ToList();
            var blst = b.ToList();
            var clst = c.ToList();

            alst.Sort((x, y) => y.CompareTo(x));
            blst.Sort((x, y) => y.CompareTo(x));
            clst.Sort((x, y) => y.CompareTo(x));
            var abclst = new List<long>();
            for(int i = 0; i < xyzk[0]; i++)
            {
                for (int j = 0; j < xyzk[1]; j++)
                {
                    if ((i + 1) * (j + 1) > xyzk[3])
                    {
                        break;
                    }
                    for (int k = 0; k < xyzk[2]; k++)
                    {
                        if ((i + 1) * (j + 1) * (k + 1) > xyzk[3])
                        {
                            break;
                        }
                        abclst.Add(alst[i] + blst[j] + clst[k]);
                    }
                }
            }
            abclst.Sort((x, y) => y.CompareTo(x));

            for(int i = 0; i < xyzk[3]; i++)
            {
                Console.WriteLine(abclst[i]);
            }
        }
    }
}


Measured memory_bytes: 15456
N = int(input())
A = list(map(int,input().split()))

A.sort(reverse = True)
a=0
b=0
cnt = 1
for i in range(1,len(A)):
    if A[i]==A[i-1]:
        cnt+=1
    else:
        cnt=1
        
    if cnt==2:
        if a==0:
            a=A[i]
        elif b==0:
            b=A[i]
        cnt=0
        
        if a*b!=0:
            break

print(a*b)

Measured memory_bytes: 20012
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>

int lcs(const std::string& x, const std::string& y)
{
    int c[x.size()][y.size()] = {0};
    for (int i = 0; i < x.size(); ++i) {
        for (int j = 0; j < y.size(); ++j) {
            if (i == 0) {
                if (j == 0) {
                    if (x[i] == y[j]) {
                        c[i][j] = 1;
                    } else {
                        c[i][j] = 0;
                    }
                } else {
                    if (x[i] == y[j]) {
                        c[i][j] = 1;
                    } else {
                        c[i][j] = c[i][j-1];
                    }
                }
            } else if (j == 0) {
                if (i == 0) {
                    if (x[i] == y[j]) {
                        c[i][j] = 1;
                    } else {
                        c[i][j] = 0;
                    }
                } else {
                    if (x[i] == y[j]) {
                        c[i][j] = 1;
                    } else {
                        c[i][j] = c[i-1][j];
                    }
                }
            } else {
                if (x[i] == y[j]) {
                    c[i][j] = c[i-1][j-1] + 1;
                } else {
                    c[i][j] = std::max(c[i][j-1], c[i-1][j]);
                }
            }
        }
    }

    return c[x.size() -1][y.size()-1];
}

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

    std::string x;
    std::string y;
    for (int i = 0; i < n; ++i) {
        std::cin >> x >> y;
        std::cout << lcs(x, y) << std::endl;
    }

    return 0;
}


Measured memory_bytes: 7060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
#define mod 200003
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;
using pl = pair<ll,ll>;
using vvb=vector<vector<bool>>;
using vb= vector<bool>;
ll f(ll a,ll b,ll p){
	if(b==0) return 1;
	if(b%2==0){
		ll t=f(a,b/2,p);
		return t*t%p;
	}
	return a*(f(a,b-1,p))%p;
} 

//__builtin_popcount()
signed main(){
	ll n; cin>>n;
	string s; cin>>s;
	ll ans=0;
	rep(i,0,n){
		map<char,ll> a,b;
		rep(j,0,i){
			a[s[j]]++;
		}
		rep(j,i,n){
			b[s[j]]++;
		}
		ll cnt=0;
		for(auto c:a){
			if(b[c.first]>0)cnt++;
		}
		chmax(ans,cnt);
	}
	cout<<ans<<endl;



	return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <cstdlib>
#include <cstring>

typedef long long LL;
const int maxn = 15;

int n;
char s[maxn];
LL ans;

void dfs(int p,LL sum,LL num)
{
	if(p == n)
	{
		num = num * 10 + (s[p] - '0');
		sum += num;
		
		ans += sum;
	}
	else
	{
		num = num * 10 + (s[p] - '0');
		dfs(p + 1, sum + num, 0);
		dfs(p + 1, sum, num);
	}
}
int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	
	dfs(1, 0, 0);
	
	printf("%lld", ans);
	return 0;
}

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

int main()
{
	int ans = 0;
	string s,t;
	cin >> s >>t;
	for(int i = 0; i < 3;++i)
	{
		if(s[i]==t[i]) ++ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dx[2]={-1,0};
const int dy[2]={0,-1};
int n,m,it,inf,d,i,j,x,y,nx,ny,fi,fr,qx[105*105],qy[105*105],f[105][105],u[105][105];
char s[105][105];
int main() {
  scanf("%d%d",&n,&m);
  for (i=0; i<n; i++) scanf("%s",s[i]);
  memset(f,100,sizeof(f));
  inf=f[0][0];
  f[0][1]=f[1][0]=0;
  for (i=1; i<=n; i++) for (j=1; j<=m; j++) if (s[i-1][j-1]=='.') {
    for (d=0; d<2; d++) {
      x=i+dx[d];
      y=j+dy[d];
      f[i][j]=min(f[i][j],f[x][y]);
    }
  } else {
    u[i][j]=++it;
    qx[fi=0]=i; qy[0]=j;
    for (fr=1; fi<fr; fi++) {
      x=qx[fi];
      y=qy[fi];
      for (d=0; d<2; d++) {
        nx=x+dx[d];
        ny=y+dy[d];
        f[i][j]=min(f[i][j],f[nx][ny]+1);
        if (nx>=1 && ny>=1 && s[nx-1][ny-1]=='#' && u[nx][ny]!=it) {
          u[nx][ny]=it;
          qx[fr]=nx; qy[fr++]=ny;
        }
      }
    }
  }
  printf("%d\n",f[n][m]);
  return 0;
}


Measured memory_bytes: 892
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll =long long;
using P = pair<int,int>;

int main(){
    int n,m;
    cin >> n >> m;
    if(6<=n && n<=12)
        m/=2;
    if(n<=5)
        m=0;

    cout << m << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(std::unique(all(x)), x.end());
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=acos(-1);
using namespace std;
vector<int> dx={1,0,-1,0};
vector<int> dy={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

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

vector<ll> kai(1001001);
vector<ll> kaijou() {
    vector<ll> vec(1001001,1);
    rep(i,1001000) vec[i+1]=(vec[i]*(i+1))%MOD;
    return vec;
}

ll comb(int x,int y){
    if(x<y || y<0)  return 0;
    return kai[x]*modinv(kai[x-y]*kai[y],MOD)%MOD;
}

int main() {
    kai=kaijou();
    ll x,y;
    cin>>x>>y;
    if((x+y)%3!=0) {
        cout<<0<<endl;
        return 0;
    }
    
    ll left=(x+y)/3;
    ll right=2*left;
    
    //cout<<left<<" "<<right<<endl;
    if(left>min(x,y) || right<max(x,y)) {
        cout<<0<<endl;
        return 0;
    }
    
    cout<<comb(left,min(x,y)-left)<<endl;
}


Measured memory_bytes: 15872
eval'H,W,A,B='+`tr ' ' ,`
f=r=1,*(1..H+W).map{r=r*_1%M=10**9+7}
p (B...W).sum{|i|(f[h=H-A-1]*f[i]*f[A-1]*f[W-1-i]).pow(M-2,M)*f[h+i]*f[A+W-i-2]}%M

Measured memory_bytes: 35124
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
const int MAX = 510000;
const int MOD = 1000000007;

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

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

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  COMinit();
  ll s;
  cin >> s;
  ll ans = 0;
  rep(i,s/3) ans += COM(s-2*i-3,i);
  ans %= MOD;
  cout << ans << endl;
}

Measured memory_bytes: 15576
#include <bits/stdc++.h>
#define pq priority_queue
#define _x first
#define _y second
#define REP(i, a, b) for (int i = a; i < b; i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vpii = vector<pii>;
using vpll = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;

void solve() {
    ll x, k, d; cin >> x >> k >> d;
    if (x < 0) x = -x;
    if (x / d >= k) cout << x - k * d;
    else if ((k - x / d) % 2 == 0) cout << x % d;
    else cout << d - x % d;
}

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

Measured memory_bytes: 3652
#include<stdio.h>

int main(){
    char s[20];
    scanf("%s", s);
    if(s[0] == 'S'){
        printf("Cloudy");
    }else if(s[0] == 'C'){
        printf("Rainy");
    }else{
        printf("Sunny");
    }

    return 0;
}

Measured memory_bytes: 128
import sys

s = input()
t = input()
ls = len(s)
lt = len(t)

ans = lt
for i in range(ls -lt + 1):
  tmp = lt
  for j in range(lt):
    if s[i + j] == t[j]:
      tmp -= 1
  ans = min(ans, tmp)
  if ans == 0:
    print(0)
    sys.exit()
  
print(ans)

Measured memory_bytes: 9128
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"
#include "stack"
#include "tuple"

#define rep(n) for (int i = 0; i < n; ++i)
#define REP(n,i) for (int i = 0; i < n; ++i)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define intinf 1000000000
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define mkt make_tuple
#define P pair<ll, ll>
typedef long long ll;
using namespace std;

int n;

int main() {
	cin >> n;
	n = ((n - 1) / 111 + 1) * 111;
	cout << n << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
   ll n,m,k;
   cin>>n>>m>>k;
   vector<ll>a;
   vector<ll>b;
  ll t;
   for(int i=0;i<n;i++)
    {
        cin>>t;
        a.push_back(t);
    }
   for(int i=0;i<m;i++)
    {
        cin>>t;
        b.push_back(t);
    }

    vector<ll>sum_a(n+1);
    sum_a[0]=0;
   for(int i=1;i<=n;i++)
    sum_a[i]=sum_a[i-1]+a[i-1];

   vector<ll>sum_b(m+1);
   sum_b[0]=0;
   for(int i=1;i<=m;i++)
    sum_b[i]=sum_b[i-1]+b[i-1];

   ll ans=0;ll other;ll temp;
   for(int i=0;i<=n;i++)
   {
       other=k-sum_a[i];
       if(other<0)
        break;
        int l=lower_bound(sum_b.begin(),sum_b.end(),other)-sum_b.begin();
        if(l>m||sum_b[l]>other)
            l--;
            temp=i+l;
        ans=max(ans,temp);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 9540
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

ll h,w;

ll f(ll a,ll b,ll c){
    ll ma=max(a,max(b,c));
    ll mi=min(a,min(b,c));
    return ma-mi;
}

ll solA(){
    ll res=1LL<<60;
    if(2<h){
        if(h%3==0) return 0;
        res=min(res,w);
    }
    if(2<w){
        if(w%3==0) return 0;
        res=min(res,h);
    }
    
    return res;
}

ll solB(){
    ll res=1LL<<60;

    for(ll x=1;x<=w-1;x++){
        ll b=h/2;
        res=min(res,f(x*b,x*(h-b),(w-x)*h));
    }
    for(ll y=1;y<=h-1;y++){
        ll b=w/2;
        res=min(res,f(y*b,y*(w-b),(h-y)*w));
    }

    return res;
}

int main(){
    cin>>h>>w;
    
    ll ans=min(solA(),solB());
    cout<<ans<<endl;
}




Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;

const int N = 100010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 97;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

// OrderedSet
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template < typename T > using ordered_set = tree < T, null_type, greater < T >, rb_tree_tag, tree_order_statistics_node_update >;

//typedef uint64_t hash_t;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//const int HASH_COUNT = 2;
//const hash_t HASH_P = (uint32_t)-13337;
//uniform_int_distribution<hash_t> MULT_DIST(0.25 * HASH_P, 0.75 * HASH_P);
//const hash_t HASH_MULT[HASH_COUNT] = {MULT_DIST(rng), MULT_DIST(rng)};

int a[N * 2];

int main(){
  int n, m;
  fastScan(n);
  for(int i = 2; i <= n; i++){
    int x, y;
    fastScan(x);
    a[x]++;
  }
  for(int i = 1; i <= n; i++){
    printf("%d\n", a[i]);
  }
  return 0;
}


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

#define F first
#define S second
#define pb push_back
#define ll long long
#define all(v) (v).begin(),(v).end()
#define endl '\n'

using namespace std;

const int N = 100005;
const int MOD = 1e9 + 7;
const int INF = 2000000000;
const ll INFLL = 1LL * INF * INF;

#define ld long double

int n, x[N], y[N];
char d[N];

ld get(ld k) {
    ld mxx = -INF, mnx = INF, mxy = -INF, mny = INF;
    for (int i = 1; i <= n; i++) {
        ld X = x[i], Y = y[i];
        if (d[i] == 'U') Y += k;
        if (d[i] == 'D') Y -= k;
        if (d[i] == 'R') X += k;
        if (d[i] == 'L') X -= k;
        mxx = max(mxx, X); mnx = min(mnx, X);
        mxy = max(mxy, Y); mny = min(mny, Y);
    }
    return (mxx - mnx) * (mxy - mny);
}

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> x[i] >> y[i] >> d[i];
    }
    int mxx = x[1], mnx = x[1], mxy = y[1], mny = y[1];
    vector <int> up, down, left, right;
    for (int i = 1; i <= n; i++) {
        if (d[i] == 'U') up.pb(i);
        if (d[i] == 'D') down.pb(i);
        if (d[i] == 'L') left.pb(i);
        if (d[i] == 'R') right.pb(i);
        mxx = max(mxx, x[i]); mnx = min(mnx, x[i]);
        mxy = max(mxy, y[i]); mny = min(mny, y[i]);
    }
    ld l = 0, r = 1e9, res = INFLL;
    for (int go = 0; go < 600; go++) {
        ld m1 = l + (r - l) / 3.0, m2 = r - (r - l) / 3.0;
        ld t1 = get(m1), t2 = get(m2);
        if (t1 < t2) {
            res = min(res, t1);
            r = m2;
        } else {
            res = min(res, t2);
            l = m1;
        }
    }
    cout << fixed << setprecision(16) << res << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
//cin.sync_with_stdio(false);

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

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;

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

	string s;
	int flag = 0;
	
	cin >> s;
	
	if (s[0] != s[1])	flag++;
	if (s[1] != s[2])	flag++;
	if (s[2] != s[0])	flag++;

	if (flag == 3)
	{
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int a, b ,c, d, e, f;
	scanf("%d", &a);
	b= a/100;
	c= b*100;
	d= a-c;
	e= d%10;
	f= d/10;
	if (b==7){
		printf("Yes\n");
	}
	else if(e==7){
		printf("Yes\n");
	}
	else if(f==7){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1616
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll a, b;
    char c;
    cin >> a >> c >> b;

    if(c == '+') {
        out(a+b);
    }
    else {
        out(a-b);
    }

    re0;
}

Measured memory_bytes: 256
h,w,k=map(int,input().split())
mod=10**9+7
dp=[[0]*w for _ in range(h+1)] #dp[i][j]:=端点iまで辺を張った時辺ｊにたどり着くあみだくじの数
dp[0][0]=1
for hi in range(1,h+1):
    for i in range(2**(w-1)):
        idx1=[]
        idx2=[]
        ok=True
        for j in range(w-1):
            if (i>>j)&1:
                idx1.append(j)
                idx2.append(j)
                idx2.append(j+1)
        if len(idx1)>=2:
            for j in range(len(idx1)-1):
                if idx1[j+1]==idx1[j]+1:
                    ok=False
        if not ok:
            continue
        idx1=set(idx1)
        idx2=set(idx2)
        for wi in range(w):
            if wi in idx1:
                dp[hi][wi]+=dp[hi-1][wi+1]
                dp[hi][wi+1]+=dp[hi-1][wi]
                dp[hi][wi]%=mod
                dp[hi][wi+1]%=mod
            if wi not in idx2:
                dp[hi][wi]+=dp[hi-1][wi]
                dp[hi][wi]%=mod
print(dp[h][k-1])

Measured memory_bytes: 44400
h,w,k = map(int,input().split())
mod = 10 ** 9 + 7
if w == 1:
  print(1)
  exit()
lis = [[0 for i in range(w)] for s in range(h+1)]
lis[0][0] = 1
dp1 = [0]
dp2 = [1]
for i in range(1,w-1):
  dp1.append(dp2[i-1])
  dp2.append(dp2[i-1] + dp1[i-1])
dp1.insert(0,0)
dp2.insert(0,0)
dp = [dp1[i] + dp2[i] for i in range(w)]
for i in range(h):
  for j in range(w):
    if j == 0 or j == w-1:num = dp[w-1]
    else:num = dp[j] * dp[w-j-1]
    lis[i+1][j] += num * lis[i][j] % mod
    if j != 0:
      lis[i+1][j-1] += max(1,dp[j-1]) * max(1,dp[w-j-1]) * lis[i][j] % mod
    if j != w-1:
      lis[i+1][j+1] += max(1,dp[j]) * max(1,dp[w-j-2]) * lis[i][j] % mod
print(lis[h][k-1] % mod)

Measured memory_bytes: 3064
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 22;
char dn[dm], * di = dn;
inline void putint(int X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

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


	int N = getint();
	int A[200000];
	rep(i, N) A[i] = getint();
	int S[600000];
	rep(i, N) S[i] = getint();
	int B0 = S[0];

	if (N == 1) {
		printf("%d %d\n", 0, A[0] ^ S[0]);
		Would you please return 0;
	}

	rep(i, N - 1) S[i] ^= S[i + 1];
	S[N - 1] ^= B0;
	rep(i, N - 1) {
		int tmp = A[i] ^ A[i + 1];
		S[i + N] = tmp;
		S[i + N + N] = tmp;
	}
	S[N + N - 1] = A[0] ^ A[N - 1];
	S[N + N + N - 1] = A[0] ^ A[N - 1];

	int Z[600000];
	N = 3 * N;
	Z[0] = N;
	int i = 1;
	int j = 0;
	while (i < N) {
		while (i + j < N && S[j] == S[i + j]) j++;
		Z[i] = j;
		if (j == 0) {
			i++;
			continue;
		}
		int k = 1;
		while (i + k < N && k + Z[k] < j) {
			Z[i + k] = Z[k];
			k++;
		}
		i += k;
		j -= k;
	}
	N /= 3;
	
	rep(i, N) {
		if (Z[i + N] >= N) {
			putint(i);
			putint(A[i] ^ B0);
		}
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

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

#define fr first
#define sc second

using namespace std;

const int N = (int)1e3 + 7;

int x[N], y[N];
int n;

main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d %d", &x[i], &y[i]);				
	}	
	vector <int> d;
	for (int i = 30; i >= 0; i--) {
		d.push_back(1 << i);
	}
	int parity = abs(x[1] + y[1]);
	parity %= 2;

	for (int i = 1; i <= n; i++) {
		if (parity != abs(x[i] + y[i]) % 2) {
			cout << -1;
			return 0;
		}
	}
	if (parity == 0) {
		d.push_back(1);
	}
	cout << d.size() << endl;
	for (int to : d) {
		cout << to << ' ';
	}          
	cout << endl;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < d.size(); j++) {
			if (abs(x[i]) < abs(y[i])) {
				if (y[i] > 0) {
					y[i] -= d[j];
					putchar('U');
				} else {
					y[i] += d[j];
					putchar('D');
				}
			} else {
				if (x[i] > 0) {
					x[i] -= d[j];
					putchar('R');
				} else {
					x[i] += d[j];
					putchar('L');
				}
			}
		}
		putchar('\n');
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=b-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 1005;
bool g[N][N];
int h,w;

int main(){
	scanf("%d %d",&h,&w);
	queue<pii> q;
	fu(i,1,h){
		fu(j,1,w){
			char c;
			scanf(" %c",&c);
			g[i][j] = c == '.';
			if(!g[i][j]){
				q.push({i,j});					
			}
		}
	}
	int cnt = 0;
	int timer = 0;
	while(q.size()){
		if(timer == 0){timer = q.size();++cnt;}
		pii p = q.front();q.pop();		
		--timer;
		if(g[p.F + 1][p.S]){g[p.F + 1][p.S] = 0;q.push({p.F+1,p.S});}
		if(g[p.F - 1][p.S]){g[p.F - 1][p.S] = 0;q.push({p.F-1,p.S});}
		if(g[p.F][p.S + 1]){g[p.F][p.S + 1] = 0;q.push({p.F,p.S+1});}
		if(g[p.F][p.S - 1]){g[p.F][p.S - 1] = 0;q.push({p.F,p.S-1});}
	}
	cout << cnt - 1 << endl;
}


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

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

Measured memory_bytes: 3636
#include<iostream>
#include<cmath>
#include<vector>
using namespace std;

int R[16][16][16][256]={0};

int main(){
  for(int S=0;S<=15;S++){
    for(int A=0;A<=15;A++){
      for(int C=0;C<=15;C++){
	R[S][A][C][0]=S;
	for(int i=1;i<256;i++){
	  R[S][A][C][i]=(A*R[S][A][C][i-1]+C)%256;
	}
      }
    }
  }
  int n;
  while(cin>>n,n){
    vector<int> v(n);
    for(int i=0;i<n;i++){
      cin>>v[i];
    }
    int s=0,a=0,c=0;
    double mi=1000000;
    for(int S=0;S<=15;S++){
      for(int A=0;A<=15;A++){
	for(int C=0;C<=15;C++){
	  int table[256]={0};
	  for(int i=0;i<n;i++){
	    table[(v[i]+R[S][A][C][i+1])%256]++;
	  }
	  double h=0.0;
	  for(int i=0;i<256;i++){
	    if(table[i]){
	      double t=(double)table[i]/n;
	      h+=(t*log(t));
	    }
	  }
	  h=-h;
	  if((mi-h) > 1e-6){
	    mi=h;
	    s=S;
	    a=A;
	    c=C;
	  }
	}
      }
    }
    cout<<s<<" "<<a<<" "<<c<<endl;
  }
  return 0;
}

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

int main() {
	int n;cin>>n;
	vector<long long> t(n),a(n);
	for(int i=0;i<n;i++){
		cin>>t[i]>>a[i];
	}
	long long anst=t[0];
	long long ansa=a[0];
	for(int i=1;i<n;i++){
		if((t[i]>=anst)*(a[i]>=ansa)){
			anst=t[i];
			ansa=a[i];
		}else{
			long long kt=(anst-1)/t[i]+1;
			long long ka=(ansa-1)/a[i]+1;
			long long k=kt;
			if(kt<ka)k=ka;
			anst=t[i]*k;
			ansa=a[i]*k;
		}
	}
	cout<<anst+ansa<<endl;

	return 0;
}


Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	int size = str.size();
	vector< vector<int> > A(26);
	for(int i=0;i<size;++i){
		A[(str[i]-'a')].push_back(i);
	}
	for(int a=0;a<26;++a){
		int asize = A[a].size();
		for(int i=1;i<asize;++i){
			int Len = A[a][i]-A[a][i-1];
			if( Len <= 2 ){
				cout << A[a][i-1]+1 << " " << A[a][i]+1 << endl;
				return;
			}
		}
	}
	cout << "-1 -1" << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


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

int main()
{
  vector<vector<int>> A(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> A[i][j];
    }
  }
  int N;
  cin >> N;
  vector<vector<int>> C(8);
  for(int i=0;i<N;i++){
    int B;
    cin >> B;
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(A[j][k]==B){
          if(j==0)C[0].push_back(B);
          if(j==1)C[1].push_back(B);
          if(j==2)C[2].push_back(B);
          if(k==0)C[3].push_back(B);
          if(k==1)C[4].push_back(B);
          if(k==2)C[5].push_back(B);
          if((j==0&&k==0)||(j==2&&k==2))C[6].push_back(B);
          if((j==0&&k==2)||(j==2&&k==0))C[7].push_back(B);
          if(j==1&&k==1){
            C[6].push_back(B);
            C[7].push_back(B);
          }
        }
      }
    }
  }
    bool f=0;
    for(int i=0;i<8;i++){
      if(C[i].size()==3)f=1;
    }
    if(f==1)cout << "Yes" << endl;
    else{
      cout << "No" << endl;
    }
} 

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
			Scanner scan = new Scanner(System.in);
			int[] k = new int[10000];
			while(true) {
				int n,cnt = 0;
				n = scan.nextInt();
				String check = "no";
				if(n == 0) break;
				for(int i = 0; i < n; i++) {
					k[i] = scan.nextInt();
					if(k[i] >= 1) cnt++;
					if(k[i] >= 2) check = "Yes";
				}
				if(check != "Yes") {
					System.out.println("NA");
				} else {
					System.out.println(cnt + 1);
				}
			}
	}
}

Measured memory_bytes: 158708
#include<stdio.h>

typedef struct que {
    char name[100];
    int time;
} S;

int head, tail;
S Q[100000];

void initialize()
{
    head = 0;
    tail = 0;
}

void enqueue(S x)
{
    Q[tail] = x;

    tail = (tail + 1) % 100000;
}

S dequeue()
{
    S x;

    x = Q[head];

    head = (head + 1) % 100000;

    return x;
}

int main()
{
    int n, q, t = 0, i;
    S Q2;

    initialize();

    scanf("%d%d", &n, &q);

    for (i = 0; i < n; i++) {
        scanf("%s%d", Q2.name, &Q2.time);
        enqueue(Q2);
    }

    while (tail != head) {
        Q2 = dequeue();

        if (Q2.time - q <= 0) {
            t += Q2.time;
            printf("%s %d\n", Q2.name, t);
        }

        else {
            Q2.time = Q2.time - q;
            enqueue(Q2);
            t += q;
        }
    }

    return 0;
}


Measured memory_bytes: 11856
#include <iostream>
#include <vector>
#include <string>
#include <set>
using namespace std;

#define ll long long

int main(){
    int N,ans=0;
    string S;
    string X,Y;
    set<char> P;
    set<char> E;
    cin >> N >> S;
    //全ての小文字に対して
    for(int i = 1; i < N-1; i++){
        X = S.substr(0, i);
        Y = S.substr(i, S.size()-i);
        int cnt = 0;
        for(char moji = 'a'; moji <= 'z'; ++moji){
            bool left = false, right = false;
            for(int i = 0; i < X.size(); i++){
                if(X[i] == moji)left = true;
            }
            for(int i = 0; i < Y.size(); i++){
                if(Y[i] == moji)right = true;
            }
            if(left && right)cnt++;
        }
        ans = max(ans,cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static final int MOD = 1000000007;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			int num = in.nextInt();
			int count = 0;
			while (num % 2 == 0 && num > 0) {
				num /= 2;
				count++;
			}
			a[i] = count;
		}
		Arrays.sort(a);
		System.out.println(a[0]);
		in.close();
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int s = n%10;
  if (s==3) cout << "bon"<< endl;
  else if (s==0||s==1||s==6||s==8)
    cout <<"pon"<<endl;
  else cout << "hon"<<endl;
}

Measured memory_bytes: 3572
n=1<<18;N,m;L[1<<18],p;F[1<<18],X[1<<18];i;
long D[1<<20],Z[1<<20],A[1<<18],x,z;
long f(a,b,k,l,r){
	D[k]+=z=Z[k];
	Z[2*k+1]+=z;
	Z[2*k+2]+=z;
	Z[k]=0;
	return a<=l&r<=b?D[k]+(Z[k]=x):l<b&a<r?D[k]=fmax(
		f(a,b,2*k+1,l,(l+r)/2),
		f(a,b,2*k+2,(l+r)/2,r)
	):D[k];
}
main(j){
	for(scanf("%d%d",&N,&m);~scanf("%d%d%ld",L+j,&p,A+j);F[p]=j++)X[j]=F[p];
	for(;i++<N;){
		//x=f(x=0,i,0,0,n);
		f(i,i+1,0,0,n);
		for(p=F[i];p!=0;p=X[p])x=A[p],x=f(L[p],i+1,0,0,n);
	}
	//printf("%ld",f(x=0,i,0,0,n));
	printf("%ld",x);
}

/*
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
####################################################################################################
*/


Measured memory_bytes: 16640
#include <stdio.h>

int main(void){
	int n,k;
	scanf("%d %d",&n,&k);
	int l[n];
	int i,j;
	int max[k];
	short flag[n];
	for(i=0;i<n;i++) {scanf("%d", &l[i]);flag[i]=0;}
	for(i=0;i<k;i++) {max[i]=0;}
	int number=0;
	int sum=0;
	for(i=0;i<k;i++){
		for(j=0;j<n;j++){
			if(max[i]<l[j]&&flag[j]==0){
				max[i]=l[j];
				number=j;
			}
		}
		flag[number]=1;
		sum+=max[i];
	}
	printf("%d", sum);
	return 0;
} 

Measured memory_bytes: 128
N = int(input())
s_list = [input() for i in range(N)]
M = int(input())
t_list = [input() for i in range(M)]
count = 0

for item in t_list:
    if item in s_list:
        s_list.remove(item)

for item in s_list:
    if count < s_list.count(item):
        count = s_list.count(item)

print(count)


Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
 
using namespace std;
 
#define pai 3.14159265359
#define mod 1000000007

int main()
{
    int n;
    cin >> n;
    int a[100001], b[100001];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        b[n - 1 - i] = a[i];
    }
    long long int ans1 = 0;
    for(int i = 0; i < n - 1; i++){
        ans1 += a[i] / 2;
        if(a[i + 1] > 0) a[i + 1] += a[i] % 2;
    }
    ans1 += a[n - 1] / 2;
    long long int ans2 = 0;
    for(int i = 0; i < n - 1; i++){
        ans2 += b[i] / 2;
        if(b[i + 1] > 0) b[i + 1] += b[i] % 2;
    }
    ans2 += b[n - 1] / 2;
    cout << max(ans1, ans2) << endl;
    return 0;
}

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int INF = INT_MAX/3;

int dp[31][1<<16];

int main()
{
    int n,c;
    while(cin >>n >>c,n)
    {
        vector<int> a(n),b(c);
        rep(i,n)rep(j,16)
        {
            int x;
            cin >>x;
            a[i] |= x<<j;
        }
        rep(i,c)rep(j,16)
        {
            int x;
            cin >>x;
            b[i] |= x<<j;
        }

        fill(dp[0],dp[31],-INF);
        dp[0][0]=0;

        rep(i,n)rep(mask,1<<16)
        {
            rep(j,c)
            {
                int mm = mask|a[i];
                int get = mm&b[j];
                int nmask = mm^get;
                dp[i+1][nmask] = max(dp[i+1][nmask], dp[i][mask]+__builtin_popcount(get));
            }
        }

        int ans = 0;
        rep(mask,1<<16) ans = max(ans,dp[n][mask]);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 11036
N, A, B = gets.chomp.split(" ").map(&:to_i)

if (B - A) % 2 == 0 then
  puts (B - A) / 2
  exit
end

if B < (N - A) + 1 then
  puts (B + A) / 2
else
  puts ((N - B) + (N - A)) / 2 + 1
end

Measured memory_bytes: 1788
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[50]={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;

signed main(){
	cin>>K;
	cout<<A[K-1]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
    int a,b;
    cin >> a >> b;
    cout << a*b << endl;

    return 0;

}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(Args&&... args) const { print(std::forward<Args>(args)...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(T&& head, Tail&&... tail) const { std::cout << head, print_rest(std::forward<Tail>(tail)...); }
        template <class T, class... Tail>
        void print_rest(T&& head, Tail&&... tail) const { std::cout << sep << head, print_rest(std::forward<Tail>(tail)...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
    template <class T>
    void print_vec(const std::vector<T>& vec, const char* sep = " ", const char* term = "\n") const {
        const size_t sz = vec.size();
        for (size_t i = 0; i < sz; i++) std::cout << vec[i] << (i == sz - 1 ? term : sep);
    }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;
    double D;
    cin >> D;
    ll cnt = 0;
    for (ll i = 0; i < N; i++) {
        double x, y;
        cin >> x >> y;
        double d = sqrt(x * x + y * y);
        if (d <= D + 1e-9) {
            ++cnt;
        }
    }
    prints()(cnt);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3864
#include <bits/stdc++.h>
using namespace std;
int n , k , d, a , ans ;
bool found[105];
int main()
{
  cin >> n >> k ;
  for ( int i = 0 ; i < k ; i++ )
  {
    cin  >> d ;
    while ( d-- ) {
      cin >> a ;
      found[a] = 1;
    }
  }
   for ( int i = 1 ; i <= n ; i++ )
     ans += (!found[i]);
   
  cout << ans ;
    return 0;
}

Measured memory_bytes: 3640
S = input()
if S == "SUN":
    print("7")
if S == "MON":
    print("6")
if S == "TUE":
    print("5")
if S == "WED":
    print("4")
if S == "THU":
    print("3")
if S == "FRI":
    print("2")
if S == "SAT":
    print("1")

Measured memory_bytes: 8940
char s[3333],t[3333];
int dp[3333][3333];
i,j;
ans(i,j){
	i&&j?s[i-1]==t[j-1]?ans(i-1,j-1),putchar(s[i-1]):dp[i][j]==dp[i-1][j]?ans(i-1,j):ans(i,j-1):0;
}
main(l)
{
	gets(s);l=strlen(gets(t));
	for(i=0;i<strlen(s);i++)
	{
		for(j=0;j<l;j++)
		{
			dp[i+1][j+1]=s[i]-t[j]?fmax(dp[i+1][j],dp[i][j+1]):dp[i][j]+1;
		}
	}
	ans(i,j);
}

Measured memory_bytes: 41216
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int h, w; cin >> h >> w;
  char goal[h][w]; rep(i, h)rep(j, w) cin >> goal[i][j];
  char start[h][w]; rep(i, h)rep(j, w) start[i][j] = '.';

  for (int yi = 0; yi < h; yi++) {
    for (int xi = 0; xi < w; xi++) {
      if (goal[yi][xi] == '.') continue;
      start[yi][xi] = '#';

      if (xi + 1 < w && goal[yi][xi + 1] != '.') {
        start[yi][xi + 1] = '#';
        continue;
      }

      if (xi - 1 >= 0 && goal[yi][xi - 1] != '.') {
        start[yi][xi - 1] = '#';
        continue;
      }

      if (yi + 1 < h && goal[yi + 1][xi] != '.') {
        start[yi + 1][xi] = '#';
        continue;
      }

      if (yi - 1 >= 0 && goal[yi - 1][xi] != '.') {
        start[yi - 1][xi] = '#';
        continue;
      }

      // debug3(yi, xi, goal[yi][xi]);

      No();
      return;
    }
  }
  Yes();
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <stdarg.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>

#define ll long long

using namespace std;

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

  vector<pair<int, int>> data;
  int a, b;
  for (int i=0; i<n; i++) {
    cin>>a>>b;
    data.push_back({a, -b});
  }
  sort(data.begin(), data.end());
  for (int i=0; i<data.size(); i++) data[i].second = -data[i].second;

  int v[3005] = {0};
  int ans = 0;
  for (int j=0; j<n; j++) {
    for (int i=t-1; i>=0; i--) {
      if ((i+data[j].first) < t) v[i+data[j].first] = max(v[i+data[j].first], v[i] + data[j].second);
      ans = max(ans, v[i] + data[j].second);
    }
  }

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



Measured memory_bytes: 256