akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**7)
def dfs(v,c):
  for i,w in enumerate(e[v]):
    e[w].discard(v)
    c=c*dfs(w,k-i+~(v>0))%(10**9+7)
  return c
n,k,*t=map(int,open(0).read().split())
e=eval('set(),'*n)
for a,b in zip(t[::2],t[1::2]):
  e[a-1].add(b-1)
  e[b-1].add(a-1)
print(dfs(0,k))

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

typedef long long ll;

int main () {
	int A, B, K;
	cin >> K >> A >> B;
	for (int i=A; i<=B; i++) {
		if (i%K==0) {
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3592
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: June 5 2019
 * 
 */

#include <bits/stdc++.h>

//#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(x) for(auto i=0 ; i<(x); ++i)
#define _rep(a,b) for(auto i=(a); i<(b); ++i)
#define endl '\n'
using namespace std;

bool compare(pair<int , int>a , pair<int , int > b){
    return a.ff < b.ff;
}



auto SOLUTION_FUNCTION( void ) ->void {

    // your solution goes here 

    int n , m;

    cin>>n>>m;

    vpii v(n);

    rep(n){
        int a , b;
        cin>>a>>b;

        v[i].ff = a;
        v[i].ss = b;
    }

    sort(all(v),compare);

    bint counter = 0;
    for(int i=0; m; ++i){
        bint k = min(m , v[i].ss);
        counter+=k*v[i].ff;
        m-=k;
    }
    cout<<counter<<endl;



    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("cin","r",stdin);
    freopen("cout","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    map<int, int> mp;
    int cnt = 0;
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        if (a >= 3200) {
            cnt++;
        } else {
            mp[a / 400]++;
        }
    }
    int res = mp.size();
    cout << max(1, res) << ' ' << res + cnt << endl;

    return 0;
}

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

using namespace std;

typedef pair<double,double> P;
double EPS = 1e-9;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

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

  point operator * (double d){
    return point(x*d,y*d);
  }

  point operator / (double d){
    return point(x/d,y/d);
  }
};


struct circle{
  point p;
  double r;
};

vector<point> circles_cross(circle a, circle b){
    vector<point> ret;
     
    double x = a.p.x - b.p.x , y = a.p.y - b.p.y;
    double L = x * x + y * y;
    if(L > pow(a.r+b.r,2))return ret;
     
    L = sqrt(L);
    double C = atan2(b.p.y-a.p.y,b.p.x-a.p.x);
    double alpha = acos((L*L+a.r*a.r-b.r*b.r)/(2*L*a.r));
     
    point r1,r2;
    r1.x = a.p.x + cos(C+alpha) , r1.y = a.p.y + sin(C+alpha);
    r2.x = a.p.x + cos(C-alpha) , r2.y = a.p.y + sin(C-alpha);
     
    ret.push_back(r1) , ret.push_back(r2);
     
    return ret;
}

int main(void){
  int n;
  circle a[100];

  while(cin >> n,n){
    vector<P>d;

    for(int i=0;i<n;i++){
      scanf("%lf,%lf",&a[i].p.x,&a[i].p.y);
      a[i].r=1;
    }

    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	vector<point> p=circles_cross(a[i],a[j]);
	for(int k=0;k<p.size();k++){
	  d.push_back(make_pair(p[k].x,p[k].y));
	}
      }
    }

    int count,ans=1;
    for(int i=0;i<d.size();i++){
      count=0;
      
      for(int j=0;j<n;j++){
	if(pow(d[i].first-a[j].p.x,2)+pow(d[i].second-a[j].p.y,2)<=1+EPS)count++;
      }
	ans=max(ans,count);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
(* O(n) *)
let n = Scanf.scanf " %d" @@ (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let ps = Array.make_matrix 2 n 0
let pc = Array.make 2 0
let ms = [|[|max_int; min_int|]; [|max_int; min_int|]|]
let mis = Array.make_matrix 2 2 0
let ds = Array.make_matrix 2 n false
let xys = ref []
let f i a =
  let j = if a < 0 then 1 else 0 in
  ps.(j).(pc.(j)) <- a; pc.(j) <- pc.(j) + 1;
  if a < ms.(j).(0) then (ms.(j).(0) <- a; mis.(j).(0) <- i);
  if a >= ms.(j).(1) then (ms.(j).(1) <- a; mis.(j).(1) <- i)
let show_result () =
  Printf.printf "%d\n" ps.(0).(0);
  List.rev !xys |> List.iter (fun (x, y) -> Printf.printf "%d %d\n" x y)
let g () =
  for i = 2 to pc.(0) - 1 do
    let x, y = ps.(0).(1), ps.(0).(i) in
    xys := (x, y) :: !xys;
    ps.(0).(1) <- x - y
  done;
  let x, y = ps.(0).(0), ps.(0).(1) in
  xys := (x, y) :: !xys;
  show_result ()
let _ =
  Array.iteri f a_s;
  let i, j, k, l = if pc.(0) = 0 then 0, 1, 1, 0 else if pc.(1) = 0 then 1, 0, 0, 1 else -1, -1, -1, -1 in
  if i <> -1 then
    (if pc.(j) = 2 then
      let x, y = max ps.(j).(0) ps.(j).(1), min ps.(j).(0) ps.(j).(1) in
      Printf.printf "%d\n%d %d\n" (x - y) x y; exit 0
    else ();
    let x, y = ps.(j).(mis.(j).(k)), ps.(j).(mis.(j).(l)) in
    if x = y && i = 1 then (g (); exit 0);
    xys := (x, y) :: !xys;
    ds.(j).(mis.(j).(k)) <- true;
    ds.(j).(mis.(j).(l)) <- true;
    ps.(i).(0) <- x - y;
    pc.(i) <- 1)
  else ();
  let h (i0, j0) =
    for i = i0 to pc.(1 - j0) - 1 do
      if not ds.(1 - j0).(i) then
        let x, y = ps.(j0).(0), ps.(1 - j0).(i) in
        xys := (x, y) :: !xys;
        ps.(j0).(0) <- x - y;
        ds.(1 - j0).(i) <- true;
    done in
  List.iter h [1, 1; 0, 0]; show_result ()

Measured memory_bytes: 16128
import time
import random
d = int(input())
dd = d * (d + 1) // 2
*C, = map(int, input().split())
S = [list(map(int, input().split())) for i in range(d)]


def calc_score(T):
    L = [-1 for j in range(26)]
    X = [0 for j in range(26)]
    score = 0
    for i in range(d):
        score += S[i][T[i]]
        X[T[i]] += (d - i) * (i - L[T[i]])
        L[T[i]] = i
    for j in range(26):
        score -= C[j] * (dd - X[j])
    return score


# 各日に一番満足度の増加が大きいコンテストを開催する
T = [S[i].index(max(S[i])) for i in range(d)]
score = calc_score(T)
start = time.time()
cnt = 0
while True:
    now = time.time()
    if now - start > 1.7:
        break
    p = cnt % d
    q = cnt % 26
    memo = T[p]
    T[p] = q
    new_score = calc_score(T)
    temp = 20000 * (1 - (now - start) / 2)
    prob = 2**((new_score - score) / temp)
    if random.random() < prob:
        score = new_score
    else:
        T[p] = memo
    cnt = (cnt + 1) % (10**9 + 7)

for t in T:
    print(t + 1)


Measured memory_bytes: 78876
import itertools
n = int(input())
l = [0 for _ in range(n)]
l = [int(s) for s in input().split()]




def solve(l_list):
    l_list = list(l_list)
    l_list.sort()
    #print(l_list)
    l1 = l_list[0]
    l2 = l_list[1]
    l3 = l_list[2]
    if(l1 + l2 <=l3 or l1 == l2 or l1 == l3 or l3 == l2):
        #print(l_list)
        return 0
    else:
        return 1
if(n < 3):
    print(0)
else:
    l_koho = list(itertools.combinations(l,3))
    #print(l_koho)
    cnt = 0
    for x in l_koho:
        #print(x)
        cnt += solve(x)

    print(cnt)




Measured memory_bytes: 20544
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define INF 10000000001
#define DIM 200001
#define mod 1000000007
#define PI 3.1415926535897932384626433
#define se second
#define fi first
#define pb push_back
#define gg exit(0)
#define T true
#define F false
#define endl "\n"
typedef char ch;
typedef bool boll;
typedef string st;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef set < string > sst;
typedef set < long long > sl;
typedef queue < long long > que;
typedef vector < long long > vec;
typedef map < long long, long long > mll;
typedef pair < long long, long long > pll;
typedef vector < pair < long long, long long > > vpl;
typedef pair < long long, unsigned long long > pul;
ll t,n,z,x,c;
st s;
int main()
{
    cin>>z>>x;
    if(z*500>=x)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
N,W = map(int,input().split())

product = [(0,0)]
for _ in range(N):
    v,w = map(int,input().split())
    product.append((w, v))

#縦が商品i，横が仮想カバンの耐久値
#i番目までの商品だけを使って，耐久wのカバンの価値を最大化していく
dp = [[-float('inf')]*(W+1) for _ in range(N+1)]

for i in range(N+1):
    for w in range(W+1):
        if i == 0:
            dp[i][w] = 0
            continue
        if w == 0:
            dp[i][w] = 0
            continue
        if product[i][0] > w:
            dp[i][w] = dp[i-1][w]
        else:
            dp[i][w] = max(dp[i-1][w], dp[i-1][w-product[i][0]] + product[i][1])
print(max(dp[N]))


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

#define fill(a,val) memset(a, (val), sizeof a)
#define pb push_back
#define lli long long int
#define scantype int
#define endl "\n"
#define unique(x) x.erase(unique(x.begin(),x.end()), x.end())

lli MOD  = 1000000007;
lli inf = 1e15;

void scan(scantype &x);
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli string_to_number(string s){lli x=0; stringstream convert(s); convert>>x; return x;}
lli add(lli a,lli b){lli x = (a+b)%MOD; return x; }
lli mul(lli a,lli b){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b){lli x = (a-b+MOD)%MOD; return x; }
lli divi(lli a,lli b){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}

#define N 100003

int main(void)
{
  int n,m;
  cin>>n>>m;

  int a[n+1];
  fill(a,0);

  for(int i=0;i<m;i++)
  {
  	int x,y;
  	cin>>x>>y;
  	a[x]++;
  	a[y]++;
  }

  for(int i=1;i<=n;i++)
  	if(a[i]%2)
  	{
  		cout<<"NO";
  		return 0;
  	}
  cout<<"YES";
  return 0;
}


void scan(scantype &x)
{
    register int c = getchar(); //for negative/positive
    x = 0;
    int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = getchar());
    if(c=='-') {neg=1;c=getchar();}
    for(;c>47 && c<58;c = getchar()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}



Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main()
{
    int c = 0;
    string s;
    cin >> s;
    for(int i = 0, j = s.size() - 1; i < j; i++, j--){
        if(s[i] != s[j]) c++;
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"n=int(input())\n"
"if n==7 or n==5 or n==3:\n"
"  print('YES')\n"
"else:\n"
"  print('NO')\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 3280
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

int ans[3];

int main()
{
  int n, m;
  cin >> n >> m;
  for(int i = 0 ; i < n ;i++)
    ans[i] = -1;
  while(m--) {
    int idx, c;
    cin >> idx >> c;
    --idx;
    if(~ans[idx] && ans[idx] != c) {
      cout << -1 << endl;
      return 0;
    }
    ans[idx] = c;
  }
  if(n > 1 && ans[0] == 0)
    return cout << -1 << endl, 0;
  if(ans[0] == -1) ans[0] = n == 1 ? 0 : 1;
  for(int i = 0 ; i < n ; i++) {
    if(ans[i] == -1) 
      ans[i] = 0;
    cout << ans[i];
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n, x; cin >> n >> x;
    vi a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    ll ans = 0;
    for(ll i=0; i<n; i++){
        if(x >= a[i]){
            if(i == n-1){
                x -=a[i];
                if(x == 0) ans++;
            }
            else{
                x -= a[i];
                ans++;
            }
        }
        else break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

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

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

	ll t = 1900 * k + 100 * (n - k);
	int s = 1;
	for (int i = 0; i < k; i++) {
		s *= 2;
	}
	cout << t*s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
     
int main(void) {
    int a,b,c;
    scanf("%d" "%d" "%d",&a,&b,&c);
    
    if(a<1 || a>10000 || b<1 || b>10000 || c<1 || c>10000){
        printf("The cost must be more than 1 and less than 10000.\n");
    }
    		
    if(a==b && b==c && c==a){
    	printf("%d\n",a+b);
    }else if(a >= b && a >= c){
    	printf("%d\n",b+c);
    				
    }else if(b >= a && b >= c){
    	printf("%d\n",a+c);
    	
    }else if(c >= a && c >= b){
    	printf("%d\n",a+b);
    }

    return 0;
}



Measured memory_bytes: 128
#![allow(unused_mut, non_snake_case, unused_macros,unused_imports)]
use std::cmp::{max, min, Ordering};
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque};
use std::iter::FromIterator;

//　高速 EOF要
//macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();input_inner!{iter, $($r)*}};($($r:tt)*) => {let mut s = {use std::io::Read;let mut s = String::new();std::io::stdin().read_to_string(&mut s).unwrap();s};let mut iter = s.split_whitespace();input_inner!{iter, $($r)*}};}
//macro_rules! input_inner {($iter:expr) => {};($iter:expr, ) => {};($iter:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($iter, $t);input_inner!{$iter $($r)*}};}
//macro_rules! read_value {($iter:expr, ( $($t:tt),* )) => {( $(read_value!($iter, $t)),* )};($iter:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()};($iter:expr, chars) => {read_value!($iter, String).chars().collect::<Vec<char>>()};($iter:expr, usize1) => {read_value!($iter, usize) - 1};($iter:expr, $t:ty) => {$iter.next().unwrap().parse::<$t>().expect("Parse error")};}
// 低速 EOF不要
macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

fn main(){
    input!(A:usize,B:usize);
    println!("{}",if A*B%2==0 {"No"} else {"Yes"});
}

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

int main()
{
	int n,T,ans=1001,i;
	int c[101],t[101];

	cin >> n >> T;
	for(i=0;i<n;i++){
		cin >> c[i] >> t[i];
	}

	for(i=0;i<n;i++){
		if(t[i]<=T){
			if(c[i]<ans){
				ans=c[i];
			}
		}
	}
	if(ans==1001){
		cout << "TLE" << endl;
	}
	else{
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define ll long long
# define all(x) x.begin(), x.end()
# define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
# define MOD 1000000007
														
using namespace std;

int main(){
	//fastio;
	vector<vector<int>> a(26);
	char tmp=getchar();
	int n=1;
	while (tmp>='a'&&tmp<='z'){
		a[tmp-'a'].push_back(n++);
		tmp=getchar();
	}

	int x=-1,y=-1;
	bool found=false;
	for (auto poses:a){
		sort(all(poses));
		if (poses.size()<2) continue;
		for (int i=1;i<poses.size();i++){
			int dis=poses[i]-poses[i-1];
			if(dis<=2) {
				x=poses[i-1];y=poses[i];
				found=true;
				break;
			}
		}
		if (found) break;
	}
	cout<<x<<' '<<y<<'\n';
	return 0;
}
	


Measured memory_bytes: 3904
#include<bits/stdc++.h>
using namespace std;
int main() {
	float a, b,A,B;
	cin >> a >> b;
	A = a / 0.08;
	B = b / 0.1;
	int ans=-1;
	for (int i = 1; i <= 1010; i++) {
		if (floor(i * 0.08) == a && floor(i * 0.1) == b) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N, A, B;
        public long MOD = 1000000007;

        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                N = line[0];
                A = line[1];
                B = line[2];
            }

            int mn = Math.Max(A + B - N, 0);
            int mx = Math.Min(A, B);

            Console.WriteLine($"{mx} {mn}");
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396
#include<iostream>
using namespace std;
int K,S;
int c=0;
int x,y,z;

int main(){
  cin>>K>>S;
 for(int x = 0; x <= K; ++x){
 for(int y = 0; y <= K; ++y){
int z = S - x - y;
 if(0 <= z and z <= K){
 c = c + 1;
 }
 }
 }
  cout<<c<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b[300],i,cnt=0;
	scanf("%d",&a);
	for(i=0;i<a;i++){
		scanf("%d",&b[i]);
	}
	i=0;
	while(1){
		if(b[i]%2!=0) break;
		else b[i]/=2;
		i++;
		if(i==a){
				i=0;
				cnt++;
		}
	}
	printf("%d\n",cnt);
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES

#include <bits/stdc++.h> 
  
using namespace std;
  
#define $(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second    
#define int long long
#define double long double       
#define vec vector            
#define pb push_back
#define pii pair<int, int>
#define pdd pair<double, double> 
#define beg begin
  
#ifdef LOCAL
    #define dbg(x) cerr << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
    cout.setf(ios::fixed); cout.precision(9);    
    solve();   
    return 0;
} 

const int MAXN = 1e5 + 10, INF = 1e18;

void solve() {
    int h, n;
    cin >> h >> n;
    vec<pii> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i].x >> a[i].y;
    }

    vec<int> dp(MAXN, INF);
    dp[0] = 0;
    for (int wt = 1; wt < MAXN; ++wt) {
        for (int i = 0; i < n; ++i) {
            if (wt - a[i].x >= 0 && (dp[wt - a[i].x] + a[i].y < dp[wt])) {
                dp[wt] = dp[wt - a[i].x] + a[i].y;
            }
        }
    }

    int mn = INF;
    for (int i = h; i < MAXN; ++i) {
        mn = min(mn, dp[i]);
    }
    cout << mn << endl;
}   

Measured memory_bytes: 1024
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n; readV(n);
  int[] l; readA(n, l);

  auto ml = l.reduce!max;
  writeln(l.sum-ml > ml ? "Yes" : "No");
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <numeric>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    vector<int> w(10), k(10);
    for (auto &&i : w) scanf("%d", &i);
    for (auto &&i : k) scanf("%d", &i);
    sort(w.begin(), w.end(), greater<>());
    sort(k.begin(), k.end(), greater<>());
    cout << accumulate(w.begin(), w.begin()+3, 0) << " " <<
            accumulate(k.begin(), k.begin()+3, 0) << "\n";
    return 0;
}



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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) (a).begin(),(a).end()

int cnt;
void insert_sort(int a[], int n, int g){
    REP(i,g,n){
        int v = a[i];
        int j = i - g;
        while(j >= 0 && a[j] > v){
            a[j+g] = a[j];
            j -= g;
            cnt++;
        }
        a[j+g] = v;
    }
}

void shell_sort(int a[], int n){
    int m = log2(n);
    cout << m << endl;
    rep(i,m){
        int g = n / pow(2, i+1);
        cout << g;
        if(i < m-1)printf(" ");
        else printf("\n");
        insert_sort(a, n, g);
    }

    
    cout << cnt << endl;
    rep(i,n)cout << a[i] << endl;
}

int main(){
    int n;
    cin >> n;
    int a[n];
    rep(i,n)cin >> a[i];
    
    if(n == 1){
        printf("1\n1\n0\n%d\n", a[0]);
        return 0;
    }

    shell_sort(a, n);

    return 0;
}


Measured memory_bytes: 7116
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int N;
    string S;
    cin >> N >> S;
    int mx = 0;
    rep(i, N){
        set<char> a, b;
        rep(j, N){
            if(j <= i){
                a.insert(S.at(j));
            }else{
                b.insert(S.at(j));
            }
        }
        int mx_now = 0;
        for(auto A : a){
            if(b.count(A) == 1) mx_now++;
        }
        mx = max(mx, mx_now);
    }
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
s = str(input())
ans = ''
if s[k-1] == 'A':
    ans = s[:k-1] + 'a' + s[k:]
    print(ans)
    exit()
elif s[k-1] == 'B':
    ans = s[:k-1] + 'b' + s[k:]
    print(ans)
    exit()
elif s[k-1] == 'C':
    ans = s[:k-1] + 'c' + s[k:]
    print(ans)
    exit()

Measured memory_bytes: 9020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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 ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,w,h;cin >> n >> w >> h;
    vector<int> c(2*w+1),d(2*h+1);
    for(int i=0;i<n;i++){
        int x,y,k;cin >> x >> y >> k;
        c[max(0,2*(x-k))]++;
        c[min(2*w+1,2*(x+k)+1)]--;
        d[max(0,2*(y-k))]++;
        d[min(2*h+1,2*(y+k)+1)]--;
    }
    bool f=true,g=true;
    int sum=0;
    for(int i=0;i<=2*w;i++){
        sum+=c[i];
        if(sum<=0){
            f=false;
        }
    }
    sum=0;
    for(int i=0;i<=2*h;i++){
        sum+=d[i];
        if(sum<=0){
            g=false;
        }
    }
    if(f|g){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 4424
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define rep(i,n) for (int i=0; i<(n); ++i)

using namespace std;
using ll = long long;
int main (){
    int a,b;
    cin >> a >> b;

    cout << 6 - a - b;



}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        w: [chars; n],
    }
    let mut ans = "Yes";
    for i in 0..(n - 1) {
        if w[i][w[i].len() - 1] != w[i + 1][0] {
            ans = "No";
            break;
        }
    }
    for i in 0..n {
        for j in (i + 1)..n {
            if w[i] == w[j] {
                ans = "No";
                break;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
#define INF __INT32_MAX__
#define LINF __LONG_LONG_MAX__

class UnionFind
{
    private:
        vl parents;
        vl rank;
        vl diff_weight;

    public:
        UnionFind(ll n) {
            for (ll i = 0; i < n; i++) {
                parents.push_back(i);
            }
            rank.resize(n, 1);
            diff_weight.resize(n, 0);
        }

        ll weight(ll a) {
            root(a);
            return diff_weight[a];
        }

        ll diff(ll a, ll b) {
            return diff_weight[a] - diff_weight[b];
        }

        ll root(ll a) {
            if (parents[a] == a) return a;
            ll r = root(parents[a]);

            diff_weight[a] += diff_weight[parents[a]];
            parents[a] = r;
            return r;
        }

        ll same(ll a, ll b) {
            return root(a) == root(b);
        }

        bool unite(ll a, ll b, ll d) {
            ll ra = root(a);
            ll rb = root(b);
            if (ra == rb) return false;

            if (rank[ra] < rank[rb]) {
                rank[rb] += rank[ra];
                diff_weight[ra] = d - diff_weight[a] + diff_weight[b];
                parents[ra] = rb;
            } else {
                rank[ra] += rank[rb];
                diff_weight[rb] = diff_weight[a] - diff_weight[b] - d;
                parents[rb] = ra;
            }
            return false;
        }
};

int main() {
    int N, Q;
    cin >> N >> Q;
    UnionFind uni(N);
    rep(i, Q) {
        int C, X, Y, Z;
        cin >> C;
        if (C == 0) {
            cin >> X >> Y >> Z;
            uni.unite(X, Y, Z);
        } else {
            cin >> X >> Y;
            if (uni.same(X, Y)) {
                cout << (uni.diff(X, Y)) << endl;
            } else {
                cout << '?' << endl;
            }
        }
    }
}


Measured memory_bytes: 5248
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>
#include<cmath>
#include<assert.h>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int N, C;
int D[33][33];
int c[505][505];
int cost[3][30];

signed main() {
    cin >> N >> C;
    rep(i, C) {
        rep(j, C) {
            cin >> D[i][j];
        }
    }
    rep(i, N) {
        rep(j, N) {
            cin >> c[i][j];
            --c[i][j];
        }
    }
    rep(mod, 3) {
        rep(col, C) {
            int d = 0;
            rep(i, N) {
                for (int j = (3 - i % 3 + mod) % 3; j < N; j += 3) {
                    d += D[c[i][j]][col];
                }
            }
            cost[mod][col] = d;
        }
    }
    int ans = INF;
    rep(x, C) {
        rep(y, C) {
            if (x == y)continue;
            rep(z, C) {
                if (x == z || y == z)continue;
                ans = min(ans, cost[0][x] + cost[1][y] + cost[2][z]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2176
#include "bits/stdc++.h"

int main() {
	int H, W, N;
	std::cin >> H >> W;
	std::cin >> N;

	std::vector<int> a(N);
	for (auto& p : a) 
		std::cin >> p;

	std::vector<std::vector<int>> ans(H, std::vector<int>(W));
	int index = 0;
	for (int i = 0; i < H; i++) {
		int j = (i % 2 ? W - 1 : 0);
		while (0 <= j && j < W) {
			ans[i][j] = index + 1;
			index += (--a[index] == 0 ? 1 : 0);
			j += (i % 2 ? -1 : 1);
		}
	}

	for (auto m_ans : ans) {
		for (int i = 0; i < W; i++) 
			std::cout << m_ans[i] << (i == W - 1 ? '\n' : ' ');
	}
	return 0;
}

Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int x = Integer.parseInt(in.next());
            int ans = 0;
            for (int i = 0; ; i++) {
                ans += i;
                if (ans >= x) {
                    out.println(i);
                    return;
                }
            }

        }

    }
}



Measured memory_bytes: 21716
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");


        for (int i = 0; i < s.length; i++) {
            if (s[i].equals(",")) {
                System.out.print(" ");
            } else {
                System.out.print(s[i]);
            }
        }
    }
}


Measured memory_bytes: 22868
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

class Dice
{

  public:
    Dice()
    {
        num = new int[7];
        // rl[1][0] = 2;
        // rl[1][1] = 3;
        // rl[1][2] = 5;
        // rl[1][3] = 4;

        // rl[2][0] = 3;
        // rl[2][1] = 1;
        // rl[2][2] = 4;
        // rl[2][3] = 6;

        // rl[3][0] = 2;
        // rl[3][1] = 6;
        // rl[3][2] = 5;
        // rl[3][3] = 1;
    }

    ~Dice()
    {
        delete[] num;
    }

    int setLabel(int i, int label)
    {
        num[i] = label;
    }

    int rightOn(int top, int front){
        top = idx(top);
        front = idx(front);

        int dir = 1;
        if(top > 3){
            dir = -1;
            top = 7 - top;
        }

        for(int i=0;i<4;i++){
            if(rl[top][i] == front){
                return num[rl[top][(4 + i + dir)%4]];
            }
        }
        return -1;
    }

  public:
    static int rl[4][4];

  private:
    int *num;

  private:
    int idx(int label){
        for(int i = 0; i< 6;i++){
            if(label == num[i+1])
                return i+1;
        }
        return -1;
    }

};
int Dice::rl[4][4]={{0}, {2,3,5,4}, {3,1,4,6},{2,6,5,1}};

int main()
{
    Dice dice;

    for (int i = 0; i < 6; i++)
    {
        int label;
        cin >> label;
        dice.setLabel(i + 1, label);
    }

    int n;
    cin >> n;
    while(n--){
        int top, front;
        cin >> top >> front;
        cout << dice.rightOn(top, front) << endl;
    }
}


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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] =new int[n];
		int sa = 0;
		for(int i=0;i<n;i++) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a);

		for(int i=0;i<n;i++){
			if(i%2==1)
				sa+=a[i];
			else
				sa-=a[i];

		}
		if(sa<0)
			sa=-sa;
		System.out.print(sa);
	}

}


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

int main() {
    double A, B, H, M;
    static const double pi = 3.141592653589793;
    cin >> A >> B >> H >> M;
    double doH, doM, sa, kakudo;
    doH = H*30+0.5*M;
    doM = M*6;
    sa = abs(doH-doM);
    kakudo = min(sa, 360-sa);
    double ans = pow(A,2)+pow(B,2)-2.00000000*A*B*cos((pi*kakudo)/180);
    ans = sqrt(ans);
    //cout << ans;
    printf("%.12lf",ans);
}

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

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

double p, z = 0;
vector<vector<P> > g;

double dfs(int now, int pre){
    double res = 0;
    for(auto e : g[now]){
        int nxt = e.first, c = e.second;
        if(nxt == pre) continue;
        res += p*(dfs(nxt,now)+c);
    }
    return res + z;
}

bool solve(){
    int n;
    cin >> p >> n;
    g.resize(n);
    for(int i=0;i<n-1;i++){
        int x, y, c;
        cin >> x >> y >> c;
        x--; y--;
        g[x].push_back(P(y,c));
        g[y].push_back(P(x,c));
    }
    z = dfs(0,-1);
    printf("%.9lf\n",dfs(0,-1));
    return true;
}

int main(){
    solve();
    return 0;
}


Measured memory_bytes: 14500
#include <bits/stdc++.h>
#define ll signed long long int
#define MAXX 1000005
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
 


signed main()
{
	FAST;
	ll n, t = 0, m;
	cin >> n >> m;
	while(n > 0){
		n /= m;
		++ t;
	}
	cout << t;
	
	
	
}
		
		
	
	


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

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

int main(){

  char c; cin >> c;
  cout << (char)(c+1) << endl;
  return 0;
}

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

using namespace std;
string str;
int place;

int dfs(){
  place++;
  // cout << str[place];
  vector<int> v;
  while(str[place] == '['){
    //cout << str[place];
    place++;
    //再帰をもっているなら
    if(str[place] == '['){
      // cout << "!";
      place--;
      v.push_back(dfs());
    }
    else{
      int tmp = 0;
      while(isdigit(str[place])){
	tmp *= 10;
	tmp += str[place] - '0';
	place++;
      }
      // cout << str[place];
      v.push_back(tmp / 2 + 1);
      place++;
    }
  }

  sort(v.begin(),v.end());
  int ret = 0;
  for(int i = 0;i < v.size()/2+1;i++){
    ret += v[i];
  }
  // cout << str[place];
  place++;
  return ret;
}



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

  for(int i = 0;i < kaisuu;i++){
    cin >> str;
    place = 0;
    cout << dfs() << endl;
    //cout << endl;
  }
  return 0;
}



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

int main(){
  int n;
  cin>>n;
  long long int arr[100000];
  for(int i = 0; i < n; i++){
    cin>>arr[i];
  }
  if(n==1){
      cout<<arr[0];
  }else if(n==2){
      cout<<abs(arr[1] - arr[0]);
  }else if(n==3){
      cout<<min(abs(arr[2] - arr[0]),abs(arr[1] - arr[0])+abs(arr[1] - arr[2]));
  }else{
      long long int dp[n];
      memset(dp,0,sizeof(dp));
      dp[0] = arr[0];
      dp[1] = abs(arr[1] - arr[0]);
      dp[2] = min(abs(arr[2] - arr[0]),abs(arr[1] - arr[0])+abs(arr[1] - arr[2]));
      for(int i=3; i<n; i++){
        dp[i] = min(dp[i-1]+abs(arr[i] - arr[i-1]), dp[i-2]+abs(arr[i-2] - arr[i]));
      }
      cout<<dp[n-1];
  }
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

// N以下の素数を列挙して返す
vector<ll> enum_prime(ll N){
	deque<bool> is_prime(N+1,true);
	vector<ll> P;
	for(ll i=2;i<=N;i++){
		if(is_prime[i]){
			for(ll j=i*i;j<=N;j+=i){
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	while(cin>>N){
		auto res = enum_prime(2*N);
		sort(ALL(res));
		auto L = lower_bound(ALL(res),N);
		if(*L>=N) L--;
		auto R = L+1;
		if(*R<=N) R++;
		out(*L,*R);
	}
	
	return 0;
}


Measured memory_bytes: 3188
L1 = input().split(" ")
L12 = int(L1[2])
score = [int(L1[1])-L12]*(int(L1[0]))
for i in range(L12):
    A = int(input()) - 1
    score[A] += 1

for j in score:
    if j > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 50776
//minamoto
#include<bits/stdc++.h>
#define R register
#define inline __inline__ __attribute__((always_inline))
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
using namespace std;
const int N=305,P=998244353;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
int f[2][N*N],g[2][N*N],a[N],n,res,t,sum;
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d",&n);
	f[0][0]=1,g[0][0]=2,t=0;
	fp(i,1,n){
		scanf("%d",&a[i]);
		memset(f[t^1],0,sizeof(f[t^1]));
		memset(g[t^1],0,sizeof(g[t^1]));
		fp(j,0,sum)if(f[t][j]||g[t][j]){
			upd(f[t^1][j],mul(2,f[t][j]));
			upd(g[t^1][j],g[t][j]);
			upd(f[t^1][j+a[i]],f[t][j]);
			upd(g[t^1][j+a[i]],g[t][j]);
		}
		sum+=a[i],t^=1;
	}
	fp(i,(sum+1)>>1,sum-1)res=add(res,dec(f[t][i],g[t][i]));
	res=mul(res,3),res=P-res;
	res=add(res,ksm(3,n)),res=dec(res,mul(3,ksm(2,n))),res=add(res,3);
	printf("%d\n",res);
	return 0;
}

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

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

using namespace std;
using lint=long long;

template<class T>
vector<T> Bellman_Ford(const vector<vector<pair<int,T>>>& G,int s){
	const T INF=numeric_limits<T>::max();

	int n=G.size();
	vector<T> d(n,INF);
	d[s]=0;
	rep(_,n-1){
		bool upd=false;
		rep(u,n) if(d[u]<INF) for(const auto& e:G[u]) {
			int v=e.first;
			T wt=e.second;
			if(d[v]>d[u]+wt) d[v]=d[u]+wt, upd=true;
		}
		if(!upd) return d;
	}

	queue<int> Q;
	rep(u,n) if(d[u]<INF) Q.emplace(u);
	while(!Q.empty()){
		int u=Q.front(); Q.pop();
		for(const auto& e:G[u]){
			int v=e.first;
			T wt=e.second;
			if(d[v]>-INF && (d[u]==-INF || d[v]>d[u]+wt)) d[v]=-INF, Q.emplace(v);
		}
	}
	return d;
}

int main(){
	int n,m; scanf("%d%d",&n,&m);
	vector<vector<pair<int,lint>>> G(n),G_rev(n);
	rep(i,m){
		int u,v;
		lint c; scanf("%d%d%lld",&u,&v,&c); u--; v--;
		G[u].emplace_back(v,-c);
		G_rev[v].emplace_back(u,-c);
	}

	lint ans=Bellman_Ford(G,0)[n-1];

	if(ans>-LLONG_MAX) cout<<-ans<<endl;
	else               cout<<"inf"<<endl;

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define REP(i, n) for(int i=0; i<n; i++)
#define RER(i, n) for(int i=n-1; i>=0; i--)
#define ALL(v) v.begin() v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int n;

signed main(){
	int m, d, ret;
	ret = 0;
	cin >> m >> d;
	for(int i=1; i<=m; i++){
		for(int j=1; j<=d; j++){
			int d1 = j%10;
			int d10 = j/10;
			if(d1 >= 2 && d10 >= 2 && d1*d10 == i) ret++;
		}
	}
	cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.HashMap;
import java.util.Queue;
import java.util.LinkedList;
import java.util.HashSet;
public class Main {

  public class Node {
    int val;
    int dist;
    public Node(Integer val, int dist) {
      this.val = val;
      this.dist = dist;
    }
  }

  int n;
  HashMap<Integer, Integer[]> graph;
  HashSet<Integer> visited = new HashSet<Integer>();
  int[] distances;

  public Main(HashMap<Integer, Integer[]> graph, int n) {
    this.n = n;
    this.graph = graph;
    this.distances = new int[n];
    for (int i = 0; i < n; i++)
      this.distances[i] = -1;
  }

  public void bfs() {
    Queue<Node> q = new LinkedList<Node>();
    q.add(new Node(1, 0));
    this.visited.add(1);
    while(!q.isEmpty()) {
      Node currNode = q.remove();
      this.distances[currNode.val-1] = currNode.dist;
      Integer[] neighbors = this.graph.get(currNode.val);
      for (Integer neighbor : neighbors) {
        if (!this.visited.contains(neighbor)) {
          q.add(new Node(neighbor, currNode.dist + 1));
          this.visited.add(neighbor);
        }
      }
    }
  }

  public void displayResults() {
    for (int i = 0; i < this.n; i++) {
      System.out.println((i+1) + " " + this.distances[i]);
    }
  }

  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    HashMap<Integer, Integer[]> graph = new HashMap<Integer, Integer[]>();
    for (int i = 0; i < n; i++) {
      int id = s.nextInt();
      int degree = s.nextInt();
      Integer[] edges = new Integer[degree];
      for (int j = 0; j < degree; j++) {
        int val = s.nextInt();
        edges[j] = val;
      }
      graph.put(id, edges);
    }
    s.close();
    Main main = new Main(graph, n);
    main.bfs();
    main.displayResults();
  }
}



Measured memory_bytes: 28600
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

int main(){
	ll x,k,d;
	cin >> x >> k >> d;
	
	if((ll)(1e15)/k >= d && abs(x) >= k*d){
		cout << abs(x) - k*d << endl;
		return 0;
	}
	
	ll saisyou = abs(x)%d;
	ll kaisuu = abs(x)/d;
	ll ans;
	if(saisyou > abs(saisyou - d)){
		saisyou = abs(saisyou - d);
		kaisuu++;
	}
	if((k-kaisuu)%2==1){
		ans = abs(saisyou-d);
	}else{
		ans = saisyou;
	}
	cout << ans << endl;
	
	return 0;
}

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

int main(){
	int N;
	cin >> N;
	vector<pair<int, int>> task(N);
	for(int i = 0; i < N; i++){
		cin >> task[i].second >> task[i].first;
	}
	
	sort(task.begin(), task.end());//締め切りの早い順にソート
	
	int deadline;//締め切り時間のカウント
	int count = 0;//現在の時刻(仕事にかかった時間の累積)
	bool judge = true;
	string can = "Yes";
	string cant = "No";
	
	for(int i = 0; i < N; i++){
		deadline = task[i].first;
		count += task[i].second;
		if(deadline < count){
			judge = false;
			break;
		}
	}
	
	if(judge){
		cout << can << endl;
	} else {
		cout << cant << endl;
	}
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a;
  int ans=0;
  int b[1000010]={0};
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    b[a-1]++;
    b[a]++;
    b[a+1]++;
  }
  for(int i=0;i<1000000;i++){
    ans=max(ans,b[i]);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4096