akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int x;
    cin>>x;
    string arrS[x];
    int AC=0, WA=0, TLE=0, RE=0;
    for(int i=0 ; i<x ; i++)
    {
        cin>>arrS[i];
        if(arrS[i]=="AC")
            AC++;
        else if(arrS[i]=="WA")
            WA++;
        else if(arrS[i]=="TLE")
            TLE++;
        else
            RE++;
    }

    cout<<"AC x "<<AC<<endl;
    cout<<"WA x "<<WA<<endl;
    cout<<"TLE x "<<TLE<<endl;
    cout<<"RE x "<<RE;




    return 0;
}


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

using namespace std;

int freq[(int)1e5 + 5];

int main()
{
    cin.tie(0);
    int N; cin >> N;
    for (int i = 0; i < N; i++)
    {
        int v; cin >> v; v++;
        freq[v]++;
        freq[v - 1]++;
        freq[v + 1]++;
    }
    int best = 0;
    for (int i = 0; i < (int)1e5 + 5; i++) best = max(best, freq[i]);
    cout << best << "\n";
}

Measured memory_bytes: 3960
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
	constexpr int INF = 1e9;
	int n,m;
	cin>>n>>m;
	vector<int> dp(n+1, INF), d(m);
	for (auto i = 0; i < m; i++) {
		cin>>d[i];
		dp[d[i]] = 1;
	}
	for (auto i = 0; i < n+1; i++) {
		for (auto& j : d) {
			if (i+j >= n+1) continue;
			dp[i+j] = min(dp[i+j], dp[i]+1);
		}
	}
	cout << dp[n] << endl;
	return 0;
}

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

using namespace std;



int main() {

	string s;
	cin >> s ;

	/*1010の場合*/
	int counter1 = 0;
	for (int i = 0; i < s.size()-1; i = i + 2) {
		if (s[i] != '1') { counter1++; }
		if (s[i + 1] != '0') { counter1++; }
	}
	if (s.size() % 2 == 1) {
		if (s[s.size()-1] != '1') { counter1++; }
	}

	int counter2 = 0;
	for (int i = 0; i < s.size()-1; i = i + 2) {
		if (s[i] != '0') { counter2++; }
		if (s[i + 1] != '1') { counter2++; }
	}
	if (s.size() % 2 == 1) {
		if (s[s.size()-1] != '0') { counter2++; }
	}
	cout << min(counter1, counter2) << endl;

}

Measured memory_bytes: 512
import numpy as np
n = int(input())
init = np.expand_dims(np.array([2, 1]), 0)
to_next = np.array([
    [1, 1],
    [1, 2],
])
for i in range(n // 2):
    init = init.dot(to_next)
print(init[0][n & 1])


Measured memory_bytes: 21488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
ll a, b, c, n, m, x, y, z, w, h, ans, cnt, mx, mn;
string s, t;
ll dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};
string alphabet = "abcdefghijklmnopqrstuvwxyz";

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> a >> b){
        print(a + b + 1 - gcd(a, b));
    }
}



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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3
#define MAX_N 10000
#define mod 1000000007LL

ll mod_pow(ll x,ll n){
  ll res=1;
  while(n>0){
    if(n&1)res=res*x%mod;
    x=x*x%mod;
    n>>=1;
  }
  return res;
}

ll n,d,x;
ll dp[2222][2222];
ll sum[2222];

int main(){
	cin.sync_with_stdio(false);
  while(1){
    cin>>n>>d>>x;
    if(n==0&&d==0)break;
    if(x==1){
      cout<<0<<endl;
      continue;
    }
    int maxd=min(d,n);
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    rep(i,maxd){
      memset(sum,0,sizeof(sum));
      rep(j,n){
        sum[j+1]=(dp[i][j]+sum[j])%mod;
      }
      rep(j,n+1){
        dp[i+1][j]=(sum[j]-sum[max(0LL,j-x+1)]+mod*2)%mod;
      }
    }

    ll res=0;
    d%=mod;
    repl(i,1,maxd+1){
      // calc dCi
      ll comb=1;
      rep(j,i){
        comb=comb*((d-j+mod*2)%mod)%mod;
        comb=comb*mod_pow(i-j,mod-2)%mod;
      }
      res=(res+comb*dp[i][n]%mod)%mod;
    }
    cout<<res<<endl;

  }
  return 0;
}

Measured memory_bytes: 41632
#include <iostream>
#include <string>
#include <stack>

using namespace std;

int main(void) {
    stack<int> data;
    string s;

    while(true) {
        cin >> s;
        if (cin.eof()) {
            break;
        }
        if (s == "+") {
            int num = data.top();
            data.pop();
            num += data.top();
            data.pop();
            data.push(num);
        }
        else if (s == "-") {
            int num1 = data.top();
            data.pop();
            int num2 = data.top();
            data.pop();
            data.push(num2 - num1);
        }
        else if (s == "*") {
            int num = data.top();
            data.pop();
            num *= data.top();
            data.pop();
            data.push(num);
        }
        else {
            data.push(stoi(s));
        }
    }
    cout << data.top() << endl;
    
    return 0;
}



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

class Cards{
    char symbol;
    int num;
    int index;
}


//I have to use hashset
public class Main{
    static int count =0;
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        
        str = br.readLine();
        int n = Integer.parseInt(str);

        Cards A[] = new Cards[n];
        for(int i=0;i<n;i++){
            A[i] = new Cards();
        }

        for(int i=0;i<n;i++){
            str=br.readLine();
            String[] line = str.split("\\s");
            A[i].symbol = line[0].charAt(0);
            A[i].num = Integer.parseInt(line[1]);
            A[i].index = i;
        }
        
        
        quicks(A,0,n-1);
        //Stable 判定考える
        boolean flag = judge(A);

        if(flag){
            System.out.println("Stable");
        }else{
            System.out.println("Not stable");
        }

        for(int i=0;i<n;i++){
            System.out.println(A[i].symbol + " " + A[i].num);
        }
    }

    public static boolean judge(Cards[]A){
        for(int i=0;i<A.length;i++){
            for(int j=i+1;j<A.length;j++){
                if(A[i].num == A[j].num && A[i].index > A[j].index){
                    return false;
                }
            }
        }
        return true;
    }

    public static int partition(Cards[]A,int p,int r){
        int x = A[r].num;
        int i= p -1;
        for(int j= p;j<r;j++){
            if(A[j].num <= x){
                i++;
                Cards tmp = A[i];
                A[i] = A[j];
                A[j] = tmp;
            }
        }

        Cards change = A[r];
        A[r] = A[i+1];
        A[i+1] = change;

        return i+1;
    }

    public static void quicks(Cards[]A,int p,int r){
        if(p < r){
            int q = partition(A,p,r);
            quicks(A,p,q-1);
            quicks(A,q+1,r);
        }
    }
}


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

int main()
{
  int N;
  cin >> N;
  
  vector<int> A(N);
  int T = 0;//砕くべきレンガの数
  int C = 1;//Aがこの数字ならレンガを残す
  
  for(int i = 0; i < N; i++){cin >> A.at(i);}
  for(int i = 0; i < N; i++)
  {
    if(A.at(i) == C){C++;}
    else{T++;}
  }
  if(T == N){cout << "-1" << endl;}
  else{cout << T << endl;}
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>

typedef long long ll;

using namespace std;

char rotate(char c, int N) {
    if (c + N > 'Z') {
        return c + N - 26;
    } else {
        return c + N;
    }
}

int main() {
    int N;
    string S, T = "";
    cin >> N >> S;
    for (int i = 0; i < S.size(); i++) {
        T += rotate(S[i], N);
    }
    cout << T << endl;

    return 0;
}



Measured memory_bytes: 256
N, Y = [int(i) for i in input().split()]

for x in range(N + 1):
    for y in range(N + 1):
        z = N - x - y
        if z >= 0 and 10000 * x + 5000 * y + 1000 * z == Y:
            print(x, y, z)
            quit()
print(-1, -1, -1)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
struct edge{
  ll c,s,t;
  bool operator <(const edge&q)const{
      return c<q.c;
  }
  bool operator >(const edge&q)const{
      return c>q.c;
  }
};
ll n,par[100005],ans;
vector<P>g[100005],ex,ey;
void ini(){
    for(int i=0;i<n;i++)par[i]=i;
}
int find(int x){
    if(par[x]==x)return x;
    return par[x]=find(par[x]);
}
bool same(int x,int y){
    return find(x)==find(y);
}
void unit(int x,int y){
    x=find(x);
    y=find(y);
    if(x!=y)par[x]=y;
}
int main(void){
    scanf("%lld",&n);
    ini();
    for(int i=0;i<n;i++){
        ll x,y;
        scanf("%lld%lld",&x,&y);
        ex.PB(P(x,i));
        ey.PB(P(y,i));
    }
    sort(ex.begin(),ex.end());
    sort(ey.begin(),ey.end());
    priority_queue<edge,vector<edge>,greater<edge> >kul;
    for(int i=0;i<ex.size()-1;i++){
        kul.push(edge{ex[i+1].F-ex[i].F,ex[i].S,ex[i+1].S});
    }
    for(int i=0;i<ey.size()-1;i++){
        kul.push(edge{ey[i+1].F-ey[i].F,ey[i].S,ey[i+1].S});
    }
    while(!kul.empty()){
        ll c=kul.top().c,s=kul.top().s,t=kul.top().t;
        kul.pop();
        if(same(s,t))continue;
        ans+=c;
        unit(s,t);
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 16224
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=1e6+9;
int main()
{
    FASTINOUT;
    string s;
    cin>>s;
    s[3]='8';
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		String str = input.readLine();
		int n = Integer.parseInt(str);
		ArrayList<Integer> list = new ArrayList();
		int sum = 0;
		int temp;
		for (int i = 0; i < n; i++) {
			str = input.readLine();
			temp = Integer.parseInt(str);
			sum = sum + temp;
			if(temp % 10 != 0){
				list.add(temp);
			}
		}

		if(list.size() == 0){
			sum = 0;
		}else{
			Collections.sort(list);
			int j = 0;
			while (sum % 10 == 0 && j < list.size()) {
				sum = sum - list.get(j);
				j++;
			}
		}

		System.out.println(sum);

	}
}


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

int main() {

  int N, K, A = 1, i;
  cin >> N >> K;
  for(i = 0; i < N; i++){
    if( A * 2 < A + K){
      A *= 2;
    }
    else{
      A += K;
    }
  }
  cout << A << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int inf = 1e9+7;
const int N = 1e6+9;

int main() {
    ios_base::sync_with_stdio(0);
    int a,b,n;
    string s;
    cin>>s;
    int sum=0, mx=0;
    for(char ch: s) {
        if(ch=='R') sum++;
        else sum=0;
        mx = max(mx, sum);
    }
    cout<<mx<<endl;
    return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=605;
const ll INF=0x3f3f3f3f;
const ll MOD=998244353;
int n,d1,d2,s1=1,s2=1,mask1[MAX][MAX],mask2[MAX][MAX],cnt;
int main(){
    scanf("%d%d%d",&n,&d1,&d2);
    while(d1%4==0) d1/=4,s1*=2;
    while(d2%4==0) d2/=4,s2*=2;
    for(int i=0;i<2*n;i++) for(int j=0;j<2*n;j++){
        if(d1%2){if((i/s1)%2==(j/s1)%2) mask1[i][j]=1;}
        else{if((i/s1)%2==0) mask1[i][j]=1;}
    }
    for(int i=0;i<2*n;i++) for(int j=0;j<2*n;j++){
        if(d2%2){if((i/s2)%2==(j/s2)%2) mask2[i][j]=1;}
        else{if((i/s2)%2==0) mask2[i][j]=1;}
    }
    for(int i=0;i<2*n;i++) for(int j=0;j<2*n;j++) if(mask1[i][j]&&mask2[i][j]){
        cnt++;
        printf("%d %d\n",i,j);
        if(cnt==n*n) return 0;
    }
}


Measured memory_bytes: 3712
A,B = map(int,input().split())
A=A-1
B=B-1

lineA=int(A/50)
line = '.#'*50
print(100,100)
for i in range(lineA):
    print(line)
    print('#'*100)

if A%50!=0:
    print('.#'*(A%50),end='')
    print('##'*(50-A%50))
    for _ in range(48-2*lineA):
        print('#'*100)
else:
    for _ in range(49-2*lineA):
        print('#'*100)

print('#'*100)
print('.'*100)

lineB=int(B/50)

for _ in range(lineB):
    print('#.'*50)
    print('.'*100)

if B%50!=0:
    print('#.'*(B%50),end='')
    print('..'*(50-B%50))
    for _ in range(48-2*lineB):
        print('.'*100)
else:
    for _ in range(49-2*lineB):
        print('.'*100)






Measured memory_bytes: 3064
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

template<typename T>
struct Mat
{
    vector<vector<T>> dat;
    Mat(int h, int w) : dat(h, vector<T>(w)){};
    Mat operator * (const Mat& m) const {
        assert(dat[0].size() == m.dat.size());
        Mat ret(dat.size(), m.dat[0].size());
        rep(i, dat.size()) rep(j, dat[0].size()) rep(k, m.dat[0].size()) {
            // ret[i][k] += dat[i][j] * m.dat[j][k];
            // xor : 足し算っぽい
            // and : 掛け算っぽい
            (ret.dat[i][k] += (dat[i][j] * m.dat[j][k]) % MOD) %= MOD;
        }
        return ret;
    }
    Mat operator ^(ll n) const {
        assert(dat.size() == dat[0].size());
        auto x = *this;
        Mat ret(dat.size(), dat[0].size());
        rep(i, dat.size()) {
            ret.dat[i][i] = 1;
        }
        while(n) {
            if(n&1LL) ret = ret * x;
            x = x * x;
            n >>= 1;
        }
        return ret;
    }
};

int main(){
    ll n, k;
    cin >> n >> k;
    Mat<ll> mt(n, n);
    rep(i, n) rep(j, n) cin >> mt.dat[i][j];
    auto mt2 = mt ^ k;
    ll ans = 0LL;
    rep(i, n) rep(j, n) {
        (ans += mt2.dat[i][j]) %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define fi first
#define se second
#define cl clear()
#define sqr(a) (a*a)
#define mk make_pair
#define po pop()
#define pu push
#define pb push_back
#define pf push_front
#define pob pop_back()
#define pof pop_front()
string en="\n";
string sp=" ";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<long long>
#define vs  vector<string>
#define MX LLONG_MAX
#define MN LLONG_MIN
#define MOD 1000000007
#define vp(vi,x) cin>>x; vi.pb(x);
#define bsearch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
LL ceil2(LL a,LL b){LL c=a/b; if(a%b)c++; return c; }
LL bpow(LL a,LL b){if(b==0)return 1;LL r=bpow(a,b/2);if(b%2)return r*r*a;else return r*r;}
LL binpow(LL a,LL b){LL r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
LL binpow(LL a,LL b,LL m){a%=m;LL r=1;while(b>0){if(b&1) r=r*a%m;a=a*a%m; b>>=1;}return r;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,p,q,a,b,c=0;
    bool f=0,ff=0;string st,s1,s2,s3; char ch;
    while(cin>>a>>b>>c)
    {
        s=0;
        for(i=a;i<=b;i++)
        {
            if(i%c==0)s++;
        }
        cout<<s<<en;
    }

}




Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int num=0;
  if(n<=104){
    cout << 0 << endl;
  }
  else{
    for(int j=105; j<=n; j++){
      int cnt=0;
      for(int i=1; i<=200; i++){
        if(j%2==0){
          break;
        }
        else{
          if(j%i==0){
            cnt++;
          }
        }
      }
      if(cnt == 8){
        num++;
      }
    }
    cout << num << endl;
  }
}

Measured memory_bytes: 256
def main():
    n,a,b = map(int, input().split())
    MOD = 1000000007
    k = b

    modinv_table = [-1] * (k+1)
    modinv_table[1] = 1
    for i in range(2, k+1):
        modinv_table[i] = (-modinv_table[MOD % i] * (MOD // i)) % MOD

    def comb(n, k):
        ans = 1
        for i in range(k):
            ans *= n-i
            ans *= modinv_table[i + 1]
            ans %= MOD
        return ans

    # sigma{comb(n,k)} (2<=k<=n,k!=a,k!=b)
    # 全パターン(2^n) - 0or1個選ぶ時 - sigma{comb(n,k)}(k==a,k==b)
    k1 = comb(n,a) if a>=1 else 0
    k2 = comb(n,b) if b>=1 else 0
    ans = pow(2,n,MOD) - 1 - (k1+k2)
    print(ans%MOD)

main()


Measured memory_bytes: 10868
#include <iostream>
#include <algorithm>
#include <iterator>
using namespace std;

int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(begin(a), end(a));
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
}



Measured memory_bytes: 3160
using System;

public class AtCoderB
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        int[] weights = new int[n];
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            for (int i = 0; i < n; i++)
            {
                weights[i] = int.Parse(words[i]);
            }
        }

        int answer = int.MaxValue;
        for (int i = 0; i < n; i++)
        {
            int sumA = 0;
            for (int j = 0; j < i; j++)
            {
                sumA += weights[j];
            }
            int sumB = 0;
            for (int k = i; k < n; k++)
            {
                sumB += weights[k];
            }
            answer = Math.Min(answer, Math.Abs(sumA - sumB));
        }

        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main() 
{
    fast;
    ll n,a,b,ans=0,k,j;
    cin>>n>>a>>b;
    ans=n/(a+b);
    if(ans>0)
    {
        k=ans*a;
        j=n%(a+b);
        k=k+min(j,a);
    }
    else
    {
        k=min(n,a);
    }
    cout<<k;
    return 0;
}

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

typedef long long ll;
#define vec vector<int>
#define vecll vector<ll>
#define vpair vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define rep(i,n)   for(int i=(int)0; i<(int)n; i++)
#define llrep(i,n)   for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n) for(int i=(int)m; i<(int)n; i++)
#define all(var)     (var).begin(), (var).end()
#define prt(var)     cout << var << endl
#define prt_dbl(i,var) cout<<fixed<<setprecision(i)<<var<<endl;
template <typename Val>
Val gcd(Val a, Val b) {
//use ll or int for gcd
    if (b==0) return a;
    else return gcd(b, a%b);
}
template <typename Val>
Val vec_max(vector<Val> v){
  return *max_element(v.begin(),v.end());
}
template <typename Val>
Val vec_min(vector<Val> v){
  return *min_element(v.begin(),v.end());
}
//---------------------------------------------------------------
int main(){
  ll N,M;
  cin>>N>>M;
  vector<ll>H(N);
  rep(i,N){
    cin>>H.at(i);
  }

  vector<vector<ll>> A(N);
  rep(i,M){
    ll a,b;
    cin>>a>>b;
    A.at(a-1).push_back(H.at(b-1));
    A.at(b-1).push_back(H.at(a-1));

  }
  ll ans= 0;
  rep(i,N){
    int t = H.at(i);

    if(A.at(i).size()>0){
      if(vec_max(A.at(i))<H.at(i))ans++;
    }else{
      ans++;
    }
}

  cout<<ans<<endl;


}


Measured memory_bytes: 9860
class Dice:
    def __init__(self,faces):
        self.faces = tuple(faces)
    def N(self):
        self.faces = (self.faces[1], self.faces[5], self.faces[2],
                      self.faces[3], self.faces[0], self.faces[4])
    def S(self):
        self.faces = (self.faces[4], self.faces[0], self.faces[2],
                      self.faces[3], self.faces[5], self.faces[1])
    def W(self):
        self.faces = (self.faces[2], self.faces[1], self.faces[5],
                      self.faces[0], self.faces[4], self.faces[3])
    def E(self):
        self.faces = (self.faces[3], self.faces[1], self.faces[0],
                      self.faces[5], self.faces[4], self.faces[2])
    def number(self, face_id):
        return self.faces[face_id - 1]
dice = Dice(list(map(int, input().split())))
x=input()
 
for i in x:
    if i == "N":
        dice.N()
    elif i == "S":
        dice.S()
    elif i == "W":
        dice.W()
    elif i == "E":
        dice.E()
print(dice.number(1))

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

long long int N, M;

typedef vector< vector<long long int> > matrix;

matrix mul(matrix a, matrix b)
{
	matrix res(N, vector<long long int>(N, 0));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < N; k++) {
				res[i][j] += a[k][j] * b[i][k];
			}
			if(res[i][j] >= M)
				res[i][j] %= M;
		}
	}
	return res;
}

matrix pow(matrix m, int n)
{
	matrix res(N, vector<long long int>(N, 0));
	for (int i = 0; i < N; i++)
		res[i][i] = 1;
	int x = 1;
	while (x <= n) {
		if ((x & n) > 0) {
			res = mul(res, m);
		}
		m = mul(m, m);
		x <<= 1;
	}
	return res;
}

int main()
{
	long long int A, B, C, T;
	while (cin >> N >> M >> A >> B >> C >> T, N | M | A | B | C | T) {
		matrix bottom(N,vector<long long int>(N,0)),mat(N, vector<long long int>(N, 0)),res;
		for (int i = 0; i < N; i++) {
			if (i - 1 >= 0) {
				bottom[i][i - 1] = A;
			}
			bottom[i][i] = B;
			if (i + 1 < N) {
				bottom[i][i + 1] = C;
			}
		}
		for (int i = 0; i < N; i++) {
			cin >> mat[i][N - 1];
		}
		res = mul(mat, pow(bottom, T));
		for (int i = 0; i < N; i++) {
			cout << res[i][N - 1];
			if (i + 1 < N)
				cout << " ";
			else
				cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1364
#include <stdio.h>
#include <string.h>
 
int main() {
  char c[4];
  char *week[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  scanf("%s", c);
  for(int i = 0; i < 7; i++) {
    if(strcmp(c, week[i]) == 0) {
      printf("%d", 7 - i);
      break;
    }
  }
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

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


    int retnum=0;
    for(int i=0;i<n-2;i++){
        if(p[i]<p[i+1]){
            if(p[i+1]<p[i+2]){
                ++retnum;
            }
        }
        else{
            if(p[i+1]>p[i+2]){
                ++retnum;
            }
        }
    }
    cout<<retnum<<endl;

}



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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    int n;
    cin>>n;

    int a=n+n*n+n*n*n;
    cout<<a;


    return 0;
}


Measured memory_bytes: 3648
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define pf printf
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node

using namespace std;
///check n=1;
///check corner case;

int main()
{
   ll i,j,k,n,cc=0;
   string str;
   cin>>str;
   n=str.size();
   for(i=0;i<n/2;i++){
    if(str[i]!=str[n-i-1])cc++;
   }
   cout<<cc<<endl;
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();

        String[] s = new String[m];
        String[] c = new String[m];
        for(int i=0; i<m; i++){
            s[i] = scanner.next();
            c[i] = scanner.next();
        }
        scanner.close();
        String[] result = new String[n];
        //初期化
        for(int i=0; i<n; i++){
            result[i] = "";
        }
        for(int i=0; i<m; i++){
            // 2桁以上かつ1桁目が0指定はNG
            if(n>1 && s[i].equals("1") && c[i].equals("0")){
                System.out.println("-1");
                return;
            }
            // 重複はNG
            if(!result[Integer.parseInt(s[i])-1].equals("") && !result[Integer.parseInt(s[i])-1].equals(c[i])){
                System.out.println("-1");
                return;
            }
             result[Integer.parseInt(s[i])-1] = c[i];    
        }
        if(result[0].equals("") && n==1){
            result[0]="0";
        }
        if(result[0].equals("")){
            result[0]="1";
        }
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++){
            if(result[i].equals("")){
                result[i]="0";
            }
            sb.append(result[i]);
        }
        System.out.println(sb.toString());

    }
}

Measured memory_bytes: 22612
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
using namespace std;
const long long Mod=1e9+7;
long long n,k,a[2020],ans,sum1,sum2;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++){
		for(int j=1;j<i;j++){
			if(a[j]>a[i]) sum1++;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(a[j]>a[i]) sum2++;
		}
	}
	ans=sum1*k%Mod;
	ans+=(k*(k-1)/2%Mod)*sum2%Mod;
	ans%=Mod;
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

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

    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    REP(i, m){
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
    }

    int ans = 0;
    REP(i, m){
        vector<vector<int>> wf(n, vector<int>(n, INF));
        REP(j, m) if(i != j){
            wf[a[j]][b[j]] = 1;
            wf[b[j]][a[j]] = 1;
        }
        REP(c, n) REP(j, n) REP(k, n){
            wf[j][k] = min(wf[j][k], wf[j][c] + wf[c][k]);
        }
        bool flag = false;
        REP(j, n) REP(k, n) if(wf[j][k] == INF)flag = true;

        if(flag) ans++;
    }
    
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
	pair<long long,long long> p[100005];
    long long n,k; cin>>n>>k;
    long long sum=0;
    for(int i=0;i<n;i++){
		cin>>p[i].first; cin>>p[i].second;
	}
	sort(p,p+n);
	for(int i=0;i<n;i++){
		sum=sum+p[i].second;
		if(sum>=k){
			cout<<p[i].first<<endl;
			return 0;
		}
	}
    
}


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i=0;i<n;i++){
    cin >> a[i];
  }
  if (n%2==0){
    for (int i=n-1;i>=1;i-=2){
      cout << a[i] << ' ';
    }
    for (int i=0;i<n;i+=2){
      cout << a[i] << ' ';
    }
  }
  else {
    for (int i=n-1;i>=0;i-=2){
      cout << a[i] << ' ';
    }
    for (int i=1;i<n;i+=2){
      cout << a[i] << ' ';
    }
  }
  cout << endl;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    vector<int> a(n), b(m);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = 0; i < m; ++i)
        cin >> b[i];
    bool odp = false;
    for (int z = x + 1; z <= y; ++z)
    {
        bool ok = true;
        for (int i = 0; i < n; ++i)
            if (a[i] >= z)
                ok = false;
        for (int i = 0; i < m; ++i)
            if (b[i] < z)
                ok = false;
        if (ok)
            odp = true;
    }
    if (odp)
        cout << "No War";
    else
        cout << "War";
    return 0;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a,b,c[100000],cmp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;

string s,w;

vector<int> z;

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

       cin >> n >> a >> b;
       rep(i,n){
           cin >> c[i];
       }
       if(n==1){
           Cout(Abs(c[0],b));
       }
       else{
           Cout(max(Abs(c[n-1],c[n-2]),Abs(c[n-1],b)));
       }
return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#define rep(a, n) for(int i = a; i < (int) n; i++)
#define rep(n) for(int i = 0; i < (int) n; i++)
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define fast() ios::base::sync_with_stdio(false); cin.tie(NULL);
typedef long long int ll;
//typedef vector<int> vi;
//using ll = long long; //only for C++11 compiler and newer

using namespace std;

int main(){
    //fast()
    //freopen("input.txt","r",stdin);
    int n, k; cin >> n >> k;
    int ans = 0;
    while(n > 0){n /= k; ans++;}
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF (int)1e9
#define INFL (ll)1e11
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int N, M, Q;
	scanf("%d%d%d", &N, &M, &Q);
	vector<int> L(M), R(M);
	vector<vector<int>> sum(N + 1,vector<int>(N + 1, 0)); // sum[i][j]:L=iのときのj番目までの累積和
	REP(i, M) {
		scanf("%d%d", &L[i], &R[i]);
		sum[L[i]][R[i]]++;
	}
	REP(i, N)REP(j, N) {
		sum[i + 1][j + 1] += sum[i + 1][j];
	}
	vector<int> p(Q), q(Q);
	REP(i, Q) {
		scanf("%d%d", &p[i], &q[i]);
		int res = 0;
		for (int j = p[i];j <= q[i];j++) {
			res += sum[j][q[i]] - sum[j][j - 1];
		}
		printf("%d\n", res);
	}


	return 0;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int main(){
	int n;cin>>n; 
	string s;cin>>s;
	int x=0,mx=0;
	for(int i=0;i<n;i++){
		mx=max(mx,x);
		if(s[i]=='I') x++;
		else x--;
	}
	mx=max(mx,x);
	cout<<mx;
	return 0;
}

Measured memory_bytes: 3576
#include <cstdio>

int main() {
  int a, b, c, d;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  if(c > a)
    a = c;
  if(d < b)
    b = d;
  if(a < b)
    printf("%d", b - a);
  else
    printf("0");
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N; cin >> N;
	vector<double> x(N), y(N);
	vector<vector<double>> c(N);
	double ans = 0;
	for (int i = 0;i < N;i++) {
		cin >> x[i] >> y[i];
	}
	double sum=1;
	for (int i = 2;i < N;i++) sum *= i;
	for (int i = 0;i < N-1;i++) {
		c[i].resize(N);
		for (int j = i + 1;j < N; j++) {
			c[i][j] = sqrt((x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]));
			c[i][j] *= 2*sum;
			ans += c[i][j];
		}
	}
	for (int i = 2;i <= N;i++) ans /= i;
	cout << setprecision(12) <<ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace AGC010_B___Boxes
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(solver() ? "YES" : "NO");
        }
        static bool solver()
        {
            var N = long.Parse(Console.ReadLine());
            var A = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);

            var difference = new long[N];
            difference[0] = A[0] - A[N - 1];
            for (int i = 1; i < N; i++) difference[i] = A[i] - A[i - 1];

            if ((A.Sum() % (N * (N + 1) / 2) != 0))return false;
            var opCount = A.Sum() / (N * (N + 1) / 2);
            for (int i = 0; i < N; i++)
            {
                var check = (difference[i] - opCount) * -1;
                if (check < 0 || check % N != 0) return false;
            }
            return true;
        }
    }
}


Measured memory_bytes: 21728
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char a[1005];cin>>a;
	int n=0,s=0,w=0,e=0;
	for(int i=0;a[i];i++)
	{
	 n+=a[i]=='N';
	w+=a[i]=='W';
	e+=a[i]=='E';
	  s+=a[i]=='S';
	}
	if(((s==0&&n==0)||(s&&n))&&((w&&e)||(w==0&&e==0)))puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
class Program
{
    static void Main()
    {
        List<int> ab = new List<int>();
        for (int i = 0; i < 3; i++)
        {
            int[] ipts = Console.ReadLine().Split().Select(s => int.Parse(s) - 1).ToArray();
            foreach (var j in ipts)
                ab.Add(j);
        }
        for (int i = 0; i < 4; i++)
        {
            int co = ab.Count(s => s == i);
            if (co > 2)
            {
                Console.WriteLine("NO");
                return;
            }
        }
        Console.WriteLine("YES");
    }
}

Measured memory_bytes: 13396
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

B = [0] * N
C = [0] * N

B[0] = A[0][0]
C[0] = A[1][0]
for i in range(1, N):
  B[i] += B[i - 1] + A[0][i]
  C[i] += C[i - 1] + A[1][i]

ans = B[0] + C[-1]
for i in range(1, N):
  ans = max(ans, B[i] + C[-1] - C[i - 1])
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

#define MAX 60000

void maketable( int sosu[MAX] )
{
	sosu[0] = -1, sosu[1] = -1;
	int i, j;

	for ( i = 2 ; i < MAX ; i++ ) {
		if ( sosu[i] == 0 ) {
			sosu[i] = 1;

			for ( j = 2*i ; j < MAX ; j += i ) {
				sosu[j] = -1;
			}
		}
	}
	return;
}

int main()
{
	int sosu[MAX], i, j;
	int n = 0, minum, maxnum;

	maketable( sosu );

	while ( scanf( "%d", &n ) != EOF ) {
		for ( i = n-1 ; i > 0 ; i-- ) {
			if ( sosu[i] == 1 ) {
				minum = i;
				break;
			}
		}

		for ( i = n+1 ; i < MAX ; i++ ) {
			if ( sosu[i] == 1 ) {
				maxnum = i;
				break;
			}
		}

		printf( "%d %d\n", minum, maxnum );
	}

	return 0;
}



Measured memory_bytes: 2024
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


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

  if((n+1)/2>=k) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    int x[110000];
    for(int i=0; i<n; i++){
        cin >> x[i];
    }
    int ans = 999000111;
    for(int i=0; k-1+i<n; i++){
        int left = x[0+i];
        int right = x[k-1+i];
        if(left >= 0  &&  right >= 0){
            ans = min(ans, right);
        }else if(left <= 0  &&  right <= 0){
            ans = min(ans, abs(left));
        }else{
            ans = min(ans, 2 * min(abs(left),right) + max(abs(left),right) );
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <algorithm>
using namespace std;

int n, k, a[200010], cnt, ans, total;

int main(void) {
    scanf("%d%d", &n, &k);
    for(int i=0; i<n; i++) {
        int t;
        scanf("%d", &t);
        total+=t;
        if(a[t]) a[t]++;
        else {
            a[t]=1;
            cnt++;
        }
    }

    if(cnt<=k) {
        printf("0");
        return 0;
    }
    
    sort(a+1, a+n+1);
    
    int i=1;
    while (cnt>k) {
        if(a[i]) {
            total-=a[i];
            cnt--;
            ans+=a[i];
        }
        i++;
    }
    
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 896
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 11 09:54:00 2019

@author: shinjisu
"""


# ARC 064 WA
def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def dmp(x):
    global debug
    if debug:
        print(x)


def probC_try1():
    N, x = getIntList()
    a = getIntList()
    dmp((N, x, a))
    eatCnt = 0
    half = (x+1) // 2
    dmp((N,x,a,half))
    for i in range(N-1):
        if a[i]+a[i+1] > x:
            #eat = a[i]+a[i+1]-(min(a[i],half)+min(a[i+1],half))
            eat = a[i] - min(a[i],max(a[i+1]-half,half),half)
            eatCnt += eat
            a[i] = min(a[i],max(a[i+1]-half,half),half)
    eat = a[N-1] - min(a[N-1], half)
    eatCnt += eat
    a[N-1] = min(a[N-1],half)
    dmp((eatCnt,a))
    i=0
    while i<N:
        while i<N-1 and a[i]+a[i+1]<=x: i+=1
        cnt=1
        while i<N-1 and a[i]+a[i+1]>x: 
            i+=1; cnt+=1
        eatCnt += cnt//2
        dmp((cnt,eatCnt))
        i+=1
    return eatCnt


def probC():
    N, X = getIntList()
    a = getIntList()
    dmp((N, X, a))
    eatCnt = 0
    for i in range(N-1):
        dmp((eatCnt,a))
        if a[i] > X:
            eat = a[i] - X
            dmp(('eat',eat))
            eatCnt += eat
            a[i] = X
        if a[i]+a[i+1] > X:
            eat = a[i]+a[i+1] - X
            dmp(('eat',eat))
            eatCnt += eat
            if a[i+1] < eat:
                # a[i] -= X-a[i+1]
                a[i+1] = 0
            else:
                a[i+1] -= eat
    dmp((eatCnt,a))
    return eatCnt


debug = False  # True False
print(probC())


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;

int main() {
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  cout << H * W - (h * W) - (H * w) + (h * w) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
char s[16][10];
void init(){
	strcpy(s[0],"AKIHABARA");
	strcpy(s[1],"AKIHABAR");
	strcpy(s[2],"AKIHABRA");
	strcpy(s[3],"AKIHBARA");
	strcpy(s[4],"KIHABARA");
	strcpy(s[5],"AKIHABR");
	strcpy(s[6],"AKIHBAR");
	strcpy(s[7],"KIHABAR");
	strcpy(s[8],"AKIHBRA");
	strcpy(s[9],"KIHABRA");
	strcpy(s[10],"KIHBARA");
	strcpy(s[11],"AKIHBR");
	strcpy(s[12],"KIHABR");
	strcpy(s[13],"KIHBAR");
	strcpy(s[14],"KIHBRA");
	strcpy(s[15],"KIHBR");
}

int main(){
	init();
	int i,ans;
	char S[55];
	while(scanf("%s",S)!=EOF){
		ans=0;
		for(i=0;i<16;i++){
			if(strcmp(S,s[i])==0)
				ans=1;
		}
		if(ans)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>>n;
  vector<char> s(n);
  for(int i=0; i<n; i++){
    cin>>s.at(i);
    if(s.at(i) == 'Y'){cout<<"Four"; return 0;}
  }
  cout<<"Three";
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
N=int(input())
data=[]
for i in range(N):
    a,b=map(int,input().split())
    data.append((a,b,a+b))
A=0
B=0
data.sort(key=lambda x:x[2],reverse=True)
for i in range(N):
    if i%2==0:
        A+=data[i][0]
    else:
        B+=data[i][1]
print(A-B)

Measured memory_bytes: 22120
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d,f,g,h,i,j;
	char z[3];
	scanf("%s",z);
	if(z[0]==z[2]) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

int main() {
  int A, B, C, K;
  cin >>A >>B >>C >>K;
 
 if(K<=A)
  cout<< K;
 
 else if (K<=A+B)
  cout<< A;
 
 else
   cout<<A-(K-A-B);
  
 }

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	string s; cin >> s;
	sort( s.begin(), s.end() );
	if( s == "abc" ) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
def main():
  n = int(input())
  a = list(map(int,input().split()))
  b = list(map(int,input().split()))
  c = 0
  for i in range(n):
    if a[i] >= b[i]:
      c += b[i]
    else:
      d = b[i] -a[i]
      if a[i+1] <= d:
        c += a[i] + a[i+1]
        a[i+1] = 0
      else:
        a[i+1] -= d
        c += b[i]
  print(c)

if __name__ == '__main__':
  main()

Measured memory_bytes: 18476