akhauriyash/Code-Regression huggingface dataset:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,m,v,p = inpl()
a = inpl()
c = Counter(a)
a.sort()
b_num = a[n-p]
d_cnt = 0
b_cnt = 0
u_cnt = 0
for i in a:
    if i < b_num: d_cnt += 1
    elif i == b_num: b_cnt += 1
    else: u_cnt += 1

def f(x,i):
    if x >= b_num:
        return True
    if x + m < b_num:
        return False
    if i + 1 + u_cnt >= v:
        return True
    cnt = 0
    for item in a:
        if item > b_num or item <= x:
            cnt += m
        else:
            cnt += x + m - item
    # print(cnt)
    if cnt >= m*v:
        return True
    else:
        return False
# print(f(a[2],2))
ok = n-1
ng = -1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    if f(a[mid],mid):
        ok = mid
    else:
        ng = mid
print(n-ok)


Measured memory_bytes: 96104
import java.util.*;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int W = sc.nextInt();
        
        long[][] map = new long[N][2];
        for (int i = 0; i < N; i++) {
        	map[i][0] = sc.nextLong();
        	map[i][1] = sc.nextLong();
        }
        
        long[][] dp = new long[N+1][W+1];
        for (int i = 1; i <= N; i++) {
        	for (int j = 1; j <=W; j++) {
        		if (j >= map[i-1][0]) {
            		dp[i][j] = Math.max(dp[i-1][j], map[i-1][1] + dp[i-1][j-(int)map[i-1][0]]);
            	} else {
            		dp[i][j] = dp[i-1][j];
            	}
        	}
        }
        
        System.out.println(dp[N][W]);
    }
}

Measured memory_bytes: 127060
#include<bits/stdc++.h>
using namespace std;
int n,ans=1;

int main(){
    scanf("%d",&n);
    int maxx;
    scanf("%d",&maxx);
    for (int i=1,x;i<n;i++)
      scanf("%d",&x),
      ans+=maxx<=x,
      maxx=max(maxx,x);
    printf("%d",ans);
    return 0;
}

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

using namespace std;

#define rep(i, a, b)    for (int i(a); i <= (b); ++i)
#define dec(i, a, b)    for (int i(a); i >= (b); --i)
#define MP        make_pair
#define fi        first
#define se        second


typedef long long LL;
typedef pair <int, int> PII;

int n;
int answer = 1e9;
map <int, int> map1, map2;
multiset <int> s1, s2;

int main(){
    
    scanf("%d", &n);
    
    rep(i, 1, n){
        int x;
        scanf("%d", &x);
        if (i & 1) map1[x]++;
        else map2[x]++;
    }
    
    for (auto u : map1) s1.insert(u.se);
    for (auto u : map2) s2.insert(u.se);
    
    for (auto u : map1){
        int x = u.se;
        if (map2.count(u.fi)){
            int ll = map2[u.fi];
            s2.erase(s2.find(ll));
            if (map2.size() > 1u){
                answer = min(answer, n - x - (*s2.rbegin()));
            }
            
            else answer = min(answer, n - x);
            s2.insert(ll);
        }
        
        else{
            answer = min(answer, n - x - (*s2.rbegin()));
        }
        
    }
    
    printf("%d\n", answer);
    return 0;
}


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

#define endl '\n'
using namespace std;
using ll = long long;

const int N = 3000;
int n;
double p[N];
double dp[N][N];

void init();
void process();

int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    init();
    process();
    cout.flush();
    return 0;
}

void init()
{
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> p[i];
}

void process()
{
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++)
    {
        dp[i][0] = dp[i-1][0]*(1.0-p[i]);
        for(int j = 1; j <= n; j++)
        {
            dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1.0-p[i]);
        }
    }
    double sum = 0;
    for(int j = n/2+1; j <= n; j++) sum += dp[n][j];
    cout << fixed << setprecision(10) << sum << endl;
}



Measured memory_bytes: 70528
#include<cmath>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int arr[100];
	int q=0;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		q+=arr[i];
	}
	if(q>=0)
	q=(double)q/n+0.5;
	else
	q=(double)q/n-0.5;
	int a=q;
	int sum=0;
	for(int i=0;i<n;i++)
	{
		sum+=(arr[i]-a)*(arr[i]-a);
	}
	cout<<sum;
}

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

int main(){
  int n;
  cin >> n;
  bool all_white = true;
  vector<vector<bool> > a(n, vector<bool>(n, false));
  vector<int> line(n, 0);
  for(int i = 0; i < n; i++){
    string s;
    cin >> s;
    int line_black = 0;
    for(int j = 0; j < n; j++){
      if(s[j] == '#'){
        a[i][j] = true;
        line_black++;
        all_white = false;
      }
    }
    line[i] = line_black;
  }
  if(all_white){
    cout << -1 << endl;
    return 0;
  }

  vector<bool> column_black(n, false);
  int white_column = 0;
  for(int j = 0; j < n; j++){
    bool all_black = true;
    for(int i = 0; i < n; i++){
      all_black = all_black && a[i][j];
      column_black[j] = column_black[j] || a[i][j];
    }
    if(!all_black) white_column++;
  }

  int min_row = n + 1;
  for(int i = 0; i < n; i++){
    int line_white = n - line[i];
    if(!column_black[i])
      line_white++;
    if(min_row > line_white)
      min_row = line_white;
  }



  cout << min_row + white_column << endl;
}


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

class Main {
    static int[] A;

    static int partition(int l, int r){
        int i = l-1;

        for (int j = l; j < r; j++){
            if (A[j] <= A[r]){
                i++;
                // swap
                int temp = A[j];
                A[j] = A[i];
                A[i] = temp;
            }
        }
        i++;
        int temp = A[r];
        A[r] = A[i];
        A[i] = temp;
        return i;
    }

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        int n = sc.nextInt();


        A = new int[n];

        for (int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }

        int x = partition(0,n-1);

        StringBuilder s = new StringBuilder().append(A[0]);
        for (int i = 1; i < n; i++) {
            if (i == x) s.append(" [").append(A[i]).append("]");
            else s.append(" ").append(A[i]);
        }

        System.out.println(s);


    }

    /**
     * MyScanner is a user-defined fast I/O class.
     * Source: https://algocoding.wordpress.com/2015/04/23/fast-io-methods-for-competitive-programming/
     */

    static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() { return Integer.parseInt(next()); }
        long nextLong() { return Long.parseLong(next()); }
        double nextDouble() { return Double.parseDouble(next()); }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}



Measured memory_bytes: 41256
// "header" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int int64_t
#define Fixed fixed << setprecision(10)
#define moke_pair make_pair
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1000000007;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class T,class U> using umap = unordered_map<T,U>;

inline int64_t updiv(int64_t n,int64_t d){
    return ((n + d -1) / d);
}
/*
inline double Sqrt( const double &x) 
{
	double         xHalf = 0.5 * x;
	int64_t  tmp   = 0x5FE6EB50C7B537AAl - ( *(int64_t*)&x >> 1);
	double         xRes  = * (double*)&tmp;

	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	return xRes * x;
}
*/
// }}}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,c,k;
    cin >> n >> c >> k;
    vector<int> t(n);
    int res = 0,cnt = 0,now = 0,tmp = 0;
    rep(i,n){
        cin >> t[i];
    }
    sort(all(t));
    rep(i,n){
        if(i == 0) tmp = t[i];
        now = t[i];
        ++cnt;
        if(now > tmp + k || cnt > c){
            cnt = 1;
            tmp = t[i];
            ++res;
        }
    }
    cout << res + (cnt != 0) << '\n';
    return 0;
}


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

int main() {

    int N;
    cin >> N;
    map<int,int> n_map;

    for (int i = 0; i < N; i++) {
        int a;
        cin >> a ;

        n_map[a] = a;
    }

    cout << n_map.size() << endl;

    
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=1e6+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
ll a[L];
void fff()
{
	int n, k;
	cin >> n >> k;
	FOR(i,0,n)cin >> a[i];
	sort(a,a+n);
	ll ans = 0;
	FOR(i,0,k)ans += a[i];
	cout<<ans<<ln;	
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

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

int A, B, C, D;

int solve()
{
	return max(min(B, D)-max(A, C), 0);
}

int main(int argc, char **argv)
{
	cin >> A >> B >> C >> D;

	std::cout << solve() << std::endl;
}


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

a = 0
b = []
c = []
for i in range(N):
    if i+1 != p[i]:
        a += 1
        b.append(p[i])
        c.append(i+1)

if a == 0:
    print("YES")
elif a == 2:
    if b[0] == c[1] and b[1] == c[0]:
        print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    S =     _in[0]   # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = 700
    for s in S:
        if s == 'o':
            cnt += 100
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


Measured memory_bytes: 38256
R=range
M=998244353
n,m,k=map(int,input().split())
f=1
for i in R(n-1):f=f*-~i%M
r=[pow(f*n,-1,M)]
for i in R(n):r+=r[i]*(n-i)%M,
print(sum(m*f*r[i-n]*r[~i]*pow(m-1,~i+n,M)for i in R(k+1))%M)

Measured memory_bytes: 16980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long INF = 1LL << 60;

int main()
{
  ll X; cin >> X;
  ll A, B;
  for(int a = -118; a <= 119; a++)
  {
    for(int b = -119; b <= 118; b++)
    {
      if(a*a*a*a*a-b*b*b*b*b == X)
      {
        A = a; B = b; break;
      }
    }
  }
  cout << A << " " << B << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    // failed to analyze input format
    // TODO: edit here
    char a;
    cin >> a;
    if (a - 'A' >= 0 && a - 'A' < 27 ) p("A");
    else if (a - 'a' >= 0 && a - 'a' < 27 ) p("a");
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc171/abc171_a && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc171/abc171_a && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc171/abc171_a && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++) 

int main(){
    //A
    /*
    vector<int> a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    cin>>K;
    cout<<a[K-1]<<endl;
    */
   //B
   long long H,W;
   cin>>H>>W;
   if(H==1||W==1) cout<<1<<endl;
   else cout<<(H*W+1)/2<<endl;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define test        int t;cin>>t;while(t--)
#define REP(i,a,b)  for(int i=a,i<=b;i++)
#define MAXN        200001

int solve(int arr[],int n,int k){

    int dp[n+1];
    memset(dp,0,sizeof(dp));
    dp[1]=0;
    for(int i=2;i<=n;i++){

        int mn=INT_MAX;
        for(int j=1;j<=k;j++){
            if(i-j>=1){
                int op1=abs(arr[i]-arr[i-j])+dp[i-j];
                mn=min(mn,op1);
            }
        }
        dp[i]=mn;
    }
    return dp[n];
}

int32_t main()
{   

    int n,k;cin>>n>>k;
    int arr[n+1];
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }

    cout<<solve(arr,n,k)<<endl;

    return 0;
}


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



int main(void)
{
    string a, b;
    cin >> a >> b;
    string tmp = a + b;
    int num = stoi(tmp);
    int root = sqrt(num);
    if(root*root == num) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100010
#define INF 10000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
    string s;
    IN(s);
    bool f=true;
    REP(i,SZ(s)-1){
        if(s[i]==s[i+1]){
            f=false;
        }
    }
    if(f)OUT("Good");
    else OUT("Bad");
	return 0;
}

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

#define all(x) x.begin(),x.end()
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define pr(x) printf("%d",x)
#define prl(x) printf("%lld",x)
#define LL long long
#define pb push_back
#define PB pop_back
#define PF pop_front
#define F first
#define S second
#define inrow(vec)    for(int i=0;i<vec.size();i++)cout<<vec[i]<<" ";
#define incoloum(vec) for(int i=0;i<vec.size();i++)cout<<vec[i]<<endl;

const double PI=3.1415926;
const int KL=1e6;

using namespace std;

LL q,x,y,z,n,k,m,p[KL],mn=1e9,mx=-1e9,ans;
string t;
vector <LL> vec;
set <int> s;
map <int,int> M;


int main()
{
    scl(n);
    LL sum=1,cnt=0;
    while(n!=0)
    {
        n/=2;
        cnt+=sum;
        sum*=2;
    }
    cout<<cnt<<endl;
   return 0;
}


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

int main() {
  int a,b;
  cin >> a >> b;
  
  if (a >= 13){
    cout << b << endl;
  }
  
  else if (a <= 5){
    cout << 0 << endl;
  }
  
  else {
    cout << b/2 << endl;
  }

}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;


int main()
{
	int a, b;
	
	scanf("%d%d", &a, &b);
	if (a >= 13)
		printf("%d\n", b);
	else
		if (a >= 6)
			printf("%d\n", b >> 1);
		else
			printf("0\n");
	return 0;
}



Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vi a(n);
    rep(i,n)cin>>a[i];
    SORT(a);
    int l=a[0];
    int r=a[n-1];
    vp v;
    Rep(i,1,n-1){
        if(a[i]<=0){
            v.pb({r,a[i]});
            r-=a[i];
        }
        else{
            v.pb({l,a[i]});
            l-=a[i];
        }
    }
    v.pb({r,l});
    cout<<r-l<<endl;
    rep(i,n-1){
        cout<<v[i].fi<<sp<<v[i].se<<endl;
    }
}

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

int main() {
  int n,m;cin>>n>>m;
  vector<vector<char>> a(n,vector<char>(n)),b(m,vector<char>(m));
  rep(i,n)rep(j,n)cin>>a[i][j];
  rep(i,m)rep(j,m)cin>>b[i][j];
  rep(i,n-m+1)rep(j,n-m+1){
    bool ans=true;
    rep(k,m)rep(l,m){
        if(a[i+k][j+l]!=b[k][l])ans=false;
      }
    if(ans){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

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

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

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
long long gcd(long long a, long long b) {return b ? gcd(b, a % b) : a;}
long long lcm(long long m, long long n ){if((0 == m )||( 0 == n ))return 0;
    return ((m / gcd(m, n)) * n);
}
signed main(){
    int n,k;cin>>n>>k;
    int maxi=-INF;
    vector<int>v(n); rep(i,n)cin>>v[i];
    rep(i,n)cmax(maxi,v[i]);
    int gd=v[0];
    rep(i,n)gd=(int)gcd((ll)gd,(ll)v[i]);
    if(k%gd==0&&k<=maxi)return puts("POSSIBLE")*0;
    puts("IMPOSSIBLE");
    
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int d;
  cin >> d;
  if(d==22){cout << "Christmas Eve Eve Eve" << endl;}
  if(d==23){cout << "Christmas Eve Eve" << endl;}
  if(d==24){cout << "Christmas Eve" << endl;}
  if(d==25){cout << "Christmas" << endl;}
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <array>
#include <algorithm>
#include <string>

typedef long long ll;

int main()
{

    ll A, B, C, D;

    std::cin >> A >> B >> C >> D;

    if(C < D)
    {
        ll tmp = C;
        C = D;
        D = tmp;
    }

    ll CCopy = C;
    ll DCopy = D;
    //最小公倍数を計算
    ll x = C*D;
    ll r = C % D;
    while(r!=0)
    {
        C=D;
        D=r;
        r=C%D;
    }

    ll minNum = x/D;

    ll ADash = A-1;
    ll lowerNum = ADash - (ADash/CCopy)-(ADash/DCopy) + (ADash/minNum);
    ll upperNum = B - (B/CCopy)-(B/DCopy) + (B/minNum);

    std::cout << upperNum - lowerNum << std::endl;


    return 0;
}






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

using namespace std;

int main(){
    vector<int> ans;

    while(true){
        int n;
        cin >> n;

        if(n==0) break;

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

        int dp[n][n];
        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++){
                dp[i][j] = 0;
            }
        }

        for(int l=2; l<=n;l++){
            for(int i=0; i<n; i++){
                int j = i + l - 1;
                if(j>=n) continue;
                if(dp[i+1][j-1] == j-i-1 && abs(w[i]-w[j])<=1){
                    dp[i][j] = j - i + 1;
                }else{
                    for(int k=0; k<n-1; k++){
                        dp[i][j] = max(dp[i][j], dp[i][k]+dp[k+1][j]);
                    }
                }
            }

        }

        ans.push_back(dp[0][n-1]);
    }

    for(auto it=ans.begin(); it != ans.end(); it++){
        cout << *it << endl;
    }

    return 0;
}


Measured memory_bytes: 3392
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String N = scanner.nextLine();
        char lastDigit = N.charAt(N.length()-1);
        if (lastDigit == '3') {
            System.out.println("bon");
        } else if (lastDigit == '0' || lastDigit == '1' || lastDigit == '6' || lastDigit == '8') {
            System.out.println("pon");
        } else {
            System.out.println("hon");
        }
    }
}

Measured memory_bytes: 35616
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAX = 100005;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;

int main()
{
    int n;
    string s;
    cin >> n >> s;
    int len = s.size();
    int l = 0, r = 0;
    string ans = "";
    for(int i = 0; i < len; ++i)
    {
        if(s[i] == '(') r++;
        if(s[i] == ')') r--;
        if(r < 0)
        {
            r = 0;
            ans += "(";
        }
    }
    ans += s;
    for(int i = 0; i < r; ++i)
        ans += ")";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
bool used[10];
int parm[10];
int N;
int a[10][10];
int dist[10];
int ans;
void dfs(int idx){
  if(idx == N){
    ans = dist[idx - 1];
    return;
  }
  for(int i = 0; i < N; i++) if(!used[i]){
    parm[idx] = i;
    used[i] = true;
    dist[idx] = 0;
    for(int j = 0; j < idx; j++){
      dist[idx] = max(dist[idx], dist[j] + a[parm[j]][parm[idx]]);
    }
    if(dist[idx] < ans) dfs(idx + 1);
    used[i] = false;
  }
}

int main(){
  while(cin >> N && N){
    REP(i, N){
      REP(j, N){
        cin >> a[i][j];
      }
    }
    REP(i, N)REP(j, N) a[i][j] = max(a[i][j], a[j][i]);
    memset(used, 0, sizeof(used));
    ans = INF;
    dfs(0);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
import heapq
import bisect
T = int(input())
lis = [[int(i) for i in input().split()] for _ in range(T)]

w = [2,3,5]


for l in lis:
    n = l[0]
    q = [-n,-1]
    heapq.heapify(q)
    d = {2:l[1],3:l[2],5:l[3],1:l[4]}
    clis = [0,(n-1)*d[1],n*d[1]]
    mlis = [-n,-1,0]
    while True:
        m = heapq.heappop(q)
        if -1 <= m:
            clis[-1] = min([clis[-1],clis[-2]+d[1]])
            break
        ind = bisect.bisect_left(mlis,m)
        clis[-1] = min([clis[-1],clis[ind]-m*d[1]])
        c = clis[bisect.bisect_left(mlis,m)]
        for i in w:
            x = m//i
            y = m%i
            ind = bisect.bisect_left(mlis,x)
            if mlis[ind] == x:
                clis[ind] = min([clis[ind],c +d[i]+ d[1]*y])
            else:
                mlis.insert(ind,x)
                clis.insert(ind,c +d[i]+ d[1]*y)
                heapq.heappush(q,x)
            if y != 0:
                ind = bisect.bisect_left(mlis,x+1)
                if mlis[ind] == x+1:
                    clis[ind] = min([clis[ind],c+d[i]+d[1]*(i-y)])
                else:
                    mlis.insert(ind,x+1)
                    clis.insert(ind,c+d[i]+d[1]*(i-y))
                    heapq.heappush(q,x+1)

    print(clis[-1])


Measured memory_bytes: 10348
#include <stdio.h>
#define N 100

int main(){
  int n, i, j, minj, temp, count=0;
  int A[N+1];
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++) {
    scanf("%d",&A[i]);
  }
  
  for(i =0; i<n-1;i++) {
    minj = i;
    for(j=i;j<n;j++) {
      if(A[j] < A[minj]) minj =j;
    }
    temp = A[i];
    A[i] = A[minj];
    A[minj] = temp;
    if(i != minj) count++;
  }
  
  for(i=0;i<n;i++) {
    if(i < n-1) printf("%d ",A[i]);
    else if(i == n-1) printf("%d\n", A[n-1]);
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
    int A,B,C; cin >> A >> B >> C;
    rep(i,101) {
        if(A * i % B == C) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import math
N, X = map(int, input().split())
arr = list(map(int, input().split()))

kyori = []

for i in arr:
    kyori.append(abs(X-i))

c =math.gcd(kyori[0],kyori[0])
for i in kyori:
    c =math.gcd(c,i)

print(c)






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

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = -1 * (((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};

class LazyBucket{
  public:
  vector<ll> buc,v,minb;
  ll N,sqn,K;
  LazyBucket(){};
  LazyBucket(ll n){
    N = n;
    sqn = sqrt(N);
    K = (n + sqn - 1) /sqn;
    buc.assign(K,-inf);
    minb.assign(K,-inf);
    v.assign(K * sqn,-inf);
  }
  ll find(int x,int y){
    ll res = -1 * inf;
    for (int k = 0; k < K; ++k) {
      int l = k * sqn, r = (k + 1) * sqn;
      if (r <= x || y <= l)
        continue;
      if (x <= l && r <= y) {
        res = min(res,minb[k]);
      } else {
        lazyupdate(k);
        for (int i = max(x, l); i < min(y, r); ++i) {
          res = min(res,v[i]);
        }
      }
    }
    return res;
  }
  void lazyupdate(int k){
    if(k >= K) return ;
    if(buc[k] != -inf){
      for(int i = k * sqn; i < (k+1) * sqn;++i){
        v[i] = buc[k];
      }
      minb[k] = min(minb[k],buc[k]);
    }
    buc[k] = -inf;
  }
  void update(int x,int y,ll n){
    for (int k = 0; k < K; ++k) {
      int l = k * sqn, r = (k + 1) * sqn;
      if (r <= x || y <= l)
        continue;
      if (x <= l && r <= y) {
        buc[k] = n;
        minb[k] = n;
      } else {
        lazyupdate(k);
        for (int i = max(x, l); i < min(y, r); ++i) {
          v[i] = n;
        }
        ll res = -inf;
        for(int i = l; i < r; ++i){
          res = min(res,v[i]);
        }
        minb[k] = res;
      }
    }
  }
  void Debug(){
    cout << "sqn " << sqn << endl;
    for(int i = 0; i < N;++i){
      cout << minb[i/sqn] << ' ';
    }
    cout << endl;
    for(int i = 0; i < N;++i){
      cout << buc[i/sqn] << ' ';
    }
    cout << endl;
    for(int i = 0; i < N;++i){
      cout << v[i] << ' ';
    }
    cout << endl;
  }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, q,s,t,x,a;
  cin >> n >> q;
  LazyBucket buc(n);
  rep(i,q){
    /* buc.Debug(); */
    cin >> a;
    if(a){
      cin >> s >> t;
      cout << buc.find(s,t+1) << endl;
    }
    else{
      cin >> s >> t >> x;
      buc.update(s,t+1,x);
    }
  }
  /* buc.Debug(); */
  return 0;
}

Measured memory_bytes: 3612
/* This code is written by Nemlit */
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define rep(i, a, b) for(re int i = (a); i <= (b); ++ i)
#define drep(i, a, b) for(re int i = (b); i >= (a); -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define int long long
#define D double
#define inf 1023456789
#define mod 1000000007
#define lb(x) (x)&(-(x))
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
il int Mul(int a, int b) { return 1ll * a * b % mod; }
il int Inc(int a, int b) { return (a += b) >= mod ? a - mod : a; }
il int Dec(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
il int qpow(int a, int b) { int r = 1; while(b) { if(b & 1) r = Mul(r, a); a = Mul(a, a), b >>= 1; } return r; }
#define ls k * 2
#define rs k * 2 + 1
#define maxn 2008
namespace Graph {
	int head[maxn], cnt = 1, vis[maxn], dis[maxn], S, T, cost, cur[maxn];
	queue<int>q;
	struct edge { int v, next, w, val; }e[maxn * 50];
	il void add(int u, int v, int w, int val) { 
		e[++ cnt] = (edge){v, head[u], w, val}, head[u] = cnt;
		e[++ cnt] = (edge){u, head[v], 0, -val}, head[v] = cnt; 
	 }
	il int SPFA() {
		mem(dis, 63), mem(vis, 0), q.push(S), dis[S] = 0, memcpy(cur, head, sizeof(head));
		while(!q.empty()) {
			int u = q.front(); q.pop(), vis[u] = 0;
			Next(i, u) {
				int v = e[i].v;
				if(e[i].w && dis[v] > dis[u] + e[i].val) {
					dis[v] = dis[u] + e[i].val;
					if(!vis[v]) vis[v] = 1, q.push(v);
				}
			}
		}
		return dis[T] <= inf;
	}
	il int dfs(int u, int mi) {
		vis[u] = 1;
		if(u == T) return mi;
		int use = 0;
		for(re int &i = cur[u]; i; i = e[i].next) {
			int v = e[i].v;
			if((vis[v] == 0 || v == T) && dis[v] == dis[u] + e[i].val && e[i].w) {
				int low = dfs(v, min(mi, e[i].w));
				if(low) {
					e[i].w -= low, e[i ^ 1].w += low, use += low, mi -= low, cost += e[i].val * low;
					if(!mi) break;
				}
			}
		}
		return use;
	}
	il void init() { mem(head, 0), cnt = 1; }
	il int dinic() {
		while(SPFA()) {
			vis[T] = 1;
			while(vis[T]) mem(vis, 0), dfs(S, inf);
		}
		return cost;
	}
}
using namespace Graph;
int n, m, x[maxn], y[maxn], z[maxn], a[maxn], b[maxn], c[maxn], p1, p2, p3, p4;
signed main() {
	n = read(), S = 0, T = maxn - 1, p1 = maxn - 2, p2 = maxn - 3, p3 = maxn - 4, p4 = maxn - 5;
	rep(i, 1, n) x[i] = read(), y[i] = read(), z[i] = read(), add(S, i, z[i], 0);
	rep(i, 1, n) a[i] = read(), b[i] = read(), c[i] = read(), add(i + n, T, c[i], 0);
	rep(i, 1, n) add(i, p1, inf, x[i] + y[i]), add(i, p2, inf, x[i] - y[i]), add(i, p3, inf, -x[i] + y[i]), add(i, p4, inf, -x[i] - y[i]);
	rep(i, 1, n) add(p1, i + n, inf, -a[i] - b[i]), add(p2, i + n, inf, -a[i] + b[i]), add(p3, i + n, inf, a[i] - b[i]), add(p4, i + n, inf, a[i] + b[i]);
	cout << -dinic();
	return 0;
}


Measured memory_bytes: 1024
using System;
class Program {
    static void Main(string[] args){
        string[] input = Console.ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int k = int.Parse(input[1]);
        double res = 0;
        for(int i = 1; i <= n; i++){
          if(i >= k){
            res += 1 / (double)n;
            continue;
          }
            int count = 1;
            while(i * Math.Pow(2, count) < k) count++;
            res += 1 / (Math.Pow(2, count) * n);
        }
        Console.WriteLine(res);
    }
}

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

public class Main {
	static PrintWriter out;
	static StringBuilder sb;
	static long mod = 998244353;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		int al = (int)  Math.ceil((a) / 0.08);
		int ar = (int) Math.ceil((a + 1) / 0.08)-1;
		int bl = (int)  Math.ceil((b) / 0.1);
		int br = (int) Math.ceil((b + 1) / 0.1)-1;
	//	System.out.println(al + " " + ar + " " + bl + " " + br);
		int ans=0;
		if (bl < al)
			ans = al;
		else
			ans = bl;
		if (ans > br || ans > ar) {
			System.out.println(-1);
			return;
		}
		out.println(ans);
		out.flush();
	}

	static long modPow(long a, long e)

	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res = (res * a) % mod;
			a = (a * a) % mod;
			e >>= 1;
		}
		return res;
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

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

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if (A+B > C+D) {
    cout << "Left" << endl;
  }
    
    else if (A+B == C+D) {
      cout << "Balanced" << endl;
    }
  
      else cout <<  "Right" << endl;
  
}

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

typedef long long ll;
#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define int ll

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define ALL(s) (s).begin(),(s).end()
#define ALLn(s,n) s,s+n
#define F first
#define S second
#define pb push_back
#define tc(t) int t; cin >> t; while(t--)
#define _ ios_base::sync_with_stdio(false); cin.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }

const ll MOD = 1e9 + 7;
const ll MAXN = 1e6 + 7;
const ll INF = LONG_LONG_MAX;

vi adj[MAXN];
int vis[MAXN];

int dfs(int n) {
	vis[n] = 1;
	int cur = 1;

	for (auto x : adj[n]) {
		if (!vis[x]) cur += dfs(x);
	}

	return cur;
}

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

	F0R(i, m) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		adj[u].pb(v);
		adj[v].pb(u);
	}

	int cnt = 0;

	F0R(i, n) {
		if (!vis[i]) {
			int d = dfs(i);
			// D1(d);
			cnt = max(cnt, d);
		}
	}

	cout << cnt;
}

int32_t main() {
	_

#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif

	// tc(t)
	solve();
	cerr << "[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}



Measured memory_bytes: 44400
a, b, c = gets.split.map(&:to_i)
K = gets.to_i
cnt = 0
while true do
  if b <= a
    b *= 2
    cnt += 1
  else
    break
  end
end

while true do
  if c <= b
    c *= 2
    cnt += 1
  else
    break
  end
end
puts cnt <= K ? "Yes" : "No"

Measured memory_bytes: 14168
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long int ll;

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

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

using pii = pair<int, int>;

void Main() {
  Cin(int, n);
  vector<pii> v(n);
  int cnt = 0;
  rep(i, n) {
    Cin(int, a);
    v[i] = {a, cnt++};
  }

  sort(rng(v));
  rep(i, n) {
    if (i) cout << " ";
    cout << v[i].second + 1;
  }
  cout << endl;
}

Measured memory_bytes: 1664
#include<iostream>

using namespace std;

int main() {
	int N;
	cin >> N;
	int wa = 0;
	int x = N;
	while (x > 0) {
		wa += (x % 10);
		x /= 10;
	}
	if (N % wa == 0)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int N, M;
  cin >> N >> M;
  if(N<=M)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

string name;
char type;

int main(){
  while(cin >> name >> type){
    if(type == 'X') break;
    if(name.find("_") != std::string::npos){
      if(type == 'D') goto e;
      if(type == 'U') name[0] -= 32;
      rep(i, name.size()){
	if(name[i] != '_') continue;
	name.erase(name.begin()+i);
	name[i] -= 32;
      }
    }else{
      if(type == 'L' ){ if(name[0] < 97) name[0] += 32;}
      else if(type == 'U'){ if( name[0] > 96) name[0] -= 32;}
      else{
	if(name[0] < 97) name[0] += 32;
	rep(i, name.size()){
	  if(name[i] > 96) continue;
	  name[i] += 32;
	  name.insert(i, "_");
	}
      }
    }
  e:
    cout << name << endl;
  }
  return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define cst(x) cout<<fixed<<setprecision(x)
#define pi 3.14159265359
#define mod 1000000007
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


int n;
vector<int> a;
vector<vector<ll>> dp;
vector<vector<int>> flag;

ll rec(int s,int e){
    if(flag.at(s).at(e)) return dp.at(s).at(e);
    if(s == e) return a.at(s);
    flag.at(s).at(e) = 1;
    return dp.at(s).at(e) = max(a.at(s) - rec(s+1,e) , a.at(e) - rec(s,e-1));
}

int main(){

    cin >> n;
    a.resize(n);
    rep(i,n) cin >> a.at(i);
    dp.resize(n,vector<ll>(n));
    flag.resize(n,vector<int>(n,0));

    cout << rec(0,n-1) << endl;
    return 0;   

}


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

int main() {
  // ここにプログラムを追記
  int S,S1,S2,S3;
  cin >> S;
  S1 = S&0x64?1:0;
  S2 = S&0x0A?1:0;
  S3 = S&0x01?1:0;
  cout << S1+S2+S3 << endl;
}


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

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

    if (r < 1200) puts("ABC");
    else if(r < 2800) puts("ARC");
    else puts("AGC");
}

Measured memory_bytes: 256
m,v = {i: int(raw_input()) for i in range(3)}, {0:500,1:100,2:50}
x = int(raw_input())

def dfs(x, i, m, v):
  	if x < 0: return 0
  	if x == 0 or i == 3: 
  		return 1 if x == 0 else 0   	
  	r = 0
  	for k in range(0, m[i] + 1): r += dfs(x - k * v[i], i + 1, m, v)
  	return r
print dfs(x,0,m,v)


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

using namespace std;
long long MOD = 1000000007LL;
const double PI = 3.14159265358979323846;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

template<class T>
void prime_factorization(T n, map<T, int> &ret) {
	for (long long i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}

	if (n != 1)ret[n] += 1;
}



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

	if (N == 1) {
		cout << 1 << endl;
		return 0;
	}

	map<long long, int> mp;
	for (long long i = 1; i <= N; ++i) {
		prime_factorization(i, mp);
	}
	
	long long ans = 1;
	for (auto iter = mp.begin(); iter != mp.end(); ++iter) {
		long long buf = iter->second;
		ans = (ans * (buf + 1)) % MOD;
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>

int main(int argc, char **argv){

    int a, b;

    std::cin >> a;
    std::cin >> b;

    int sum = a + b;
    int x = sum / 2 + (sum % 2 > 0 ? 1 : 0);

    std::cout << x << std::endl;
    
}


Measured memory_bytes: 256