akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;
 
typedef long long LL;
typedef set <LL> SET;
 
const int size = 51;
const string YES = "YES";
const string NO = "NO";

int bek[size];
int vol[size];
int n;

SET visited[size];
 
bool dist( int now );
bool solve( int now );
 
bool dist( int now ) {
    if ( vol[now] == 0 ) return solve( now + 1 );

    LL state = 0;
    for ( LL i = now; i < n; ++ i ) {
        if ( vol[i] == bek[i] ) state |= 1LL << i;
    }
    
    if ( visited[now].find( state ) != visited[now].end() ) return false;
    visited[now].insert( state );
    if ( vol[now] == 0 ) return false;
    
    for ( int i = now + 1; i < n; ++ i ) {
        if ( vol[i] != 0 ) continue;
        if ( vol[now] < bek[i] ) continue;
        if ( i - 1 >= now + 1 && bek[i-1] == bek[i] && vol[i-1] == 0 ) continue;
        vol[now] -= bek[i];
        vol[i] = bek[i];
        if ( dist( now ) ) return true;
        vol[i] = 0;
        vol[now] += bek[i];
    }
    return false;
}
 
bool solve( int now ) {
    if ( now == n ) return true;
    if ( vol[now] == 0 ) return false;
    if ( solve( now + 1 ) ) return true;
    if ( dist( now ) ) return true;
    return false;
}
 
int main() {
    while ( cin >> n && n ) {
        for ( int i = 0; i < n; ++ i ) {
            cin >> bek[i];
            vol[i] = 0;
            visited[i].clear();
        }
        sort( bek, bek + n, greater<int>() );
        vol[0] = bek[0];
        cout << ( solve( 0 ) ? YES : NO ) << endl;
    }
    return 0;
}

Measured memory_bytes: 3160
#include<stdio.h>
int main(){
int n,m,l;
long long a[100][100],b[100][100],c[100][100]={0};
scanf("%d %d %d", &n,&m,&l);
for (int i = 0; i < n; i++)
{
    for (int j = 0; j < m; j++)
    {
        scanf("%lld", &a[i][j]);
    }
    
}
for (int i = 0; i <m; i++)
{
    for (int j = 0; j < l; j++)
    {
        scanf("%lld", &b[i][j]);
    }
    
}
for (int i = 0; i < n; i++)
{
    for (int j = 0; j < l; j++)
    {
        c[i][j]=0;
        for (int k = 0; k < m; k++)
        {
            c[i][j] = c[i][j] + a[i][k]*b[k][j];
        }
        
    }
    
}


for (int i = 0; i < n; i++)
{
    for (int j = 0; j < l; j++)
    {
        if (j == 0)
        {
            printf("%lld",c[i][j]);
        }
        else
        {
        printf(" %lld", c[i][j]);
        }
        
    }
    printf("\n");
}

return 0;
}



Measured memory_bytes: 2112
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut keys: Vec<(usize, usize)> = vec![];
    for _ in 0..m {
        let a: usize = read();
        let b: usize = read();
        let mut key = 0;
        for _ in 0..b {
            let c: u32 = read();
            key |= (2 as usize).pow(c - 1);
        }
        keys.push((key, a));
    }
    const INF: usize = 1001001001;
    let mut dp = vec![INF; (2 as usize).pow(n as u32)];
    dp[0] = 0;
    for i in 0..(2 as usize).pow(n as u32) {
        if dp[i] == INF {
            continue;
        }
        for key in keys.iter() {
            let k = i | key.0;
            dp[k] = std::cmp::min(dp[k], dp[i] + key.1);
        }
    }
    let v = dp.pop().unwrap();
    println!("{}", if v != INF {
        v as i32
    } else {
        -1
    });
}


Measured memory_bytes: 4352
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;

struct edge {
	int a, b;
	int len;
};

int main() {
	int l;
	scanf("%d", &l);
	int base = 1;
	int n = 0;
	while (base * 2 <= l) {
		base *= 2;
		n ++;
	}
	n ++;
	vector<edge> ans;
	vector<int> p(30);
	p[0] = 1;
	for (int i = 1; i < 30; i ++) {
		p[i] = 2 * p[i - 1];
	}
	for (int i = 0; i < n - 1; i ++) {
		ans.push_back({i, i + 1, 0});
		ans.push_back({i, i + 1, p[n - 2 - i]});
	}
	l -= base;
	int sum = base;
	for (int i = 30; i >= 0; i --) {
		if (l & (1 << i)) {
			ans.push_back({0, n - 1 - i, sum});
			sum += (1 << i);
		}
	}
	printf("%d %d\n", n, (int) ans.size());
	for (int i = 0; i < (int) ans.size(); i ++) {
		printf("%d %d %d\n", ans[i].a + 1, ans[i].b + 1, ans[i].len);
	}
        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pii pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define ios ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
const char nl = '\n';
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  (B) <= (A) && (A) <= (C)
#define AIN(A, B, C) assert(IN(A, B, C))
ll power(ll x, unsigned int y) {ll res = 1;	while (y > 0) { if (y & 1) res = res*x%mod; y = y>>1; x = x*x;} return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
void solve(){
   ll  n,d;
    cin>>n>>d;
    ll ans=0;
    for(int i=0;i<n;i++){
    	ll x,y;
    	cin>>x>>y;
    	if(x*x+y*y<=d*d)ans++;
    }
    cout<<ans;
}	
int main() {
    ios;
	int t=1;
	//cin>>t;
	while(t--)solve();
 
    
}


Measured memory_bytes: 3612
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():

        s=input()
        n=len(s)
        if s=='keyence':
            return 'YES'
        else:
            for i in range(n):
                for j in range(i+1,n+1):
                    if s[:i]+s[j:]=='keyence':
                        return 'YES'
            return 'NO'
    print(main())
resolve()

Measured memory_bytes: 38640
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

ll MOD = 1e9 + 7;

ll add(ll a, ll b) {
    ll res = a + b;
    if (res >= MOD) {
        res -= MOD;
    }
    return res;
}

ll sub(ll a, ll b) {
    ll res = a - b;
    if (res < 0) {
        res += MOD;
    }
    return res;
}

ll mul(ll a, ll b) {
    return (a * b) % MOD;
}

ll rev(ll a, ll m = MOD) {
    if (a == 1) {
        return 1;
    }
    return (1 - rev(m % a, a) * m) / a + m;
}

ll divv(ll a, ll b) {
    return (a * rev(b)) % MOD;
}

const int maxn = 4040;
int n;
ll dp[maxn][maxn];
ll fact[2 * maxn], rev_fact[2 * maxn];

ll f(ll a, ll b) {
    return mul(mul(fact[a + b], rev_fact[a]), rev_fact[b]);
}

void pre_calc() {
    fact[0] = rev_fact[0] = 1;
    for (int i = 1; i < 2 * maxn; i++) {
        fact[i] = mul(fact[i - 1], i);
        rev_fact[i] = rev(fact[i]);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;

    pre_calc();

    cin >> n;
    vector<int> a(n), b(n);
    ll ans = 0;
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        ans = sub(ans, f(a[i] + a[i], b[i] + b[i]));
        dp[2000 - a[i]][2000 - b[i]]++;
    }


    for (int i = 0; i < maxn; i++) {
        for (int j = 0; j < maxn; j++) {
            if (i) {
                dp[i][j] = add(dp[i][j], dp[i - 1][j]);
            }
            if (j) {
                dp[i][j] = add(dp[i][j], dp[i][j - 1]);
            }
        }
    }

    for (int i = 0; i < n; i++) {
        ans = add(ans, dp[2000 + a[i]][2000 + b[i]]);
    }
    ans = divv(ans, 2);
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 129408
#include <bits/stdc++.h>
using namespace std;
const int inf=1<<30;
vector<int> p,c,e;
int dp[510][10010];
int main(){
	int n,m;	cin>>m>>n;
	p.resize(m);	c.resize(n);	e.resize(n);
	for(int i=0;i<m;i++)	cin>>p[i];
	//饅頭はソートして価値の高い順に使う。
	sort(p.begin(),p.end());	reverse(p.begin(),p.end());
	for(int i=0;i<n;i++)	cin>>c[i]>>e[i];
	//dp[i][j]:i個の饅頭を使うのに必要な箱の価格の最小値
	for(int i=0;i<510;i++)	fill_n(dp[i],10010,inf);
	dp[0][0]=0;
	for(int i=1;i<=c[0];i++)	dp[0][i]=e[0];
	for(int i=1;i<n;i++){
		dp[i][0]=0;
		for(int j=1;j<=m;j++){
			if(j<c[i])	dp[i][j]=min(dp[i-1][j],e[i]);
			else 	dp[i][j]=min(dp[i-1][j],dp[i-1][j-c[i]]+e[i]);
		}
	}
	int sum=0,ans=0;
	for(int i=0;i<m;i++){
		sum+=p[i];
		ans=max(ans,sum-dp[n-1][i+1]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 21196
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc140/abc140_d.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll N, K;
  cin >> N >> K;
  string S;
  cin >> S;

  ll ans = 0;
  ll score = 0;
  rep(i, N) {
    if (S[i] == S[i + 1]) score++;
  }
  ans = min(N - 1, score + 2 * K);

  cout << ans << endl;
}

Measured memory_bytes: 512
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();
		int x =0;
		if((1<=A&&A<=20)&&(1<=B&&B<=20)&&(A<=B)) {
	if(B%A == 0) {
		x=A+B;
	}
	else {
		x=B-A;
	}
	System.out.println(x);
		}
	}
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <math.h>

int main(void) {

    int X = 0;
    int N = 0;
    int N_5, N_4, N_3, N_2;
    int C_5, C_4, C_3, C_2, C_1, C;

    scanf("%d", &X);

    N = X % 100;
    C = X / 100;

    N_5 = N % 5;
    C_5 = N / 5;

    N_4 = N_5 % 4;
    C_4 = N_5 / 4;
    
    N_3 = N_4 % 3;
    C_3 = N_4 / 3;

    N_2 = N_3 % 2;
    C_2 = N_3 / 2;

    C_1 = N_2;

    if((C_1 + C_2 + C_3 + C_4 + C_5) <= C){
        printf("1\n");
    } else {
        printf("0\n");
    }



    return 0;
}

Measured memory_bytes: 128
#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>;

const ll INF = 1LL<<61;

struct edge {
  int from;
  int to;
  ll cost;
};

int main() {

  int n, m;
  cin >> n >> m;
  vector<edge> G;
  ll dist[n+1];

  rep(i, m) {
    edge e;
    cin >> e.from >> e.to >> e.cost;
    G.push_back(e);
  }

  fill(dist, dist+n+1, -1 * INF);
  dist[1] = 0;
  bool neg_loop = false;

  // 頂点数-1　回ループして更新する。
  // 頂点数 回目のループで更新があった場合、正の閉路が存在する。
  for(int i = 1; i < n+1; ++i) {
    for(auto &e: G) {
      if(dist[e.to] < dist[e.from] + e.cost) {
        dist[e.to] = dist[e.from]+ e.cost;
        if(i == n && e.to == n) {
          neg_loop = true;
          break;
        }
      }
    }
  }

  if(!neg_loop) cout << dist[n] << endl;
  else cout << "inf" << endl;
  return 0;
}

Measured memory_bytes: 3596
fun solve(a:List<Int>, n:Int){
    var ans:Int = 0
    for(i in 0 until n-1){
        for(j in i+1 until n){
            ans += a[i] * a[j]
        }
    }
    println(ans)
}

fun main(){
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map{it.toInt()}

    solve(a,n)
}

Measured memory_bytes: 36432
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    int N, K;
    read(N, K);

    string s;
    read(s);
    reverse(all(s));

    vector<int> ans;

    const auto findNext = [&](int cur) -> int {
        repr(j, cur + K, cur+1) {
            if (j > N) continue;
            if (s[j] == '0') return j;
        }
        return -1;
    };

    int i = 0;
    while (i < N) {
        const int nxt = findNext(i);
        if (nxt == -1) {
            print(-1);
            return 0;
        }
        ans.push_back(nxt - i);
        i = nxt;
    }

    reverse(all(ans));
    print(ans);

    return 0;
}



Measured memory_bytes: 1096
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
ll mod=998244353;

int main(){
    std::ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    int f=0;
    for(int i=0;i<3;i++)if(s[i]==t[i])f++;
    cout<<f;

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
    char s[100000];
    scanf("%s",s);

    int n =strlen(s);
    s[n] = 'e';
    int i=0;
    int j=1;
    int count;
    int a[100000];
    for(i=0;i<n;i++){
        a[i] = -1;
    }
    //RLになってるところ以外は全部0
    //LRになってるところで一区切り
    int fcheck=0,bcheck;
    int rcheck,lcheck;
    //RLのRの添え字がrcheck、Lの添え字がlcheck
    for(i=0;i<n;i++){
        if(s[i]=='R' && s[i+1]=='L'){ //ここが0じゃない部分
            rcheck = i;
            lcheck = i+1;
        }
        else if(s[i]=='L' && s[i+1]=='R' || s[i]=='L' && s[i+1]=='e'){//ここで切れる。
            
            bcheck = i;
            if((bcheck-fcheck+1) % 2 ==0 ){//群の数が偶数なら同じになる
            a[rcheck] = (bcheck-fcheck+1)/2;
            a[lcheck] = (bcheck-fcheck+1)/2;
            }
            else if((rcheck-fcheck)%2==0){ //群の左端とRL部分のRの距離が偶数の時
                a[rcheck] = (bcheck-fcheck+1)/2+1;
                a[lcheck] = (bcheck-fcheck+1)/2;
            }
            else{
                a[rcheck] = (bcheck-fcheck+1)/2;
                a[lcheck] = (bcheck-fcheck+1)/2+1;
            }
            fcheck = i+1;
            if(i!=lcheck){ //切れ目がRLのLじゃない時、0
                a[i] =0;
            }
        } 
        else{
            a[i] = 0;
        }
    }
    for(i=0;i<n;i++){
        printf("%d ",a[i]);
    }
    printf("\n");
    return 0;
}

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

int main(){

    int n;
    cin >> n;
  
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
  
    cout << a[n/2] - a[n/2 - 1] << endl;
    return 0;

}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
char s[10005];
int N;
int main()
{
	cin>>N;
	cin>>s+1;
	int i,a;
	a=strlen(s+1);
	for(i=1;i<=a;i++)
	{
		if((int(s[i])+N)>int('Z'))
		{
			s[i]=(int(s[i])+N)%int('Z')+'A'-1;
		}
		else s[i]+=N;
	}
	for(i=1;i<=a;i++)
	{
		cout<<s[i];
	}
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	int a[3] = {};
	for (auto it = begin(s); it != end(s); it++) {
		if (*it == 'a') {
			a[0]++;
		} else if (*it == 'b') {
			a[1]++;
		} else {
			a[2]++;
		}
	}
	sort(a, a + 3);
	cout << (a[2] - a[0] <= 1 ? "YES" : "NO") << endl;
	return 0;
}


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

int main(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
// #ifndef ONLINE_JUDGE 
//     freopen("input.txt", "r", stdin); 
//     freopen("output.txt", "w", stdout); 
// #endif
    int n;
   	cin>>n;
   	int a[n][3];
   	for (int i=0; i<n;i++){
   		cin>>a[i][0]>>a[i][1]>>a[i][2];
   	}
   	// for(auto x:a){
   	// 	cout<< x[0] << " "<< x[1] << " "<< x[2] << "\n";
   	// }
   	int dp[n][3];
   	for (int i = 0; i < n; ++i){
        dp[i][0] = 0;
        dp[i][1] = 0;
        dp[i][2] = 0;
    }
    dp[0][0] = a[0][0];
    dp[0][1] = a[0][1];
    dp[0][2] = a[0][2];
    // for(auto x:dp){
   	// 	cout<< x[0] << " "<< x[1] << " "<< x[2] << "\n";
   	// }
   	for (int i=1;i<n;i++){
   		for(int j=0;j<3;j++){
   			if (j==0){
   				dp[i][j]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
   			}
   			else if (j==1){
   				dp[i][j]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
   			}
   			else{
   				dp[i][j]=max(dp[i-1][0],dp[i-1][1])+a[i][2];
   			}
   			
   		}
   	}
   	// for(auto x:dp){
   	// 	cout<< x[0] << " "<< x[1] << " "<< x[2] << "\n";
   	// }
   	int ans=max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
   	cout<<ans;
	return 0;

}


Measured memory_bytes: 2560
import java.util.*
import kotlin.*

fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = Scanner(System.`in`)
        val k = sc.nextLong()
        val n = 50
        val ans = Array(n) { (n - 1).toLong() + k / n }

        val m = (k % n).toInt()

        for (i in 0 until m) {
            ans[i] += n.toLong()
            for (j in 0 until n) {
                if (i == j) continue
                ans[j] -= 1L
            }
        }

        println(n)
        println(ans.joinToString(" "))
    }
}


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

namespace ABC117A
{
    class Program
    {
        static void Main(string[] args)
        {
            double a, b;
            string[] ss = Console.ReadLine().Split(' ');
            a = double.Parse(ss[0]);
            b = double.Parse(ss[1]);
            Console.WriteLine(a / b);
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;

int main()
{
    int ans1 = 0, ans2 = 0;
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++)
        if((i&1) && s[i] == '0')ans1++;
        else if(i%2 == 0 && s[i] == '1')ans1++;
    for(int i = 0; i < s.size(); i++)
        if(i%2==0 && s[i] == '0')ans2++;
        else if((i&1) && s[i] == '1')ans2++;
    cout<<min(ans1, ans2)<<endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
int mod=int(1e9)+7;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    string s,t;
    cin>>s;
    cin>>t;
    int n=s.size();
    int m=t.size();
    int dp[n+1][m+1];
    memset(dp,0,sizeof(dp));
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i==0||j==0){
                dp[i][j]=0;
            }
            else{
                if(s[i-1]==t[j-1]){
                    dp[i][j]=dp[i-1][j-1]+1;
                }
                else{
                    dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
                }
            }
        }
    }
    int i=n,j=m;
    vector<char> v;
    while(i>=1&&j>=1){
        if(s[i-1]==t[j-1]){
            v.push_back(s[i-1]);
            i--;
            j--;
        }
        else{
            int g=max(dp[i-1][j],dp[i][j-1]);
            if(g==dp[i-1][j]){
                i--;
            }
            else{
                j--;
            }
        }
    }
    reverse(v.begin(),v.end());
    for(auto h:v){
        cout<<h;
    }
    cout<<"\n";

}

Measured memory_bytes: 38824
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    if (k <= a) {
        printf("%lld", k);
    } else if (k <= a+b) {
        printf("%lld", a);
    } else {
        i = a-(k-(a+b));
        printf("%lld", i);
    }
    return 0;
}

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



int main() {

    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
   	int k,n;
   	cin>>k>>n;
   	vector<int> v(n);
   	for(int i = 0; i < n; i++)
   		cin>>v[i];

   	vector<int> seg(n);
   	int sum = 0;
   	for(int i = 0; i < n-1; i++) {
   		seg[i] = v[i+1] - v[i];
   		sum += seg[i];
   	}
   	seg[n-1] = v[0] + (k - v[n-1]);
   	sum += seg[n-1];

   	// for(auto it : seg) {
   	// 	cout<<it<<endl;
   	// }
   	auto maxSeg = max_element(seg.begin(), seg.end());
   	
   	//sum = accumulate(seg.begin(), seg.end(), 0);
   	cout<<sum - *maxSeg;


	return 0;		
}


Measured memory_bytes: 1792
# input = readlines()

# n, m = input.shift().chomp.split("\s").map{|x| x.to_i}

c = gets().chomp

data = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

puts data[data.find_index(c) + 1]


Measured memory_bytes: 14288
import java.util.Scanner;
 
class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        for(int i=0;i<str.length();i++){
            char ch = str.charAt(i);
            if(Character.isLowerCase(ch)) {
                ch = Character.toUpperCase(ch);
                System.out.print(ch);
           }else{
                ch = Character.toLowerCase(ch);
                System.out.print(ch);
}
        }
        System.out.printf("\n");
    }
}


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> hw(h, vector<char>(w));
  rep(i, h) {
    rep(j, w) {
      cin >> hw.at(i).at(j);
    }
  }
  rep(i, w + 2) {
    cout << "#";
  }
  cout << endl;
  rep(i, h) {
    cout << "#";
    rep(j, w) {
      cout << hw.at(i).at(j);
    }
    cout << "#" << endl;
  }
  rep(i, w + 2) {
    cout << "#";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
S=[]
N=int(input())
A=list(map(int,input().split()))
C=[0]*(N);x=10**10;p=0
S.append(A[0])
for i in range(1,N):
  S.append(S[i-1]+A[i])
#print(S)
C[0]=abs(A[0]-(S[-1]-S[0]))
for i in range(1,N-1):
  C[i]=abs(S[i-1]+A[i]-(S[-1]-S[i]))
  if x>(C[i]):
    x=(C[i])
    p=i
print(abs(S[p-1]+A[p]-(S[-1]-S[p])))

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
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 int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

template <int mod>
struct ModInt {
    ll x;
    ModInt() : x(0) {}
    ModInt(ll y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod - p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = 1LL * x * p.x % mod; return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {
        ll a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }
    ModInt pow(ll n) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }
    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }
};
const int mod = 1000000007;
using mint = ModInt<mod>;

mint com[200010];

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    mint res = mint(2).pow(n) - 1;

    mint x = 1;
    for (int i = 0; i < 200010; ++i) {
        com[i] = x;
        x *= mint(n-i) / mint(i+1);
    }

    cout << res - com[a] - com[b] << endl;
}

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

using namespace std;

int main()
{
    int h, w;
    cin>>h>>w;

    int s[h][w], c=0;
    vector<int> f;
    char temp;
    for(int i=0; i<h; i++)
    {
        for(int j=0; j<w; j++)
        {
            cin>>temp;
            if(temp=='#')
            {
                s[i][j]=-1;
                while(!f.empty())
                {
                    s[i][f.back()]=c;
                    f.pop_back();
                }
                c=0;
            }
            else
            {
                c++;
                f.push_back(j);
            }
        }
        while(!f.empty())
        {
            s[i][f.back()]=c;
            f.pop_back();
        }
        c=0;
    }

    c=0;
    for(int j=0; j<w; j++)
    {
        for(int i=0; i<h; i++)
        {
            if(s[i][j]==-1)
            {
                while(!f.empty())
                {
                    s[f.back()][j]+=c-1;
                    f.pop_back();
                }
                c=0;
            }
            else
            {
                c++;
                f.push_back(i);
            }
        }
        while(!f.empty())
        {
            s[f.back()][j]+=c-1;
            f.pop_back();
        }
        c=0;
    }

    int m=-1;

    for(int i=0; i<h; i++)
    {
        for(int j=0; j<w; j++)
        {
            m=max(m, s[i][j]);
        }
    }

    if(m<0) m=0;
    cout<<m;

    return 0;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	for(int i=9;i>=1;i--){
		if(n%i==0&&n/i<=9){
			printf("Yes");
			return 0;
		}
	}
	printf("No");
} 

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

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "begin", long, "end");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    auto p = aryread();
    long minimam = INF, cnt;
    foreach (i; iota(n))
    {
        if(p[i] < minimam)
        {
            cnt++;
            minimam = p[i];
        }
    }
    cnt.writeln();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 11408
#include <bits/stdc++.h>
using namespace std;
int x;
int gcd(int x,int y){
    if(y==0)
        return x;
    return gcd(y,x%y);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int main()
{
    scanf("%d",&x);
    printf("%d",lcm(x,360)/x);
    return 0;
}


Measured memory_bytes: 3820
#include <stdio.h>
#include <time.h>
#include <stdlib.h>


int main(void){ 
    long long i,H,W,a;
        scanf("%lld%lld",&H,&W);  
        if(H == 1 || W == 1){
            printf("1\n");
        }
        else if(H%2 == 0){
            a = (H/2)*W;
            printf("%lld\n",a);
        }
        else if(H%2==1){
            a = (H*W+1)/2;
            printf("%lld\n",a);
        }
      
    
    return 0;
} 

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

using namespace std;
typedef long long ll;

const int N=1e5+5;

ll x[N],y[N],mx,ans;
int n,m,a,b;

inline void add(int l,int r,int a,int b){x[l]+=a,x[r+1]-=a,y[l]+=b,y[r+1]-=b;}

int main(){
	scanf("%d%d",&m,&n);
	m--;scanf("%d",&a);
	while(m--){
		scanf("%d",&b);
		if(a<b)add(a+1,b,1,-a-1),ans+=b-a;
		else add(a+1,n,1,-a-1),add(1,b,1,n-a-1),ans+=n-a+b;
		a=b;
	}
	for(int i=1;i<=n;i++)x[i]+=x[i-1],y[i]+=y[i-1],mx=max(mx,x[i]*i+y[i]);
	printf("%lld\n",ans-mx);
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] SH = S.split("");
        String Kotae;
        String SHaM = SH[0]+SH[1];
        String SHbM = SH[2]+SH[3];
        int SHa= Integer.parseInt(SHaM);
        int SHb= Integer.parseInt(SHbM);
        if(SHa==00 || SHa>=13){
            if(SHb==00 || SHb>=13){
                Kotae = "NA";
            }else{
                Kotae = "YYMM";
            }
        }else{
            if(SHb==00 || SHb>=13){
                Kotae = "MMYY";
            }else{
                Kotae = "AMBIGUOUS";
            }
        }
        System.out.println(Kotae);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL <<60;
typedef long long ll;
using namespace std;

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

ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

ll choose2(ll n){
    return n*(n-1)/2;
}

int main(){
    int n,k;
    cin>>n>>k;
    if(n % k == 0) cout<<0<<endl;
    else cout<<1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={-1,0,1,0,1,1,-1,-1};
const int INF = 1<<30;
const double EPS = 1e-15;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef pair<int,Pii> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
struct Point{
	double x,y;
	Point(){}
	Point(double _x,double _y){
		x = _x;
		y = _y;
	}
	Point operator + (Point p){
		return Point(x+p.x,y+p.y);
	}

	Point operator - (Point p){
		return Point(x-p.x,y-p.y);
	}

	Point operator * (double k){
		return Point(k*x,k*y);
	}


	bool operator<(const Point &p)const{
		return x!=p.x?x<p.x:y<p.y;
	}	
};
double dot(Point p, Point q){
	return p.x*q.x+p.y*q.y;
}

double cross(Point p,Point q){
	return p.x*q.y-q.x*p.y;
}

double norm(Point p){
	return p.x*p.x+p.y*p.y;
}

double pabs(Point p){
	return sqrt(norm(p));
}
typedef vector<Point> Polygon;
struct Line : Polygon{
	Line(){}
	Line(Point p,Point q){
		PB(p);
		PB(q);	
	}
};
struct Circle{
	Point p;
	double r;
	Circle(){}
	Circle(Point _p,double _r){
		p = _p;
		r = _r;
	}
};
int ccw(Point a,Point b,Point c){
	b = b-a;
	c = c-a;
	if(cross(b,c) > 0)return +1; //ccw
	if(cross(b,c) < 0)return -1; //cw
	if(pabs(b)<pabs(c))return +2; //a--b--c
	if(dot(b,c) < 0)return -2; // c--a--b;
	return 0;
}

string ccw_s(Point a,Point b,Point c){
	b = b-a;
	c = c-a;
	if(cross(b,c) > 0)return "COUNTER_CLOCKWISE"; //ccw
	if(cross(b,c) < 0)return "CLOCKWISE"; //cw
	if(dot(b,c) < 0)return "ONLINE_BACK"; // c--a--b;
	if(norm(b)<norm(c))return "ONLINE_FRONT"; //a--b--c
	return "ON_SEGMENT";
}

int main(){
	double xp0,yp0,xp1,yp1;
	cin >> xp0 >> yp0 >> xp1 >> yp1;
	Point p1 = Point(xp0,yp0);
	Point p2 = Point(xp1,yp1);
	int Q;
	cin >> Q;
	while(Q--){
		double x,y;
		cin >> x >> y;
		Point p3 = Point(x,y);
		cout << ccw_s(p1,p2,p3) << "\n";
	}
	return 0;
}

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

using ll = long long;
#define int long long
using P = pair<int, int>;

#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, n, r) 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;}
template<typename T = int>
T in() {T a; cin >> a; return a;}
/***** MAIN *****/
signed main() {
  int n, c, k;
  cin >> n >> c >> k;
  vector<int> times(n);
  REP(i,n) {
    cin >> times[i];
  }
  SORT(times);
  int counter = 1;
  int current_time = times[0];
  int ans = 0;
  REPS(i,1,n) {
    if(times[i] > current_time + k || counter >= c) {
      ++ans;
      current_time = times[i];
      counter = 1;
    } else {
      ++counter;
    }
  }
  ++ans;
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


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

int main(){
  int x, a, b;
  cin >> x >> a >> b;
  int da = abs(a-x);
  int db = abs(b-x);
  if(da > db) cout << "B" << endl;
  else cout << "A" << endl;
  return 0;
}

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

void bubbleSort(int numbers[], int array_size)
{
  int i, j, temp;

  for (i = 0; i < (array_size - 1); i++) {
    for (j = (array_size - 1); j > i; j--) {
      if (numbers[j-1] > numbers[j]) {
        temp = numbers[j-1];
        numbers[j-1] = numbers[j];
        numbers[j] = temp;
      }
    }
  }
}

int main(){
  int a[3],k;cin>>a[0]>>a[1]>>a[2]>>k;
  bubbleSort(a,3);
  cout<<a[0]+a[1]+a[2]*pow(2,k)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define N 2000005
int fac[N],inv[N];
const int mod=1000000007;
void shai()
{
	fac[0]=fac[1]=inv[0]=inv[1]=1;
	for(int i=2;i<=2000000;i++){
		fac[i]=1ll*i*fac[i-1]%mod;
		inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	}
	for(int i=2;i<=2000000;i++)
		inv[i]=1ll*inv[i]*inv[i-1]%mod;
}
int C(int x,int y){return 1ll*fac[x]*inv[y]%mod*inv[x-y]%mod;}
int ab(int x){return x<0?-x:x;}
int G(int x1,int y1,int x2,int y2){return C(ab(x1-x2)+ab(y1-y2),ab(x1-x2));}
int X[7],Y[7];
int F(int x,int y,int flg)// A point to a rectangle
{
	if(flg==1)
		return 1ll*(1ll*G(x,y,X[2],Y[2])+1ll*mod-1ll*G(x,y,X[1]-1,Y[2])+1ll*mod-1ll*G(x,y,X[2],Y[1]-1)+1ll*G(x,y,X[1]-1,Y[1]-1))%mod;
	else
		return 1ll*(1ll*G(x,y,X[5],Y[5])+1ll*mod-1ll*G(x,y,X[6]+1,Y[5])+1ll*mod-1ll*G(x,y,X[5],Y[6]+1)+1ll*G(x,y,X[6]+1,Y[6]+1))%mod;
}
int main()
{
	int i,ans=0,x,y;shai();
	for(i=1;i<=6;i++)scanf("%d",&X[i]);
	for(i=1;i<=6;i++)scanf("%d",&Y[i]);
	for(x=X[3];x<=X[4];x++){
		ans=(1ll*ans+1ll*F(x,Y[4],1)*F(x,Y[4]+1,3)%mod*(x+Y[4]+1)%mod)%mod;
		ans=(1ll*ans-1ll*F(x,Y[3]-1,1)*F(x,Y[3],3)%mod*(x+Y[3])%mod+mod)%mod;
	}
	for(y=Y[3];y<=Y[4];y++){
		ans=(1ll*ans+1ll*F(X[4],y,1)*F(X[4]+1,y,3)%mod*(y+X[4]+1)%mod)%mod;
		ans=(1ll*ans-1ll*F(X[3]-1,y,1)*F(X[3],y,3)%mod*(y+X[3])%mod+mod)%mod;
	}
	printf("%d",ans);
}

Measured memory_bytes: 15744
import math
X = int(input())


def get_primenumber(number):
    prime_list = []
    # 2からnumberまでの数字をsearch_listに入れる
    search_list = list(range(2, number+1))
    while True:
    # search_listの先頭の値が√nの値を超えたら処理終了
        if search_list[0] > math.sqrt(number):
            # prime_listにsearch_listを結合
            prime_list.extend(search_list)
            break
        else:
            # search_listの先頭をprime_listに入れる
            head_num = search_list[0]
            prime_list.append(head_num)
            # search_listの先頭をpopする
            search_list.pop(0)
            # head_numの倍数を取り除く
            search_list = [num for num in search_list if num % head_num != 0]
    return prime_list

prime_list = get_primenumber(100000)

left = 0
right = len(prime_list)-1

if X == 2:
    print(int(2))
elif X > 99991:
    print(int(100003))
else:
    while left <= right:
        mid = (left+right) // 2
        if prime_list[mid] == X:
            ans = prime_list[mid]
            break
        elif prime_list[mid] > X:
            if prime_list[mid-1] < X:
                ans = prime_list[mid]
                break
            else:
                right = mid - 1
        else:
            if prime_list[mid+1] > X:
                ans = prime_list[mid+1]
                break
            else:
                left = mid + 1

    print(int(ans))

Measured memory_bytes: 7472
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;
// 多倍長テンプレ
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}

int main() {
  int X,Y;
  cin >> X >> Y;
  
  cout << X*Y;
  cout << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#define N 101
int main(void){
    int i;
    int j;
    int n;
    int adj[N][N];
    int a, b, c;
    scanf("%d", &n);
    for(i=1; i<=n; i++){
        for(j=1; j<=n; j++) adj[i][j]=0;
    }
    for(i=1; i<=n; i++){
        scanf("%d %d ", &a, &b);
        for(j=1;j<=b;j++){
            scanf("%d", &c);
            adj[a][c]=1;
        }
    }
    for(i=1; i<=n; i++){
        for(j=1; j<=n; j++){
            printf("%d", adj[i][j]);
            if(j!=n) printf(" ");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 636
# coding: utf-8
# Your code here!



for _ in range(100):
    H, W = map(int, input().split())
    if H == 0 and W ==0:
        break
    else:
        print('#' * W)
        for i in range(H-2):
            print('#'+'.'*(W-2)+'#')
        print('#' * W)
        print('')
        


Measured memory_bytes: 5616
#include <iostream>
#include <vector>

using namespace std;

int main(void){
	int n;
	while(cin >> n && n){
		vector<int> v(n);
		int l=0,r=n-1,m,k,ans=0;;
		for(int i=0;i<n;i++){
			cin >> v[i];
		}
		cin >> k;
		while(l<=r){
			ans++;
			m = (r+l)/2;
			if(v[m] == k) break;
			if(v[m] < k){
				l = m+1;
			}else{
				r = m-1;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979;

ll expo(ll a, ll b){
    ll ex = 1;
    rep(i, b){
        ex *= a;
    }
    return ex;
}

ll fact(ll a){
    ll fc = 1;
    REP(i, 1, a+1){
        fc *= i;
    }
    return fc;
}

int main() {
    str s;
    cin >> s;
    ll cnt = 0;
    rep(i,3) {
        if(s[i]=='o') {
            cnt++;
        }
    }
    cout << 700 + 100*cnt << endl;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] grid = new char[h][w];
		for(int i = 0; i < h; i++){
		    String s = sc.next();
		    grid[i] = s.toCharArray();
		}
		
		// 計算
		int result = 0;
		int cnt = 0;
		for(int i = 0; i < h; i++){
		    for(int j = 0; j < w; j++){
		        if(grid[i][j] == '.') cnt++;
		    }
		}
		
		ArrayDeque<Point> q = new ArrayDeque<Point>();
		q.add(new Point(0, 0));
		int[][] dist = new int[h][w];
		int[] dx = {0, 0, -1, 1};
		int[] dy = {-1, 1, 0, 0};
		while(!q.isEmpty()){
		    Point p = q.poll();
		    if(p.x == w-1 && p.y == h-1){
		        break;
		    }
		    for(int i = 0; i < 4; i++){
		        int x = p.x + dx[i];
		        int y = p.y + dy[i];
		        if(x >= 0 && x < w && y >= 0 && y < h){
		            if(grid[y][x] == '.' && dist[y][x] == 0){
		                dist[y][x] = dist[p.y][p.x] + 1;
		                q.add(new Point(x, y));
		            }
		        }
		    }
		}
		if(dist[h-1][w-1] == 0){
		    result = -1;
		}else{
		    result = cnt - (dist[h-1][w-1] + 1);
		}
		
		// 出力
		System.out.println(result);
	}
}

class Point {
    int x;
    int y;
    
    Point(int x, int y){
        this.x = x;
        this.y = y;
    }

    public String toString(){
        return "(" + x + ", " + y + ")";
    }
}



Measured memory_bytes: 21972
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
const ll INF=1e15;
const int MAX_N=500,MAX_C=30;

int N,C,D[MAX_C][MAX_C];
int cnt[3][MAX_C];

int main(){
	cin>>N>>C;
	REP(i,C){
		REP(j,C){
			cin>>D[i][j];
		}
	}
	REP(i,N){
		REP(j,N){
			int c;
			cin>>c;
			c--;
			cnt[(i+j)%3][c]++;
		}
	}
	ll ans=INF;
	REP(i,C){
		REP(j,C){
			REP(k,C){
				if (i!=j && j!=k && k!=i){
					vector<int> vec={i,j,k};
					ll s=0;
					REP(p,3){
						REP(c,C){
							s+=D[c][vec[p]]*cnt[p][c];
						}
					}
					ans=min(ans,s);
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
#include<type_traits>

using namespace std;
int A[6][100];
int H;
int Y = 0;
void serch() {
	int t = 1;
	while (t) {
		t = 0;
	
		for (int i = 1; i <= H; i++) {
			int r = 1;
			for (int j = 1; j < 5; j++) {
				
				if (A[j][i] == A[j + 1][i]&&A[j][i]!=-1&&A[j][i]!=0) {
					
					r++;
				}
				else {
					if (r >= 3) {
						for (int R = 0; R < r; R++) {
							
							t++;
							Y += A[j - R][i];
					
							A[j - R][i] = -1;
						}
						break;
					}
					r = 1;
				}
				if (j == 4 && r >= 3) {
					for (int R = 0; R < r; R++) {
						t++;
					
						Y += A[j+1 - R][i];
						A[j+1 - R][i] = -1;
					}
				}
			

			}
		}

		int u = 1;
		while (u) {
			u = 0;
			for (int i = 0; i < H; i++) {
				for (int j = 1; j <= 5; j++) {
				
					if (A[j][H - i] == -1 && A[j][H - i - 1] == -1)u++;
					if (A[j][H - i] == -1) {
						if (A[j][H - i - 1] == 0) {
							A[j][H - i] = 0;
							goto ggo;
						}
						else {
							A[j][H - i] = A[j][H - i - 1];
							A[j][H - i - 1] = -1;
						}
					}
				}
			ggo:;
			}

		}

	}

}

int main() {
	
	cin >> H;
	while (H) {
		for (int i = 0; i < 100; i++){
			for (int j = 0; j < 6; j++) {
				A[j][i]=0;
			}
		}
		for (int i = 1; i <= H; i++) {
			for (int j = 1; j <= 5; j++) {
				cin >> A[j][i];
			}
		}

		serch();
		cout << Y<< endl;
		Y = 0;
		cin >> H;
	}
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N, T;
    cin >> N >> T;

    vector<ll> t(N);

    REP(i, N){
        cin >> t[i];
    }

    ll ans = 0;
    for(ll i=1; i<N; i++){
        ans += min(t[i] - t[i-1], T);
    }
    cout << ans + T << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

#define MON 10
#define output 3

void BubSort(int x[ ], int n)
{
    int i, j, temp;
	
    for (i = 0; i < n - 1; i++) {
        for (j = n - 1; j > i; j--) {
            if (x[j - 1] > x[j]) {  /* 前の要素の方が大きかったら */
                temp = x[j];        /* 交換する */
                x[j] = x[j - 1];
                x[j - 1]= temp;
            }
        }	
    }
}

int main (void) {
	int i;
	int mon[MON];
	for (i = 0; i < MON; i++) {
		scanf("%d",&mon[i]);
	}
	BubSort(mon,MON);
	for (i = 0 ; i < output; i++) {
		printf("%d\n",mon[MON - i -1]);
	}
	
    return 0;
}

Measured memory_bytes: 0