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

int main(void)
{
    int n, x;
    cin >> n >> x;
    vector<int> l(n);

    for (int i = 0; i < n; i++)
    {
        cin >> l[i];
    }

    int y=0;
    int c=1;
    while(y<=x && c <=n)
    {
        y+=l[c-1];
        if(y<=x)
        {
            c++;
        }else{
            break;
        }
    }
    cout << c<<endl;
}

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

int main(){
	string st;
	cin >> st;
    int n = st.size();
    int le = 0;
    int max = 0;
    rep(i, n){
      if(st.at(i) == 'A' || st.at(i) == 'C' || st.at(i) == 'G' || st.at(i) == 'T'){
        le++;
      }else{
        le = 0;
      }
      if(le > max) max = le;
    }
	cout << max << endl;
}

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

/*
提出前に確認!
- setとmultisetを間違えない
*/

int	main(void)
{
	string s;
	cin >> s;
	int ans = 0;
	int tmp = 0;
	for (int i = 0; i < 3; i++)
	{
		if (s[i] != 'R')
		{
			ans = max(ans, tmp);
			tmp = 0;
		}
		else tmp++;
	}
	ans = max(ans, tmp);
	cout << ans << endl;
	return (0);
}


Measured memory_bytes: 3592
Module Module1

    Sub Main()
        'let'
        Dim N As Long = Console.ReadLine()
        Dim a() As Long =
            Array.ConvertAll(Of String, Long) _
            (Console.ReadLine.Split(), AddressOf Long.Parse)

        Array.Sort(a)

        'var'
        Dim ans As Long = 0

        For i As Long = 0 To N - 1
            ans += New Long() {-1, 1}(i Mod 2) * a(i)
        Next

        Console.WriteLine(Math.Abs(ans))

    End Sub

End Module

Measured memory_bytes: 13268
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
int N,M,P[1001];
vector<int> PP;
int main() {
	while(scanf("%d %d",&N,&M),N|M) {
		PP.clear();
		memset(P,0,sizeof(P));
		for(int i=1;i<=N;i++) scanf("%d",&P[i]);
		for(int i=0;i<=N;i++) for(int j=0;j<=N;j++) {
			PP.push_back((P[i]+P[j])%M);
		}
		sort(PP.begin(),PP.end());
		PP.erase(unique(PP.begin(),PP.end()),PP.end());
		int ans=0;
		for(int Qi=0;Qi<PP.size();Qi++) {
			int lb=0,rb=PP.size()-1;
			while((rb-lb)>1) {
				int mid=(lb+rb)/2;
				if(PP[mid]<=(M-PP[Qi])) lb=mid;
				else rb=mid-1;
			}
			int Qj=PP[lb];
			if(PP[rb]<=(M-PP[Qi])) Qj=max(Qj,PP[rb]);
			ans=max(ans,PP[Qi]+Qj);
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 6088
using System.Collections.Generic;
using System;
using static System.Console;

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var NK = Input.ar;
            int pos = NK[1] - 1;
            var S = Input.read;


          string outt=  S.Substring(0, pos<0?0:pos) + Char.ToLower(S[pos])
                + S.Substring(NK[1] );
            System.Console.WriteLine(outt);
        }
        public class Input
        {
            
            public static string read => ReadLine();
            public static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
            public static int num => Convert.ToInt32(read);
            public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
            public static long numL => Convert.ToInt64(read);
            public const string Alfa = "abcdefghijklmnopqrstuvwxyz";
            public const int MOD = 1000000007;
        }
    }
}


Measured memory_bytes: 11092
package main

import (
    "bufio"
    "fmt"
    "os"
    "strings"
    "strconv"
    // "sort"
    // "regexp"
)

const (
    initialBufSize = 10000
    maxBufSize = 1000000
)
var reader = bufio.NewReaderSize(os.Stdin, maxBufSize)
var writer = bufio.NewWriter(os.Stdout)

func main() {
    var r string
    r  = readLine()
    r  = readLine()
    str := r
    fmt.Println(strings.Count(str, "ABC"))
}

func write(s string) {
    writer.WriteString(s)
}

func print() {
    writer.Flush()
}

func readLine() string {
    buf := make([]byte, 0, maxBufSize)
    for {
        l, p, e := reader.ReadLine()
        if e != nil {
            panic(e)
        }
        buf = append(buf, l...)
        if !p {
            break
        }
    }
    return string(buf)
}

func s2i(s string) int {
    var intVal,e = strconv.Atoi(s)
    if e != nil {
        panic(e)
    }
    return intVal
}

func i2s(i int) string {
    var strVal = strconv.Itoa(i)
    return strVal
}

func s2f(s string) float64 {
    var floatVal,e = strconv.ParseFloat(s, 64)
    if e != nil {
        panic(e)
    }
    return floatVal
}

func sum(i []int) int {
    sum := 0
    for _,val := range i {
        sum += val
    }
    return sum
}

func split(s string) []string {
    return strings.Fields(s)
}

func strAry2intAry(strs []string) []int {
    var ret = make([]int, 0, len(strs))
    for _ , str := range strs {
        var intVal, e = strconv.Atoi(string(str));
        if e != nil {
            panic(e)
        }
        ret = append(ret, intVal)
    }
    return ret
}

func intAry2strAry(nums []int) []string {
    var ret = make([]string, 0, len(nums))
    for _ , num := range nums {
        var strVal = strconv.Itoa(num);
        ret = append(ret, strVal)
    }
    return ret
}

func ary2str(strs []string) string {
    return strings.Join(strs, " ")
}

func reverse(res []int) []int {
    for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
        res[i], res[j] = res[j], res[i]
    }
    return res
}

//  
// func regexpExample() {
//     // Your code here!
//     var str = "13:20"
//     r := regexp.MustCompile(`(\d+):(\d+)`)
//     fmt.Println(r.FindStringSubmatch(str))
// }


// type Country struct {
//     gold int
//     silver int
//     blonze int
// }

// // 複数ソートのサンプル
// func stableSortExample() []Country{
//     var country = []Country {
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:3, blonze:2},
//         {gold:1, silver:3, blonze:3},
//     }
//     sort.SliceStable(country, func(i, j int) bool { return country[i].blonze > country[j].blonze })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].silver > country[j].silver })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].gold > country[j].gold })
//     return country
// }

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
//using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 10*9+7

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

int main(){
  int x;
  cin >> x;
  int happy_500 = 1000 * (x / 500);
  int happy_5 =  (x%500)/5*5;
  cout<<  happy_5+ happy_500 <<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
char a[10][10];

int main()
{
	for(int i = 1; i <= 3; i++)
	{
		for(int j = 1; j <= 3; j++)
		{
			scanf(" %c", &a[i][j]);
		}
	}
	for(int i = 1; i <= 3; i++) printf("%c", a[i][i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
class dice:
    def __init__(self, pip):
        self.pip = pip
        
    def move(self,dir):
        if str(dir) == "E":
            self.pip[0],self.pip[2],self.pip[3],self.pip[5] = self.pip[3],self.pip[0],self.pip[5],self.pip[2]
        elif str(dir) == "W":
            self.pip[0],self.pip[2],self.pip[3],self.pip[5] = self.pip[2],self.pip[5],self.pip[0],self.pip[3]
        elif str(dir) == "N":
            self.pip[0],self.pip[1],self.pip[4],self.pip[5] = self.pip[1],self.pip[5],self.pip[0],self.pip[4]
        elif str(dir) == "S":
            self.pip[0],self.pip[1],self.pip[4],self.pip[5] = self.pip[4],self.pip[0],self.pip[5],self.pip[1]

d = dice(list(map(int,input().split())))
inp = list(input())

for dir in inp:
    d.move(dir)

print(d.pip[0])

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

#define FOR(a, b, c) for (int a = (b), _for = (c); a < _for; ++a)
#define REP(a, n) FOR(a, 0, n)
#define x first
#define y second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define lf double

using namespace std;

const int MAX = (int)1e6 + 5;

int main(){
	ll a;
	scanf ("%lld\n",&a);
	if (a&1){
		puts ("0");
		return 0;
	}
	ll ans=0;
	ll p=10;
	while(p<=a){
		ans+=a/p;
		if ((lf)p*5 > 3e18) break;
		p*=5;
	}
	printf ("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll a;
  cin >> a;
  cout << a + a * a + a * a * a << "\n";
}


Measured memory_bytes: 3612
#include<cstdio>
#include<cctype>
#include<cstring>
#include<map>
#include<queue>
using namespace std;
void read(int &v)
{
	int f;char ch;
	while(!isdigit(ch=getchar())&&ch!='-'); ch=='-'?(f=-1,v=0):(f=1,v=ch-'0');
	while(isdigit(ch=getchar())) v=v*10+ch-'0';v*=f;
}
const int N=5e5+5,M=1e6+5;
struct sd{
	int next,to,w;
}edge[M<<1];
map<int,int> mp[N];
deque<int> que;
int head[N],dis[N],n,m,cnt,num;
int get(int x,int y)
{
	if(mp[x].count(y))
	return mp[x][y];
	return mp[x][y]=++cnt;
}
void add_edge(int from,int to,int w)
{
	edge[++num].next=head[from];
	edge[num].to=to;
	edge[num].w=w;
	head[from]=num;
}
int main()
{
	read(n),read(m);
	for(int i=1;i<=n;i++) get(i,0);
	for(int i=1;i<=m;i++)
	{
		int x,y,z;
		read(x),read(y),read(z);
		int x0=get(x,0),y0=get(y,0),xz=get(x,z),yz=get(y,z);
		add_edge(xz,yz,0),add_edge(yz,xz,0);
		add_edge(x0,xz,1),add_edge(xz,x0,1);
		add_edge(y0,yz,1),add_edge(yz,y0,1);
	}
	memset(dis,-1,sizeof(dis));dis[1]=0;
	que.push_back(1);
	while(!que.empty())
	{
		int v=que.front();que.pop_front();
		for(int i=head[v];i;i=edge[i].next)
		{
			int to=edge[i].to;
			if(dis[to]==-1||dis[to]>dis[v]+edge[i].w)
			{
				dis[to]=dis[v]+edge[i].w;
				if(edge[i].w==1) que.push_front(to);
				else que.push_back(to);
			}
		}
	}
	printf("%d",dis[n]>>1);
	return 0;
}

Measured memory_bytes: 67072
#include <stdio.h>

main(void)
{
	int a,b;
	
	scanf("%d",&a);
	scanf("%d",&b);
	
	if(a<b){
		printf("a < b\n");
	}
	
	if(a>b){
		printf("a > b\n");
	}
	
	if(a==b){
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x.size())
#define pb push_back
#define mp make_pair
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define int long long
#define endl "\n"

using namespace std;

const int N = 1111;//500510;
const int inf = (int)(1e18) + 123;
const int mod = (1e9) + 7;
const double eps = 1e-9;

int n, m, dp[N], p[N], mn = inf;

vector <int> v[N], ans, rev[N];

void bfs(int x) {
    memset(dp, -1, sizeof dp);
    memset(p, 0, sizeof p);
    queue <int> q;
    q.push(x);
    dp[x] = 0;
    while (!q.empty()) {
        int front = q.front();
        q.pop();
        for(auto to : v[front]) {
            if (dp[to] == -1) {
                dp[to] = dp[front] + 1;
                p[to] = front;
                q.push(to);
            }
        }
    }
}

signed main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= m; ++i) {
        int x, y; cin >> x >> y;
        v[x].pb(y);
        rev[y].pb(x);
    }
    bfs(1);

    for(int i = 1; i <= n; ++i) {
        bfs(i);
        for(auto to : rev[i]) {
            if (dp[to] == -1) continue;
            if (mn > dp[to]) {
                mn = dp[to];
                ans = {i, to};
            }
        }
    }
    if (ans.empty()) {
        cout << -1;
        return 0;
    }
    bfs(ans[0]);
    vector <int> res;
    int ver = ans[1];
    while (ver != 0) {
        res.push_back(ver);
        ver = p[ver];
    }
    cout << sz(res) << endl;
    for(auto i : res) cout << i << endl;
    return 0;
}

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

using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
int in() {int x; cin>>x; return x;}
string stin() {string s; cin>>s; return s;}
/***** MAIN *****/
signed main() {
  int n = in();
  int k = in();
  int counter = 1;
  int current = k;
  while(n >= current) {
    current*=k;
    ++counter;
  }
  cout << counter;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? 1e9:1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){int b=0;for(auto itr :a){if(b++!=0)cout << " "; cout << itr;} }
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
#define int ll
signed main(){
    int n,m,l;
    while(cin >> n >> m >> l){
        vector<vector<piii>>edge(n);
        if(n+m+l == 0)break;
        rep(i,m){
            int a,b,d,e; cin >> a >> b >> d >> e;
            --a,--b;
            edge[a].push_back(piii(b,pii(e,d)));
            edge[b].push_back(piii(a,pii(e,d)));
        }
        vector<vector<int>>d(n,vector<int>(l+1,INF));
        d[0][l] = 0;
        priority_queue<piii,vector<piii>,greater<piii>>que;
        que.push(piii(0,pii(0,l)));
        while(!que.empty()){
            piii pos = que.top();
            que.pop();
            int dis = pos.first;
            int now = pos.second.first;
            int mny = pos.second.second;
            if(dis > d[now][mny])continue;
            rep(i,edge[now].size()){
                int next = edge[now][i].first;
                int cost = edge[now][i].second.first;
                int fee = edge[now][i].second.second;
                if(mny >= fee && d[next][mny - fee] > dis){
                    d[next][mny - fee] = dis;
                    que.push(piii(dis,pii(next,mny -fee)));
                }
                if(d[next][mny] > dis + cost){
                    d[next][mny] = dis+ cost;
                    que.push(piii(dis+cost,pii(next,mny)));
                }
            }
        }
        int ans = INF;
        rep(i,l+1)cmin(ans, d[n-1][i]);
        cout <<  ans  << endl;
    }
}




Measured memory_bytes: 3520
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

int main() {

    
    ll m, k;
    cin >> m >> k;
    
    if (k >= (1 << m))
    {
        cout << -1 << endl;
        return 0;
    }
    
    if (m == 0)
    {
        if (k == 1)
        {
            cout << -1 << endl;
            return 0;
        }
        cout << "0 0" << endl;
        return 0;
    }
    
    if (m == 1)
    {
        if (k == 1)
        {
            cout << -1 << endl;
            return 0;
        }
        cout << "0 0 1 1" << endl;
        return 0;
    }
    
    for (int i = 0; i < (1 << m); ++i)
    {
        if (i == k)
        {
            continue;
        }
        cout << i << endl;
        
    }
    cout << k << endl;
    for (int i = (1 << m) - 1; i >= 0; --i)
    {
        if (i == k)
        {
            continue;
        }
        cout << i << endl;
        
    }
    cout << k << endl;
    
    
    return 0;
}

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

// UnionFind (Disjoint set)
struct unionfind {
	vector<int> d;	// 親：連結のサイズ×(-1)、子：親のID（非負）
	unionfind(int n = 0): d(n, -1) {}
	int find(int x) {
		if(d[x] < 0) return x;
		return d[x] = find(d[x]);
	}
	bool unite(int x, int y) {
		x = find(x); y = find(y);
		if(x == y) return false;
		if(d[x] > d[y]) swap(x, y);
		d[x] += d[y];
		d[y] = x;
		return true;
	}
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -d[find(x)]; }
};

int main() {
	int n, m, k;
	cin >> n >> m >> k;
	unionfind fri(n);
	vector<vector<int>> v(n), blo(n);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		v[a].push_back(b);
		v[b].push_back(a);
		fri.unite(a, b);
	}
	rep(i, k) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		blo[a].push_back(b);
		blo[b].push_back(a);
	}
	rep(i, n) {
		int now = fri.size(i) - v[i].size() - 1;
		for(int t: blo[i]) {
			if(fri.same(i, t)) now--;
		}
		printf("%d%c", now, (i == n-1) ? '\n' : ' ');
	}
	
	return 0;
}

Measured memory_bytes: 12152
fun main(args: Array<String>) {
  val input1 = readLine()!!.split(" ").map(String::toInt)
  val count = input1[0]
  val choose = input1[1]
  val input2 = readLine()!!.split(" ").map(String::toInt)
  val sum = input2.sum()
  var result = "No"
  var yesCount = 0
  for (i in 0 until count) {
    val num = input2[i]
    val threshold: Double = sum.toDouble() / (choose * 4)
    if (num >= threshold) {
      yesCount++
    }
    if (yesCount >= choose) {
      result = "Yes"
      break
    }
  }
  println(result)
}


Measured memory_bytes: 37868
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

typedef long long int64;

int gcd(int64 a,int64 b){return b?gcd(b,a%b):a;}
int64 lcm(int64 a, int64 b) { return a/gcd(a,b)*b;}

int64 f(int64 n) {
    int64 res = 0;
    while(n%2==0) n/=2,res++;
    return res;
}

int main() {
    int64 n,m;
    int64 ans = 1;
    cin >> n >> m;
    vector<int64> a(n);
    for (int64 i=0; i<n; i++) cin >> a[i];


    int64 t = f(a[0]);
    for (int64 i=0; i<n; i++) {
        if (t != f(a[i])) ans = 0;
        a[i] >>= t;
    }
    m >>= (t-1);


    int64 LCM = 1;
    if (ans) {
        for (int64 i = 0; i < n; i++) {
            LCM = LCM / gcd(LCM, a[i]) * a[i];
            if (LCM > m) ans = 0;
        }
    }

    if (ans) ans = ((m/LCM)+1)/2;


    cout << ans << endl;
}

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

int main(){
  long long a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  long long couc,cxy,price=0;
  long long pmax;
  pmax=c*2*max(x,y);
  if(a+b>2*c){
    if(x>y){
      couc=y*2;
      cxy=x-y;
      price = c*couc + a*cxy;
    }
    else {
      couc=x*2;
      cxy=y-x;
      price = c*couc + b*cxy;
    }
  }
  else{
    price = a*x + b*y;
  }
  
  cout << min(price,pmax)<<endl;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, a[N], cnt[N];
int main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin>>n;
	for (int i=1; i<=n; i++){
		cin>>a[i];
		cnt[a[i]]++;
	}
	long long sum = 0;
	for (int i=1; i<=n; i++){
		sum = sum + 1LL * cnt[i] * (cnt[i] - 1LL) / 2;
	}
	for (int i=1; i<=n; i++){
		sum = sum - 1LL * cnt[a[i]] * (cnt[a[i]] - 1LL) / 2;
		cnt[a[i]]--; 
		sum = sum + 1LL * cnt[a[i]] * (cnt[a[i]] - 1LL) / 2;
		cout<<sum<<'\n';
		sum = sum - 1LL * cnt[a[i]] * (cnt[a[i]] - 1LL) / 2;
		cnt[a[i]]++;
		sum = sum + 1LL * cnt[a[i]] * (cnt[a[i]] - 1LL) / 2;
	}
}

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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> cnt(n, 0);
    for (int i = 0; i < q; i++) {
        int a;
        cin >> a;
        a--;
        cnt[a]++;
    }
    for (int i = 0; i < n; i++) {
        if (k - (q - cnt[i]) > 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)
const ll INF = 1LL << 60;

int d[2000001];
bool seen[2000001];
vector<vector<int>> g;


int main(){
    string s;
    cin >> s;
    int n = s.size();
    ll ans = 0;

    for (int bit = 0; bit < (1 << (n-1)); bit++){
        ll tmp = 0;
        int st = 0,l = 1;
        int len = 1;
        //cout << bit << endl;
        for (int j = 0;j < n-1;j++){
            if (bit & 1 << j){
                tmp +=stoll(s.substr(st,len));
                //cout << "j = " << j  << " " << stoi(s.substr(st,len)) << endl;
                st = st+len;
                len = 1;
            }
            else len++;
        }
        tmp += stoll(s.substr(st,len));
        //cout << s.substr(st,len) << endl;
        //printf("-------\n");
        //cout << tmp << endl;
        ans += tmp;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	string s2,s3;
	for(int i=0;i<n/2;i++)
		s2+=s[i];
	for(int i=n/2;i<n;i++)
		s3+=s[i];
	//cout << s2 << " "  << s3 << endl;
	puts(s2==s3 ? "Yes\n" : "No\n");
	return 0;
}

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

int bin_search(const int a[], int n, int key){
	int pl = 0;
	int pr = n-1;

	do{
		int pc = (pl + pr) / 2;
		if (a[pc] == key){
			return 1;
		}else if (a[pc] < key){
			pl = pc + 1;
		}else{
			pr = pc - 1;
		}
	}while(pl <= pr);

	return -1;
}

int main(void)
{
	int i, j, nx, ny, k;
	int count = 0;
	int *x, *y;

	//S???????´???°??\???
	scanf("%d", &nx);
	x = calloc(nx, sizeof(int));

	//S?????´??°??????
	for (i = 0; i < nx; i++)
	{
		scanf("%d", &x[i]);
		/*
		if (i != nx - 1){
			x[i] = i + 1;
			printf("%d", x[i]);
		}else{
			x[i] = i + 1;
			printf("%d \n", x[i]);
		}*/
		
	}

	//T???????´???°??\???
	scanf("%d", &ny);
	y = calloc(ny, sizeof(int));

	//T?????´??°??????
	for (j = 0; j < ny; j++)
	{
		scanf("%d", &y[j]);
	}

	//??????C??????
	for (k = 0; k < ny; k++)
	{
		if (bin_search(x , nx, y[k]) == 1){
			count += 1;
		}
	}
	printf("%d\n", count);

	free(x);
	free(y);

	return 0;
}

Measured memory_bytes: 1152
use std::cmp;

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

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

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

#[allow(dead_code)]
fn find_min(x: &[u64]) -> u64 {
    let mut min: u64 = x[0];
    let mut x_iter = x.iter();
    while let Some(i) = x_iter.next() {
        min = cmp::min(*i, min);
    }
    return min;
}

#[allow(dead_code)]
fn find_max(x: &[u64]) -> u64 {
    let mut max: u64 = x[0];
    let mut x_iter = x.iter();
    while let Some(i) = x_iter.next() {
        max = cmp::max(*i, max);
    }
    return max;
}
fn main() {
    let init: Vec<usize> = read_vec();
    let n = init[0];
    let k = init[1];
    let mut h: Vec<u64> = Vec::new();

    for _i in 0..n {
        let tmp: u64 = read();
        h.push(tmp);
    }

    h.sort();

    let mut ans_vec: Vec<u64> = Vec::new();
    for i in 0..n - k + 1 {
        ans_vec.push(h[i + k - 1] - h[i]);
    }

    println!("{}", find_min(&ans_vec));
}


Measured memory_bytes: 6396
#!/usr/bin/env python3

from collections import Counter

n = int(input())
a = list(map(int, input().split()))
a.sort()

num = list(set(a))
cnt = Counter(a)
ans = 0

for i in range(len(num)):
    # print(num[i], cnt[num[i]])
    if num[i] == cnt[num[i]]:
        continue
    elif num[i] < cnt[num[i]]:
        # print('<')
        ans += (cnt[num[i]] - num[i])
    else:
        # print('0')
        ans += cnt[num[i]]

print(ans)


Measured memory_bytes: 20972
#pragma warning (disable:4996)
#include"bits/stdc++.h"
#include<cassert>
#define int long long
#define MRE assert(0);
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const long long mod = 998244353;
const long long inf = 1ll<<61;
typedef pair<int, int> P;
typedef pair<int, P > PP;
signed main() {
	string S; cin >> S;
	deque<char>S0, S1;
	int q; cin >> q;
	int inv = 0;
	rep(i, q) {
		int x; cin >> x;
		if (x == 1)inv++;
		else {
			int f; cin >> f;
			char c; cin >> c;
			if (f == 1) {
				if (inv & 1) {
					S1.push_back(c);
				}
				else {
					S0.push_front(c);
				}
			}
			else {
				if (inv & 1) {
					S0.push_front(c);
				}
				else {
					S1.push_back(c);
				}
			}
		}
	}
	string s0, s1;
	while (S0.size()) {
		s0.push_back(S0.front());
		S0.pop_front();
	}
	while (S1.size()) {
		s1.push_back(S1.front());
		S1.pop_front();
	}
	if (inv & 1) {
		reverse(s0.begin(), s0.end());
		reverse(s1.begin(), s1.end());
		reverse(S.begin(), S.end());
		swap(s0, s1);
	}
	cout << s0 << S << s1 << endl;
}

Measured memory_bytes: 1156
#include <stdio.h>

int main(void){
    int a=0;
    int b=0;
    int c=0;
    
    scanf("%d%d%d",&a,&b,&c);
    if((a<b)&&(b<c)){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}


Measured memory_bytes: 2056
#include <iostream> 
 
using namespace std; 
 
int main(){ 
	int n;
	cin >> n;
	int sum = 0;
	int a[n];
	for(int i = 0; i < n-1; i++){
		int b;
		cin >> b;
		if(i == 0) a[i] = b;
		if(a[i] > b) a[i] = b;
		a[i+1] = b;
		sum += a[i];
	}
	sum += a[n-1];
	cout << sum << endl;
	return 0;
} 


Measured memory_bytes: 3584
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#define int long long
#define inf 1e15
using namespace std;
struct node{
	int nxt,to,weigh;
}edge[4000010];
int head[1000100],n,m,S,T,cnt=1,level[1000100],u,v,w;
int a[1001000],ans;
queue<int> qu;
void addedge(int x,int y,int z){
	edge[++cnt].nxt=head[x];
	edge[cnt].to=y;
	edge[cnt].weigh=z;
	head[x]=cnt;
	edge[++cnt].to=x;
	edge[cnt].nxt=head[y];
	edge[cnt].weigh=0;
	head[y]=cnt;
}
bool bfs(){
	memset(level,-1,sizeof(level));
	level[S]=0;
	qu.push(S);
	while(!qu.empty()){
		int u=qu.front();
		qu.pop();
		for(int i=head[u];i;i=edge[i].nxt){
			int upup=edge[i].to;
			if(edge[i].weigh!=0 && level[upup]==-1){
				level[upup]=level[u]+1;
				qu.push(upup);
			}
		}
	}
	if(level[T]==-1)return false;
	return true;
}
int dfs(int x,int flow){
	if(x==T)return flow;
	int rest=0;
	for(int i=head[x];i;i=edge[i].nxt){
		int upup=edge[i].to;
		if(rest==flow)break;
		if(level[upup]==level[x]+1){
			int sum=dfs(upup,min(flow-rest,edge[i].weigh));
			rest+=sum,edge[i].weigh-=sum;edge[i^1].weigh+=sum;
		}
	} 
	return rest;
}
int Dinic(){
	int ans=0;
	while(bfs())
		ans+=dfs(S,inf);
	return ans;
}
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	S=0,T=n+1;
    for(int i=1;i<=n;i++)
        if(a[i]>0) addedge(S,i,a[i]),ans+=a[i];
        else{
            addedge(i,T,-a[i]);
            for(int j=2;i*j<=n;j++)
                if(a[i*j]>0)addedge(i*j,i,inf);
        }
	ans-=Dinic();
	printf("%lld\n",ans);
}

Measured memory_bytes: 12544
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define watch(x) cout<<(#x)<<" = "<<(x)<<'\n'
#define mset(a,v) memset(a,v,sizeof(a))
#define setp(x) cout<<fixed<<setprecision(x)
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e6 + 100;
const LL INF = 1e9;

VI p;

void prime()
{
    int n = sqrt(MX) + 100, n1 = sqrt(n);
    VI isp((n/32) + 100,0);
    p.PB(2);

    for(int i = 3; i <= n1; i += 2)
    {
        if(!(isp[i/32] & (1 << (i % 32))))
        {
            p.PB(i);
            for(int j = i*i; j < n; j += (2*i)) isp[j/32] = isp[j/32] | (1 << (j % 32));
        }
    }

    for(int i = n1 + 2; i < n; i += 2)
    {
        if(!(isp[i/32] & (1 << (i % 32))))
        {
            p.PB(i);
        }
    }

}

int gcd(int a,int b)
{
    if(a == 0) return b;
    else return gcd(b%a,a);
}

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    prime();

    int n;
    cin>>n;
    int a[n], g;
    loop(i,0,n)
    {
        cin>>a[i];
        if(i) g = gcd(g,a[i]);
        else g = a[i];
    }

    int f = 0;
    if(g == 1)
    {
        f = 1;
        set<int> st;
        loop(i,0,n)
        {
            int n1 = a[i];
            for(int p1 : p)
            {
                if(p1 * p1 > n1) break;
                if(n1 % p1 == 0)
                {
                    if(st.find(p1) != st.end()) {f = 0; break;}
                    st.insert(p1);
                    while(n1 % p1 == 0) {n1 /= p1;}
                }
            }

            if(f == 0) break;
            if(n1 != 1)
            {
                if(st.find(n1) != st.end()) {f = 0; break;}
                st.insert(n1);
            }
        }
    }

    if(f) cout<<"pairwise coprime\n";
    else if(g == 1) cout<<"setwise coprime\n";
    else cout<<"not coprime\n";

    /*
    int t,n;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int a[n];
        loop(i,0,n)
        {
            cin>>a[i];
        }
    }
    */

    /*
    int n;
    cin>>n;
    int a[n];
    loop(i,0,n)
    {
        cin>>a[i];
    }
    */

    /*
    cout<<ans<<'\n';

    if(f) cout<<"YES\n";
    else cout<<"NO\n";

    if(f) cout<<"Yes\n";
    else cout<<"No\n";
    */

    return 0;
}


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

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    string s;
    cin>>s;
    if (s[0]==s[1] and s[1]==s[2]){
        puts("No");
    }
    else {
        puts("Yes");
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        sc.close();
        int seven = 0;
        int ans = -1;
        int mod = 0;
        
        if (k % 2 != 0) {
            for (int i = 1; i <= k; i++) {
                seven = mod * 10 + 7;
                mod = seven % k;
                if (mod == 0) {
                    ans = i;
                    break;
                }
            }
        }
        System.out.println(ans);
    }
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, M, K;
    cin >> N >> M >> K;
    mat G(N), H(N);
    REP(i,0,M) {
        ll a, b;
        cin >> a >> b;
        --a; --b;
        G[a].pb(b);
        G[b].pb(a);
    }
    REP(i,0,K) {
        ll c, d;
        cin >> c >> d;
        --c; --d;
        H[c].pb(d);
        H[d].pb(c);
    }

    queue<ll> Q;
    vec F(N, false);
    ll k = 0;
    vector<set<ll>> V;
    while(k < N) {
        set<ll> S;
        Q.push(k);
        F[k] = true;
        S.insert(k);
        while(!Q.empty()) {
            ll v = Q.front(); Q.pop();
            FORR(nv,G[v]) {
                if(!F[nv]) {
                    S.insert(nv);
                    Q.push(nv);
                    F[nv] = true;
                }
            }
        }
        V.pb(S);
        while(k < N && F[k]) ++k;
    }

    vec C(N, 0);
    FORR(S,V) {
        FORR(v,S) {
            C[v] = SZ(S) - 1;
            FORR(nv,G[v]) {
                if(S.count(nv) > 0) --C[v];
            }
            FORR(nv,H[v]) {
                if(S.count(nv) > 0) --C[v];
            }
        }
    }

    REP(i,0,N) PS(C[i]);
    PR("");

    return 0;
}

/*



*/

Measured memory_bytes: 26200
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define all(a) a.begin(),a.end()
#define lb(s,x) lower_bound(all(s),x)-s.begin()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define INF 1e9
typedef long long ll;

int main(void){
    int n;
    string s;
    cin>>n>>s;
    int res = 0,x = 0;
    rep(i,n){
        if(s[i]=='I'){
            x++;
        }else{
            x--;
        }
        res = max(res,x);
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,i,f,a[1010],b[1010],c[1010],d[1010],l[4];
  while(scanf("%d",&n),n){
    for(i=0;i<n;i++)scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]);
    for(i=0;i<4;i++)scanf("%d",&l[i]);
    for(i=f=0;i<n;i++){
      if(b[i]>l[0]||c[i]>l[1]||d[i]>l[2])continue;//printf("%d\n",i);
      if((b[i]+d[i])*4+c[i]*9>l[3])continue;//printf("%d\n",i);
      printf("%d\n",a[i]);
      f=1;
    }
    if(f==0)printf("NA\n");
  }
  return 0;
}

Measured memory_bytes: 628
N,L=map(int,input().split())
dic={}
data=[]

for _ in range(N):
    word=input()
    data.append(word)

data=sorted(data)
ans=''
for d in data:
    ans+=d





# for _ in range(N):
#     word=input()
#     if not word in dic:
#         dic[word]=1
#     else:
#         dic[word]+=1
#
# ans=''
#
# dic=sorted(dic.items())
#
# for k,v in dic:
#     for _ in range(v):
#         ans+=k

print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        StringBuffer sbA = new StringBuffer();
        for (int i = 0; i < a; i++) {
            sbA.append(b);
        }

        StringBuffer sbB = new StringBuffer();
        for (int j = 0; j < b; j++) {
            sbB.append(a);
        }

        if (sbA.toString().compareTo(sbB.toString()) >= 0) {
            System.out.println(sbB);
        } else {
            System.out.println(sbA);
        }
    }

}


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

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S  = keyboard.next();
		String[] pass = S.split("");
        
        String ans = "Good";
        for(int i = 0; i < S.length()-1; i++){
	        if(pass[i].equals(pass[i+1])){
	        	ans = "Bad";
			}
		}

		System.out.println(ans);
		keyboard.close();	
	}
}


Measured memory_bytes: 23124
#include <vector> 
#include <list> 
 #include <map>
 #include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '(L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

int main(){
 
    string s;

    cin>>s;

    if(s[0]==s[2]){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }





}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int a,b,tmp,i;
  scanf("%d %d",&a,&b);
  if(b<a){
    tmp=b;
    b=a;
    a=tmp;
  }
  for(i=0;i<b;i++){
    printf("%d",a);
  }
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a+b>c+d){
    cout << "Left" << endl;
  }
  else if(a+b<c+d){
    cout << "Right" << endl;
  }else{
    cout << "Balanced" << endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

bool era[50030];
int main()
{
	for(int i=2;i<300;i++)if(!era[i])for(int j=i*i;j<50030;j+=i)era[j]=true;
	vector<int> p;
	for(int i=2;i<50030;i++)if(!era[i])p.push_back(i);

	int n;
	while(~scanf("%d",&n)){
		vector<int>::iterator it_l,it_u;
		it_l=it_u=upper_bound(p.begin(),p.end(),n);
		it_l-=era[n]?1:2;
		printf("%d %d\n",*it_l,*it_u);
	}

	return 0;
}

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

signed main() {
  int N, K, S;
  cin >> N >> K >> S;
  
  vector<int> ans(N);
  int cnt = 0;
  for( int i = 0; i < N; i++ ){
    if( cnt < K ){
      ans.at(i) = S;
      cnt++;
    }else{
      if( N-K < S ) ans.at(i) = 1;
      else ans.at(i) = 1000000000;
    }
  }
  
  for( int i = 0; i < N; i++ ) cout << ans.at(i) << " ";
  cout << endl;
}
  


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


void solve(long long N, long long K, std::vector<long long> A){
    double l = 0, r = 1e9;
    for (int i = 0; i < 100; i++) {
        double m = (l + r) / 2;
        long long ans = 0;
        for (int j = 0; j < N; j++) {
            ans += floor(A[j] / m);
        }
        // cout << m << "," << ans << endl;
        if (ans > K) {
            l = m;
        } else {
            r = m;
        }
    }
    cout << (long long)ceil(l) << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, K, std::move(A));
    return 0;
}


Measured memory_bytes: 4844
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
typedef long int li;

li binom(int n,int r){
  int s=1;
  rep(i,r){
    (s*=n-i)/=(i+1);
  }
  return s;
}

int main(){
  int n; cin >>n;
  vector<pair<int,int>> vec(n);
  rep(i,n){
    int a,b; cin >>a >>b;
    vec[i]={a,b};
  }
  double sum=0.0;
  rep(i,n-1){
    repa(j,i+1,n){
      sum+=hypot(vec[i].first-vec[j].first,vec[i].second-vec[j].second);
    }
  }
  sum*=n-1;
  sum/=binom(n,2);
  printf("%.10lf\n",sum);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    string a,b; cin>>a;
    for(int i=0; i<a.length(); i++){
        cout<<char('A' + (a[i]-'A' + n)%26);
    }
    cout<<"\n";
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

int n, k;

ll modpow(ll a, ll b) {
  ll r = 1;
  while (b) {
    if (b & 1) r = r * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return r;
}

ll dp[1 << 17];

main() {
  cin >> n >> k;
  ll ans = 0;
  for (int i = k; i >= 1; i--) {
    dp[i] = modpow(k / i, n);
    for (int j = 2 * i; j <= k; j += i) dp[i] -= dp[j];
    ans += i * dp[i] % mod;
  }
  cout << ans % mod << endl;
}


Measured memory_bytes: 4404
import java.util.Scanner;
import java.util.ArrayList;
public class Main{
	public static void main(String args[]){
    
    	Scanner sc=new Scanner(System.in);
    	int n = sc.nextInt();
      	long k=sc.nextLong();
      	int arr[]=new int[n+1];
      	boolean visited[]=new boolean[n+1];
      	for(int i=1;i<=n;i++) arr[i]=sc.nextInt();
      	visited[1]=true;
      	int root=-1;
      	int stepsToRoot=0;
      	int cycleSize=0;
      	for(int i=1;i<=n;){
        	int index=arr[i];
          stepsToRoot++;
          	if(visited[index]){
            	root=index;
              	break;
            }
            visited[i]=true;
            i=arr[i];
        }
      	ArrayList<Integer> cycle=new ArrayList<>();
      	for(int i=root;;){
        	cycle.add(i);
          	cycleSize++;
          	i=arr[i];
          	if(i == root) break;
        }
      	stepsToRoot-=cycleSize;
      	if(k == stepsToRoot) System.out.println(root);
      	else if(k < stepsToRoot){
        	int ans=arr[1];
          for(int i=2;i<=k;i++){
          	ans=arr[ans];
          }
        	System.out.println(ans);
        }
    	else{
        	k-=stepsToRoot;
          	k=k%cycleSize;
          	int ans=cycle.get((int)k);
          System.out.println(ans);        
        }
    }
}

Measured memory_bytes: 60612
import java.util.*;
import java.lang.*;
import java.io.*;
import java.awt.Point;

class Main{

    private static int[][] used;
    private static int N,M,L;
    private static List<Pox>[] list;
    private static final int INF = 100000000;

    private static class Pox{
	public int B,D,E;
	Pox(){
	    B = D = E = 0;
	}

	Pox(int b,int d,int e){
	    B = b;
	    D = d;
	    E = e;
	}
    }

    private static class Eleac implements Comparable<Eleac>{
	public int id,L,num;

	Eleac(){
	    id = L = num = 0;
	}

	Eleac(int a,int b,int c){
	    id = a;
	    L = b;
	    num = c;
	}

	@Override
	public int compareTo(Eleac a){
	    return 1;
	}

    }

     @SuppressWarnings("unchecked")
      public static void main(String args[])throws IOException{
	  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	  //PrintWriter out = new PrintWriter(System.out);
	  
	  while(true)
	      {
		  String[] elements = in.readLine().split(" ");
		  N = Integer.parseInt(elements[0]);
		  M = Integer.parseInt(elements[1]);
		  L = Integer.parseInt(elements[2]);
		  if(N == 0 && M == 0 && L == 0)
		      break;

		  

		  used = new int[N+1][L+1];
		  list = new ArrayList[N+2];

		  for(int i=0;i<N+1;i++)
		      for(int j=0;j<L+1;j++)
			  used[i][j] = INF;

		  for(int i=0;i<N+1;i++)
		      list[i] = new ArrayList<Pox>();
		  
		  for(int i=0;i<M;i++)
		      {
			 elements = in.readLine().split(" ");
			 int A,B,D,E;
			  A = Integer.parseInt(elements[0]);
			  B = Integer.parseInt(elements[1]);
			  D = Integer.parseInt(elements[2]);
			  E = Integer.parseInt(elements[3]);
			  //System.out.println("A : " + A  + " B : " + B + " D : " + D + " E : " + E);
			  list[A].add(new Pox(B,D,E));  
			  list[B].add(new Pox(A,D,E));
		      }

		  Queue<Eleac> que = new PriorityQueue<Eleac>();

		  que.offer(new Eleac(1,L,0)); //Eleac(id,money,the number of eemy)
		  used[1][L] = 0;		

		  int men = INF;
		  while(que.size() > 0)
		      {
			  Eleac p = que.poll(); 
			  int now = p.id;
			  int money = p.L;
			  int val = p.num;
			  // System.out.println("poll : now -> " + now + " money -> " + money + " val -> " + val );
			  if(now == N)
			      {
				  used[now][money] = Math.min(used[now][money],val);	
				  continue;
			      }
		      
			 
			  for(int i=0;i<list[now].size();i++)
			      {
				  int need = list[now].get(i).D;

				  int new_pos = list[now].get(i).B;
				  int the_number = list[now].get(i).E;
				  
				  if(money-need >= 0 && used[new_pos][money-need] > val)
				      {
					  used[new_pos][money-need] = val;
					  que.add(new Eleac(new_pos,money-need,val));
				      }				  	
				  if(used[new_pos][money] > val+the_number)
				      {
					  used[new_pos][money] = val+the_number;
					  que.add(new Eleac(new_pos,money,val+the_number));
				      }

			      }

		      
		      }

		  for(int i=0;i<=L;i++)
		      {
			  men = Math.min(men,used[N][i]);
		      }
		  System.out.println(men);
	      }
      }

}

Measured memory_bytes: 13000