akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  while(cin >> n && n){
    ll w,h,x,y;
    cin >> w >> h;
    vector<vector<ll>> v(h,vector<ll>(w,0));
    vector<vector<ll>> dp(h+1,vector<ll>(w+1,0));
    rep(i,n){
      cin >> x >> y;
      --x,--y;
      v[y][x] = 1;
    }
    rep(j,h){
      REP(i,0,w){
        dp[j+1][i+1] += dp[j+1][i] + v[j][i];
      }
    }
    rep(i,w+1){
      REP(j,0,h){
        dp[j+1][i] += dp[j][i];
      }
    }
    ll s,t;
    cin >> s >> t;
    ll ans = 0;
//     rep(j,h+1){
//       rep(i,w+1){
//         cout << dp[j][i] << ' ';
//       }
//       cout << endl;
//     }
    --s,--t;
    REP(j,1,h+1){
      REP(i,1,w+1){
        if(value(i+s,j+t,w+1,h+1)){
          ans = max(ans,dp[j+t][i+s]+dp[j-1][i-1]-dp[j+t][i-1]-dp[j-1][i+s]);
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3268
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;
// lint mod = 1000000007;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

bool app() {
  string n;
  cin>>n;

  int m=0;
  for(char c: n){
    m+=(c-'0');
  }

  return m%9==0;
}

int main(){cout<<(app()?"Yes":"No")<<endl;return 0;}


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

int main() {
  int n; cin >> n;
  vector<int> buttons(n);
  for (int i = 0; i < n; i++) {
    cin >> buttons.at(i);
  }
  
  int cnt = 0;
  int state = 1;
  while (cnt <= n and state != 2) {
    state = buttons.at(state - 1);
    cnt++;
  }
  
  if (state == 2) {
    cout << cnt << endl;
  }
  else {
    cout << -1 << endl;
  }
}

Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
using namespace std;
signed main(){
  int n,h[100005],dp[100005]={};
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>h[i];
  }
    dp[1]=0;
    for(int i=2;i<=n;i++){
      if(i!=2){
	dp[i]=min(abs(h[i]-h[i-2])+dp[i-2],abs(h[i]-h[i-1])+dp[i-1]);
      }
      else{
	dp[i]=abs(h[i]-h[i-1])+dp[i-1];
      }
    }
    cout<<dp[n]<<"\n";

  return (0);
}


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

int main() {
  string s;
  cin >> s;
  int count = 0;
  for(int i = 0; i < s.size(); i++) {
    if(s.at(i) != s.at(s.size()-1-i)) count++;
  }
  cout << count/2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long long ll;
typedef struct node
{
    int id;
    int val;
} num;
num B[200005];
int A[200005],id[200005];
bool cmp(node a,node b)
{
    return a.val < b.val;
}
int main(void)
{
    int N;
    scanf("%d",&N);
    for(int i = 0; i < N; i++)
    {
        scanf("%d",&A[i]);
        B[i].id = i;
        B[i].val = A[i];
    }
    sort(B,B+N,cmp);
    int midl = B[N/2].val;
    int midr = B[N/2 - 1].val;
    for(int i = 0;i < N;i++)
    {
        id[B[i].id] = i;
    }
    for(int i = 0;i < N;i++)
    {
        if(id[i] <= N/2-1)
            printf("%d\n",midl);
        else printf("%d\n",midr);
    }
    return 0;
}


Measured memory_bytes: 5376
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
                
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define max2(a,b) ((a)>(b) ? (a) : (b))   
#define min2(a,b) ((a)<(b) ? (a) : (b)) 
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i) 
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lli long long int 
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000

using namespace std;
typedef vector<lli>   vll;
typedef vector<int>   vi;
typedef set<lli>      sll;
typedef set<int>      si;
typedef pair<lli,lli> pll;
typedef pair<int,int> pii;
clock_t clk=clock();       

int i,j;
void solve(void);

int main()
{
  speedio;
   int t=1;  
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
//
void solve()
{
	lli a,b; cin>>a>>b;
	cout<<max2(2*a-1,max2(2*b-1,a+b));
}

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

int main(){
    string S[100];
    int N, L;
    int i;
    string tmp;

    cin >> N >> L;
    for (i=0; i<N; i++) {
        cin >> S[i];
    }

    sort(S, S+N);

    tmp = S[0];

    for (i=1; i<N; i++) {
        tmp = tmp + S[i];
    }

    cout << tmp << endl;

}

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

using namespace std;
using ull = unsigned long long;

bool isPrime (ull n) {
    if (n == 2) {
        return true;
    }
    for (ull i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

int main () {
    ull x;
    cin >> x;
    while (true) {
        if (isPrime(x)) {
            cout << x << "\n";
            return 0;
        }
        x++;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    char a[3][101];
    int b[3]={0};
    int j=0;
    for(int i=0;i<3;i++){
        scanf("%s",a[i]);
    }
    for(;;){
        if(a[j][b[j]]=='\0'){
            printf("%c",'A'+j);
            break;
        }
        j = a[j][b[j]++]-'a';
    }
}


Measured memory_bytes: 128
import itertools
import math
d,g=map(int,input().split())
x=[list(map(int,input().split())) for i in range(d)]
y=[]
z=[x[i][0]-1 for i in range(d)]
zz=[]
ans=10**10

pin=0
for i in range(d):
  pin+=100
  y.append(x[i][0]*pin+x[i][1])
  zz+=[pin]

for lst in itertools.product(range(2),repeat=d):
  sum=0
  cnt=0
  for i in range(d):
    if lst[i]==1:
      cnt+=x[i][0]
      sum+=y[i]
  if sum>=g:
      ans=min(ans,cnt)
  else:
    lack=g-sum
    for j in range(d-1,-1,-1):
      if lst[j]==0:  
        if z[j]*zz[j]>=lack:
            cnt+=math.ceil(lack/zz[j])
            lack=0
            break
        else:
            cnt+=z[j]
            lack-=z[j]*zz[j]
    if lack<=0:
      ans=min(ans,cnt)

print(ans)

Measured memory_bytes: 9284
use std::io::Read;

fn euclid_distance(x: i32, y: i32) -> f64 {
    let x = x as f64;
    let y = y as f64;
    (x * x + y * y).sqrt()
}

fn distance(order: &[usize], xy: &[(i32, i32)]) -> f64 {
    order.iter()
        .zip(order.iter().skip(1))
        .map(|(&i, &j)| euclid_distance(xy[i].0 - xy[j].0, xy[i].1 - xy[j].1))
        .sum()
}

fn rec(i: usize, m: u32, n: usize, order: &mut Vec<usize>, xy: &[(i32, i32)]) -> f64 {
    if i == n {
        distance(order, xy)
    } else {
        (0..n)
            .filter(|j| (m >> j) & 1 == 0)
            .map(|j| {
                order[i] = j;
                rec(i + 1, m | (1 << j), n, order, xy)
            })
            .sum()
    }
}

fn fact(n: usize) -> f64 {
    (2..(n + 1)).fold(1.0, |s, t| s * (t as f64))
}

fn solve(n: usize, xy: &[(i32, i32)]) -> f64 {
    rec(0, 0, n, &mut vec![0; n], xy) / fact(n)
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let xy = (0..n)
        .map(|_| {
            let x: i32 = iter.next().unwrap().parse().unwrap();
            let y: i32 = iter.next().unwrap().parse().unwrap();
            (x, y)
        })
        .collect::<Vec<_>>();
    let r = solve(n, &xy);
    println!("{}", r);
}


Measured memory_bytes: 4352
/*||>>>> Praveen Ojha <<<<>>>> 26 May 2019 <<<<>>>> 17:26:35 <<<<||*/
// #pragma GCC optimize("Ofast") //(Very Fast but Inaccurate)
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //(Small operations in many loops)
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf 1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

int32_t main(){__
  int a,p;
  cin>>a>>p;
  a*=3;
  a+=p;
  cout<<a/2<<"\n";
return 0;
}

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

public class Program
{
    static int[] L;
    static int N;
    static int[] ABC;
    static int[] USE;

    public static void Main(string[] args)
    {
        MainModule(Console.In);
    }

    public static void MainModule(TextReader In)
    { 
        var lin = In.ReadLine().Split(' ').Select(n => int.Parse(n)).ToArray();
        N = lin[0];
        ABC = lin.Skip(1).ToArray();
        L = new int[N];
        for (int i = 0; i < N; i++)
        {
            L[i] = int.Parse(In.ReadLine());
        }

        USE = new int[N];

        CurrMinMP = int.MaxValue;
        F(0);
        Console.WriteLine(CurrMinMP);
    }

    static int CurrMinMP;

    static void F(int depth)
    {
        if (depth == N)
        {
            int[] abcLength = new int[3];
            int[] abcNum = new int[3];
            for (int i = 0; i < N; i++)
            {
                switch (USE[i])
                {
                    case 0:
                        break;
                    case 1:
                    case 2:
                    case 3:
                        abcLength[USE[i] - 1] += L[i];
                        abcNum[USE[i] - 1] += 1;
                        break;
                }
            }
            int MP = 0;
            for (int i = 0; i < 3; i++)
            {
                if (abcNum[i] == 0)
                    goto L100;
                MP += (10 * (abcNum[i] - 1));
                MP += Math.Abs(abcLength[i] - ABC[i]);
            }
            CurrMinMP = Math.Min(CurrMinMP, MP);
        L100:
            ;
        }
        else
        {
            for (int i = 0; i < 4; i++)
            {
                USE[depth] = i;
                F(depth + 1);
            }
        }
    }
}


Measured memory_bytes: 17488
#include<bits/stdc++.h>
using namespace std;
#define N 100001
vector<long long> adj[N];
vector<int> vis(N,0);
vector<long long> dp(N,0);
void dfs(int node)
{
    vis[node] = 1;
    for(int i=0; i<adj[node].size(); i++)
    {
        if(vis[adj[node][i]]==0)
            dfs(adj[node][i]);
      dp[node] = max(dp[node], dp[adj[node][i]] + 1); }
}

int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0; i<m; i++)
    {
        int x,y;
        cin>>x>>y;
        x--;
        y--;
        adj[x].push_back(y);
    }

    for(int i=0; i<n; i++)
        if(vis[i]==0)
           dfs(i);
    cout<<*max_element(dp.begin(), dp.end());
     return 0;
}


Measured memory_bytes: 8960
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll a;
  cin >> a;
  cout << a + a*a + a*a*a<<endl;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int INF = 1000;
int main(){
  while (1){
    int n, m;
    cin >> n >> m;
    if (n == 0 && m == 0){
      break;
    }
    vector<int> s(n);
    for (int i = 0; i < n; i++){
      cin >> s[i];
    }
    vector<int> t(m);
    for (int i = 0; i < m; i++){
      cin >> t[i];
    }
    int sum1 = 0;
    for (int i = 0; i < n; i++){
      sum1 += s[i];
    }
    int sum2 = 0;
    for (int i = 0; i < m; i++){
      sum2 += t[i];
    }
    int ans1 = INF;
    int ans2 = INF;
    for (int i = 0; i < n; i++){
      for (int j = 0; j < m; j++){
        if (sum1 - s[i] + t[j] == sum2 - t[j] + s[i]){
          if (ans1 + ans2 > s[i] + t[j]){
            ans1 = s[i];
            ans2 = t[j];
          }
        }
      }
    }
    if (ans1 == INF && ans2 == INF){
      cout << -1 << endl;
    } else {
      cout << ans1 << ' ' << ans2 << endl;
    }
  }
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
signed main()
{
	int n;
	cin>>n;
	while (n--)
		cout<<"ACL";
	re 0;
}


Measured memory_bytes: 3556
import java.util.Scanner;

public class Main {

    static int[] dp;

    static int min(int a,int b){
        if(a<b)
            return a;
        return b;
    }
    static int calculate(int n,int[] arr){
        if(dp[n] != -1){
            return dp[n];
        }
        if(n == 1){
            dp[n] = 0;
            return dp[n];
        }else if(n == 2){
            dp[n] = Math.abs(arr[n]-arr[n-1]);
            return dp[n];
        }
        dp[n] = min(Math.abs(arr[n]-arr[n-1])+calculate(n-1,arr),Math.abs(arr[n]-arr[n-2])+calculate(n-2,arr));
        return dp[n];
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n+1];

        dp = new int[n+1];

        for(int i =1; i <= n; i++){
            dp[i] = -1;
            arr[i] = sc.nextInt();
        }
        System.out.println(calculate(n,arr));
    }
}


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

const int MAXN = 300005;
const int MOD = 998244353;

int N;
long long fact[MAXN];
char s[MAXN];

int main(){
	scanf("%d %s", &N, s);
	
	for(int i = 0; i <= N; i++){
		if(i == 0)fact[i] = 1;
		else fact[i] = (i * fact[i - 1]) % MOD;
	}
	
	char c0 = '-';
	char c1 = '-';
	int r0 = 0, r1 = 0;
	long long res = 1;
	
	for(int i = 0; i < 3 * N; i++){
		if(r1 > 0 && c1 == s[i]){
			res = (res * r1) % MOD;
			r1--;
		}else{
			if(r0 > 0 && c0 != s[i]){
				res = (res * r0) % MOD;
				r0--;
				
				r1++;
				c1 = ('R' ^ 'G' ^ 'B') ^ s[i] ^ c0;
			}else{
				r0++;
				c0 = s[i];
			}
		}
	}
	
	res = (res * fact[N]) % MOD;	
	printf("%lld\n", res);
	
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int N;
    int64_t A, B;
    cin >> N >> A >> B;
    int64_t ans = 0;
    int64_t l, r;
    cin >> l;
    for(int i = 0; i < N - 1; i++) {
        cin >> r;
        ans += min((r - l) * A, B);
        swap(l, r);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = input()
	val = 0
	for i in N:
		val += int(i)

	if val % 9 == 0:
		print("Yes")
	else:
		print("No")

	




if __name__ == '__main__':
	main()

Measured memory_bytes: 68936
#include <bits/stdc++.h>
using namespace std;
int main() {
    int W,a,b;
    cin>>W>>a>>b;
    if (W+a<b){
        cout<<b-(W+a);
    }
    else if (W+b<a){
        cout<<a-(W+b);
    }
    else{
        cout<<"0";
    }
	return 0;
}


Measured memory_bytes: 3568
//password1488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 2e5+228;

signed main(){
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
    ll a, b;
    cin >> a >> b;
    cout << a*b;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};
int main(void){
  string S;
  cin >> S;
  int N = S.length();
  int ans1 = 0;
  int ans2 = 0;
  //010...
  vector <int>  black(N);
  for (int i = 1; i < N; i += 2) black[i] = 1;
  //101...
  vector <int>  white(N);
  for (int i = 0; i < N; i += 2) white[i] = 1;
  rep(i,N){
    if (S[i] != char(black[i] + '0')) ans1 ++;
    if (S[i] != char(white[i] + '0')) ans2 ++;
  }
  cout << min(ans1, ans2) << endl;
  return 0;
}


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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

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

//最小公倍数
 ll lcm(ll a,ll b){
 ll g = gcd(a,b);
 return a / g * b; // Be careful not to overflow  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 




int main(){
int N;
cin >> N;
vector<ll>H(N);
REP(i, N) cin >> H.at(i);

int cnt = -1;
int tmp = 0;
REP(i, N - 1){
    if(H.at(i) >= H.at(i + 1)) tmp++;
    else{
      cnt = max(cnt, tmp);
      tmp = 0;
      } 
}
cnt = max(cnt, tmp);
print(cnt);


}



Measured memory_bytes: 1152
using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
	static void Main(string[] args)
	{
		List<int> Left = new List<int>();
		List<int> Right = new List<int>();

		for (; ; )
		{
			var ReadValue = Console.ReadLine().Split(' ');

			if (ReadValue[0] == "0" && ReadValue[1] == "0")
				break;

			Left.Add(Convert.ToInt32(ReadValue[0]));
			Right.Add(Convert.ToInt32(ReadValue[1]));
		}

		for (int i = 0; i < Left.Count; i++)
		{
			if (Left[i] < Right[i])
				Console.WriteLine(string.Format("{0} {1}", Left[i], Right[i]));
			else
				Console.WriteLine(string.Format("{0} {1}", Right[i], Left[i]));

		}

	}
}






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

signed main() {

  int N, K;
  cin >> N >> K;

  vector<int> p(N);
  for(int i = 0; i < N; i++){
    cin >> p[i];
  }

  sort(p.begin(), p.end());

  int sum = 0;
  for(int i = 0; i < K; i++){
    sum += p[i];
  }
  cout << sum << endl;
}


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

int main()
{
	ll x;
	ios::sync_with_stdio(false);
	cin>>x;
	ll sum=100;
	ll cnt=0;
	while(1)
	{
		sum+=sum/100;
		cnt++;
		if(sum>=x)
		{
			cout<<cnt<<endl;
			return 0;
		}
	}
	
}


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

int main(){
	vector<int> sum_list;
	int n;
	int prevnum=0;
	string str;
	cin >> n >> str;
	sum_list.push_back(0);
	for(auto i=str.begin(); i != str.end(); i++){
		if(*i == 'I'){
			prevnum++;
			sum_list.push_back(prevnum);
		} else {
			prevnum--;
		}
	}
	int max = *max_element(sum_list.begin(), sum_list.end());
	cout << max << endl;
}

Measured memory_bytes: 256
/// In the name of God
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;

#define y1 def1
#define X first
#define Y second
#define endl '\n'
#define all(o) o.begin(), o.end()
#define IOS ios::sync_with_stdio(0), cin.tie(0)
const int maxn = 1e5 + 10;
int a[maxn];
inline int sgn(int x){
    if(x == 0) return 0;
    if(x < 0) return -1;
    return 1;
}
main(){
    IOS;
    int n;
    cin >> n;
    for(int i=0; i<n; i++)
        cin >> a[i];
    int jav = 1e15;
    for(int t=-1; t<=1; t+=2){
        int sum = 0, ans = 0;
        int cur = t;
        for(int i=0; i<n; i++){
            sum += a[i];
            cur *= -1;
            if(sgn(sum) != cur){
                ans += abs(sum - cur);
                sum = cur;
            }
        }
        jav = min(jav, ans);
    }
    cout << jav << endl;
}


Measured memory_bytes: 1024
import collections
N = int(input())
S = [input() for n in range(N)]
c = collections.Counter(S)
a = []
b = 0

for v,c in c.most_common():
  if b==0:
    m = c
    a.append(v)
    b = 1
  else:
    if m==c:
      a.append(v)

a = sorted(a)
print(*a,sep="\n")

Measured memory_bytes: 45036
n, k = gets.chomp.split.map(&:to_i)

s = gets.chomp
# k の要素数を-1 している
s[k - 1] = s[k - 1].downcase  # downcaseは大→小へ変換する
                              # upcaseはその逆、先頭だけは capitalize 、大小入れ替えは swap
puts s


Measured memory_bytes: 1788
import java.io.*;

/**
 * Created by Ayushi on 17 May 2020.
 * Problem:
 * Round:
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int k = Integer.parseInt(br.readLine());
        String s = br.readLine();
        br.close();
        System.out.print(s.substring(0, Math.min(s.length(), k)));
        if (s.length() > k) System.out.println("...");
        else System.out.println();
    }
}


Measured memory_bytes: 32560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




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

    ll x,y;
    cin >> x >> y;
    if(x % y == 0) cout << -1 << endl;
    else cout << x*(y-1) << endl;
    
    

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int x,a,b;
  cin>>x>>a>>b;
  if(a>=b) cout<<"delicious"<<endl;
  else if(b-a <=x) cout<<"safe"<<endl;
  else cout<<"dangerous"<<endl;

  return 0;
}






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

using namespace std;

class SecretOfChocolatePoles {
public:
    SecretOfChocolatePoles(int l, int k) : l(l), k(k), memo(l + 1, -1) {};
    long long Count() { return Dfs(l); }
private:
    int l, k;
    vector<long long> memo;

    long long Dfs(const int res) {
        if (res <= 0) return 0;
        if (memo[res] != -1) return memo[res];

        long long &num = (memo[res] = 0);
        if (0 <= res - k) num += Dfs(res - k - 1) + 1;
        if (0 <= res - 1) num += Dfs(res - 2) + 1;

        return num;
    }
};

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

    int l, k;
    cin >> l >> k;
    SecretOfChocolatePoles scp(l, k);
    cout << scp.Count() << '\n';

    return 0;
}



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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);



int n , m;


void solve(int testCase){

    ll x;
    scanf("%lld" , &x);

    ll sum = 100;

    int cnt = 0;
    while(sum < x) {
            cnt ++;
            sum += sum / 100;
    }

    printf("%d\n" , cnt);

}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


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

import static java.lang.Math.*;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {


        public void solve(int testNumber, InputReader in, PrintWriter out) {

            int n = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();
            out.println(Math.abs(n - a) < Math.abs(n - b) ? "A" : "B");
        }

    }


    static class InputReader implements AutoCloseable {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

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

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

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return "";
        }

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

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

        public void close() {
        }

    }
}


Measured memory_bytes: 21460
#include<cstdio>

int main(void){
    int w, h, x, y;

    scanf("%d %d %d %d", &w, &h, &x, &y);

    printf("%lf %d\n", (double)w * (double)h / 2.0, (w == x * 2 && h == y * 2) ? 1 : 0);

    return 0;
}

Measured memory_bytes: 128
PROGRAM piyo
      IMPLICIT NONE
      INTEGER,PARAMETER :: prec = 16
      real(prec) :: b
      integer(prec) :: aa,bb
      
      read*,aa,b
      

      bb = nint( b*100_prec )
      print*,aa*bb/100_prec
      
      
      stop
      !debugg
      
      !BADBADBADBADBADBADBADBADBADBADBADBAD!
      
      END PROGRAM

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

bool f(ll i, ll j, ll k){
    vector<ll> a = {i, j, k};
    sort(a.begin(), a.end());
    return i!=j&&j!=k&&k!=i&&(a[0]+a[1]>a[2]);
}

int main(void){
    int n, ans = 0;
    cin >> n;
    if(n < 3){
        cout << 0 << endl;
        return 0;
    }
    vector<ll> l(n);
    for(int i = 0; i < n; i++) cin >> l[i];
    for(int i = 0; i < n-2; i++){
        for(int j = i+1; j < n-1; j++){
            for(int k = j+1; k < n; k++){
                if(f(l[i],l[j],l[k])){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

bool checkO(string str){
  if(str[0]=='o' && str[str.size()-1]=='o') return true;
  else if(str[0]=='o' && str[str.size()-1]=='x') return true;
  else if(str[0]=='x' && str[str.size()-1]=='o') return true;
  else return false;
}

int main(){

  string str;
  cin>>str;

  if(checkO(str)==true) cout<<"o"<<endl;
  else cout<<"x"<<endl;
  return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000001;
typedef pair<int, int> P;

int N, M;
vector<vector<P>> edge;
vector<int> dist;

void dfs(int v){
   int n = edge[v].size();
    for(int i=0; i<n; i++){
        int next = edge[v][i].first;
        int cost = edge[v][i].second;
        if(dist[next] == inf){
            dist[next] = dist[v] + cost;
            dfs(next);
        }else if(dist[next] != dist[v] + cost){
            cout << "No" << endl;
            exit(0);
        }
    }
}

int main(){
    cin >> N >> M;
    edge = vector<vector<P>>(N, vector<P>());
    for(int i=0; i<M; i++){
        int L, R, D;  cin >> L >> R >> D;
        L--;  R--;
        edge[L].push_back(P(R,D));
        edge[R].push_back(P(L,-D));
    }

    dist = vector<int>(N,0);
    fill(dist.begin(), dist.end(), inf);
    for(int i=0; i<N; i++){
        if(dist[i] == inf) dist[i] = 0;
        dfs(i);
    }

    cout << "Yes" << endl;
}


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

void sort_N(int *x,int n);

int main() {

	int i, n, *ary;
	int counter=0;

	scanf("%d", &n);

	ary = (int*)calloc(2 * n, sizeof(int));
	if (ary == NULL) {
		return 0;
	}

	for (i = 0; i < 2 * n; i++) {
		scanf("%d", &ary[i]);
	}

	sort_N(ary, 2 * n);

	for (i = 0; i < n; i++) {
		counter += ary[2 * i];
	}

	printf("%d\n", counter);

	free(ary);

	return 0;
}

void sort_N(int *x,int n) {

	int i,j,fake;
	
	for (i = 0; i < n - 1; i++) {
		for (j = 0; j < n - 1;j++){
			if (x[j] > x[j + 1]) {
				fake = x[j];
				x[j] = x[j + 1];
				x[j + 1] = fake;
			}
		}
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    ld N, M, D, K;
    cin >> N >> M >> D;
    if(abs(D) < EPS) K = N;
    else K = 2*(N-D);
    cout << sp(10) << K*(M-1)/(N*N) << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
  ll k,n;cin>>k>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  ll MAX;
  MAX=a[0]+k-a[n-1];
  for(ll i=1;i<n;i++)MAX=max(a[i]-a[i-1],MAX);
  cout<<k-MAX<<endl;
}

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

using namespace std;

#define pan(i,n) for(int i=0;i<n;i++)
#define pans(i,n,a) for(int i=a;i<n;i++)
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define INF INT_MAX
#define PI 3.141592653
#define inf 1000007
#define pll pair<ll,ll>
#define pii pair<int,int>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

int n,m,x,ans=INF;
int a[12][12],c[12];

int main(){
    cin>>n>>m>>x;
    pan(i,n){
        cin>>c[i];
        pan(j,m)
            cin>>a[i][j];
    }
    pan(i,(1<<n)){
        int arr[m] = {0};
        int cost=0;
        // cout << i << endl;
        pan(j, n){
            if((i>>j)&1){
                cost+=c[j];
                pan(k,m) arr[k]+=a[j][k];
            }
        }
        bool flag=true;
        pan(j, m) if(arr[j] < x) flag = false;
        if(flag) ans=min(ans,cost);
    }
    if(ans==INF) cout<<-1;
    else cout<<ans;   
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"

int main(){
    string s, t;
    int i=0, j=0;

    cin >> s >> t;

    int mini=t.size();

    for(i=0; i<(s.size()-t.size()+1); i++){
        int k=i;
        int cnt=0;
        for(j=0; j<t.size(); j++){
            if(t[j]!=s[k]){
                cnt++;
            }
            k++;
        }
        if(cnt<mini){
            mini = cnt;
        }
    }

    cout << mini << endl;
    return 0;
}


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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;

void solve() {
    i64 a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


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

int main() {
    ll n, x;
    cin >> n >> x;
    vector<ll> l(n);
    for(ll i = 0;  i< n; i++) cin >> l[i];
    vector<ll> bound(n + 1);
    bound[0] = 0;
    for(ll i = 1; i < n + 1; i++){
        bound[i] = bound[i - 1] + l[i - 1];
    }
    ll ans = 0;
    for(ll i = 0; i < n + 1; i++){
        if(bound[i] <= x) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int f(int a, int b, int c) {
    if (a > b && a > c) {
        return b + c;
    }
    if (b > a && b > c) {
        return a + c;
    }
    return a + b;
}

int main() {

    int a, b, c;
    cin >> a >> b >> c;

    int result = f(a, b, c);
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  cin >> str;
  while(str[0]!='0'){
    int i,o=0;
    for(i=0;i<str.size();i++){
      o+=str[i]-'0';
    }
    cout << o << endl;
    cin >> str;
  }
  return 0;
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define SEKAI_NO_OWARI return 0;
#define rep(i, n) for(int i=0; i<n; i++)

using namespace std;

void solve() {
	int n; cin >> n;
	vector<string> s(n);
	unordered_map<string, long long> um(n);
	rep(i, n) cin >> s[i];

	long long res = 0;
	for (int i = 0; i < n; i++) {
		sort(s[i].begin(), s[i].end());
		um[s[i]] += 1;
		res += um[s[i]] - 1;
	}
	cout << res << endl;
}

int main(void) {
	solve();
	SEKAI_NO_OWARI
}

Measured memory_bytes: 17536
from operator import itemgetter
from itertools import accumulate
 
n = int(input())
a = sorted((tuple(map(int, input().split())) for _ in range(n)),
           key=itemgetter(1))
c, d = zip(*a)
print('YNeos'[any(x > y for x, y in zip(accumulate(c), d))::2])

Measured memory_bytes: 45980
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */

/* function */

/* main */
int main() {

    int trial; cin >> trial;
    string T, H;

    int T_point = 0, H_point = 0;
    while (trial--) {
        cin >> T >> H;
        if (T == H) {
            T_point++;
            H_point++;
        }
        else if (T < H) {
            H_point += 3;
        }
        else  {
            T_point += 3;
        }
    }
    cout << T_point << ' ' << H_point << '\n';

}



Measured memory_bytes: 3204
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
using namespace std;
#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout << #X << ": " << X << " ";
#define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " ";
#define END cout << endl;
#else
#define DEB(X) \
    {          \
    }
#define ARDEB(i, X) \
    {               \
    }
#define END \
    {       \
    }
#endif
typedef pair<int, int> P;
typedef long long ll;

signed main()
{
    int n,m,a[111111];
    pair<int,int> p[111111];
    cin>>n>>m;
    rep(i,n)cin>>a[i];
    rep(i,m)cin>>p[i].second>>p[i].first;
    sort(a,a+n);
    sort(p,p+m,greater<>());
    int j=0,flag=0;
    rep(i,m){
        int lim=j+p[i].second;
        for(;j<lim;j++){
            if(a[j]<p[i].first)a[j]=p[i].first;
            else {
                flag=1;
                j++;
                break;
            }
        }
        if(flag)break;
    }
    int ans=0;
    //rep(i,n)DEB(a[i])END
    rep(i,n)ans+=a[i];
    cout<<ans<<endl;

}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

string S,key = "keyence";
bool flag = false;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> S;


	int c = 0;
	REP(i,key.size()){
		if(S[i]==key[i]){
			c++;
		}else{
			break;
		}
	}
	if(c == key.size()){
		flag = true;
	}else if(c == 0){
		
	}else{
		string str = key.substr(c);
		int pos = S.rfind(str);
		if(pos == S.size() - str.size()){
			flag = true;
		}
	}
	
	if(flag){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
}

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

#define MAX_N 51000

int prime[MAX_N];
bool is_prime[MAX_N + 1];


void prime_generate(){
	int p = 0;
	for(int i = 0; i <= MAX_N; i++) is_prime[i] = true;

	is_prime[0] = is_prime[1] = false;

	for(int i = 2; i <= MAX_N; i++){
		if(is_prime[i]){
			prime[p++] = i;
			for(int j = 2 * i; j <= MAX_N; j += i) is_prime[j] = false;
		}
	}
}

void solve(int n){
	for(int i = 0; i < MAX_N; i++){
		if(prime[i] == n){
			cout << prime[i-1] << " " << prime[i+1] << endl;;
			break;
		}
		else if(prime[i] > n){
			cout << prime[i-1] << " " << prime[i] << endl;
			break;
		}
		else continue;
	}
}

int main(){
	prime_generate();

	int n;
	while(cin >> n){
		solve(n);
	}
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////

typedef vector<ll> vec;
typedef vector<vec> mat;
mat mul(mat a,mat b){/*行列aと行列bの積*/
    mat c(a.size(),vec(b[0].size()));
    for(int i=0;i<a.size();i++){
        for(int j=0;j<b[0].size();j++){
            for(int k=0;k<a[0].size();k++){
                c[i][j]=mod(c[i][j]+a[i][k]*b[k][j]);
            }
        }
    }
    return c;
}

mat pow(mat a,ll n){/*行列aのn乗*/
    mat b(a.size(),vec(a.size()));
    for(int i=0;i<a.size();i++){
        b[i][i]=1;
    }
    while(n>0){
        if(n&1)b=mul(b,a);
        a=mul(a,a);
        n>>=1;
    }
    return b;
}
//////////////////////////////////////////



int main(){
    ll n,k;cin>>n>>k;
    mat a(n,vec(n));
    rep(i,0,n-1)rep(j,0,n-1)cin>>a[i][j];
    a=pow(a,k);
    mat b(n,vec(1));
    rep(i,0,n-1)b[i][0]=1;
    mat c=mul(a,b);
    ll ans=0;
    rep(i,0,n-1)Add(&ans,c[i][0]);
    cout<<ans<<endl;
    
    
    
    
    return 0;
}






Measured memory_bytes: 384
#include <iostream>
#include <set>
#include <cstring>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;

// dp[i]: 根からの最長距離

int dp[100010];
vector<int> path[100010];
set<int> sx, sy, end_nodes;

int dfs(int cur) {
    if(dp[cur] >= 0) return dp[cur];
    if(path[cur].size() == 0) {
        return dp[cur] = 0;
    }

    int ret = 0;
    for(int next: path[cur]) {
        ret = max(ret, 1 + dfs(next));
    }

    return dp[cur] = ret;
}

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

    for(int i = 0; i < M; ++i) {
        int x, y;
        scanf("%d%d", &x, &y);
        x--, y--;
        path[y].push_back(x);
        sx.insert(x);
        sy.insert(y);
    }

    memset(dp, -1, sizeof dp);

    std::set_difference(sy.begin(), sy.end(), sx.begin(), sx.end(), std::inserter(end_nodes, end_nodes.end()));

    int ret = 0;
    for(auto end: end_nodes) {
        ret = max(ret, dfs(end));
    }

    cout << ret << endl;
}


Measured memory_bytes: 20224
#include<stdio.h>

#define N 100

int main(){
  int n,k,u,v,i,j;
  int A[N+1][N+1];

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      A[i][j]=0;
    }
  }

  for(i=1;i<=n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      A[u][v]=1;
    }
  }

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      if(j==1) printf("%d",A[i][j]);
      else printf(" %d",A[i][j]);
    }
    printf("\n");
  }
		  

  return 0;
}



Measured memory_bytes: 2112
#include<stdio.h>
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }
    else if(a==b){
        printf("a == b\n");
    }
    else{
        printf("a > b\n");
    }
    return 0;
}

Measured memory_bytes: 580
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        long n = stdin.nextInt();
        long k = stdin.nextInt();
        
        if (k == 0) {
            System.out.println(n * n);
        } else {
            long c = 0;
            for (long i = 1; i <= n; i++) {
                if (i - 1 >= k) {
                    c += n / i * (i - k);
                    c += Math.max(0, (n % i) - k + 1);
                }
            }
            System.out.println(c);
        }
    }
}


Measured memory_bytes: 21716
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const lines = input.trim().split('\n');

    lines.forEach(function(val){
        const dataStrings = val.split(' ');
        
        const x = Number(dataStrings[0]);
        const y = Number(dataStrings[1]);
        if (x === 0 && y === 0) {
          return false;
        } else {
          if (x < y) {
          console.log(x +' '+ y);
        } else {
          console.log(y +' '+ x);
        }
        }
      });


Measured memory_bytes: 19100
#include <stdio.h>

int main(void){
    int N,M,P,x,xm,sum,i;
    while(scanf("%d %d %d", &N, &M, &P),N||M||P){
        sum=0;
        for(i=0;i<N;i++){
            scanf("%d",&x);
            sum+=x;
            if(i==M-1) xm=x;
        }
        if(xm){
            printf("%d\n", (sum*(100-P))/xm);
        }else{
            printf("0\n");
        }
    }
    return 0;
}

Measured memory_bytes: 612
n = int(input())
a = list(map(int,input().split()))
a=sorted(a)
a=a[::-1]
sei=10**18
ans = 1
if a[-1] == 0:
    print(0)
else:
    tf =False
    for i in range(n):
        ans*=a[i]
        if ans > sei:
            tf = True
            break
    if tf:
        print(-1)
    else:
        print(ans)

Measured memory_bytes: 84660
#include<stdio.h>

int main(){
  int a,b,c,sum;
  scanf("%d %d %d",&a,&b,&c);
  sum=a+b+c;
  
  if(sum!=17)
    printf("NO");
  else{
    if(a==7 || b==7 || c==7){
      if((a==5 && b==5) || (a==5 && c==5) || (b==5 && c==5)){
        printf("YES");
      }
      else{
        printf("NO");
      }
    }
    else{
      printf("NO");
    }
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll n;
    cin>>n;
    ll a[n];
    bool T=true;
    rep(0,i,n){
        cin>>a[i];
        if(a[i]%2==0 &&(a[i]%3!=0 && a[i]%5!=0))T=false;
    }
    if(T)cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void) {
	int a, b, total, hik, kake;
	cin >> a >> b;
	total = a + b;
	hik = a - b;
	kake = a * b;
	if (total >= hik && total >= kake)
		cout << total << endl;
	else if (hik > total && hik > kake)
		cout << hik << endl;
	else
		cout << kake << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>

using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  struct zahyou{
    int x;
    int y;
  };
  zahyou N[50],M[50];
  for (int i=0;i<a;i++){
    cin >> N[i].x >> N[i].y;
  }
  for (int i=0;i<b;i++){
    cin >> M[i].x >> M[i].y;
  }

  for (int i=0;i<a;i++){
    int point=1;
    int ans=(abs(N[i].x-M[0].x)+abs(N[i].y-M[0].y));
    for (int j=1;j<b;j++){
      if (ans>(abs(N[i].x-M[j].x)+abs(N[i].y-M[j].y))){
        point=j+1;
        ans=(abs(N[i].x-M[j].x)+abs(N[i].y-M[j].y));
      }
    }
    cout << point << endl;
  }
  return 0;
}


Measured memory_bytes: 256