akhauriyash/Code-Regression huggingface dataset:
#include <atcoder/all>
#include <bits/stdc++.h>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
const ul mod = 1000000007;

ll extgcd(ll a, ll b, ll &x, ll &y) {
    ll d = a;
    if (b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else {
        x = 1;
        y = 0;
    }
    return d;
}

void prime_map(map<ll, ll> &m, ll num) {
    for (ll i = 2; i * i <= num; i++) {
        while (num % i == 0) {
            m[i]++;
            num /= i;
        }
    }
    if (num != 1) {
        m[num] = 1;
    }
    return;
}

ll rep_square(ll a, ll b) {
    // return a^b
    ll ans = 1;
    ll base = a;
    while (b != 0) {
        if (b & 1) {
            ans *= base;
        }
        base *= base;
        b >>= 1;
    }
    return ans;
}

using p = pair<ll, ll>;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    n *= 2;
    map<ll, ll> m;
    prime_map(m, n);

    vector<p> v;
    for (auto iter = m.begin(); iter != m.end(); iter++) {
        if (iter->second != 0) {
            v.push_back(p(iter->first, iter->second));
        }
    }

    ll prime_num = v.size();

    if (prime_num == 1) {
        cout << n - 1 << endl;
        return 0;
    }

    ll ans = n;
    for (int i = 0; i < (1 << prime_num); i++) {
        ll a = 1, b = 1;
        rep(j, prime_num) {
            if ((1 << j) & i) {
                a *= rep_square(v[j].first, v[j].second);
            } else {
                b *= rep_square(v[j].first, v[j].second);
            }
        }
        ll x = 0, y = 0;
        extgcd(a, b, x, y);
        ll temp = min(a * x, b * y);
        if (temp != 0) {
            ans = min(ans, -temp);
        }
    }

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



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

int main(void){
    int N,T,A;
    cin>>N>>T>>A;
    int H[N];

    for(int i=0;i<N;i++)
        cin>>H[i];
    double s=fabs(A-(T-H[0]*0.006));
    int f=0;
    for(int i=1;i<N;i++){
        double ss=fabs(A-(T-H[i]*0.006));
        if(s>ss){
            s=ss;
            f=i;
        }
    }
    cout<<f+1<<endl;
    return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n;
    cin>>n;
    int k;cin>>k;
    ll arr[n];
    for (int i=0;i<n;i++){
        cin>>arr[i];
    }ll opt[n];
    opt[0]=0;
    ll m=0;
    for (int i=1;i<n;i++){
        m=-1;
        for (int j=max(0,i-k);j<i;j++){
            if (m==-1){
                m=abs(opt[j]+abs(arr[j]-arr[i]));
            }else m=min(m,opt[j]+abs(arr[j]-arr[i]));
        }opt[i]=m;
    }cout<<opt[n-1];
    return 0;
}

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

long long N;
vector<long long> A;
int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		long long tmp;
		cin >> tmp;
		A.push_back(tmp);
	}

	sort(A.begin(), A.end());
	long long maxi = A[A.size() - 1];
	long long midi = A[0];

	for(long long i = 0; i < N-1; i++){
		if(abs((double)midi - (double)maxi/2.0) > abs((double)A[i] - (double)maxi/2.0))
			midi = A[i];
	}
	cout << maxi << " " << midi << endl;
}


Measured memory_bytes: 1400
#include<stdio.h>
#include<string>
#include<iostream>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<list>
using namespace std;

int main() {
	int N, max = 0, sum = 0, sum1 = 0;
	cin >> N;
	int *a, *b;
	a = (int*)malloc(sizeof(int)*N);
	b = (int*)malloc(sizeof(int)*N);
	for (int i = 0;i < N;i++)cin >> a[i];
	for (int i = 0;i < N;i++)cin >> b[i];
	for (int i = 0;i < N;i++) {
		sum += a[i];
		sum1 = sum;
		for (int j = i;j < N;j++) {
			sum1 +=b[j];
		}
		if (sum1 >= max) {
			max = sum1;
		}
	}
    
	cout << max << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args ) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String end = T.substring(S.length(),S.length()+1);
        if(T.equals(S+end)){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}


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

num,height=0,A[0]
B=[]
for i in range(1,n):
    if height>A[i]:
        B.append(height-A[i])
        num=max(num,height-A[i])
    else:height=A[i]
print(sum(B))

Measured memory_bytes: 105268
#include <iostream>

int main () {
  int A, B, AB, a, b;
  std::cin >> A >> B >> AB >> a >> b;
  
  if ( A > B ) { 
    std::swap(A,B);
    std::swap(a,b);  
  }   
  
  int max_number = (a > b ) ? a:b;
  if (AB <= A ) {
    if (AB <= B/2) {
      std::cout << AB * 2 * (max_number ) << std::endl;
    }
    else {
      if (a > b ) {
        std::cout << AB * 2 * b + A * (a-b) << std::endl;
      }
      else {
        std::cout << AB * 2 * a + B * (b-a) << std::endl;  
      }
    }
  }
  else {
    if (AB <= (A + B) / 2  ) {
      if (a < b ) {
        std::cout << AB * 2 * a + B * (b-a) << std::endl; 
      }
      else {
        std::cout << AB * 2 * b + A * (a-b) << std::endl;
      }
    }  
    else {
      std::cout << A * a + B * b << std::endl;  
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する
// 切り上げ　ceil(a)


int main() {
    ll k, x;
    cin >> k >> x;
    if(500 * k >= x){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 256
# include <bits/stdc++.h>  
using namespace std;  
const int maxn = 1e5+3;  
int cnt=0, id=0, Next[maxn],in[maxn],out[maxn];  
int fa[maxn][20], len[maxn];  
struct node  
{  
    int v, next;  
}edge[maxn<<1];  
void add_edge(int u, int v)  
{  
    edge[cnt] = {v, Next[u]};  
    Next[u] = cnt++;  
    edge[cnt] = {u, Next[v]};  
    Next[v] = cnt++;  
}  
   
void dfs(int cur, int pre, int d)  
{  
    fa[cur][0] = pre;  
    len[cur] = d;  
    for(int i=1; i<20; ++i)  
        fa[cur][i] = fa[fa[cur][i-1]][i-1];  
    in[cur] = ++id;  
    for(int i=Next[cur]; i!=-1; i=edge[i].next)  
    {  
        int v = edge[i].v;  
        if(v == pre) continue;  
        dfs(v, cur, d+1);  
    }  
    out[cur] = id;  
}  
int main()  
{  
    int n, a, b;  
    scanf("%d",&n);  
    memset(Next, -1, sizeof(Next));  
    for(int i=1; i<n; ++i)  
    {  
        scanf("%d%d",&a,&b);  
        add_edge(a, b);  
    }  
    dfs(1, 0, 0);  
    int tmp=(len[n]-1)/2, now=n;  
    for(int i=0; i<20; ++i)  
        if(tmp>>i&1) now = fa[now][i];  
    int bl = n-(out[now]-in[now]+1)-len[n]/2-1;  
    int wh = out[now]-in[now]+1-tmp-1;  
    if(len[n]&1)  
    {  
        if(bl <= wh) puts("Snuke");  
        else puts("Fennec");  
    }  
    else  
    {  
        if(wh <= bl) puts("Fennec");  
        else puts("Snuke");  
    }  
    return 0;  
} 

Measured memory_bytes: 15872
import heapq

n, m = map(int, input().split())
A = list(map(int, input().split()))
k = len(A)
for i in range(k):
    A[i] = A[i] * -1

heapq.heapify(A)

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

for i in range(k):
    A[i] = int(A[i] * -1)

ans = sum(A)
print(ans)


Measured memory_bytes: 14180
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vs = vector<string>;
using vp = vector<pii>;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(), (x).end()
#define each(a, x) for (auto&& a : (x))
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, n) for (ll i = (a); i < (n); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _per(i, n) peri(i, 0, n)
#define peri(i, a, n) for (ll i = (n) - 1; i >= (a); --i)
#define per(...) _overload3(__VA_ARGS__, peri, _per)(__VA_ARGS__)
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
template<typename T> inline void chmax(T& a, const T& b) {if (a < b) a = b;}
template<typename T> inline void chmin(T& a, const T& b) {if (a > b) a = b;}
template<typename T> inline void print(const T& x) {cout << x << "\n";}
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p) {is >> p.fi >> p.se; return is;}
template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) {os << p.fi << " " << p.se; return os;}
template<typename T> istream& operator>>(istream& is, vector<T>& v) {each(in, v) is >> in; return is;}
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {rep(i, sz(v)) {os << v[i] << (i + 1 != sz(v) ? " " : "");} return os;}
struct Init {Init() {ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(10);}} init;

/* ABC161  D  Lunlun Number */

ll unit_digit(ll n) {
    /* 一の位の数字を返す */
    string str = to_string(n);
    ll u = *str.rbegin() - '0';
    return u;
}

void bfs(ll k) {
    ll cnt = 0;
    queue<ll> q;
    rep(i, 1, 10) q.push(i);
    while (cnt < k) {
        ll n = q.front(); q.pop();
        cnt++;
        if (cnt == k) print(n);
        ll u = unit_digit(n);
        if (u != 0) q.push(10 * n + u - 1);
        q.push(10 * n + u);
        if (u != 9) q.push(10 * n + u + 1);
    }
}

int main() {
    ll k; cin >> k;
    bfs(k);
}

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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

void solve();

int main(void){
    int ans = 0;
    int N; cin >> N;
    pair<int, int> A[N];
    for(int i = 1; i <= N; i++){
        int a; cin >> a;
        A[i-1] = make_pair(a, i%2);
    }
    sort(A, A+N);
    rep(i, N){
        if((i+1) % 2 != A[i].second) ans++;
    }
    cout << ans/2 << endl;
    return 0;
}

void solve(){}

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

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

  vector<vector<int>> e(110, vector<int>(110, 1));

  for(int i=1; i<=N; i++) e[i][i] = 0;

  int cnt = N*(N-1);
  if(N % 2 == 1){
    for(int i=1; i<=N; i++){
      e[i][N-i] = 0;
      if(i != N )cnt--;
    }
  } else {
    for(int i=1; i<=N; i++){
      e[i][N-i+1] = 0;
      cnt--;
    }
  }

  cout << cnt / 2   << endl;
  for(int i=1; i<=N; i++){
    for(int j=i+1; j<=N; j++){
      if(e[i][j] == 1) cout << i << " " << j << endl;
    }
  }
}


  
  

Measured memory_bytes: 384
def read():
    W, H, x, y = list(map(int, input().strip().split()))
    return W, H, x, y


def solve(W, H, x, y):
    half = W * H / 2.0
    is_multiple = 1 if (x * 2 == W and y * 2 == H) else 0
    return half, is_multiple


if __name__ == '__main__':
    inputs = read()
    print("%.10f %d" % solve(*inputs))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ppb pop_back
using namespace std;
typedef long long int ll;
#define MOD 1000000007
int  main(){
	ll n,r;
	cin>>n>>r;
	if(n>=10){
		cout<<r<<endl;
	}
	else{
		cout<<r+100*(10-n)<<endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>

using namespace std;

int main(void)
{

    set<int> input;
    for (int i = 0; i < 3; i++)
    {
        int tmp;
        scanf("%d", &tmp);
        input.insert(tmp);
    }

    input.size() == 2 ? printf("Yes") : printf("No");
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    static class APoor
    {
        static void Main(string[] args)
        {
            var abc = Console.ReadLine().Split(' ').ToList();
            int cnt = 0;
            if (abc[0] == abc[1])
            {
                cnt++;
            }
            if (abc[0] == abc[2])
            {
                cnt++;
            }
            if (abc[1] == abc[2])
            {
                cnt++;
            }

            Console.WriteLine(cnt == 1 ? "Yes" : "No");
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 11220
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var a = cin.ReadInt;
            var b = cin.ReadInt;
            if(b % a == 0){
              Console.WriteLine(a + b);
            }else{
              Console.WriteLine(b - a);
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


Measured memory_bytes: 13268
#include <stdio.h>
#include <stdlib.h>

typedef struct {
  int parent;
  int left; //左の子
  int right; //右の兄弟
  int depth;
} node;


void initializNodeArray(node* a, int n) {
  int i;

  for( i=0; i<n; i++) {
    a[i].parent = -1;
    a[i].left = -1;
    a[i].right = -1;
  }

}


void treeWalkForDepth(node* a, int root, int depth) {
  a[root].depth = depth;
  
  if( a[root].left != -1 ) {
    treeWalkForDepth( a, a[root].left, depth+1 ); 
  }
  if( a[root].right != -1) {
    treeWalkForDepth( a, a[root].right, depth );
  }

}


int rootNodeSearch(node* a, int n) {
  int i;

  for( i=0; i<n; i++) {
    if( a[i].parent == -1 ) {
      return i;
    }
  }

}


main() {

  int n, k, id, children, parent;
  node* a;
  
  int i, j;

  scanf("%d", &n);

  a = (node*)malloc( sizeof(node) * n );

  initializNodeArray( a, n);

  for( i=0; i<n; i++) {
    scanf("%d", &id);

    scanf("%d", &k);

    for( j=0; j<k; j++) {
      if( j==0 ) {
	scanf("%d", &a[id].left);
	children = a[id].left;
	a[children].parent = id;
      }else {
	scanf("%d", &a[children].right);
	children = a[children].right;
	a[children].parent = id;
      }
    }

  }
  treeWalkForDepth( a, rootNodeSearch( a, n), 0);
  
  for( i=0; i<n; i++) {
    printf("node %d: parent = %d, depth = %d, ", i, a[i].parent, a[i].depth);

    if( a[i].parent == -1 ) {
      printf("root, ");
    }else if( a[i].left == -1 ) {
      printf("leaf, ");
    }else {
      printf("internal node, ");
    }

    printf("[");
    if( a[i].left != -1){
      printf("%d",a[i].left);
      children = a[i].left;

      while(1) {
	if( a[children].right != -1) {
	  printf(", %d", a[children].right);
	  children = a[children].right;
	}else {
	  break;
	}
      }
    }
    printf("]");
      

    printf("\n");

  }

    return 0;

}
  

Measured memory_bytes: 2168
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using vec = vector<ll>;
using vec2 = vector<vector<ll>>;
ll inf = pow(2, 62);

int main(){
    ll n;cin >> n;
    vec A(n);
    rep(i,n){
        cin >> A[i];
    }
    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());
    ll ans = A[0];
    for(int i = 1;i < n-1;i++){
        if(i%2 == 1){
            ans += A[(i+1)/2];
        }
        if(i%2 == 0){
            ans += A[i/2];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4824
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,tot;
int chi[105];
int main(){
	scanf("%d%d",&n,&tot);
	for(int i=0;i<n;i++)
		scanf("%d",&chi[i]);
	sort(chi,chi+n);
	int ans=0;
	for(int i=0;i<n;i++)
		if(chi[i]<=tot){
			ans++;
			tot-=chi[i];
		}
		else{
			tot=0;
			break;
		}
	if(tot) ans--;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,(n))
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    int H[N], high[N] = {};
    rep(i, N) cin >> H[i];
    rep(i, M) {
        int A, B;
        cin >> A >> B;
        A--; B--;
        high[A] = max(high[A], H[B]);
        high[B] = max(high[B], H[A]);
    }
    int ans = 0;
    rep(i, N) {
        if (high[i] < H[i]) ans++;
    }
    cout << ans << endl;
}

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

int main() {
  int n;
  cin>>n;
  string s;
  rep(i,n) cin>>s[i];
  ////////////////////////
  
  int ans=0;
  rep(i,n-2){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
      ans++;
    }
  }
    cout<<ans<<endl;
  
  
    
    
  
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
struct data{
  int y;
  string s;
};
int main(){
  int n,q,i,flag=0;
  struct data d[50];
  cin >> n >> q;
  for(i=0;i<n;i++){
    cin >> d[i].y;
    cin >> d[i].s;
  }
  for(i=0;i<n;i++){
    if(i==0&&0<=q&&q<d[i].y){
      cout << "kogakubu10gokan" << endl;
      flag=1;
      break;
    }
    /*    if(i==0&&d[i].y<=q&&q<d[i+1].y){
      cout << "sogo10gokan" << endl;
      break;
      }*/
    if(i>0&&d[i-1].y<=q&&q<d[i].y){
      cout << d[i-1].s << endl;
      flag=1;
      break;
    }
  }
  if(flag==0) cout << d[n-1].s << endl;
  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////

bool prime(ll p){
    for(ll i=2;i*i<=p;i++){
        if(p%i==0)return false;
    }
    return true;
}

int main(){fastio
    ll x;cin>>x;
    rep(i,x,inf){
        if(prime(i)){
            cout<<i<<endl;return 0;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
//code written by a living bruh moment
import java.io.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.Random;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        ArrayList<Integer> al = new ArrayList<Integer>(n);
        for(int i = 0; i<n; i++){
            al.add(in.nextInt());
        }
        int count = 0;
        int need = 1;
        if(!al.contains(1)){
            out.println(-1);
        }
        else{
            for(int i = 0; i<n; i++){
                if(al.get(i)!=need){
                    ++count;
                }
                else{
                    ++need;
                }
            }
            out.println(count);
        }

        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

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

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

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong()
        {
            return Long.parseLong(next());
        }
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
        public String nextLine()
        {
            try
            {
                return reader.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=reader.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            tokenizer=new StringTokenizer(next);
            return true;
        }
    }
}

Measured memory_bytes: 57356
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  int r, d, c;
  cin >> r >> d >> c;
  int x[12];
  rep(i, 11){
    x[0] = c;
    x[i+1] = r*x[i] - d;
  }
  for (int i = 1; i < 11; ++i){
    cout << x[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
D, N = map(int, input().split())
list = []
i = 1

while len(list) < N:
  if D != 0:
    if i != 100:
      list.append(i * 100 ** D)
      i += 1
    else:
      i += 1
   
  else:
    if i != 100:
      list.append(i)
      i += 1
    else:
      i += 1
    
print(list[-1])
  

Measured memory_bytes: 2940
#include<stdio.h>

#define MAX 91

long long H[MAX];

long long fib(int n){
  if (n == 0 || n == 1){
    return H[n] = 1;
  }
  
  if(H[n] != -1){
    return H[n];
  }

  return H[n] = fib(n-1)+fib(n-2);
}

int main(){
  int n;
  int i;

  scanf("%d",&n);

  for(i=0; i<MAX; i++){
    H[i] = -1;
  }

  printf("%lld\n",fib(n));

  return 0;
}


Measured memory_bytes: 2084
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	long int i, j;
	long int n, k, s;
	long int work;
	
	scanf("%ld%ld%ld", &n, &k, &s);
	
	if(s < 3) {
		for(i = 0; i < k; i++) {
			printf("%ld ", s);
		}
		for(i = 0; i < n - k; i++) {
			printf("%ld ", s + 1);
		}
	} else {
		for(i = 0; i < k; i++) {
			printf("%ld ", s);
		}
		for(i = 0; i < n - k; i++) {
			printf("%ld ", s - 1);
		}
	}
	
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919810364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, m, s;
vector<pair<int, P>> vec[55];
P a[55];
int d[55][5010];

void dijkstra() {
	d[1][min((int)5000, s)] = 0;
	priority_queue<pair<int, P>, vector<pair<int, P>>, greater<pair<int, P>>> que;
	que.push({ 0,{1,min((int)5000,s)} });
	while (!que.empty()) {
		pair<int, P> p = que.top(); que.pop();
		int v = p.second.first;
		int x = p.second.second;
		if (d[v][x] < p.first)continue;
		if (d[v][x] + a[v].second < d[v][min((int)5000, x + a[v].first)]) {
			d[v][min((int)5000, x + a[v].first)] = d[v][x] + a[v].second;
			que.push({ d[v][x] + a[v].second,{v,min((int)5000,x + a[v].first)} });
		}
		for (int i = 0; i < (int)vec[v].size(); i++) {
			if (x < vec[v][i].second.first)continue;
			if (d[v][x] + vec[v][i].second.second < d[vec[v][i].first][x - vec[v][i].second.first]) {
				d[vec[v][i].first][x - vec[v][i].second.first] = d[v][x] + vec[v][i].second.second;
				que.push({ d[vec[v][i].first][x - vec[v][i].second.first] ,{vec[v][i].first,x - vec[v][i].second.first} });
			}
		}
	}
	for (int i = 2; i <= n; i++) {
		int ans = INF;
		for (int j = 0; j <= 5000; j++)ans = min(ans, d[i][j]);
		cout << ans << endl;
	}
}

signed main() {
	cin >> n >> m >> s;
	for (int i = 0; i < m; i++) {
		int u, v, b, c; cin >> u >> v >> b >> c;
		vec[u].push_back({ v,{b,c} });
		vec[v].push_back({ u,{b,c} });
	}
	for (int i = 1; i <= n; i++)cin >> a[i].first >> a[i].second;
	for (int i = 1; i <= n; i++)for (int j = 0; j <= 5000; j++)d[i][j] = INF;
	dijkstra();
}

Measured memory_bytes: 11428
#include<iostream>
#define N 1000001
using namespace std;
int main(){
  int p[N]={0};
  for(int i=3;i<N;i+=2) p[i] = 1;
  p[2] = 1;
  for(int i=3;i<=1000;i+=2){
    if(p[i]==1){
      for(int j=2*i;j<N;j+=i) p[j] = 0;
    }
  }
  int n,x;
  while(cin >> n >> x){
    if(n==0&&x==0) break;
    int t[x+1];
    for(int i=0;i<=x;i++) t[i] = 0;
    for(int i=0;i<n;i++){
      int k;
      cin >> k;
      if(k<=x) t[k] = 1;
      for(int j=1;j<=x;j++){
    if(t[j]==1&&j+k<=x) t[j+k] = 1;
      }
    }
    bool ok = false;
    for(int i=x;i>=0;i--){
      if(t[i]==1&&p[i]==1){
    cout << i << endl;
    ok = true;
    break;
      }
    }
    if(!ok) cout << "NA" << endl;
  }
  return 0;
}


Measured memory_bytes: 10908
object Main extends App {
  val MASK = 1000000000L + 7L
  def fact(n: Long): Long = {
    var result = 1L
    for (i <- 2 to n.toInt) result = mul(result, i.toLong)
    result
  }

  def mul(x: Long, y: Long): Long = (x * y) % MASK
  def pow2(x: Long): Long = mul(x, x)

  def solve(n: Long, m: Long): Long = (n - m).abs match {
    case 0 => mul(2, pow2(fact(n)))
    case 1 => mul(pow2(fact(n min m)), (n max m))
    case _ => 0
  }

  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val m = sc.nextInt()
  println(solve(n, m))
}

Measured memory_bytes: 25548
#include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<deque>
#define ll long long
using namespace std;
#define BUF_SIZE 1048576
char _buf[BUF_SIZE],*_is=_buf,*_it=_buf;
inline char rdc(){
	if (_is==_it) _it=(_is=_buf)+fread(_buf,1,BUF_SIZE,stdin);
	return *_is++;
}
inline void rdi(int &x){
	int f=0;
	register char ch=rdc();
	while ((ch<'0' or ch>'9') and (ch^'-')) ch=rdc();
	if (ch=='-') f=1,ch=rdc();
	while (ch>='0' and ch<='9') x=(x<<3)+(x<<1)+(ch^'0'),ch=rdc();
	if(f) x=-x;
}
inline void rdi(ll &x){
	ll f=0;
	register char ch=rdc();
	while ((ch<'0' or ch>'9') and (ch^'-')) ch=rdc();
	if (ch=='-') f=1,ch=rdc();
	while (ch>='0' and ch<='9') x=(x<<3)+(x<<1)+(ch^'0'),ch=rdc();
	if(f) x=-x;
}
inline void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
inline void _write(int x){
	write(x);
	putchar(' ');
}
inline void print(int x){
	write(x);
	putchar('\n');
}
inline void write(ll x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
inline void _write(ll x){
	write(x);
	putchar(' ');
}
inline void print(ll x){
	write(x);
	putchar('\n');
}
struct dsu{
	int par[200200];
	inline void init(int _n){for(int i=0;i<_n;++i) par[i]=i;}
	inline int find(int now){
		if(par[now]==now) return now;
		return par[now]=find(par[now]);
	}
	inline bool unite(int a, int b){
		int Pa(find(a)),Pb(find(b));
		if(Pa==Pb) return false;
		par[Pa]=Pb;
		return true;
	}
};
int n,a,b,c,d;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int i,j;
	cin>>a>>b;
	a=(a+1)/2;
	if(a>=b) cout<<"YES\n";
	else cout<<"NO\n";
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> input(n-1);
  vector<vector<int>> G(n);
  for(int i=0;i<n-1;i++) {
    int a, b;
    cin >> a >> b;
    a--;b--;
    input[i].first = a;
    input[i].second = b;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  int k = 0;
  for(int i=0;i<n;i++) {
    if(G[i].size() > k) k = G[i].size();
  }

  cout << k << endl;

  vector<int> parent(n, -1);
  queue<int> que;
  map<pair<int, int>, int> ans;
  que.emplace(0);
  while(!que.empty()) {
    int node = que.front();que.pop();
    int alt = 1;
    for(int i=0;i<G[node].size();i++) {
      if(G[node][i] == parent[node]) continue;
      if(alt == ans[make_pair(parent[node], node)]) {
        alt++;
      }
      ans[make_pair(node, G[node][i])] = alt;
      ans[make_pair(G[node][i], node)] = alt;
      alt++;
      parent[G[node][i]] = node;
      que.emplace(G[node][i]);
    }
  }

  for(int i=0;i<n-1;i++) {
    cout << ans[input[i]] << endl;
  }

  return 0;
}

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


int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    rep(i,N){
        cin >> X[i];
    }
    int ans = 99999999;
    rep(i,110){
        int total = 0;
        rep(j,N){
            total += (X[j]-i)*(X[j]-i);
        }
        ans = min(ans,total);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	count := 0
	var N, M, C int
	fmt.Scan(&N, &M, &C)

	reader := bufio.NewReader(os.Stdin)
	numberChars, _ := reader.ReadString('\n')
	numberChars = strings.TrimSuffix(numberChars, "\n")

	numberCharsAry := strings.Split(numberChars, " ")

	var numbers = []int{}
	for _, numChar := range numberCharsAry {
		num, _ := strconv.Atoi(numChar)
		numbers = append(numbers, num)
	}

	for i := 0; i < N; i++ {
		codeChars, _ := reader.ReadString('\n')
		codeChars = strings.TrimSuffix(codeChars, "\n")
		codes := strings.Split(codeChars, " ")

		sum := 0
		for i, code := range codes {
			code, _ := strconv.Atoi(code)
			sum += code * numbers[i]
		}
		if sum+C > 0 {
			count++
		}
	}

	fmt.Println(count)
}


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

const ll maxs = 1e5+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

void pre(){

}

void solve(){ 
    ll n,m;
    cin >> n >> m;
    ll a[m];
    ll sum=0;
    for(ll i=0;i<m;i++){
        cin >> a[i];
        sum += a[i];
    }
    ll ans = n - sum;
    ans = max(ans , -1ll);
    cout << ans;
}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;   
    //cin>>T;
    while(T--){  
        solve();
    }
    return 0;
}


Measured memory_bytes: 3744
l_dict = {}


def lucas(num):
    if num == 0:
        return 2
    elif num == 1:
        return 1
    elif num in l_dict:
        return l_dict[num]
    else:
        lu = lucas(num-1) + lucas(num-2)
        l_dict[num] = lu
        return lu


n = int(input())
print(lucas(n))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef pair<int,int> pi;
priority_queue<pi, vector<pi>, greater<pi> > pq; //min heap
 
ll mini(ll a,ll b){	return a<b?a:b;}
ll maxi(ll a,ll b){	return a>b?a:b;}
ll gcd(ll a,ll b){	if(b == 0)	return a;return gcd(b,a%b);}
ll binpow(ll n,ll x){	ll ans = 1;while(x){if(x & 1)	ans *= n;n *= n;x >>= 1;}return ans;}
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    int n;
    cin>>n;
 
    vector<int> A(n+4,0), cost(n+4,0);
 
    for(int i=1;i<=n;++i)   cin>>A[i];
 
    cost[0] = 1200000000;
    cost[1] = 0;
    cost[2] = abs(A[2]-A[1]);
 
    for(int i=2;i<=n;++i){
        cost[i] = min(cost[i-2] + abs(A[i] - A[i-2]), cost[i-1] + abs(A[i] - A[i-1]));
    }
 
    cout<<cost[n]<<"\n";
 
    return 0;
}

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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int i##_to_ = (t), i = (f); i <= i##_to_; i++)
#define uptil(f, t, i)   for(int i##_to_ = (t), i = (f); i <  i##_to_; i++)
#define downto(f, t, i)  for(int i##_to_ = (t), i = (f); i >= i##_to_; i--)
#define downtil(f, t, i) for(int i##_to_ = (t), i = (f); i >  i##_to_; i--)
typedef long double LD;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
#define debug true
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 2
#define _LIBCPP_DEBUG2 2
#define ln << endl
#else
#define debug false
#define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '



signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    int N, Z, W; scanf("%d%d%d", &N, &Z, &W);
    vector<long> A(N+1), B, xm(N);
    times(N, i) scanf("%lld", &A[i+1]);
    B = A;
    A[0] = Z; B[0] = W;

    vector<vector<long>> pyon(N+1, vector<long>(N+1, 0));

    times(N, i) pyon[i][N] = abs(A[N] - A[i]);
    times(N, j) pyon[N][j] = abs(B[N] - B[j]);

    long ans;
    rtimes(N, j) {
        uptil(j+1, N, i) pyon[i][j] = xm[i];

        long yM = 0;
        upto(j+1, N, k) yM = max(yM, pyon[k][j]);
        xm[j] = LLONG_MAX;
        upto(j+1, N, l) xm[j] = min(xm[j], pyon[j][l]);

        times(j, i) {
            pyon[i][j] = yM;
        }

        if(j == 0) ans = yM;
    }

    if(debug) { times(N, i) cout << (i?" ":"") << xm[i]; cout ln; }

    cout << ans ln;

    return 0;
}


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

int main(){

string s;
cin>>s;
int i=0;
int n =s.length();
while( i<n && s[i]!='A' )i++;
int j = n-1;
while( j>=0 && s[j]!='Z' )j--;
cout<<j-i+1<<endl;

return 0;
}


Measured memory_bytes: 640
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: Christmas Eve Eve
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);

  int sum = 0, maxp = 0;
  for (int i = 0; i < n; i++) {
    int pi;
    scanf("%d", &pi);
    sum += pi;
    if (maxp < pi) maxp = pi;
  }

  printf("%d\n", sum - maxp / 2);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma region Macros
#define ios\
    ios::sync_with_stdio(false);\
    cin.tie(nullptr);
#define VEC(type, name, size)\
    V<type> name(size);\
    IN(name)
#define VVEC(type, name, h, w)\
    VV<type> name(h, V<type>(w));\
    IN(name)
#define INT(...)\
    int __VA_ARGS__;\
    IN(__VA_ARGS__)
#define LL(...)\
    ll __VA_ARGS__;\
    IN(__VA_ARGS__)
#define STR(...)\
    string __VA_ARGS__;\
    IN(__VA_ARGS__)
#define CHAR(...)\
    char __VA_ARGS__;\
    IN(__VA_ARGS__)
#define DOUBLE(...)\
    DOUBLE __VA_ARGS__;\
    IN(__VA_ARGS__)
#define LD(...)\
    LD __VA_ARGS__;\
    IN(__VA_ARGS__)
template <class T> void scan(T &a) { cin >> a; }
template <class T> void scan(vector<T> &a) { for(auto &i : a) scan(i); }
template <class T, class L> void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) { scan(head); IN(tail...); }
template <class T> inline void print(T x){ cout << x << '\n';}
#define ll long long
#define ld long double
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
template <typename T> T pow(T a, long long n, T e = 1) {T ret = e; while (n) {if (n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
const ll INF = 1e18;
#pragma endregion

int main(){
    ios;
    STR(s, t);
    s += s;
    REP(i, SZ(t)){
        if(s.substr(i, SZ(t)) == t){
            print("Yes");
            return 0;
        }
    }
    print("No");
}

Measured memory_bytes: 3652
#include <algorithm>
#include <iostream>
#include <vector>

typedef std::vector<int> vec;

int power_of_2(int n) {
    return (n & (n - 1)) == 0;
}

int max_divisor(int n) {
    return (~n & (n - 1)) + 1;
}

int g(const vec& sequence) {
    int sum = 0;
    for (int i = 0; i < sequence.size(); i++) {
        sum += sequence[i];
    }

    vec table(sum + 1);
    std::fill(table.begin(), table.end(), -1);
    table[0] = 0;

    sum = 0;
    for (int i = 0; i < sequence.size(); i++) {
        int x = sequence[i];
        for (int a = sum / x * x; a >= 0; a -= x) {
            if (table[a] >= 0) {
                if (table[a + x] >= 0) {
                    table[a + x] = std::max(table[a] + 1, table[a + x]);
                } else {
                    table[a + x] = table[a] + 1;
                }
            }
        }
        sum += sequence[i];
    }

    int i = 1;
    int max = 0;
    while (i <= sum) {
        max = std::max(max, table[i]);
        i *= 2;
    }

    return max;
}

vec extract(const vec& sequence, int k) {
    vec subsequence;
    int min = 0x7fffffff;
    for (int i = 0; i < sequence.size(); i++) {
        int x = sequence[i];
        if (x % k == 0 && power_of_2(x / k)) {
            subsequence.push_back(x);
            if (min > x) {
                min = x;
            }
        }
    }
    for (int i = 0; i < subsequence.size(); i++) {
        subsequence[i] /= min;
    }
    return subsequence;
}

int f(const vec& sequence) {
    vec numbers;
    for (int i = 0; i < sequence.size(); i++) {
        int x = sequence[i];
        numbers.push_back(x / max_divisor(x));
    }
    std::sort(numbers.begin(), numbers.end());
    numbers.erase(std::unique(numbers.begin(), numbers.end()), numbers.end());

    int max = 0;
    for (int i = 0; i < numbers.size(); i++) {
        int k = numbers[i];
        const vec& subsequence = extract(sequence, k);
        max = std::max(max, g(subsequence));
    }
    return max;
}

int main() {
    while (true) {
        int n;
        std::cin >> n;
        if (n == 0) {
            break;
        }
        vec sequence(n);
        for (int i = 0; i < n; i++) {
            std::cin >> sequence[i];
        }
        std::cout << f(sequence) << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3660
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
     
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,n) for(int i=(n)-1;i>=0;--i)
#define rrep2(i,a,b) for(int i=(a)-1;i>=b;--i)
#define range(i,a,b,c) for(int i=a;							\
												 c>0?i<b:							\
												 i>b;								\
												 i+=c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
#define int long long
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif
     
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
const int INF = 1 << 28;
const ll INFL = (ll)1 << 58;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real& r) { return (r > eps) - (r < -eps); }
int sgn(const Real& a, const Real &b) { return sgn(a - b); }
     
//.....................
const int MAX = (int)2e5 + 5;
     
vector<string> split(const string &str, char sep) {
	vector<string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}
     
template<class InputIterator>
int sum(InputIterator begin, InputIterator end) {
	return accumulate(begin, end, 0ll);
}

void solve();

signed main() {
	cout << fixed << setprecision(20);
	solve();
	while(true) {
		char s[MAX];
		if (scanf("%s", s) == EOF) break;
		int n = strlen(s);
		for (int i = n - 1; i > -1; i--) {
			ungetc(s[i], stdin);
		}
		solve();
	}
	return 0;
}

int N, M;
vector<int> graph[10];
vector<int> path;
bool visited[10];

int dfs(int cur, int visited_cnt) {
	if (visited_cnt == N) {
		for (auto v : path) {
			cerr << v << " ";
		}
		cerr << endl;
		return 1;
	}
	int res = 0;
	rep(i, graph[cur].size()) {
		int next = graph[cur][i];
		if (visited[next]) continue;
		
		visited[cur] = true;
		// path.push_back(cur);
		
		res += dfs(next, visited_cnt + 1);
		
		visited[cur] = false;
		// path.pop_back();
	}
	return res;
}

void solve() {
	cin >> N >> M;
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	cout << dfs(0, 1) << endl;
}


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

#include <bits/stdc++.h>
 
#if DEBUG
    #include "debug.h"
#else
    #define debug(args...)
#endif    

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;


#define M 1000000 
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int INF = INT_MAX;
const int mod = 1e9+7;

const int N = 2e5 + 10;
inline int add(int x,int y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline int mul(int x,int y){
  x = (1LL * x * y) % mod;
  return x;
}
clock_t time_p=clock();

int a[N];
ll pref[N];

int32_t main(){
  fast;

  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);

  int n,k,s;
  cin >> n >> k >> s;

  FOR(i,1,100) {
    FOR(i,1,k) {
      a[i] = s;
    }
    FOR(i,k+1,n) {
      int x = (rng() % (int)(1e9)) + 1;
      a[i] = x;
    }
    int ff = 1;
    set<ll>ss;
    ss.insert(0);
    FOR(i,1,n) {
      pref[i] = pref[i - 1] + a[i];
      if(i <= k)ss.insert(pref[i]);
    }
    FOR(i,k+1,n) {
      if(ss.find(pref[i] - s) != ss.end()) {
        ff = 0;
        break;
      }
    }
    if(ff) {
      FOR(i,1,n)cout << a[i] << " ";cout << "\n";
      // FOR(i,1,n) {
      //   FOR(j,0,i-1) {
      //     cout << pref[i] - pref[j] << " ";
      //   }
      // }
      break;
    }
  }

  time_p=clock()-time_p;
  cerr<<"\nTime Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";

  return 0;
}

Measured memory_bytes: 7168
# A
# Ferris Wheel

a_b = input()

a = int(a_b.split(" ")[0])
b = int(a_b.split(" ")[1])

if a >= 13:
    print(b)
    
elif a >= 6 and a <= 12:
    print(int(b/2))
    
else:
    print(0)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char r[], a[];
        int hit, blow;

        while (true) {
            r = sc.next().toCharArray();
            a = sc.next().toCharArray();
            if (r.length == 1 && a.length == 1 && r[0] == '0' && a[0] == '0') {
                break;
            }
            hit = blow = 0;
            for (int i = 0; i < 4; i++) {
                if (r[i] == a[i]) {
                    hit++;
                }
            }
            for (int i = 0; i < 4; i++) {
                for (int j = 0; j < 4; j++) {
                    if (i != j && a[i] == r[j]) {
                        blow++;
                    }
                }
            }
            System.out.println(hit + " " + blow);
        }
    }
}

Measured memory_bytes: 46744