akhauriyash/Code-Regression huggingface dataset:
import sys
n = int(input())
ans = []
for i in range(n):
    ans.append(int(input()))
ans.sort()
key = ans[0]
count = 1
ans_sum = 0
if len(ans) == 1:
    print(1)
    sys.exit()
for i in range(1,n):
    if key != ans[i]:
        key = ans[i]
        if count%2 == 0:
            count = 1
        else:
            count = 1
            ans_sum += 1
    else:
        count += 1
if count%2 == 0:
    count = 1
else:
    ans_sum += 1
print(ans_sum)


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

int main() {
    int N, K;
    cin >> N >> K;
    long long cnt = 0, cnt2 = 0;
    long long ans = 0;
    rep(i, 1, N + 1) if(i % K == 0) cnt++;
    ans = cnt * cnt * cnt;
    if(K % 2 == 0) {
        rep(i, 1, N + 1) if(i % K == (K / 2)) cnt2++;
        ans = ans + cnt2 * cnt2 * cnt2;
    }
    cout << ans << endl;
    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var temp = Console.ReadLine().Split(" ").Select(s => int.Parse(s)).ToArray();
            int n = temp[0];
            int m = temp[1];
            List<int> a = Console.ReadLine().Split(" ").Select(s => int.Parse(s)).ToList();
            int ans = n - a.Sum();
            if (ans < 0 ) ans = -1;
            System.Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 29132
package main

import (
	"fmt"
	"sort"
)

func main() {
	var A, B, K int
	fmt.Scanf("%d %d %d", &A, &B, &K)

	D := make([]int, 0)

	var X int
	if A > B {
		X = B
	} else {
		X = A
	}

	for i := 1; i <= X; i++ {
		if A % i == 0 && B % i == 0 {
			D = append(D, i)
		}
	}

	sort.Sort(sort.Reverse(sort.IntSlice(D)))
	fmt.Println(D[K-1])
}

Measured memory_bytes: 512
import java.util.*

fun main(argv : Array<String>){
    
    val scan = Scanner(System.`in`)
    
    //
    val S = scan.next()
    var ca = S.toCharArray()
    Arrays.sort(ca)

    //
    var stop : Char = 'a'
    for(c in ca) {
        if(c==stop) {
            stop=c+1
        }
    }
    
    //
    if(stop=='z'+1)
        println("None")
    else
        println(stop)
    
}




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

int n;
int a[100005];

int main()
{
    scanf("%d",&n);
    for(int i = 1; i <= n; i++)
        scanf("%d",&a[i]);
    sort(a,a+n+1);
    int mid = n/2+1;
    int ans = a[mid]-a[mid-1];
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
bool checkPal(string s){
	if(s.length() == 1) return true;
  	int l = 0, r = s.length()-1;
  	while(l < r){
    	if(s[l] != s[r]) return false;
        else{
        	l++;
            r--;
        }
    }
  return true;
}
 
int main(){
  string s;
  cin>>s;
//   cout<<s.substr(0, s.length()/2)<<" "<<s.substr((s.length()+3)/2 -1)<<endl;
  if(checkPal(s) && checkPal(s.substr(0,s.length()/2)) &&
     checkPal(s.substr((s.length()+3)/2 -1))){
     cout<<"Yes"<<endl;
     }else{
     	cout<<"No"<<endl;
     }
}

Measured memory_bytes: 256
using System;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().ToCharArray();

            if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3]){
                Console.WriteLine("Bad");   
            }else{
                Console.WriteLine("Good");
            }
        }
    }
}


Measured memory_bytes: 11092
#include<stdio.h>
int main()
{
    int a,b,c,d;
    while(scanf("%d%d%d",&a,&b,&c)==3)
    {
        d=a-b;
        if(d<c)
          printf("%d\n",c-d);
        else
            printf("0\n");

    }
    return 0;
}


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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
const int INF = 1e9;
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");
#define FOR(i, l, r) for (int i = int(l); i < int(r); ++i)
#define print(a)       for(auto x : a) cout << x << " "; cout << "\n"
#define print1(a)      for(auto x : a) cout << x.ff << " " << x.ss << "\n"
#define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << "\n"


ll fast_exp(ll base, ll exp) {ll res=1;while(exp>0) {if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return res%MOD;}
int gcd(int a,int b){while (a&&b)a>b?a%=b:b%=a;return a+b;}
int val(char c){if (c >= '0' && c <= '9')return (int)c - '0';else return (int)c - 'A' + 10;}
ll pows(int a , int b){ll res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll divisibles(ll a, ll b, ll m){if(a%m==0)return (b/m)-(a/m)+1;else return (b/m)-(a/m);}// in [a,b]
string bitstring(int n, int size){string s;while(n){s+=(n%2)+'0';n/=2;}while(s.size()<size){s+='0';}reverse(all(s));return s;}
// dsu start

vi root(200001,0);
vi size(200001,1);
int find(int x){while(x!=root[x])x = root[x];return x;}
bool same(int a,int b){return find(a)==find(b);}
void unite(int a, int b){a = find(a);b = find(b);if(size[a]<size[b])swap(a,b);size[a] += size[b];root[b] = a;}

// dsu end
vi vis(200001,0);
vi adj[200001];

int main()
{	
    std::ios::sync_with_stdio(false);
    //string bitstring = std::bitset< 3 >( 7 ).to_string(); <bits> (num)
    //srand(time(0));
    //cin.tie(NULL);
    //cout.tie(NULL);
 	int n,a,b;
 	cin>>n>>a>>b;
 	vi vec;
 	for(int i=0; i<n; ++i)
 	{
 		int x;
 		cin>>x;
 		vec.pb(x);
 	}
 	ll cost = 0;
 	for(int i=0; i<vec.size()-1; ++i)
 	{
 		ll x = vec[i];
 		ll y = vec[i+1];
 		ll dist = y - x;
 		if(dist*a<b)
 			cost+=(dist*a);
 		else
 			cost+=b;
 	}
 	cout<<cost<<"\n";
}

Measured memory_bytes: 7932
function Main(s) {
  s = s.split("\n");
  const n = +s[0];
  var ans = 0;
  var m = 1e10;
  for(var i = 0; i < n; i++){
    var a = s[i+1].split(" ").map(a => +a);
    if(a[0] > a[1])m = Math.min(m, a[1]);
    ans += a[0];
  }
  if(m === 1e10)ans = 0;
  else ans -= m;
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 15760
N,M=map(int,input().split())
H=list(map(int,input().split()))
ab=[0]*N
for i in range(M):
    a,b=map(int,input().split())
    ab[a-1]=max(ab[a-1],H[b-1])
    ab[b-1]=max(ab[b-1],H[a-1])
ans=0
for i in range(N):
    if ab[i]<H[i]:
        ans+=1
print(ans)

Measured memory_bytes: 20052
#include <bits/stdc++.h>
#define int long long
#define endre getchar();getchar();return 0
#define INF 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;


int a[5];
signed main() {
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	cout<<a[0]*a[1]/2<<endl;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int n[5],i,j,tmp;

  scanf("%d %d %d %d %d ",&n[0],&n[1],&n[2],&n[3],&n[4]);
  
  for(i=0;i<5;i++){
    for(j=4;j>=i;j--){
      if(n[i] < n[j]){
	tmp = n[i];
	n[i] = n[j];
	n[j] = tmp;
      }
    }
  }

  printf("%d %d %d %d %d\n",n[0],n[1],n[2],n[3],n[4]);
  
  
  return 0;
}

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

int main() {
	int m, d;
	scanf("%d%d", &m, &d);
	int ans = 0;
	for (int i = 1; i <= m; i++) {
		for (int j = 22; j <= d; j++) {
			if ((j % 10) >= 2 && (j / 10) * (j % 10) == i) ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  string S;
  cin >> S;
  int ans = 0;
  rep(i, N-1){
    if(S.at(i) == S.at(i+1)) ans++;
  }
  cout << min(N - 1, ans + 2*K) << endl;

}

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

int main(){
    char b; cin>>b;
    if(b=='A')cout<<'T'<<endl;
    if(b=='T')cout<<'A'<<endl;
    if(b=='C')cout<<'G'<<endl;
    if(b=='G')cout<<'C'<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main (void){
  double r;
  scanf("%lf",&r);
  double pai;
  pai=3.141592653589;
  double x;
  x=r*r*pai;
  double y;
  y=r*2*pai;
  printf("%f %f\n",x,y);
  return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

struct SegmentTree {
private:
	int n;
	vector<int> node;
public:
	SegmentTree(vector<int> vec) {
		n = 1;
		while (n < vec.size()) {
			n *= 2;
		}

		node.resize(2 * n - 1);

		for (int i = 0; i < vec.size(); i++) {
			node[n + i - 1] = vec[i];
		}

		for (int i = n - 2; i >= 0; i--) {
			node[i] = node[2 * i + 1] + node[2 * i + 2];
		}
	}

	void add(int x, int y) {
		x += (n - 1);

		node[x] += y;
		while (x > 0) {
			x = (x - 1) / 2;
			node[x] = node[2 * x + 1] + node[2 * x + 2];
		}
	}

	int getSum(int x, int y, int now = 0, int l = 0, int r = -1) {
		if (r < 0) {
			r = n;
		}

		if (r <= x || y <= l) {
			return 0;
		}

		if (x <= l && r <= y) {
			return node[now];
		}

		return getSum(x, y, 2 * now + 1, l, (l + r) / 2)
			+ getSum(x, y, 2 * now + 2, (l + r) / 2, r);
	}
};

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

	int n, q;
	cin >> n >> q;

	SegmentTree seg(vector<int>(n, 0));
	for (int i = 0; i < q; i++) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com == 0) {
			seg.add(x - 1, y);
		} else {
			cout << seg.getSum(x - 1, y) << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 4156
#include<bits/stdc++.h>
using namespace std;
int t;
long long po[26],p[26],arr[26][26],mk[70000];
vector<int>v;
void re(int bm,int cur)
{
	if(cur==t)
	{
		v.clear();
		for(int i = 0;i < cur;i++)
		{
			if(p[i]==1)
			v.push_back(i);
		}
		long long pp=0;
		for(int i = 0;i < v.size();i++)
		{
			for(int j = i;j < v.size();j++)
			pp+=arr[v[i]][v[j]];
		}
		mk[bm]=max(mk[bm],pp);
		return;
	}
	for(int i = 0;i < 2;i++)
	{
		p[cur]=i;
		if(i==1)
		re(bm|po[cur],cur+1);
		else
		re(bm,cur+1);
	}
}
vector<int>tmp;
void re2(int bm,int cur,int tt,int val)
{
	if(cur==tt)
	{
		mk[val]=max(mk[val],mk[val-bm]+mk[bm]);
		return;
	}
	for(int i = 0;i < 2;i++)
	{
		if(i==1)
		re2(bm|tmp[cur],cur+1,tt,val);
		else
		re2(bm,cur+1,tt,val);
	}
}
main()
{
	po[0]=1;
	for(int i = 1;i < 25;i++)
	po[i]=po[i-1]*2;
	scanf("%d",&t);
	for(int i = 0;i < t;i++)
	{
		for(int j = 0;j < t;j++)
		{
			scanf("%lld",&arr[i][j]);
		}
	}
	re(0,0);
	for(int i = 1;i < po[t];i++)
	{
		int cal=i;
		tmp.clear();
		for(int j = 0;cal>0;j++)
		{
			if(cal%2==1)
			tmp.push_back(po[j]);
			cal/=2;
		}
		re2(0,0,tmp.size(),i);
	}
	printf("%lld",mk[po[t]-1]);
}

Measured memory_bytes: 896
#include <stdio.h>
 
using namespace std;
 
void output(int H[3][10]){
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            printf(" %d",H[i][j]);
        }
        printf("\n");
    }
}
 
 
int main(){
    int H1[3][10],H2[3][10],H3[3][10],H4[3][10],n,h_num,f_num,r_num,div_num;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            H1[i][j] = H2[i][j] = H3[i][j] = H4[i][j] = 0;
        }
    }
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d %d %d %d",&h_num,&f_num,&r_num,&div_num);
        switch(h_num){
        case 1:
            H1[f_num-1][r_num-1] += div_num;
            break;
        case 2:
            H2[f_num-1][r_num-1] += div_num;
            break;
        case 3:
            H3[f_num-1][r_num-1] += div_num;
            break;
        case 4:
            H4[f_num-1][r_num-1] += div_num;
            break;
        }
    }
 
    output(H1);
    printf("####################\n");
    output(H2);
    printf("####################\n");
    output(H3);
    printf("####################\n");
    output(H4);
 
}


Measured memory_bytes: 2704
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    h,w,k=map(int,readline().split())
    grid=[readline().strip() for _ in range(h)]

    output_h=[]
    for i in range(1<<h):
        tmp=[]
        for j in range(h):
            if(i>>j)&1:
                tmp.append(j)
        output_h.append(tmp)
    
    output_w=[]
    for i in range(1<<w):
        tmp=[]
        for j in range(w):
            if(i>>j)&1:
                tmp.append(j)
        output_w.append(tmp)

    ans=0
    for li_h in output_h:
        for li_w in output_w:
            grid_after=[[True]*w for _ in range(h)]
            
            for i in li_h:
                for j in range(w):
                    grid_after[i][j]=False
            
            for j in li_w:
                for i in range(h):
                    grid_after[i][j]=False

            cnt=0
            for i in range(h):
                for j in range(w):
                    if grid_after[i][j]==True and grid[i][j]=="#":
                        cnt+=1
            
            if cnt==k:
                ans+=1

    print(ans)

if __name__=="__main__":
    main()

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

typedef long long ll;

int main()
{
    int n[3];

    scanf("%d %d %d", &n[0], &n[1], &n[2] );

    sort( n, n + 3, greater<int>() );

    printf("%d\n",  n[0] * 10 + n[1] + n[2] );

    return 0;
}


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

using namespace std;

vector<long long> msk;
vector<long long> mdep;

long long find(long long x){
    while(msk[x] != x){
        x = msk[x];
    }

    return x;
}

bool same(long long x, long long y){
    return find(x) == find(y);
}

void unite(long long x, long long y){
    long long xx = find(x);
    long long yy = find(y);

    if(mdep[xx] < mdep[yy]){
        msk[xx] = yy;
    }
    else{
        msk[yy] = xx;
        if(mdep[xx] == mdep[yy]){
            mdep[xx]++;
        }
    }
}

int main()
{
    long long n;
    cin>>n;
    vector<pair<long long,long long>> vec(n);
    for(auto&v:vec){
        cin>>v.first>>v.second;
    }

    vector<pair<long long, long long>> xvec;
    vector<pair<long long, long long>> yvec;

    for(long long i = 0; i < vec.size(); ++i){
        xvec.push_back(make_pair(vec[i].first, i));
        yvec.push_back(make_pair(vec[i].second,i));
    }

    sort(xvec.begin(),xvec.end());
    sort(yvec.begin(),yvec.end());

    vector<pair<long long, pair<long long,long long>>> xdis;
    vector<pair<long long, pair<long long,long long>>> ydis;

    for(long long i = 1; i < xvec.size();++i){
        xdis.push_back(make_pair(xvec[i].first-xvec[i-1].first, make_pair(xvec[i-1].second,xvec[i].second)));
    }

    for(long long i = 1; i < yvec.size(); ++i){
        ydis.push_back(make_pair(yvec[i].first-yvec[i-1].first, make_pair(yvec[i-1].second,yvec[i].second)));
    }

    msk.resize(n);
    mdep.resize(n);
    for(long long i = 0; i < n; ++i){
        msk[i] = i;
        mdep[i] = 0;
    }

    long long left = n-1;
    long long xpos = 0;
    //long long ypos = 0;

    xdis.insert(xdis.end(), ydis.begin(),ydis.end());
    sort(xdis.begin(),xdis.end());
    long long ans = 0;

    while(left){
        if(!same(xdis[xpos].second.first,xdis[xpos].second.second)){
            ans += xdis[xpos].first;
            unite(xdis[xpos].second.first,xdis[xpos].second.second);
            left--;
        }
        xpos++;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 16608
#include <stdio.h>

int main()
{
	int i, N;
	char S;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf(" %c", &S);
		if (S == 'Y') break;
	}
	if (i <= N) printf("Four\n");
	else printf("Three\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1636
from time import time
start = time()

import random


def solve(c_list, days, now):
    r = sum(c_list[i]*(now-days[i]) for i in range(26))
    return r


d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _i in range(d)]


last_days = [-1 for _i in range(26)]
result = []
score = 0
for today in range(d):
    checker = [c[j]*(today-last_days[j]) for j in range(26)]
    y = sum(checker)

    finder = [s[today][j]-(y-checker[j]) for j in range(26)]
    x = finder.index(max(finder))

    last_days[x] = today
    result.append(x+1)
    score += s[today][x] - solve(c, last_days, today)


def change(problems, days):
    last_days = [-1 for _i in range(26)]
    score = 0
    for i in range(d):
        score += s[i][problems[i]-1]
        last_days[problems[i]-1] = i
        score -= sum([c[j]*(i-last_days[j]) for j in range(26)])
    return score

change_list = result.copy()
hantei = True
coun = 0
while hantei:
    if random.randrange(2)<1:
        x, y = random.randrange(0, d), random.randrange(0, d)
        while x == y:
            y = random.randrange(0, d)
        change_list[x], change_list[y] = change_list[y], change_list[x]
        next_score = change(change_list, d)
        if next_score >= score:
            score = next_score
            result[x], result[y] = result[y], result[x]
        elif coun == 25 or coun == 75:
            score = next_score
            result[x], result[y] = result[y], result[x]
        else:
            change_list[x], change_list[y] = change_list[y], change_list[x]
    else:
        x = random.randrange(0, d)
        y = random.randrange(1, 27)
        while change_list[x] == y:
            x = random.randrange(0, d)
            y = random.randrange(1, 27)    
        change_list[x], z = y, change_list[x]
        next_score = change(change_list, d)
        if next_score >= score:
            score = next_score
            result[x] = y
        else:
            change_list[x] = z
    coun += 1
    if coun ==100:
        coun = 0
        if time()-start >= 1.8:
            hantei = False

for i in result:
    print(i)

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

using namespace std;

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

    int N, L;
    cin >> N >> L;
    int bst_dist = 10000, sum = 0;
    for (int i = 1; i <= N; ++i) {
        int cur = L + i - 1;
        sum += cur;
        if (abs(cur) < abs(bst_dist)) {
            bst_dist = cur;
        }
    }
    cout << sum - bst_dist << "\n";

    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class AColorfulSlimes2 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            int[] a = in.nextIntArray(n);
            int ans = 0;
            int count = 1;
            int index = 0;
            while (index < n) {
                while (index < n - 1 && a[index] == a[index + 1]) {
                    index++;
                    count++;
                }
                ans += count / 2;
                count = 1;
                index++;
            }
            out.println(ans);
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

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

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

    }
}



Measured memory_bytes: 21460
<?php
	fscanf(STDIN, "%d", $w);
	fscanf(STDIN, "%d", $n);

	for($i = 1; $i <= $w; $i++) {
		$arr[$i] = $i;
	}

	for($i = 0; $i < $n; $i++) {
		fscanf(STDIN, "%d,%d", $a, $b);
		$arr[$a] ^= $arr[$b];
		$arr[$b] ^= $arr[$a];
		$arr[$a] ^= $arr[$b];
	}

	for($i = 1; $i <= $w; $i++) {
		print $arr[$i] . "\n";
	}
?>

Measured memory_bytes: 6568
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	string s; cin >> s;
	rep(i, s.size())
	{
		cout << "x";
	}
}

Measured memory_bytes: 256
import sys

n = input()
for i in range(n):
    a = list(reversed(map(int, raw_input())))
    b = list(reversed(map(int, raw_input())))
    if len(a) < len(b):
        a, b = b, a
    for j in range(len(a)):
        if j < len(b):
            a[j] += b[j]
        if a[j] >= 10:
            a[j] -= 10
            if j != len(a) - 1:
                a[j + 1] += 1
            else:
                a.insert(len(a), 1)
    if len(a) > 80:
        print "overflow"
    else:
        for x in reversed(a):
            sys.stdout.write("%d" %x)
        print

Measured memory_bytes: 4256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	int ans = 0;
	rep(i, n) {
		string s; cin >> s;
		if (s == "E869120")ans++;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3232
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

unsigned getdigit(unsigned NUM){
    return log10(NUM) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

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


/////////////////////////////////////////////////////////////////////////////////////////
int main(){
    int n,m;
    cin >> n >> m;
    int num[5];
    memset(num,-1,sizeof(num));
    bool ok = true;
    for (int i = 0;i < m;i++){
        int s,c;
        cin >> s >> c;
        if (num[s] != -1 && num[s] != c){
            cout << -1 << endl;
            return 0;
        }
        else {
            num[s] = c;
        }
    }

    string ans = "";

    if (n > 1 && num[1] == 0) cout << -1 << endl;
    else if (n == 1){
        if (num[1] == -1) cout << 0 << endl;
        else cout << num[1] << endl;
    }
    else {
        for (int i = 1;i <= n;i++){
            if (i == 1 && num[i] == -1) ans += to_string(1);
            else if (num[i] == -1) ans += to_string(0);
            else ans += to_string(num[i]);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    h,w = LI()
    board = []
    for _ in range(h):
        line = list(S())
        board.append(line)
    
    wpro = []
    wline = ["." for _ in range(w)]

    for line in board:
        if line != wline:
            wpro.append(line)
    
    hpro = list(zip(*wpro))
    hline = tuple(["." for _ in range(len(hpro[0]))])
    # print(hline)
    ans = []
    # print(hpro)
    for line in hpro:
        if line!= hline:
            ans.append(line)
    
    ans = list(zip(*ans))
    for line in ans:
        print("".join(line))
main()

Measured memory_bytes: 74552
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const long long INF = 1LL<<60;

int main() {
    int V=10;
    int E=10;
    int H,W;
    cin >> H >> W;
    // initialization of Floyd-Warshall
    vector<vector<long long> > dp(V, vector<long long>(V, INF));
    for (int i = 0; i < V; ++i) dp[i][i] = 0;  // necessary
    
    // input
    for(int v=0;v<V;++v){
      for (int e=0;e<E;++e) {
        int w;
        cin >> w;
        dp[v][e] = w;
      }
    }
    // Floyd-Warshall
    for (int k = 0; k < V; ++k)
        for (int i = 0; i < V; ++i)
            for (int j = 0; j < V; ++j)
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
    
    // output
    long long sum=0;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            int w;
            cin >> w;
            if(w<0);
            else sum+= max(dp[w][1],0LL);
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3568
# -*- coding: utf-8 -*-
n,k = map(int, input().split())
s = input()

il = [0]

for i in range(1,n):
    if s[i]!=s[i-1]:
        il.append(i)

res = -1
for i in range(len(il)):
    if s[il[i]]=="0":
        ri = i+2*k
    else:
        ri = i+2*k+1

    if ri>=len(il):
        r = n
    else:
        r = il[ri]
    res = max(res, r-il[i])

print(res)


Measured memory_bytes: 7108
#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector <ll> vec[100009];
ll ans=0;
ll len[100009]={0};
ll dp[100009];
bool visited[100009]={0};
void dfs(ll cur)
{
    len[cur]=1;
    visited[cur]=1;
    for(int i:vec[cur])
    {
        if(dp[i]!=-1)
            {len[i]=dp[i];}
        else
        {dfs(i);

        }
        dp[cur]=len[cur]=max(len[i]+1,len[cur]);
    }
}
int main()
{
    ll i,j,k,l,m,n;
    cin>>n>>m;
    ll a,b;
    memset(dp,-1,sizeof dp);
    for(i=0;i<m;i++)
        {
            cin>>a>>b;
            vec[a].push_back(b);
        }

        ll ans=0;
    for(i=1;i<=n;i++)
    {
        if(!visited[i])
            dfs(i);
        ans=max(ans,len[i]);
    }


    cout<<ans-1<<endl;



}


Measured memory_bytes: 13468
/*
    AUTHOR:hruday pabbisetty
    NIT ROURKElA(My_College_Sucks)
*/
#include <bits/stdc++.h>
using namespace std;
#define opt ios_base::sync_with_stdio(0)
#define lli long long int
#define ulli unsigned long long int
#define I int
#define S string
#define D double
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define in(n) scanf("%lld",&n)
#define in2(a,b) scanf("%lld %lld",&a,&b)
#define in3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define out(n) printf("%lld\n",n)
#define inu(a) scanf("%lld",&a)
#define outu(a) printf("%llu",a)
#define ins(s) scanf("%s",&s)
#define outs(s) printf("%s",s)
#define nl printf("\n")
#define mod 1000000007
#define inf 100000000000000
typedef long long       ll;
typedef pair<lli,lli>  plli;
typedef vector<lli>     vlli;
typedef vector<ulli>    vulli;
typedef vector<ll>      vll;
typedef vector<string>  vs;
typedef vector<plli>     vplli;
#define MM(a,x)  memset(a,x,sizeof(a));
#define ALL(x)   (x).begin(), (x).end()
#define P(x)       cerr<<"{"#x<<" = "<<(x)<<"}"<<endl;
#define P2(x,y)       cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<"}"<<endl;
#define P3(x,y,z)  cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"}"<<endl;
#define P4(x,y,z,w)cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<", "#w" = "<<(w)<<"}"<<endl;
#define PP(x,i)     cerr<<"{"#x"["<<i<<"] = "<<x[i]<<"}"<<endl;
#define TM(a,b)     cerr<<"{"#a" -> "#b": "<<1000*(b-a)/CLOCKS_PER_SEC<<"ms}\n";
#define UN(v)    sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define sz() size()
#define nl cout<<"\n"
#define MX1 100005
#define MX2 1000005
#define sqr(a) a*a*a
#define bs binary_search
#define lb lower_bound
#define ub upper_bound

lli power(lli a,lli b)
    {
    lli value;
    if(b==0)
        {
        return 1;
    }
    else if(b%2==0)
        {
        value=power(a,b/2)%mod;
        return(value*value)%mod;
    }
    else
        {
        value=power(a,b/2)%mod;
        return ((a*value)%mod*(value))%mod;
    }
}
vplli v[100005];
lli visited[100005],d[100005];
void DFS(lli k)
{
    visited[k]=1;
    lli i;
    rep(i,0,v[k].sz())
    {
        if(!visited[v[k][i].f])
        {
            d[v[k][i].f]=d[k]+v[k][i].s;
            DFS(v[k][i].f);
        }
    }
}
int main()
{
      /*  #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif*/
    opt;
    lli n,m;
    cin>>n;
    m=n-1;
    while(m--)
    {

        lli x,y,w;
        cin>>x>>y>>w;
        v[x].pb(mp(y,w));
        v[y].pb(mp(x,w));
    }
    lli q,k;
    cin>>q>>k;
    d[k]=0;
    DFS(k);
    while(q--)
    {
        lli x,y;
        cin>>x>>y;
        cout<<d[x]+d[y]<<endl;
    }
}


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

int main(){
  int N;
  cin>>N;
  vector<int> alpha(N);
  vector<int> beta(N-1);
  for(int i=0; i<N-1; i++){
    int B;
    cin>>B;
    beta.at(i)=B;
  }
  alpha.at(0)=beta.at(0);
  int sum=alpha.at(0);
  for(int i=1; i<N-1; i++){
    alpha.at(i)=min(beta.at(i-1), beta.at(i));
    sum+=alpha.at(i);
  }
  cout<<sum+beta.at(N-2)<<endl;
}


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

using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    for (int i=1; i<=30; i++) {
        if (b==1) {
            cout<<"0"<<endl;
            return 0;
        }
        if (b<=a*i-(i-1)) {
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int count = 0;
    int num = 1;
    int n = Integer.parseInt(stdIn.next());
    int[] a = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = Integer.parseInt(stdIn.next());
    }

    for (int i = 0; i < n; i++) {
      if (a[i] == num) num++;
      else count++;
    }

    if (count > n - 1) count = -1;

    System.out.println(count);
  }
}


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

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char SMAX(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char SMIN(A &a, const B &b) {return b < a ? a = b , 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I>
inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

const int N = 1e5 + 7;

int n, m, x, y, rt, idg[N], fa[N];

struct Edge {int to, ne;} g[N]; int head[N], tot;
inline void Addedge(int x, int y) {g[++tot].to = y; g[tot].ne = head[x]; head[x] = tot;}

int q[N], hd, tl;
inline void BFS() {
	q[++tl] = rt;
	while (hd < tl) {
		int x = q[++hd];
		for fec(i, x, y) if (!--idg[y]) fa[y] = x, q[++tl] = y;
	}
}

int main() {
	#ifdef hzhkk
	freopen("hkk.in", "r", stdin);
	#endif
	read(n), read(m);
	for (int i = 1; i <= n - 1 + m; ++i) read(x), read(y), Addedge(x, y), ++idg[y];
	for (int i = 1; i <= n; ++i) if(!idg[i]) rt = i;
	BFS();
	for (int i = 1; i <= n; ++i) printf("%d\n", fa[i]);
}

Measured memory_bytes: 3200
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <cmath>
#include <queue>
#include <ctime>
#include <utility> // std::pair
#include <functional> // std::greater <int> ()
#define int long long
#define inf 1000000000000000001
#define BASE 29 // hashings mod, can be rand'd
#define mod 998244353 // can be 1000000007
#define pi 3.1415926535897
#define pii pair <int, int>
#define fii first
#define see second

typedef long long ll;
typedef long double ld;
using namespace std;

int n, cnt=0;
int tmp;

// functions
void input(){
	cin >> n;
	return;
}

void solve(){
	for(int i=1; i<=n; i++){
		cin >> tmp;
		while(tmp%2==0){
			cnt++;
			tmp/=2;
		}
	}
	return;
}

void output(){
	cout << cnt;
	return;
}

signed main(){
/*
//  REMEMBER TO TURN OFF IFDEF IN PROBLEMS WITH FILE I/O
*/
//#ifdef sheeep
//	freopen("forces.inp", "r", stdin);
//	freopen("forces.out", "w", stdout);
//#endif
	ios_base::sync_with_stdio(false);
//	int t;
//	cin >> t;
//	for(int i=1; i<=t; i++){
		input();
		solve();
		output();
//	}
	return 0;
}
// Author: NamSPro



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; cin >> N; 
	int X[60] = {}; int Y[60] = {}; 
	map<pair<int, int>, int> S; 
	for(int i = 0; i < N; i++){
		cin >> X[i] >> Y[i]; 
	}
	for(int i = 0; i < N; i++){
		for(int j = i+1; j < N; j++){
			S[make_pair(X[i]-X[j], Y[i]-Y[j])] ++; 
			S[make_pair(X[j]-X[i], Y[j]-Y[i])] ++; 
		}
	}
	int mx = 0; 
	for(int i = 0; i < N; i++){
		for(int j = i+1; j < N; j++){
			mx = max(mx, S[make_pair(X[i]-X[j], Y[i]-Y[j])]); 
			mx = max(mx, S[make_pair(X[j]-X[i], Y[j]-Y[i])]); 
		}
	}
	cout << N - mx << endl; 
}

Measured memory_bytes: 384
# 解答AC

A,B,C = map(int, input().split())

is_even = lambda n: True if n % 2 == 0 else False

if A == B == C:
    if A % 2 == 0: print(-1)
    else: print(0)
else:
    cnt = 0
    while is_even(A) and is_even(B) and is_even(C):
        cnt += 1
        A,B,C = (B + C) // 2, (A + C) // 2, (A + B) // 2
    print(cnt)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

int main() {
    
    int table[1001] = {0};
    int n;
    cin >> n;
    rep3(i, 2, n + 1) {
        int tmp = i;
        rep3(j, 2, n + 1) {
            while (tmp % j == 0) {
                tmp /= j;
                table[j]++;
            }
        }
    }
    // rep(i, n + 1) cout << table[i] << " "; cout << endl;
    
    ll ans = 1;
    rep(i, n + 1) {
        if (table[i]) {
            (ans *= table[i] + 1) %= inf;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int n,i,a;
long long int max=-1000000,min=10000000,sum=0;
scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(min>=a){
			min=a;
		}
		if(max<=a){
			max=a;
		}
		sum+=a;
	}
	printf("%lld %lld %lld\n",min,max,sum);
	
return 0;
}


Measured memory_bytes: 2088
turns = int(input())
taro = 0
hanako = 0

for i in range(turns):
    t_card, h_card = input().split(" ")
    if t_card > h_card:
        taro += 3
    elif t_card == h_card:
        taro += 1
        hanako += 1
    else:
        hanako += 3
print(taro, hanako)


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

typedef vector<int> vi;
#define ll long long
#define loop(i,n) for(int i=0; i<n; i++)
#define loop1(i,n) for(int i=1; i<=n; i++)
#define loopi(i,s,e) for(int i=s; i < e; i++)
#define loopiRev(i,s,e) for(int i=s; i >= e; i--)
#define PI 3.14159265359
#define x first
#define y second
#define point pair<double,double>
#define len(s)   (int)s.length()
#define sz(v)    (int)v.size()
#define all(a)   a.begin(),a.end()
#define clr(x, val)	memset((x), (val), sizeof(x))

void initialize(vector<int> &F, int n){
    F = vector<int> (n+1, 0);

    for(int i=2; i*i  <= n; i++){
        if(F[i] == 0)
            for(int k=i*i; k <=n ; k+= i)
                if(F[k] == 0) F[k] = i;
    }
}

//you don't know math, unless you can do math!
int l,n;
vector<int> cuts;
ll dp[1100][1100];

ll solve(int i, int j){
    ll &ret= dp[i][j];
    if(ret != -1)
        return ret;

    int cur= lower_bound(cuts.begin(), cuts.end(), i+1) - cuts.begin();
    if(cur == cuts.size() || cuts[cur] >= j)
        return ret= 0;



    ret= 10000000;
    while(cur < n && cuts[cur] < j){
        ret = min(ret, solve(i, cuts[cur]) + solve(cuts[cur], j) + j - i);
        cur++;
    }

    return ret;
}
int main() {
    //freopen("input.txt" , "r" , stdin) ;
    //freopen("output.txt" , "w" , stdout) ;

    cin.tie(0);
    cin.sync_with_stdio(0);

   string a,b; cin>>a>>b;
   while(a.length() < b.length())
        a= '0' + a;
   while(b.length() < a.length())
        b= '0' + b;


   for(int i=0; i <  b.length() ; i++){
    if(a[i] > b[i])
        return cout<<"GREATER",0;
    else if(b[i] > a[i])
        return cout<<"LESS",0;
   }

   cout<<"EQUAL";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fr(i,a,n) for(ll i=a;i<n;i++)
#define YES cout<<"YES"<<endl
#define all(v) v.begin(),v.end()
#define NO cout<<"NO"<<endl
#define pb(x) emplace_back(x)
#define fastio std::ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define vi vector<ll>
#define mi map<ll,ll>
#define pi pair<ll,ll>
#define what(x) cout<<#x<<" ="<<x<<endl;
using namespace std;
using ll =long long;
vi adj[200005],vis(200005);

ll dfs(ll u)
{
    ll cnt=0;
    vis[u]=1;
    cnt++;

    for(auto v:adj[u])
        if(vis[v]==0)cnt+=dfs(v);

    return cnt;

}

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

        fr(i,0,m)
        {
            ll x,y;
            cin>>x>>y;

            adj[x].pb(y);
            adj[y].pb(x);


        }

        ll ans=0;

        fr(i,1,n+1)
        {
            ll s=0;

            if(vis[i]==0)s=dfs(i);
            ans=max(ans,s);
        }
        cout<<ans<<endl;


}




























Measured memory_bytes: 21732
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
bool prime(ll n){
    for(ll i = 2; i * i <= n; i++)
        if(n % i == 0)
            return false;
    return true;
}
int main()
{
    Hello
    ll a, b;
    cin >> a >> b;
    ll n = max(a, b);
    set <ll> v;
    for(ll i = 1; i * i <= n; i++){
        if(a % i == 0 && b % i == 0 && prime(i))
                v.insert(i);
        if(b % i == 0 && (a) % (b/i) == 0 && prime(b/i))
            v.insert(b/i);
        if(a % i == 0 && (b) % (a/i) == 0 && prime(a/i))
            v.insert(a/i);
    }
    cout << v.size();
    //cout << endl;
    //for(auto i : v)
    //    cout << i << " ";
    return 0;
}


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

enum color{
    r,bl
};

set<int> s;
vector<pair<pair<int,int>,color>> v;


int main() {

    int n;

    cin >> n;

    int a[101],b[101],c[101],d[101];

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

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

    pair<int,int> red[101],blue[101];

    for(int i=0; i<n; i++){
        red[i] = make_pair(a[i],b[i]);
        blue[i] = make_pair(c[i],d[i]);
        v.push_back(make_pair(red[i],r));
        v.push_back(make_pair(blue[i],bl));
    }

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

    int ans = 0;

    for(int i=0; i<2*n; i++){
        if(v[i].second == r){
            s.insert(v[i].first.second);
        }
        else if(v[i].second == bl){
            if(!s.empty()){
                int max_red_y = -1;
                set<int>::iterator del_itr = s.end();
                for(set<int>::iterator itr=s.begin(); itr != s.end(); itr++){
                    if(*itr < v[i].first.second){
                        if(max_red_y < *itr){
                            max_red_y = *itr;
                            del_itr = itr;
                        }
                    }
                }
                if(del_itr != s.end()) {
                    s.erase(del_itr);
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int n,q;
main()
{
	cin>>n>>q;
	vector<queue<int> >s(n);
	for(int i=0;i<q;i++)
	{
		int c;cin>>c;
		if(c==0)
		{
			int t,x;cin>>t>>x;
			s[t].push(x);
		}
		else if(c==1)
		{
			int p;cin>>p;
			if(!s[p].empty())cout<<s[p].front()<<endl;
		}
		else
		{
			int t;cin>>t;
			if(!s[t].empty())s[t].pop();
		}
	}
}


Measured memory_bytes: 4168
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int n;
    cin>>n;
    vector<vector<int>> dist(n,vector<int>(n));
    rep(i,n)rep(j,n)dist[i][j]=abs(i-j);
    int l,r;
    cin>>l>>r;
    --l;--r;
    rep(i,n)rep(j,n){
        dist[i][j]=min(dist[i][j],dist[i][l]+dist[r][j]+1);
        dist[i][j]=min(dist[i][j],dist[i][r]+dist[l][j]+1);
    }
    vector<int> cnt(n);
    rep(i,n)rep(j,n)cnt[dist[i][j]]++;
    rep(i,n-1)cout<<cnt[i+1]/2<<endl;
}

Measured memory_bytes: 16000
# -*- coding: utf-8 -*-
import math
import sys

## input
n,a,b,c = map(int, sys.stdin.readline().rstrip().split())
len_s = []
for _ in range(n):
  len_s.append(int(sys.stdin.readline().rstrip()))

def solve(abc, mp, k):
  if k < 0:
    if abc[0]==0 or abc[1]==0 or abc[2]==0:
      return 10000
    else:
      return mp + abs(abc[0]-a) + abs(abc[1]-b) + abs(abc[2]-c) - 30
  else:
    add_a = solve([abc[0]+len_s[k],abc[1],abc[2]], mp+10, k-1)
    add_b = solve([abc[0],abc[1]+len_s[k],abc[2]], mp+10, k-1)
    add_c = solve([abc[0],abc[1],abc[2]+len_s[k]], mp+10, k-1)
    add_no = solve([abc[0],abc[1],abc[2]], mp, k-1)
    return min(add_a, add_b, add_c, add_no)

if __name__ == "__main__":
  print(solve([0, 0, 0], 0, n-1))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;
const int N = 100005;

char t[25];

int main() {
scanf("%s", t);
printf("%c%c%c\n", t[0], t[1], t[2]);
return 0;
}

Measured memory_bytes: 3752
import scala.io.StdIn.readLine

object Main {
  val gesIndex = Map("Rock"->0,"Fire"-> 1, "Scissors" -> 2, "Snake" -> 3,
                    "Human"->4, "Tree"->5, "Wolf"->6, "Sponge"->7,
                    "Paper"->8, "Air"->9, "Water"->10, "Dragon"->11,
                    "Devil"->12, "Lightning"->13, "Gun" -> 14)

  def scan(list:Array[Int],i:Int,n:Int):String = {
    if(i==n) "Draw"
    else {
      val win = (list((i+1)%n)-list(i)+15)%15
      val j = if(i>0) i-1 else n-1
      val lose = (list(i)-list(j)+15)%15
      if(win<=7 && lose>7) gesIndex.find(_._2==list(i)).map(_._1).get
      else scan(list,i+1,n)
    }
  }

  def main(args:Array[String]) = {
    var n = 0
    while({n=readLine.trim.toInt;n}!=0) {
      val list = {for(i<-1 to n) yield gesIndex(readLine.trim)}.toArray.sorted
      println(scan(list,0,list.length))
    }
  }
}

Measured memory_bytes: 54816
def calc(A):
    if A <= 0:
        return 0

    # i桁目の偶奇を調べる
    ans = 0
    for i in range(50):
        # 0桁目 -> 周期2
        # 1桁目 -> 周期4
        # 2桁目 -> 周期8
        # ...
        loop = 1 << (i+1)
        cnt = (A // loop) * (loop // 2)
        cnt += max(0, (A % loop) - (loop // 2) + 1)

        # その桁の１の数が奇数だったら足す
        if cnt % 2 == 1:
            ans += 1 << i

    return ans


A, B = map(int, input().split())

ans = calc(B) ^ calc(A-1)

print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;

/**
 * Created by User on 2017/02/07.
 */
public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);

        int n = scn.nextInt();
        int max = 0;
        int x = 0;
        String s = scn.next();

        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == 'I') {
                x++;
                if (x > max) {
                   max = x;
                }
            } else {
                x--;
            }
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 9808
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=2147483647;
const ll inf=1e16;
const ll ms=(100000) +5;

int main()
{
    idfc;

    int n;
    cin>>n;
    int ans=n/2;
    if(n%2)ans++;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256