akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sin = new Scanner(System.in);
		
		int a, b;
		a = sin.nextInt();
		b = sin.nextInt();
		
		if(a == b ){
			System.out.println("a == b");
		
		}else if(a > b){
			System.out.println("a > b");
		
		}else{
			System.out.println("a < b");
		}
		
	}
}



Measured memory_bytes: 26180
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Reader sc = new Reader();
        PrintWriter pw = new PrintWriter(System.out);
        
        try {
            int n = sc.nextInt();
            int m = sc.nextInt();
            ArrayList<Integer>[] adj = new ArrayList[n];
            for(int i=0 ; i<n ; i++) adj[i] = new ArrayList<>();
            for(int i=0 ; i<m ; i++) {
                int u = sc.nextInt()-1;
                int v = sc.nextInt()-1;
                adj[u].add(v);
                adj[v].add(u);
            }

            boolean[] vis = new boolean[n];
            int max = 0;
            for(int i=0 ; i<n ; i++) {
                if(!vis[i]) {
                    vis[i] = true;
                    LinkedList<Integer> queue = new LinkedList<>();
                    queue.add(i);
                    int elem = 1;
                    while(!queue.isEmpty()) {
                        int x = queue.poll();
                        for(int y: adj[x]) {
                            if(!vis[y]) {
                                vis[y] = true;
                                queue.add(y);
                                elem++;
                            }
                        }
                    }
                    max = Math.max(max, elem);
                }
            }
            pw.println(max);
        }
        finally {
            pw.flush();
            pw.close();
        }
    }
    
    static class Reader {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while(!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch(IOException io) {
                    io.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 80420
import sys
sys.setrecursionlimit(10 ** 9)

class Union_Find:
    def __init__(self, n = 0):
        self.d = [-1] * n
    
    def find(self, x: int) -> int:
        if self.d[x] < 0:
            return x
        self.d[x] = self.find(self.d[x])
        return self.d[x]
    
    def unite(self, x: int, y: int) -> bool:
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.d[x] > self.d[y]:
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x
        return True

    def same(self, x: int, y: int) -> bool:
        return self.find(x) == self.find(y)

    def size(self, x: int) -> int:
        return -1 * self.d[self.find(x)]


n, m, k = map(int, input().split())
uf = Union_Find(n)

friends = [0] * n
blocks = [[] for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    friends[a] += 1
    friends[b] += 1
    uf.unite(a, b)

for i in range(k):
    c, d = map(int, input().split())
    c -= 1
    d -= 1
    blocks[c].append(d)
    blocks[d].append(c)

ans = []
for i in range(n):
    candidates = uf.size(i) - 1 - friends[i]
    for u in blocks[i]:
        if uf.same(i, u):
            candidates -= 1
    ans.append(candidates)

print(*ans)


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

int main() {
    int n, x;
    cin >> n >> x;
    int m[n];
    for (int i = 0; i < n; i++) {
        cin >> m[i];
        x -= m[i];
    }
    stable_sort(m, m+n);
    cout << n+x/m[0] << endl;
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.algorithm;
import std.string;
import std.file;
import std.math;
 
int main() {
        string l;
        while((l = readln(), l.length)){
                l = l.split("\n")[0];
                int max = to!int(l);
                bool[] isPrime = [false, false];
                for(int i = 2; i <= max; i++) isPrime ~= true; // initial value
                for(int i = 2; i <= max; i++){
                        if(isPrime[i]) for(int j = i * 2; j <= max; j += i) isPrime[j] = false;
                        }               
                int cnt = 0;
                for(int i = 1; i <= max; i++) if(isPrime[i]) cnt += 1;
                printf("%d\n", cnt);
                }
        return 0;
}

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

int n;
vector<int> B,C;
int A[10];
bool flag; //是否有解

void dfs(int x) {
	if(x==10) { //球丢完了，递归要返回
		for(int i=1;i<B.size();i++) {
			if(B[i]<B[i-1]) return; //这个分支不行,有矛盾
		}
		for(int i=1;i<C.size();i++) {
			if(C[i]<C[i-1]) return; //这个分支不行,有矛盾
		}
		flag = true; 			 //这个分支走到最后是有解的
		return;
	}
	B.push_back(A[x]); 			//把第x个球丢给B
	dfs(x+1);  					//进入这个分支
	B.pop_back(); 				//撤销操作，弹出B的最后一个球
	
	C.push_back(A[x]); 			//把第x个球丢给C
	dfs(x+1);    				//进入这个分支
	C.pop_back(); 				//撤销操作，弹出C的最后一个球
}

int main() {
	int T;
    scanf("%d",&T);
	while(T--) {
		for(int i=0;i<10;i++) scanf("%d",&A[i]);
		flag = false;
		dfs(0);
		puts(flag ? "YES":"NO");
	}
    return 0;
}



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

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  int con;
  
  while(A >= B){
    B *= 2;
    con++;
  }
  
  while(B >= C){
    C *= 2;
    con++;
  }
  
  if(con <= K){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int H, W, N;
vector<int> a;

void solve() {
  vector<int> tmp;
  vector<vector<int>> res(H, vector<int>(W));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < a[i]; j++) {
      tmp.push_back(i + 1);
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      res[i][j] = tmp[i * W + j];
    }
  }
  for (int i = 0; i < H; i++) {
    if (i % 2 == 1) {
      reverse(res[i].begin(), res[i].end());
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cout << res[i][j] << " ";
    }
    cout << "\n";
  }
}

int main() {
  cin >> H >> W >> N;
  a.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  solve();
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(int)(n); ++i)
 
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;}

int main(){
  int a, b; cin >> a >> b;
  if(a>=1 && a<=9 && b>=1 && b<=9){
    cout << a*b << endl;
  }
  else {
  cout << -1 << endl;
  }
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

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

  if(n < 1 || 10000 < n){
    exit(0);
  }

  int a[n];
  count = n;

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

    scanf("%d",&a[i]);

    if(a[i] < 2 || 100000000 < a[i]){
      exit(1);
    }

    if(a[i] != 2 && a[i]%2 == 0){
      count--;
      continue;
    }

    for(int j=3; j<=sqrt(a[i]); j+=2){
      if((a[i]%j) == 0){
	count--;
	break;
      }
    }
  }

    printf("%d\n",count);
    return 0;
}
  

  



Measured memory_bytes: 2072
#include<cstdio>
#include<algorithm>
#include<vector>
#define int long long
int n,m,a[100100],b[100100],fa[100100],id[100100],vis[100100],sum[100100],cnt[100100];
std::vector<int> e[100100]; 
bool cmp(int x,int y){
	return a[x]<a[y];
} 
int find(int x){
	if(x==fa[x])return x;
	return fa[x]=find(fa[x]);
}
signed main(){
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%lld%lld",&a[i],&b[i]);
		a[i]=std::max(a[i]-b[i],0ll);
		cnt[i]=a[i];
		sum[i]=b[i];
		fa[i]=id[i]=i;
		vis[i]=0;
	}
	for(int i=1,x,y;i<=m;i++){
		scanf("%lld%lld",&x,&y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	std::sort(id+1,id+n+1,cmp);
	for(int i=1;i<=n;i++){
		int x=id[i];
		vis[x]=1;
		for(int j=0;j<e[x].size();j++){
			int upup=e[x][j];
			if(vis[upup]){
				int rx=find(x),ry=find(upup);
				if(rx!=ry){
					fa[ry]=rx;
					sum[rx]+=sum[ry];
					cnt[rx]=std::min(cnt[rx],cnt[ry]+std::max(0ll,a[rx]-cnt[ry]-sum[ry]));
				}
			}
		}
	}
	printf("%lld",cnt[id[n]]+sum[id[n]]);
	return 0;
}

Measured memory_bytes: 14676
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
ll INF = 1e18;
#define def 0

int main() {
  string s;
  cin >> s;
  ll p = 0;
  rep(i, s.size()) if (s[i] == 'p') p++;
  cout << s.size() / 2 - p << endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  int j=0;

  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
      if(S=="Y") {
      j++; }
  }
  if(j==0) {
    cout << "Three" << endl;
  }
  else {
    cout << "Four" << endl;
  }
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc147/tasks/abc147_a
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22) {
        cout << "bust\n";
    } else {
        cout << "win\n";
    }
    return 0;
}


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

//#define int long long

using namespace std;
const int MN = 3e3+7;
const int MOD = 1e9+7;

int n, m;
double dp[MN][MN], a[MN];

signed main()
{
    memset(dp, 0, sizeof dp);
    cin >> n;
    for(int i = 0; i < n; i++)cin >> a[i];
    dp[0][0] = 1-a[0];
    dp[0][1] = a[0];
    cout << setprecision(12);
    for(int i = 1; i < n; i++){
        dp[i][0] = (1-a[i]) * dp[i-1][0];
    }
    for(int i = 1; i < n; i++){
        for(int j = 1; j <= n; j++){
            dp[i][j] = dp[i-1][j] * (1-a[i]) + dp[i-1][j-1] * a[i];
        }
    }
    double ans = 0;
    for(int i = n/2+1; i <= n; i++){
        ans += dp[n-1][i];
        //cout << i << " " << dp[n-1][i] << endl;
    }
    cout << setprecision(12) << ans;
}


Measured memory_bytes: 70912
import fractions
def div_cnt(x):
    return b//x-(a-1)//x

a,b,c,d = map(int,input().split())
e = c*d//fractions.gcd(c,d)
cnt = b-a+1
c_cnt = div_cnt(c)
d_cnt = div_cnt(d)
e_cnt = div_cnt(e)
print(cnt-c_cnt-d_cnt+e_cnt)

Measured memory_bytes: 5076
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
from functools import reduce
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
def lcm_base(a, b):
    return (a * b) // gcd(a, b)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def nCr(n,r):
  bunshi = 1
  bunbo = 1
  for i in range(r):
    bunshi = (bunshi * (n-i)) % MOD
    bunbo = (bunbo * (i+1)) % MOD
  return bunshi * pow(bunbo, MOD - 2, MOD) % MOD


def main():
  X, Y = map(int, readline().split())
  if (X + Y) % 3 != 0 or (2 * X - Y) % 3 != 0 or (2 * Y - X) % 3 != 0:
    print(0)
    sys.exit()
  else:
    n = (2*Y - X)//3
    m = (2*X - Y)//3
    if n<0 or m<0:
      print(0)
      sys.exit()
    ans = nCr(n+m, n)
  print(ans%MOD)
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 14928
#include <iostream>
using namespace std;
int main(){
	//0.5(r+b)=g
	//r+b=g/0.5;
	//b=g/0.5-r;
	int r,g,s,b;
	cin>>r>>g;
	b=g/0.5-r;
	cout<<b<<endl;
	return 0;
}


Measured memory_bytes: 256
S = input()
N = len(S)

def dfs(i, f):
    if i == N-1:
        return sum(list(map(int, f.split('+'))))
    return dfs(i+1, f+'+'+S[i+1]) + dfs(i+1, f+S[i+1])

print(dfs(0, S[0]))

Measured memory_bytes: 3060
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto M = RD;
	auto edges = new long[][](N);
	foreach (i; 0..M)
	{
		auto a = RD-1;
		auto b = RD-1;
		edges[a] ~= b;
		edges[b] ~= a;
	}

	foreach (i; 0..N)
		writeln(edges[i].length);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

ll n, s;
ll i;

ll get_sum(ll b, ll n) {
    ll ans = 0;

    while (n > 0) {
        ans += n % b;
        n /= b;
    }

    return ans;
}

void check_small_base() {
    ll i;

    if (n <= s) return;

    for (i = 2; i * i <= n; i++) {
        if (get_sum(i, n) == s) {
            printf("%lld", i);
            exit(0);
        }
    }
}

void check_two_digits() {
    ll i, aux;

    if (n <= s) return;
    aux = n - s;

    for (i = 1; i * i <= aux; i++);

    for (i--; i > 0; i--) {
        if (aux % i != 0) continue;

        if (get_sum((aux / i) + 1, n) == s) {
            printf("%lld", (aux / i) + 1);
            exit(0);
        }
    }
}

void check_one_digit() {
    if (s == n) {
        printf("%lld", n + 1);
        exit(0);
    }
}

int main()
{
 //   freopen("test.in","r",stdin);

    scanf("%lld%lld", &n, &s);
    check_small_base();
    check_two_digits();
    check_one_digit();

    printf("-1");

    return 0;
}


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

m = 1
max_cnt = 0
for i in range(2, N+1, 2):
    cnt = 0
    tmp = i
    while tmp % 2 == 0:
        cnt += 1
        tmp /= 2
    if cnt > max_cnt:
        max_cnt = cnt
        m = i
print(m)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)

signed main(){
	ll n; cin>>n;
	vl vec(n);
	map<ll,ll> mp;
	set<ll> s;
	rep(i,0,n){
		cin>>vec[i];
		mp[vec[i]]++;
		s.insert(vec[i]);
	}
	ll ans=0;
	rep(i,0,n){
		bool ok=true;
		if(mp[vec[i]]>1){
			continue;
		}
		for(ll j=(s.count(1) ? 1:2);j*j<=vec[i];j++){
			if(vec[i]==j) continue;
			if(vec[i]%j==0 && s.count(j)){
				ok=false;
				break;
			}
			else if(vec[i]%j==0 && s.count(vec[i]/j)){
				ok=false;
				break;
			}
		}
		if(ok){
			ans++;
		}
	}
	cout<<ans;
	
	return 0;
}


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

int main() {
  int H,W;
  cin >> H >> W;
  
  vector<vector<char>> table((H + 2),vector<char>((W + 2),'#'));
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      cin >> table.at(i).at(j);
    }
  }
  
  for (int i = 0; i < (H + 2); i++) {
    for (int j = 0; j < (W + 2); j++) {
      cout << table.at(i).at(j);
      if (j == (W + 1)) {
        cout << endl;
      }
    }
  }
}

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

const int N=2e5+100;
const int mod=1e9+7;
typedef long long ll;


typedef pair<int,int> pa;

ll p[N];
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int n;cin>>n;
    for(int i=1;i<=n;i++){
        cin>>p[i];
    }
    int l=1,r=2;
    ll ans=1;
    ll k=p[1];
    while(r<=n){

        if((k&p[r])==0){
            ans+=r-l+1;
            k^=p[r];
            r++;

        }
        else{
            k^=p[l];
            l++;
        }
    }

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


Measured memory_bytes: 5208
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

int main(){
    int n,k,t;
    cin>>n>>k>>t;
    int p=n/k;
    if(n%k!=0) p++;
    cout<<p*t<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
const ll mod = 1000000007;

vector<int> to[1005];
vector<int> ans;
bool used[1005];
int xxx;

bool dfs(int x) {
    if (used[x]) {
        xxx = x;
        return true;
    }
    used[x] = true;
    for (int e: to[x]) {
        bool res = dfs(e);
        if (res) {
            ans.push_back(x);
            used[x] = false;
            return true;
        }
    }
    used[x] = false;
    return false;
}


int main(){
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
    }
    
    rep(i, n) {
        bool res = dfs(i);
        if (res) {
            break;
        }
    }
    if (ans.size()==0) {
        cout << "-1" << endl;
        return 0;
    }

    for (int i=ans.size()-1; i>=0; i--) {
        if (ans[i]==xxx) break;
        ans.pop_back();
    }

    reverse(ans.begin(), ans.end());
    
    //debug(ans.size());

    rep(i, n) used[i] = false;
    rep(i, ans.size()) {
        used[ans[i]] = true;
    }

    int start = 0;
    int startid;
    int endid;
    //rep(i, ans.size()) debug(ans[i]);

    


    while (1) {
        vector<int> now;
        swap(now, ans);
        bool flg = true;
        rep(i, now.size()) {
            int v = now[i];
            int w = now[(i+1)%now.size()];
            for (int e: to[v]) {
                if (used[e] && e!=w) {
                    flg = false;
                    start = e;
                    endid = i;
                    break;
                }
            }
            if (!flg) break;
        }
        if (flg) {
            swap(ans, now);
            break;
        }
        rep(i, now.size()) {
            if (now[i]==start) startid = i;
        }
        //debug(start);
        //debug(startid);
        //debug(endid);
        int d = (endid+now.size()-startid)%now.size(); 
        rep(i, now.size()) {
            if (i<=d) ans.push_back(now[(startid+i)%now.size()]);
            else used[now[(startid+i)%now.size()]] = false;
        }
        //rep(i, ans.size()) debug(ans[i]);
       
    }
    
    cout << ans.size() << endl;
    rep(i, ans.size()) {
        cout << ans[i]+1 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

int main(void){
  int n;
  int i,j;
  int cnt1=0,cnt2=0;
  int pl[500000];
  int pll;
  
  pl[0]=2;
  pl[1]=3;
  
  while(scanf("%d",&n)!=EOF){
    pll=2;
    for(i=5;i<=n;i=i+2){
      for(j=0;j<pll;j++){
	if(i%pl[j]==0){
	  cnt1++;
	  break;
	}
	if(i<pl[j]*pl[j]){
	  break;
	}
      }
      if(cnt1==0){
	pl[pll]=i;
	pll++;
	cnt2++;
      }
      cnt1=0;
    }
    if(n>=3){
      printf("%d\n",cnt2+2);
    }
    else if(n==2){
      printf("%d\n",cnt2+1);
    }
    else{
      printf("%d\n",cnt2);
    }
    cnt2=0;
  }
  return(0);
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define maxn 200050
#define mod 998244353
int n, ans, f[maxn][3][3][2], sum;
char a[maxn];

int read()
{
	int x = 0, k = 1;
	char c; c = getchar();
	while(c < '0' || c > '9') { if(c == '-') k = -1; }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * k;
}

bool Check()
{
	for(int i = 2; i <= n; i ++) 
		if(a[i] != a[i - 1]) return 0;
	return 1;
}

bool Check2()
{
	for(int i = 2; i <= n; i ++) 
		if(a[i] == a[i - 1]) return 0;
	return 1;
}

void Up(int &x, int y) { x = (x + y) % mod; }
void DP(int i, int j, int k, int p)
{
	for(int q = 0; q <= 2; q ++)
		Up(f[i + 1][q][(q + k) % 3][p | (j == q)], f[i][j][k][p]);
}

signed main()
{
	scanf("%s", a + 1); n = strlen(a + 1);
	if(Check()) { puts("1"); return 0; }
	if(n <= 3)
	{
		if(n == 2) puts("2");
		else 
		{
			if(a[1] != a[2] && a[1] != a[3] && a[2] != a[3]) puts("3");
			else if(a[1] == a[3]) puts("7");
			else puts("6");
		}
		return 0;
	}
	for(int i = 1; i <= n; i ++) sum = (sum + a[i] - 'a') % 3;
	for(int i = 0; i <= 2; i ++) f[1][i][i][0] = 1;
	for(int i = 1; i <= n - 1; i ++)
		for(int j = 0; j <= 2; j ++)
			for(int k = 0; k <= 2; k ++)
				for(int p = 0; p <= 1; p ++)
					DP(i, j, k, p);
	for(int i = 0; i <= 2; i ++) Up(ans, f[n][i][sum][1]);
	Up(ans, Check2());
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 28544
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Control.Arrow

main :: IO ()
main = do
  [_, _, x] <- getInts
  as <- getInts
  print . uncurry min . (length *** length) $ span (< x) as

getInts :: IO [Int]
getInts = map read . words <$> getLine


Measured memory_bytes: 892
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
  
signed main(){
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout.precision(20);
  
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  REP(i,n) {
    cin >> a[i];
    a[i]--;
  }
  
  vector<int> step(n, -1);
  vector<int> s;
  int v = 0;
  while(step[v] == -1){
    step[v] = s.size();
    s.push_back(v);
    v = a[v];
  }

  int c = s.size() - step[v];
  int l = step[v];

  if(k < l) cout << s[k] + 1 << endl;
  else {
    k -= l;
    k %= c;
    cout << s[l + k] + 1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 8440
#include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pf push_front
#define pb push_back
#define mp make_pair
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


signed main(){
  string s;
  cin>>s;
  stack<char> sta;
  rep(i,s.size()){
    if(s[i]=='S'){
      sta.push('S');
    }else{
      if(sta.size()==0||sta.top()=='T'){
        sta.push('T');
      }else{
        sta.pop();
      }
    }
  }
  cout<<sta.size()<<endl;



  return 0;
}


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

int main(){
    int j = 0;
    int x = 0;
    while (1) {
        cin >> x;
        if (x == 0) break;
        cout << "Case " << j+1 << ": " << x << endl;
        j++;
    }
}


Measured memory_bytes: 3068
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main(){

int n;
cin>>n;
if(n<=999)
    cout<<"ABC";
else
    cout<<"ABD";
return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ii pair<int,int>
#define nl '\n'
#define qquery int query;cin>>query;while(query--)
#define benfero freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
int main(){
ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	//benfero
	int n;
	cin >>n;
	int ar[n][3];
	for(int i=0;i<n;i++){
		cin >>ar[i][0]>>ar[i][1]>>ar[i][2];
	}
	int a=0;
	int b=0;
	for(int i=1;i<n;i++){
		for(int j=0;j<3;j++){
			if(j==0){
				ar[i][j]=ar[i][j]+max(ar[i-1][j+1],ar[i-1][j+2]);
			}
			else if(j==1){
				ar[i][j]=ar[i][j]+max(ar[i-1][j-1],ar[i-1][j+1]);
			}
			else if(j==2){
				ar[i][j]=ar[i][j]+max(ar[i-1][j-2],ar[i-1][j-1]);
			}
		}
	}
	cout<<max(ar[n-1][0],max(ar[n-1][1],ar[n-1][2]));
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  int n,w,v;
  while(cin >> n >> w, n){
    int N = 0;
    double p[11] = {0};
    REP(i,n){
      cin >> v; p[v/w]++;
      N = max(N,v/w);
    }
    double d = *max_element(p,p+11),ans = 0;
    REP(i,N){
      ans += (p[i]/d)*((double)(N-i)/N);
    }
    cout << shosu(10) << ans+0.01 << endl;
  }
  return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    string a,b,c;
    cin>>a>>b>>c;
    transform(a.begin(), a.end(), a.begin(), ::toupper);
	cout<<a[0];
    transform(b.begin(), b.end(), b.begin(), ::toupper);
    cout<<b[0];
    transform(c.begin(), c.end(), c.begin(), ::toupper);
    cout<<c[0];
}



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

int main() {
  int  A, B, C, D;
  cin >> A >> B >> C >> D;

  int start, end;
  if (A < C) {
    start = C;
  } else {
    start = A;
  }

  if (B < D) {
    end = B;
  } else {
    end = D;
  }

  int result = end - start;
  if (result < 0) result = 0;
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
constexpr ll MOD = 1000000007;

struct UnionFind {
    vector<int> par;
    
    UnionFind(int N): par(N) {
        // for (int i=0;i<N;i++) par[i] = i;
        for (int i=1;i<=N;i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        else return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void) {
    int N, Q;
    vector<int> a(200010), b(200010);
    vector<int> p(200010), x(200010);
    cin >> N >> Q;
    for (int i=0;i<N-1;i++) {
        cin >> a[i] >> b[i];
    }
    for (int i=0;i<Q;i++) {
        cin >> p[i] >> x[i];
    }

    vector<int> E[200010];
    for (int i=0;i<N-1;i++) {
        E[a[i]].push_back(b[i]);
        E[b[i]].push_back(a[i]);
    }

    vector<ll> cnt(N+1,0LL);
    for (int i=0;i<Q;i++) {
        cnt[p[i]] += x[i];
    }

    queue<int> X;
    vector<bool> visit(N+1,false);
    X.push(1);
    while (!X.empty()) {
        int i = X.front();
        X.pop();
        visit[i] = true;
        for (auto itr: E[i]) {
            if (!visit[itr]) {
                X.push(itr);
                cnt[itr] += cnt[i];
            }
        }
    }

    for (int i=1;i<=N;i++) {
        cout << cnt[i];
        if (i < N) cout << " ";
        else cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 19444
N=int(input())
A=["*"]+list(map(int,input().split()))
B=["*"]+list([0]*N)

for k in range(N,0,-1):
    p=A[k]
    for i in range(2*k,N+1,k):
        p^=B[i]
    B[k]=p

C=[k for k in range(1,N+1) if B[k]]
print(len(C))
if C:
    print(" ".join(map(str,C)))

Measured memory_bytes: 117044
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int main() {
  int n, k; cin >> n >> k;
  vector<long long int> a(n);
  vector<long long int> b(n+1, 0);
  vector<long long int> c(n+1, 0);
  for(int i=0; i<n; i++) cin >> a[i];
  for(int i=0; i<n; i++){
    b[i+1] = b[i];
    b[i+1] += a[i];
  }
  for(int i=0; i<n; i++){
    c[i+1] = c[i];
    c[i+1] += max(0LL, a[i]);
  }

  long long int ans = 0;
  for(int i=0; i+k<=n; i++){
    long long int tmp = 0;
    tmp += c[i]-c[0];
    tmp += max(0LL, b[i+k] - b[i]);
    tmp += c[n]-c[i+k];
    ans = max(ans, tmp);
  }
  cout << ans << endl;

  return 0;
}

///


Measured memory_bytes: 2560
use std::*;

#[allow(dead_code)]
fn read<T: str::FromStr>() -> T {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|a| a.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2d<T: str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let _: u32 = read();
    let s: String = read();

    let mut ans = 0;
    for i in 0..10 {
        for j in 0..10 {
            for k in 0..10 {
                let (mut d1, mut d2, mut d3) = (false, false, false);
                for b in s.bytes() {
                    match b - b'0' {
                        val if val == k && d2 => d3 = true,
                        val if val == j && d1 => d2 = true,
                        val if val == i => d1 = true,
                        _ => continue,
                    }
                }
                if d1 && d2 && d3 {
                    ans += 1;
                }
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
a,b,c=gets.split.map(&:to_i).sort

if (a+b+c)%2==(3*c)%2 #zenbu wo c ni suruyo
    p (b-a)/2+c-b
else #zenbu wo c+1 ni suruyo
    if (a-b)%2==0
        p (b-a)%2 + c+1-(b-a)/2
    else
        p 1+(b+1-a)/2+c-b
    end
end

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    string s,t; cin >> s >> t;
    vector<vector<int>> alpha(26);
    REP(i,s.size()){
        alpha[s[i]-'a'].push_back(i);
    }

    vector<int> t_num(t.size());

    if(alpha[t[0]-'a'].size() == 0){
        cout << -1 << endl;
        return 0;
    }
    t_num[0] = alpha[t[0]-'a'][0];
    FOR(i,1,t.size()){
        int n = t[i] - 'a';
        if(alpha[n].size() == 0){
            cout << -1 << endl;
            return 0;
        }
        auto itr = upper_bound(ALL(alpha[n]), t_num[i-1]);//一つ前より大きい最小の数字
        if(itr == alpha[n].end()) itr = alpha[n].begin();
        t_num[i] = *itr;
    }
    
    ll ans = 0;
    int num = -1;
    REP(i,t.size()){
        //cout << t_num[i] << endl;
        if(num < t_num[i]) num = t_num[i];
        else{
            ans += s.size();
            num = t_num[i];
        }
    }
    ans += num + 1;
    cout << ans << endl;
    return 0;
}

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

const int md = 1e9 + 7;
const int N = 2005;

int n, k;
int fact[N * N];
int inv[N * N];
int f[N][N];

void add(int &x, int y) { x += y; while(x >= md) x -= md; if (x < 0) x += md; }

int pw(int a, int b) {
	int res = 1;
	for(int i = 0; (1LL << i) <= b; ++i) {
		if (b & (1LL << i)) res = 1LL * res * a % md;
		a = 1LL * a * a % md;
	}
	return res;
}

void prep() {
	fact[0] = 1; for(int i = 1; i < N * N; ++i) fact[i] = 1LL * fact[i-1] * i % md;
	for(int i = 0; i < N * N; ++i) inv[i] = pw(fact[i], md - 2);
}

int nCk(int n, int k) {
	if (k > n || n < 0 || k < 0) return 0;
	return 1LL * fact[n] * (1LL * inv[k] * inv[n - k] % md) % md;	
}

int main() {
	scanf("%d%d", &n, &k);
	prep();
	if (k == 1) return cout << 1 << endl, 0;

	f[0][0] = 1;
	for(int i = 0; i <= n; ++i) for(int j = i; j <= n; ++j) {
		if(i == 0 && j == 0) continue;
		if(i > 0) f[i][j] = f[i - 1][j];
		if(j > 0) add(f[i][j], 1LL * f[i][j - 1] * nCk(i - 1 + (k - 1) * j, k - 2) % md);
	}

	cout << 1LL * fact[n] * f[n][n] % md << endl;
}

Measured memory_bytes: 47360
import bisect,collections,itertools,math,numpy,string
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
##################################################
def main(K):
    _32 = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    return _32[K-1]
    

K = I()
print(main(K))

Measured memory_bytes: 21472
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    x = LI()
    f = [[] for i in range(n)]
    l = I()
    for i in range(n):
        xi = x[i]
        j = bisect.bisect_right(x,l+xi)-1
        f[i].append(j)
    h = int(math.log(n,2))+1
    for j in range(h-1):
        for i in range(n):
            f[i].append(f[f[i][j]][j])
    q = I()
    for _ in range(q):
        a,b = LI()
        a -= 1
        b -= 1
        if b < a:
            a,b = b,a
        ans = 0
        for i in range(h)[::-1]:
            if f[a][i] < b:
                a = f[a][i]
                ans += 1<<i
        print(ans+1)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 119584
#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 a; cin >> a;
    int b; cin >> b;
    int c; cin >> c;

    if (a==b && b==c) {
        cout << "No" << endl;
    }else if (a==b || b==c || a==c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


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

int main(int argc, const char * argv[]) {
    // insert code here...
    int K, S;
    cin >> K >> S;
    int counter = 0;
    for (int i = 0; i <= K; i++) {
        int X = i;
        for (int j = 0; j <= K; j++) {
            int Y = j;
            int Z = S - X - Y;
            if (Z <= K && Z >= 0) ++counter;
        }
    }
    cout << counter << endl;
    return 0;
}


Measured memory_bytes: 256
#

#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop
import math

def main():
    n, d = map(int, input().split())
    area = d * 2 + 1
    print(math.ceil(n/area))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << "Hello World" << endl;
  } else {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(){
    int n;
    //freopen("/Users/shitian/Downloads/in.txt","r",stdin);
    //freopen("/Users/shitian/Downloads/o.txt","w",stdout);
    while(cin>>n,n){
        vector<pair<string,int> >vec;
        string str;
        cin>>str;
        vec.push_back(make_pair(str,0));
        for(int i=1;i<n;i++){
            cin>>str;
            int j;
            for(j=0;j<str.length();j++)
                if(str[j]!='.')
                    break;
            str[j-1]='+';
            vec.push_back(make_pair(str,j-1));
        }
        for(int i=1;i<vec.size()-1;i++){
            for(int j=i+2;j<vec.size();j++){
                if(vec[i].second==vec[j].second){
                    for(int k=i+1;k<j;k++){
                        if(vec[k].first[vec[j].second]!='.')
                            goto next;
                    }
                    for(int k=i+1;k<j;k++){
                        vec[k].first[vec[j].second]='|';
                    }
                    
                }
            }
        next:;
        }
        for(int i=0;i<vec.size();i++){
            for(int j=0;j<vec[i].first.length();j++){
                if(vec[i].first[j]=='.')
                    cout<<" ";
                else
                    cout<<vec[i].first[j];
            }
            cout<<endl;
        }
        vec.clear();
    }
    return 0;
}

Measured memory_bytes: 1588
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
typedef pair<int,P>P2;
#define fi first
#define se second

int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};


signed main(){
  int n,x,ans=1;
  cin>>n>>x;
  if(n==1){
    cout<<x<<endl;
    return 0;
  }
  for(int i=2;i<=2000000;i++){
    int a=x;
    r(j,n){
      if(a%i==0)a/=i;
      else break;
      if(j==n-1){
        ans=i;
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 384
array_a=[]
array_b=[]
x=0
n,m = map(int,input().split())


for i in range(n):
	array_a.append(list(map(int,input().split())))


for j in range(m):
	array_b.append(int(input()))




for i in range(n):
	for j in range(m):
		x += array_a[i][j]*array_b[j]
	print(x)
	x=0




Measured memory_bytes: 6012
import Data.List

solve :: Int -> Int -> Int -> [Int]
solve a b k =
  if b-a+1 > 2*k then [a..a+k-1] ++ [(b-k+1)..b]
  else [a..b]
    
main = do
  [a,b,k] <- map read . words <$> getLine :: IO [Int]
  mapM print (solve a b k)


Measured memory_bytes: 764
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e9+1;

int main(){
    ll a,b;
    cin >> a >> b;
    cout << (a+b+1)/2 << endl;
    return 0;
} 

Measured memory_bytes: 256
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;

int main(){
  int n,A,B;
  cin>>n>>A>>B;
  int ar[105];
  REP(i,n) cin>>ar[i];
  int x=0,y=0,z=0;
  REP(i,n){
    if(ar[i]<=A) ++x;
    else if(ar[i]<=B) ++y;
    else ++z;
  }
  int res=min({x,y,z});
  cout<<res<<endl;
  return 0;
}





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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  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++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  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;
  }
};



int main()
{
  int r, d, x;
  cin >> r >> d >> x;
  rep(i, 10) {
    x = r*x-d;
    cout << x << endl;
  }
}


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

using namespace std;

int main() {

    int N;
    int D;
    cin >> N >> D;

    int range = 2 * D + 1;

    int num = N / range;
    if (N % range != 0) {
        ++num;
    }

    cout << num << endl;

    return 0;
}


Measured memory_bytes: 384