akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>


int main(void) {
	int squares[10][10] = {0};
	int i, j;
	int count = 0, count2 = 0;
	int x, y, size;
	while( scanf("%d,%d,%d", &x, &y, &size) != EOF) {
		switch( size) {
			case 1:
				squares[y][x]++;
				if( y - 1 >= 0)
					squares[y-1][x]++;
				if( y + 1 < 10)
					squares[y+1][x]++;
				if( x - 1 >= 0)
					squares[y][x-1]++;
				if( x + 1 < 10)
					squares[y][x+1]++;
				break;
			case 3:
				if( y - 2 >= 0)
					squares[y-2][x]++;
				if( y + 2 < 10)
					squares[y+2][x]++;
				if( x - 2 >= 0)
					squares[y][x-2]++;
				if( x + 2 < 10)
					squares[y][x+2]++;
			case 2:
				for( i = y-1; i <= y+1; i++)
					for( j = x-1; j <= x+1; j++)
						if( (i >= 0 && i < 10) && (j >= 0 && j < 10))
							squares[i][j]++;
				break;
		}
	}
	for (i = 0; i < 10; i++)
		for (j = 0; j < 10; j++)
			if( squares[i][j] == 0)
				count++;
			else if( count2 < squares[i][j])
				count2 = squares[i][j];
	printf("%d\n%d\n", count, count2);
	
	return 0;
}

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

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>

#include<deque>

using namespace std;
typedef long long ll;
const int INF = 1e9+1;
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;}

int N;
//全探索だと2^Nなので最大1024^10になってしまう

int main() {
    cin >> N;
    vector<int> s(N);
    for (int i = 0; i < N; i++) cin >> s[i];
    int res = 0;
    sort(s.begin(),s.end());
    bool flag = true;
    int total = 0;
    for (int i = 0; i < N; i++) {
        if (s[i] % 10 != 0) flag = false;
        total += s[i];
    }
    if (flag) {
        cout << 0 << endl;
        return 0;
    }

    if (total % 10 != 0) {
        cout << total << endl;
    } else {
        for (int i = 0; i < N; i++) {
            if ((total - s[i]) % 10 != 0) {
                cout << total - s[i] << endl;
                return 0;
            }
        }
    }


    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 100000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;
const ll MAXN = 1e18;



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	int x,y,z;
	cin >> x >> y >> z;
	int suma = x/(y+z);
	int ama = 0;
	int maa = 0;
	if(x%(y+z) != 0 && x%(y+z) != z){
		maa++;
	}
	if(x%(y+z) == 0){
		ama+=1;
	}
	cout << suma-ama-maa << endl;
	return 0;
}



Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

void _main() {
  int N, A, B;
  cin >> N >> A >> B;

  if (0 == (B-A)%2) {
    cout << "Alice" << "\n";
  } else {
    cout << "Borys" << "\n";
  }
}

Measured memory_bytes: 256
// In the name of God 
#include <bits/stdc++.h>

using namespace std ;
 
#define int long long
#define all(v) v.begin() , v.end()

template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

const int N = 200 + 10 ;

int n , a [ N ] ; 

int32_t main()                     
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n ;
	n <<= 1 ;
	for ( int j = 0 ; j < n ; ++j ) cin >> a [ j ] ;
	sort ( a , a + n ) ;
	int res = 0 ;
	for ( int i = 0 ; i < n ; i += 2 ) res += a [ i ] ;
	cout << res << '\n' ; 
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T x; cin >> x; return x; }

signed main()
{
	int n = in();
	switch (n) {
	case 1:
		cout << "Hello World" << endl;
		break;
	case 2:
		int a = in(), b = in();
		cout << a + b << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P3;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e4 + 5);
const double EPS = 1e-11;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

void compress(vector<int> &x, map<int, int> &zip) {
    sort(x.begin(), x.end());
    x.erase(unique(x.begin(), x.end()), x.end());
    for (int i = 0; i < x.size(); i++) {
        zip[x[i]] = i;
    }
}

int n, m, a[5005][5005];

int main() {
    cin >> n >> m;
    vector<int> x(n), y(n);
    vector<P> pos(n);
    map<int,int> xzip, yzip;
    REP(i,n){
        cin >> x[i] >> y[i];
        pos[i] = {x[i],y[i]};
    }
    x.push_back(-IINF);
    x.push_back(IINF);
    y.push_back(-IINF);
    y.push_back(IINF);
    compress(x,xzip);
    compress(y,yzip);
    REP(i,n){
        int px = xzip[pos[i].first], py = yzip[pos[i].second];
        a[py][px]++;
    }
    REP(i,yzip.size()){
        REP(j,xzip.size()){
            a[i+1][j+1] += a[i+1][j] + a[i][j+1] - a[i][j];
        }
    }
    REP(i,m){
        int x1, x2, y1, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1 = lower_bound(ALL(x),x1)-x.begin()-1;
        x2 = upper_bound(ALL(x),x2)-x.begin()-1;
        y1 = lower_bound(ALL(y),y1)-y.begin()-1;
        y2 = upper_bound(ALL(y),y2)-y.begin()-1;
        cout << a[y2][x2] - a[y2][x1] - a[y1][x2] + a[y1][x1] << endl;
    }
    return 0;
}



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

const string YES = "Yes";
const string NO = "No";

void solve(long long N){
    long long num = N;
    long long dig;
    long long sum = 0;
    while(num != 0){
        dig = num % 10;
        sum = sum + dig;
        num = num / 10;
    }
    if(N % sum == 0) cout << YES << endl;
    else cout << NO << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

// mint N;

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

// combination c(N);
// mint ans = c(N,n);
// cout << ans.x << endl;

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

int main(){
  int N,M;
  cin >> N >> M;
  if(M > N){
    swap(N,M);
  }
  if(N-1 != M && M != N){
    cout << 0 << endl;
    return 0;
  }
  mint A=1,B=1;
  for(int i=1; i<=N; i++){
    A *= i;
  }
  for(int i=1; i<=M; i++){
    B *= i;
  }
  mint res;
  res = A*B;
  if((N+M)%2==0){
    res *= 2;
  }
  cout << res.x << endl;
  return 0;
}


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

using namespace std;
typedef long long int ll;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

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;
}

ll modpow(ll a, ll n, ll mod){
  ll tmp = a, val = 1;
  while(n){
    if(n % 2) val = val * tmp % mod;
    tmp = tmp * tmp % mod;
    n >>= 1;
  }
  return val;
}

int main(){
  // P(i, j) = (A^n * B^i) * (n+i)!/i!n!
  // P(i+1) = P(i) * (B / (A + B) * (n+i+1) / (i+1) + 1) * (n+i+1) / (n+i)
  ll N, A, B, C;
  cin >> N >> A >> B >> C;
  ll Pa = modpow(A, N, MOD), Pb = modpow(B, N, MOD);
  ll P = (Pa + Pb) * N % MOD;
  ll Q = modpow(A+B, N, MOD);
  rep(i, N-1){
    Pa = Pa * B * (N + i) % MOD;
    Pb = Pb * A * (N + i) % MOD;
    Q = Q * (A + B) * (i + 1) % MOD;
    P = (P * (A + B) * (i + 1) + (Pa + Pb) * (N + i + 1)) % MOD;
    // printf("Pa: %lld Pb: %lld P: %lld Q: %lld\n", Pa, Pb, P, Q);
  }
  P = P * 100 % MOD;
  Q = Q * (100 - C) % MOD;
  ll R = P * modinv(Q, MOD) % MOD;

  cout << R << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[500005];
int main()
{
    int n,k,ans=0;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]>=k)
            ans++;
    }
        cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools
import heapq
#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    n=int(input())
    total=0
    for a,b,c in itertools.product(range(1,n+1),repeat=3):
        temp1=math.gcd(a,b)
        temp2=math.gcd(temp1,c)
        total+=temp2
    print(total)



if __name__ == "__main__":

    main()

Measured memory_bytes: 68768
// ankit_singhal
#define boostit ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf push_front
#define vi vector<ll>
#define pii pair<ll,ll>
#define qi queue<ll>
#define mem(a,b) memset(a,b,sizeof(a))
#define print(a) cout<<a<<'\n'
#define sorted(arr) sort(arr.begin(),arr.end())
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define read(a) scanf("%d", &a)
#define f(a,n) for(ll i=a;i<n;i++)
#define in(a,n,arr) for(ll i=a;i<n;i++)cin>>arr[i];
#define in2(n,m,arr) for(ll i=0;i<n;i++){for(ll j=0;j<m;j++)cin>>arr[i][j];}
#define pown  1<<n
#define mod 1e9+7
#define mm 1e6
/*typedef tree<int, null_type, less<int>, rb_tree_tag,
 tree_order_statistics_node_update>
 ordered_set;
 typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
 tree_order_statistics_node_update>
 ordered_multiset;*/
//map<pii,ll> ma,visi;

/*vector<ll> v;
 void SieveOfEratosthenes(int n)
 {
 bool prime[n+1];
 memset(prime, true, sizeof(prime));
 
 for (int p=2; p*p<=n; p++)
 {
 if (prime[p] == true)
 {
 for (int i=p*p; i<=n; i += p)
 prime[i] = false;
 }
 }
 for (int p=2; p<=n; p++)
 if (prime[p])
 v.pb(p);
 }
*/
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*ll ans[(ll)mm];
ll get(ll x)
{
    //while(ans[x]!=x){x=ans[x];}
    if(ans[x]==x)return x;
    return ans[x]=get(ans[x]);
    
    //return;
}
void merge(ll a,ll b)
{
    ll temp=get(a);
    ll temp2=get(b);
    if(temp==temp2)return;
    //ans[temp]=temp2;
}*/
int main()
{
    boostit;
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        string str1,str2;
        cin>>str1>>str2;
        ll count=0;
        for(ll i=0;i<3;i++){if(str1[i]==str2[i])count++;}
        print(count);
        
    }
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e5 + 10;
int d;
int main(){
scanf("%d", &d);
if(d == 25)printf("Christmas");
    else if(d == 24)printf("Christmas Eve");
     else if(d == 23)printf("Christmas Eve Eve");
      else printf("Christmas Eve Eve Eve");

return 0;
}


Measured memory_bytes: 256
def gcd(a,b):
    if a==0:
        return b
    return gcd(b%a,a)
    
gcdcal=[0]    

for i in range(1,201):
    gcdtemp=[0]
    for j in range(1,201):
        gcdtemp.append(gcd(i,j))
    gcdcal.append(gcdtemp)

k=int(input())
sum=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            sum+=gcdcal[gcdcal[i][j]][l]
print(sum)

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

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

    vector<int> H(N);
    for(int i = 0; i < N; i++){
        cin >> H[i];
    }

    int ans = 1;
    int maxh = H[0];
    for(int i = 1; i < N; i++){
        maxh = max(maxh, H[i]);
        if(maxh == H[i]){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
from scipy.sparse import*
f=lambda*z:map(int,raw_input().split())
d=lambda s:csgraph.dijkstra(csr_matrix(([1]*len(a),(a,b)),[n+1]*2),0,s)
n,=f()
a,b=zip(*map(f,[0]*~-n))
g=d(1)
h=d(n)
print 'Fennec'if sum(g[i]>h[i] for i in range(n+1))*2<n else'Snuke'

Measured memory_bytes: 37728
import java.util.*;
import java.util.Vector;
 
class Main {
 
    
    public static void main(String[] args) throws java.lang.Exception {
        // your code goes here
        Scanner ob = new Scanner(System.in);
        int T = ob.nextInt();
        int b = ob.nextInt();
        System.out.println(T * b);
        System.out.close();
    }
}


Measured memory_bytes: 35764
n, k = map(int, input().split())
a = list(map(int, input().split()))

num = 1
li = [1]
flag = [True]*n
flag[0] = False

for i in range(k):
    num = a[num-1]
    if flag[num-1]:
        li.append(num)
        flag[num-1] = False
    else:
        break

d = li.index(num)
ans = (k-d) % (len(li)-d)+d
print(li[ans])


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

int main(){
  int X,Y,Z,max_A=0;
  cin >> X >> Y >> Z;
  for(int i=0;;i++){
    long long A=(i+1)*Y+(i+2)*Z;
    if(A>X){
      break;
    }
    max_A=i+1;
  }
  cout << max_A << endl;
}   

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	long long int minn=INT_MAX;
	string s;
	cin>>s;
	for(long long int i=0;i<s.size()-2;i++){
			long long int val1=s[i]-'0',val2=s[i+1]-'0',val3=s[i+2]-'0';
			long long int num=(val1*100)+(val2*10)+val3;
			minn=min(minn,abs(num-753));
	}
	cout<<minn;
	return 0;
}

Measured memory_bytes: 3604
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long



using namespace std;

void file(){
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
}
int tc;
const int N=2e5+5,M=2e6+5,MOD=1e9+7,OO=1e9;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//file();	
 	
 	int n;
 	ll k;

 	scanf("%d %lld",&n,&k);
 	std::vector<int>a(n);
 	ll z = 0;
 	for(int i=0;i<n;i++){
 		scanf("%d",&a[i]);
 	}
 	sort(all(a));
 	ll l = -1e18+5 , r = 1e18+5 , ans = -1;

 	while(l<=r){
 		ll mid = (l+r)/2;
 		ll howmany = 0;
 		for(int i=0;i<n;i++){
 			int lll = i+1,rr = n-1,who = i;
 			if(a[i]>0){
	 			while(lll<=rr){
	 				int midd = (lll+rr)/2;
	 				if((ll)a[i]*a[midd]<=mid){
	 					lll=midd+1;
	 					who = midd;
	 				}
	 				else	rr=midd-1;
	 			}
	 			howmany+=(who-i);
	 		}
 			else if(a[i]<0){
 				who = n;
 				while(lll<=rr){
	 				int midd = (lll+rr)/2;
	 				if((ll)a[i]*a[midd]<=mid){
	 					rr=midd-1;
	 					who = midd;
	 				}
	 				else	lll=midd+1;
	 			}
	 			howmany+=(n-who);
 			}
 			else{
 				if(mid>=0)howmany+=(n-i-1);
 			}
 		}
 		if(howmany>=k){
 			ans = mid;
 			r=mid-1;
 		}
 		else	l = mid+1;
 	} 
 	printf("%lld\n",ans);
}		


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
	int n;
	while(cin>>n){
	if(n==3)
		cout<<"2 5"<<endl;
	else{
	int i=n-1;
	while(true){
		bool t=true;
		for(int j=2;j<1+(double)sqrt((double)i);j++){
			if(i%j==0)
				t=false;
		}
		if(t==true)
			break;
		i--;
	}
	cout<<i<<" ";
	i=n+1;
	while(true){
		bool t=true;
		for(int j=2;j<1+(double)sqrt((double)i);j++){
			if(i%j==0)
				t=false;
		}
		if(t==true)
			break;
		i++;
	}
	cout<<i<<endl;
	}
	}
	return 0;
}

Measured memory_bytes: 1164
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{max, min};
use std::collections::*;
use std::io::{stdin, Read};

trait ChMinMax {
    fn chmin(&mut self, other: Self);
    fn chmax(&mut self, other: Self);
}
impl<T> ChMinMax for T
where
    T: PartialOrd,
{
    fn chmin(&mut self, other: Self) {
        if *self > other {
            *self = other
        }
    }
    fn chmax(&mut self, other: Self) {
        if *self < other {
            *self = other
        }
    }
}

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, $var:ident $($r:tt)*) => {
        let $var = parse_val!($it, usize);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

#[cfg(debug_assertions)]
macro_rules! debug {
    ($( $args:expr ),*) => { eprintln!( $( $args ),* ); }
}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($( $args:expr ),*) => {
        ()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, r: usize, c: usize, k: usize);
    let mut board = vec![vec![0; c]; r];
    let ns = 4;
    for _ in 0..k {
        parse!(it, r: u1, c: u1, v: usize);
        board[r][c] = v;
    }
    let mut dp = vec![vec![0; ns]; c];
    for i in 0..r {
        for j in 0..c {
            dp[j][0] = *dp[j].iter().max().unwrap();
            let v = board[i][j];
            if v > 0 {
                let tmp = dp[j][0] + v;
                dp[j][1].chmax(tmp);
            }
            for k in 0..ns {
                if j > 0 {
                    let tmp = dp[j - 1][k];
                    dp[j][k].chmax(tmp);
                    if k > 0 && v > 0 {
                        let tmp = dp[j - 1][k - 1] + v;
                        dp[j][k].chmax(tmp)
                    }
                }
            }
        }
    }
    println!("{}", dp[c - 1].iter().max().unwrap());
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


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

int main() {
    int X;
    bool N = true;
    cin >> X;

    if (X == 2) {
        cout << 2 << endl;
        N = false;
    }

    for (;N; X++) {
        if (X % 2 == 0) {
            continue;
        }
        else {
            for (int i = 3; i <= X; i = i + 2) {
                if  (X == i) {
                    cout << X << endl;
                    N = false;
                    break;
                    break;
                }
                else if (X % i == 0) {
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> > 
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
set <int> s;
int main()
{
	boost;
	int n, x, i;
	cin >> n;
	int ans = 1;
	fo(i, 0, n){
		cin >> x;
		if(!s.empty()){
			if(x < *s.begin())
			ans++;
		}
		s.insert(x);
	}
	cout << ans;
}

Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

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

#define LENGTH 20
int N, M;

#define INF 1000
#define MAX 210
map<string, int> ids;
int dmatrix[MAX][MAX];
int matrix[MAX][MAX];
int same[MAX][MAX];
int visited[MAX];

int num;

int get_id(string key)
{
	if (ids.count(key) == 0) return INF;
	return ids[key];
}

void dfs(int id)
{
	if (visited[id]) return;
	visited[id] = true;

	rep(to, num) {
		if (dmatrix[id][to] || same[id][to]) {
			dfs(to);
		}
	}
}

bool check(int from, int to)
{
	if (matrix[from][to]%2==0) return false;
	memset(visited, 0, sizeof(visited));
	
	dfs(from);
	return visited[to];
}

int main(void)
{
	while(cin >> N, N) {
		ids.clear();

		memset(dmatrix, 0, sizeof(dmatrix));
		memset(same, 0, sizeof(same));
		fill(matrix[0], matrix[0]+MAX*MAX, INF);
		rep(i, MAX) matrix[i][i] = 0;

		rep(i, N) {
			string line;
			cin >> line;
			string a, b;
			int pos = line.find('-');
			a = line.substr(0, pos);
			b = line.substr(pos+1);
			if (ids.count(a) == 0)
				ids.insert(make_pair(a, ids.size()));
			if (ids.count(b) == 0)
				ids.insert(make_pair(b, ids.size()));

			int aid, bid;
			aid = get_id(a); bid = get_id(b);
			dmatrix[aid][bid] = true;
			matrix[aid][bid] = 1;
			matrix[bid][aid] = 1;
		}

		num = ids.size();
		rep(i, num)
			rep(j, num)
				rep(k, num)
					matrix[j][k] = min(matrix[j][k], matrix[j][i]+matrix[i][k]);
		rep(i, num) {
			REP(j, i+1, num) {
				bool one, two, three;
				one = false;
				two = true;
				three = true;
				rep(k, num) {
					if (i == k || j == k) continue;
					if ((dmatrix[i][k] && dmatrix[j][k])
						|| (dmatrix[k][i] && dmatrix[k][j]))
						one = true;
					if (dmatrix[k][i] && dmatrix[j][k]) {
						two = false;
						break;
					}
					if (dmatrix[i][k] && dmatrix[k][j]) {
						three = false;
						break;
					}
				}
				if (one & two & three) {
					same[i][j] = true;
					same[j][i] = true;
				}
			}
		}

		cout << num << endl;

		cin >> M;
		rep(i, M) {
			string line;
			cin >> line;
			string a, b;
			int pos = line.find('-');
			a = line.substr(0, pos);
			b = line.substr(pos+1);
			if (ids.count(a) == 0 || ids.count(b) == 0) {
				puts("NO");
			} else {
				int from, to;
				from = get_id(a); to = get_id(b);

				cout << (check(from, to)?"YES":"NO") << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1768
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <utility>
#include <iterator>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
using namespace std; 
  
typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 

#define IOS ios_base::sync_with_stdio(false);\
        cin.tie(0);\
        cout.tie(0);
#define endl "\n"  
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a)) 
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a)) 
#define FOREACH(a, b) for (auto&(a) : (b)) 
#define rep(i, n) FOR(i, 0, n) 
#define repn(i, n) FORN(i, 1, n) 
#define RESET(a, b) memset(a, b, sizeof(a)) 
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define ALLA(arr, sz) arr, arr + sz 
#define all(c) c.begin(),c.end()
#define SORT(v) sort(all(v)) 
#define REVERSE(v) reverse(all(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
#define w(x)   int x; cin>>x; while(x--)
#define sz(a) int((a).size())
#define ps(x,y)         fixed<<setprecision(y)<<x
int main()
{
	IOS;
	int day;
	cin>>day;
	vvi dp(day+1,vector<int>(3,0));
	dp[0][0]=0;
	dp[0][1]=0;
	dp[0][2]=0;
	repn(i,day)
	{
		vi c(3);
		rep(j,3)
		{
			cin>>c[j];
		}
		rep(k,3)
		{
			rep(l,3)
			{
				if(k!=l)
				{
					dp[i][k]=max(dp[i-1][l]+c[l],dp[i][k]);
				}
			}
		}
	}
	cout<<max({dp[day][0],dp[day][1],dp[day][2]});
		
		
	return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <string>

using namespace std;
int main()
{
	int n, temp, ans;
	string s;

	cin >> n;
	cin >> s;
	temp = 0;
	ans = n;


	for (int i = 1; i < n; i++) {
		if (s[i] == 'E')temp++;
	}
	if (ans > temp)ans = temp;

	for (int i = 1; i < n; i++) {

		if (s[i] == 'E')temp--;
		if (s[i - 1] == 'W')temp++;
		if (ans > temp)ans = temp;
	}

	// 出力
	cout << ans;

	return 0;
}


Measured memory_bytes: 900
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;

int main()
{
    // 整数の入力
    ll N;
    cin >> N;
    cout << (N+1)/2 << endl;
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define ll long long

int main(){
    int a[3];
    int count5 = 0, count7 = 0;
    for(int i = 0; i<3; i++){
        cin>>a[i];
        (a[i]==5)?(count5++):((a[i]==7)?(count7++):(1));
    }
    if(count5==2 && count7==1)  cout<<"YES\n";
    else cout<<"NO\n";
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var num = Input.num;
        var ab = Input.ar2D(num).OrderBy(v => v[1]).ToArray();
        var t = 0L;
        for(var i=0;i<num;i++)
        {
            t += ab[i][0];
            if (t > ab[i][1]) { WriteLine("No");return; }
        }
        WriteLine("Yes");
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public static long numL => ToInt64(read);
    public static char[][] gred(int h)
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[] ar1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => num).ToArray();
    public static long[] arL1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
    public static string[] strs(int n)
        => Enumerable.Repeat(0, n).Select(_ => read).ToArray();
    public static int[][] ar2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
    public static long[][] arL2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public static string[] Make<T1, T2>(out T1 v1, out T2 v2)
    {
        var r = read.Split(' ');
        v1 = getValue<T1>(r[0]);
        v2 = getValue<T2>(r[1]);
        return r;
    }
    public static string[] Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3)
    {
        var r = Make(out v1, out v2);
        v3 = getValue<T3>(r[2]);
        return r;
    }
    public static string[] Make<T1,T2,T3,T4>(out T1 v1,out T2 v2,out T3 v3,out T4 v4)
    {
        var r = Make(out v1, out v2, out v3);
        v4 = getValue<T4>(r[3]);
        return r;
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public const int MOD = 1000000007;
}


Measured memory_bytes: 37952
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(true){
			int n = cin.nextInt();
			if(n==0){
				break;
			}
			int[][] a = new int[n][n];
			int[] now = {n/2,n/2+1};
			int count=1;
			a[now[0]][now[1]]=count++;
			
			while(count<=n*n){
				
				now[0]=(now[0]+1)%n;
				now[1]=(now[1]+1)%n;
				while(a[now[0]][now[1]]!=0){
					now[0]=(now[0]-1)%n;
					if(now[0]<0){
						now[0]=n-1;
					}
					now[1]=(now[1]+1)%n;
				}
				a[now[0]][now[1]]=count++;
			}
			for(int i = 0; i < n;i++){
				System.out.print(String.format("%4d", a[0][i]));
				for(int j = 1;j<n;j++){
					System.out.print(String.format("%4d", a[j][i]));
				}
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 12000
#include<iostream>
#include<fstream>
#include<math.h>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<sstream>
#include<set>

using namespace std;

#define forn(i,n) for(int i=0;i<(int)(n); i++)
#define forsn(i,s,n) for(int i=(s);i<(int)(n); i++)
#define esta(x,v) (find((v).begin(),(v).end(),(x)) !=  (v).end())
#define index(x,v) (find((v).begin(),(v).end(),(x)) - (v).begin())
#define debug(x) cout << #x << " = "  << x << endl
#define pb push_back
#define mp make_pair

typedef long long tint;
typedef unsigned long long utint;
typedef long double ldouble;

typedef vector<int> vint;

int toNumber (string s)
{
	int Number;
	if ( ! (istringstream(s) >> Number) ) Number = 0; // el string vacio lo manda al cero
	return Number;
}

string toString (int number)
{
    ostringstream ostr;
    ostr << number;
    return  ostr.str();
}

int main (){
	int n,m;
	cin>>n>>m;
	vector<string> a(n), b(m);
	forn(i,n)cin>>a[i];
	forn(i,m)cin>>b[i];
	bool si=false;
	forn(i,n){
		forn(j,n){
			if(a[i][j]==b[0][0] && i+m-1<n && j+m-1<n){
				si=true;
				forn(b1, m){
					forn(b2, m){
						if(a[i+b1][j+b2]!=b[b1][b2]){
							si=false;
							break;
						}
					}
					if(!si)break;
				}
				if(si){
					cout<<"Yes"<<endl;
					return 0;
				}
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool is_prime(long long x){
  for(long long i = 2; i * i <= x; ++i){
    if(x % i == 0) return false;
  }
  return true;
}
int main(){
  long long x;
  cin >> x;
  while(!is_prime(x)) x++;
  cout << x << endl;
}

Measured memory_bytes: 256
local n = io.read("*n", "*l")
local str = io.read()
local nums = {}
local ti = table.insert
local tn = tonumber
local diff = 0
for numstr in string.gmatch(str, "%-?%d+") do
  local a = tn(numstr)
  diff = diff + a
  ti(nums, a)
end
diff = diff - nums[1] * 2
local ma = math.abs
local mm = math.min
local diffmax = ma(diff)
for i = 2, n - 1 do
  diff = diff - nums[i] * 2
  diffmax = mm(diffmax, ma(diff))
end
print(diffmax)


Measured memory_bytes: 11264
//Sha3ban_El-Bay
#include<bits/stdc++.h>
using namespace std ;
//======================================================
#define El_Bay ios_base::sync_with_stdio(false);cin.tie(NULL);
#define forn(i,n)  for (int i = 0; i < (int)(n); ++i)
#define for1(i,n)  for (int i = 1; i <=(int)(n); ++i)
#define all(v)     (v).begin(),(v).end()
#define ull        unsigned long long
#define PI         3.14159265359
#define ll         long long
#define sz(v)	   v.size()
#define pb         push_back
#define pp         pop_back
#define S          second
#define bgn        begin
#define F          first
#define N          int(2e5+5)
#define	MOD        int(1e9+7)
#define inf        int(1e18)
//======================================================
int dx[] = { 0,  0, 1, -1 ,  1,  -1,  1,  -1 };
int dy[] = { 1, -1, 0,  0 , -1,   1,  1,  -1 };
//======================================================
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ll a, ll b, ll ret = 1LL) {
	while (b--) ret = (ret * a);
	return ret;}
//======================================================
int n,m;
vector<vector<int>>v;
int dp[N];
int solve(int x)
{
	if(dp[x]!=-1) return dp[x];
	int r=0;
	for(int i=0 ; i<sz(v[x]) ; i++)
	{
			int y=v[x][i];
			r=max(r,solve(y)+1);
	}
	return dp[x]=r;
}
int main()
{
	El_Bay
	cin >> n >> m ;
	v.resize(n);
	for(int i=0 ; i<m ;i ++)
	{
		int x,y;
		cin >> x >> y;
		x--,y--;
		v[x].pb(y);
	}

	memset(dp,-1,sizeof dp);
	int ans=0;
	for(int i=0 ; i<n ; i++)
		ans=max(ans,solve(i));

	cout << ans;
	return 0;
}


Measured memory_bytes: 11504
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>

#define DIV 1000000007
using namespace std;

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

    vector<long long> a(n);   
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    long long ans1 = 0, ans2 = 0;  
    long long total;
    for (int p = 0; p < 2; p++) {
        ans2 = ans1;
        ans1 = 0;
        long long temp;
        if (p == 0) {
            if (a[0] == 0) {
                total = 1;
                ans1++;
            }
            else {
                total = a[0];
            }

        }

        if (p == 1) {
            if (a[0] == 0) {
                total = -1;
                ans1++;
            }
            else {
                if (a[0] > 0) {
                    total = -1;
                    ans1 = a[0] + 1;
                }
                else {
                    total = 1;
                    ans1 = -a[0] + 1;
                }
            }

        }

        for (int i = 1; i < n; i++) {
            //cout << "total=" << total << endl;
            temp = a[i];
            if (total > 0) {
                if (total + a[i] >= 0) {
                    a[i] = -(total + 1);
                }
                total += a[i];
                ans1 += abs(a[i] - temp);
                a[i] = temp;
            }
            else if (total < 0) {
                if (total + a[i] <= 0) {
                    a[i] = (-total + 1);
                }
                total += a[i];
                ans1 += abs(a[i] - temp);
                a[i] = temp;
            }
        }
        //cout << ans1 << "  " << ans2 << endl;
    }
    
    cout << min(ans1,ans2) << endl;
}


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

int main(){
        int h, w, dx[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy[] = {1, 1, 0, -1, -1, -1, 0, 1};
        scanf("%d %d", &h, &w);
        std::vector<std::vector<int>> fie(h+2, std::vector<int>(w+2, 0));
        for(int i=1; i<=h; i++){
                char s[w+1];
                scanf("%s", s);
                for(int j=1; j<=w; j++){
                        fie[i][j] = (s[j-1]=='#');
                }
        }

        for(int i=1; i<=h; i++){
                for(int j=1; j<=w; j++){
                        if(fie[i][j]){
                                printf("#");
                                continue;
                        }
                        int cnt = 0;
                        for(int k=0; k<8; k++){
                                cnt += fie[i+dx[k]][j+dy[k]];
                        }
                        printf("%d", cnt);
                }
                puts("");
        }

        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,sum=0;
    cin>>n>>a;
    int x[n];
    ll dp[55][55][3000];
    for(int i=0;i<n;i++){
        cin>>x[i];
        sum+=x[i];
    }
    memset(dp,0,sizeof(dp));
    dp[0][0][0]=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<=n;j++){
            for(int k=0;k<=sum;k++){
                dp[i+1][j][k] += dp[i][j][k];
                dp[i+1][j+1][k + x[i]] += dp[i][j][k];
            }
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
        ans+=dp[n][i][i*a];
    }
    cout << ans<<endl;
    return 0;
}



Measured memory_bytes: 71168
#include<iostream>

using namespace std;

int main(){
    int n, c[509], s[509], f[509];
    cin >> n;
    for(int i=0;i<n-1;i++){
        cin >> c[i] >> s[i] >> f[i];
    }
    for(int i=0;i<n;i++){
        int cur = 0;
        for(int j=i;j<n-1;j++){
            cur = max(s[j], ((cur-1)/f[j]+1)*f[j]);
            cur += c[j];
        }
        cout << cur << endl;
    }
}

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

#ifdef _DEBUG
#define dout cout
#define debug() if (true)
#define dvout(v) vout(v)
#else
#define dout if (false) cout
#define debug() if (false)
#define dvout(v) if(false) vout(v)
#endif

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define vout(v)           \
	for (auto &i : v)     \
	{                     \
		cout << i << " "; \
	}                     \
	cout << "\n"; //配列出力
#define vec(v, n) vector<int> v(n, 0);
#define vecll(v, n) vector<ll> v(n, 0);
#define vecvec(v,n,m) vector<vector<int>> v(n, vector<int>(m));
#define vin(v)        \
	for (auto &i : v) \
		cin >> i; //配列入力

#define mod (int)(1e9+7)
typedef long long ll;
typedef unsigned long long ull;
#define next asdnext
#define prev asdprev
#define _n "\n"
#define _n2 "\n\n"
#define _t "\t"

//	LLONG_MAX 9.2*1e18	9223372036854775807LL
//						999999999999999989
//	O(1e7) O(1e8)

void Main()
{
	ll K;
	cin>>K;

	ll ans=0;
	ll N=0;
	for(ll i= 0; i<=1e7;i++){
		N=(N*10+7)%K;
		//dout<<i<<':'<<N<<_n;
		if(N%K==0){cout<<i+1;return;}
	}
	cout<<-1<<_n;
}


void Test();
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 3608
#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++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;
 
int main(){
    int n;
    string s,t;
    string l="";
    cin>>n>>s>>t;
    for (int i=0; i<n; i++) {
        l += s.at(i);
        l += t.at(i);
    }
    cout<<l<<endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
students = []
checkpoints = []
INF = 10**19

for _ in range(N):
    ai, bi = map(int, input().split())
    students.append((ai, bi))

for _ in range(M):
    ci, di = map(int, input().split())
    checkpoints.append((ci, di))

for item in students:
    tmp = INF
    ans = INF, INF
    for i in range(M):
        manhattan = abs(item[0] - checkpoints[i][0]) + abs(item[1] - checkpoints[i][1])
        if tmp > manhattan:
            tmp = manhattan
            ans = i+1
    print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int dp[3010][3010];

int main(){
    string s,t;cin >> s >> t;
    int n = s.size(),m = t.size();
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i-1]==t[j-1])dp[i][j]=dp[i-1][j-1]+1;
            else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
    }
    int len = dp[n][m];
    string res;
    res.resize(len);
    len--;
    int i=n,j=m;
    while(len>=0){
        if(s[i-1]==t[j-1]){
            res[len]=s[i-1];
            i--;j--;len--;
        }else if(dp[i][j]==dp[i-1][j])i--;
        else j--;
    }

    cout << res << endl;
    return 0;
}

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


int main(){
  int n,i,j;
  
  
  int up = 0;
  cin >> n;
  for(i=0;i<n;i++){
    int sum[110]={};
    string a,b;
    up = 0;
    cin >> a >> b;
    int sa=a.size(),sb=b.size();
    int flag=0;
    if(max(sa,sb)>80) flag =1;
    else 
    for(j=0;j<max(sa,sb);j++){
      if(sa>j&&sb>j){
	sum[j] = (a[sa-j-1]-'0') + (b[sb-j-1]-'0') + up;
      }else if(sa>j){
	sum[j] = (a[sa-j-1]-'0') + up;
      }else if(sb>j){
	sum[j] = (b[sb-j-1]-'0') + up;
      }
      up=0;
      if(sum[j]>9){
	up=1;
	sum[j]-=10;
      }
    }
    sum[max(sa,sb)]=up;
    int k=max(sa,sb);
    while(sum[k]==0&&k>0) k--;
    if(k>=80||flag==1) cout << "overflow";
    else
    for(j=k;j>=0;j--)
      cout << sum[j];
    cout << endl;
  }
}



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

int main()
{
  int n;
  int x = 0;
  int maxv = 0;
  char q;

  cin >> n;
  for ( int i = 0; i < n; i++) {
    cin >> q;
    if ( q == 'I' ) {
      x++;
    }
    if ( q == 'D' ) {
      x--;
    }
    
    maxv = max(x, maxv);
  }

  cout << maxv << endl;
  
  return (0);
}


Measured memory_bytes: 256