akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sn = new Scanner(System.in);
        
        long n = sn.nextLong();
        long sum = 0;
        
        for(long i = 1; i <= n; i++) {
            if((i % 3) == 0 || (i % 5) == 0 || (i % 15) == 0) {
            } else {
                sum += i;
            }
        }
        
        System.out.print(sum);
    }
}


Measured memory_bytes: 35720
#include<stdio.h>
int main(){
  int a,b,c,n,N;
       scanf("%d",&N);
    for(n=1;n<=N;n++){

     scanf("%d %d %d",&a,&b,&c);
  
     if((a*a)+(b*b)==(c*c) || (a*a)+(c*c)==(b*b) || (b*b)+(c*c)==(a*a) )
         {  printf("YES\n");  }
       else
         {  printf("NO\n");   }
    }

    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main()
{
	string s;
	cin >> s;
	map<char, int> mp;
	for (int i = 0; i < s.length(); i++) {
		mp[s[i]]++;
	}
	if (mp.size() == 2 && mp[s[0]] == 2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
       Scanner stdIn = new Scanner(System.in);
        int[] mountain_height = new int[10];
        
        for(int j = 0; j<mountain_height.length; j++){
           mountain_height[j] = stdIn.nextInt();
        }
        Arrays.sort(mountain_height);
        
        for(int i=mountain_height.length-1; i>=mountain_height.length-3; i--){
            System.out.println(mountain_height[i]);
        }
     }
    
}

Measured memory_bytes: 26180
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(void){
  int n,i,j,din;
  const int mod=998244353;
  ll d[100010]={},ans=1;
  cin >> n;
  for (i=0;i<n;i++){
    cin >> din;
    if (i==0 && din!=0){
      cout << 0 << endl;
      return 0;
    }
    d[din]++;
  }
  if (d[0]!=1){
    cout << 0 << endl;
    return 0;
  }
  for (i=1;i<n;i++){
    for (j=0;j<d[i];j++) ans=(ans*d[i-1])%mod;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    
    long long n,m,k,count=0,ans=0,sum=0,l,r,i,j,x,y;
    cin>>k>>n;
    if(n==0)
    {
        cout<<k; return 0;
    }
    long long a[n],b[200]={0};
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        b[a[i]]++;
    }
    for(i=k;i<200;i++)
    {
        if(b[i]==0)
        break;
    }
    count=i;
    for(i=k-1;i>=0;i--)
    {
        if(b[i]==0)
        break;
    }
    if((count-k)<(k-i))
    cout<<count;
    else
    cout<<i;
	return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  string S, T;
  cin>>S>>T;
  int num = 0;
  bool can;
  for(int i=0;i<N;++i) {
    can = true;
    for(int j=0;j<N-i;++j) {
      if(S[i+j]!=T[j]) can = false;
    }
    if(can) {
      num = N-i;
      break;
    }
  }
  cout<<2*N-num<<endl;
}


Measured memory_bytes: 3604
n = int(input())
a = list(map(int, input().split()))

x = []
y = {}

for i, elem in enumerate(a):
    x.append(i+a[i])
    y[i-a[i]] = y.get(i-a[i], 0) + 1

ans = 0

for i in x:
    ans += y.get(i, 0)

print(ans)


Measured memory_bytes: 46164
from scipy.sparse.csgraph import floyd_warshall
import numpy as np

N, M, L = map(int, input().split())
graph = np.zeros((N, N))
for _ in range(M):
    s, t, w = map(int, input().split())
    graph[s-1][t-1] = graph[t-1][s-1] = w
floyd_warshall(graph, directed=False, overwrite=True)
graph = np.where((graph == 0) | (graph > L), 0.0, 1.0)
floyd_warshall(graph, directed=False, overwrite=True)

Q = int(input())
for _ in range(Q):
    s, t = map(int, input().split())
    ans = graph[s-1][t-1]
    if ans == float("inf"):
        print(-1)
    else:
        print(int(ans - 1))


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

using namespace std;

int main()
{
    string S;
    int N;
    cin >> N;
    long long ans = 0;
    for (int i = 1; i <= N; i++)
    {  
        if(i%3 == 0|| i%5 ==0) continue;
        ans += i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
def main():
    N = int(input())
    level1 = int(str(N)[-1])
    if level1 == 3:
        print("bon")
    elif level1 == 0 or level1 == 1 or level1 == 6 or level1 == 8:
        print("pon")
    else:
        print("hon")
    
    return


if __name__=="__main__":
    main()



Measured memory_bytes: 9176
<?php

$x = trim(fgets(STDIN));
$eight = range(400,599);
$seven = range(600,799);
$six   = range(800,999);
$five  = range(1000,1199);
$four  = range(1200,1399);
$three = range(1400, 1599);
$two   = range(1600, 1799);
$one   = range(1800, 1999);

switch ($x){
    case in_array($x, $eight):
        echo "8";
        break;
    case in_array($x, $seven):
        echo "7";
        break;
    case in_array($x, $six):
        echo "6";
        break;
    case in_array($x, $five):
        echo "5";
        break;
    case in_array($x, $four):
        echo "4";
        break;
    case in_array($x, $three):
        echo "3";
        break;
    case in_array($x, $two):
        echo "2";
        break;
    case in_array($x, $one):
        echo "1";
        break;
}


Measured memory_bytes: 16264
#include <iostream>
#include <cmath>

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

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

int main()
{
    int N, ans = 0;
    cin >> N;

    for(int i = 1; i <= N; i++) {
        if((int)log10(i) % 2 == 0) {
            ans++;            
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define MOD 1000000007
typedef long long int ll;
int main()
{
    ll n,k,sum=0;
    string s;
    int a,b,c,d;
    cin>>n;
    set<string>se;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        se.insert(s);
    }
    cout<<se.size()<<endl;

}


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

int n, a[88];
ll x = 1000;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> n;
	for(int i=1;i<=n;i++) cin >> a[i];
	for(int i=1;i<n;i++){
		if(a[i] < a[i+1]) x = x % a[i] + x / a[i] * a[i+1];
	}
	cout << x;
}

Measured memory_bytes: 3612
# -*- coding: utf-8 -*-
# import numpy as np

N, M, Q = map(int, input().split())

# Xi = np.zeros((N+1,N+1),dtype=np.int32)
Xi = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
    L, R = map(int, input().split())
    Xi[L][R] += 1

# Ci = np.zeros((N+1,N+1),dtype=np.int32)
Ci = [[0]*(N+1) for i in range(N+1)]
tmp = 0
for l in range(N+1):
    for r in range(N+1):
        tmp += Xi[l][r]
        Ci[l][r] = tmp

# print(Ci)

for r in range(N+1):
    tmp = 0
    for l in range(N+1):
        tmp += Ci[l][r]
        Ci[l][r] = tmp

# print(Ci)

pqi = []
for i in range(Q):
    p, q = map(int, input().split())
    pqi.append((p,q))

for (p, q) in pqi:
    tmp = Ci[q][q] - Ci[q][p-1]  - Ci[p-1][q] + Ci[p-1][p-1]
    print(tmp)


Measured memory_bytes: 26220
/* in the name of Anton */

/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) ((lli)(x).size())
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;


const auto start_time = std::chrono::high_resolution_clock::now();
void aryanc403()
{
#ifdef ARYANC403
auto end_time = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n;
    map<lli,lli> mm;
    fo(i,n)
    {
        cin>>in;
        mm[in]++;
    }
    for(auto x:mm)
    {
        if(x.X<=x.Y)
            x.Y-=x.X;
        cnt+=x.Y;
    }
    cout<<cnt<<endl;
}   aryanc403();
    return 0;
}


Measured memory_bytes: 9576
#include <iostream>

using namespace std;

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

    int x = n % 1000;
    int y = n / 10;
    if (x % 111 == 0 || y % 111 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
 ll n;
 cin>>n;
 vector<ll> a(n);
 for(ll i=0;i<n;i++) cin>>a[i];
 vector<vector<ll>> dp(n,vector<ll>(2));
 dp[n-1][0]=a[n-1];
 dp[n-1][1]=-a[n-1];
 dp[n-2][0]=max(a[n-1]+a[n-2],-(a[n-1]+a[n-2]));
 dp[n-2][1]=max(-a[n-2]+a[n-1],a[n-2]-a[n-1]);
 for(ll i=n-3;i>=0;i--){
  dp[i][0]=max(a[i]+dp[i+1][0],-a[i]+dp[i+1][1]);
  dp[i][1]=max(-a[i]+dp[i+1][0],a[i]+dp[i+1][1]);
 }
 cout<<dp[0][0]<<endl;
 return 0;
}

Measured memory_bytes: 6528
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int C = sc.nextInt();
    int K = sc.nextInt();
    int[] T = new int[N];
    for (int i = 0; i < N; i++) {
      T[i] = sc.nextInt();
    }
    Arrays.sort(T);
    int ans = 1;
    int count = 1;
    int from = T[0];
    int to = T[0] + K;
    for (int i = 1; i < N; i++) {
      if (from <= T[i] && T[i] <= to && count < C) {
        from = T[i];
        count++;
      } else {
        ans++;
        count = 1;
        from = T[i];
        to = T[i] + K;
      }
    }
    System.out.println(ans);
  }
}

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

using namespace std;

const double PI = 3.141592653589;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    if(n == m) cout << "Yes";
    else cout << "No";
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ld long double
#define pb push_back
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define umap unordered_map
#define uset unordered_set
#define forz(i, n) for (ll i = 0; i < n; i++)
#define fore(i, m, n) for (ll i = m; i <= n; i++)
#define forr(i, n, m) for (ll i = n; i >= m; i--)
#define itor(it,x) for(auto it=x.begin();it!=x.end();it++)
#define itor2(it,x) for(auto it=x->begin();it!=x->end();it++)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define deci(n) fixed << setprecision(n)
#define setbits(n) __builtin_popcountll(n)
#define zrobits(n) __builtin_ctzll(n)
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define gcd __gcd
#define raunak ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define pv(v) forz(qaz,v.size()) cout<<v[qaz]<<" "; cout<<endl;
#define pa(arr,n) forz(qaz,n) cout<<arr[qaz]<<" "; cout<<endl;

#define oset tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

ll po(ll a,ll b,ll m){
    ll res=1;
    while(b>0){
        if(b&1) res=((res%m)*(a%m))%m;
        a=((a%m)*(a%m))%m;
        b>>=1;
    }
    return res;
}
ll modi(ll a,ll m){
    return po(a,m-2,m);
}
ll lcm(ll a, ll b){ 
    return (a*b)/(gcd(a, b));
}

/////////////////////(^_^)/////////////////////(^_^)/////////////////////(^_^)/////////////////////

int main(){
    raunak;
    ll* a=new ll[10000001];
    forz(i,10000001) a[i]=0;
    fore(i,1,10000000){
        //ll j=i;
        ll x=1;
        while(i*x<=10000000){
            a[i*x]++;
            x++;
        }
    }
    ll n;
    cin>>n;
    ll ans=0;
    fore(i,1,n){
        ans+=i*a[i];
    }
    p1(ans);
    return 0;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,m,i,sqt,res=0;
    cin>>n>>m;
    sqt=(int)ceil(sqrt(m));
    for(i=1;i<=sqt;i++)
    {
        if(m%i==0)
        {
            if(i>=n)res=max(res,m/i);
            if(m/i>=n)res=max(res,i);
        }
    }
    cout<<res<<endl;
    /*int n,x[102],y[102],h[102],i,j,k,temp,height;
    cin>>n;
    for(i=0;i<n;i++)cin>>x[i]>>y[i]>>h[i];
    for(i=0;i<=100;i++)
    {
        for(j=0;j<=100;j++)
        {
            height=h[0]+abs(x[0]-i)+abs(y[0]-j);
            for(k=1;k<n;k++)
            {
                temp=h[k]+abs(x[k]-i)+abs(y[k]-j);
                if(temp!=height)break;
            }
            if(k==n && height>0){cout<<i<<" "<<j<<" "<<height<<endl;return 0;}
        }
    }*/
    return 0;
}


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


int main(){
	int n;cin>>n;
	vector<double> prob(n);
	double aa;
	for(int i=0;i<n;i++){
		cin>>aa;
		prob[i] = aa;
	}
	vector<double> dp(n+1,1);
	
	
	for(int i=1;i<=n;i++){
		vector<double> new_dp(i+1,0);
		new_dp[0] = dp[0]*(1 - prob[i-1]);
		for(int j=1;j<i;j++){
			new_dp[j] = dp[j-1] * prob[i-1] + dp[j] * (1-prob[i-1]);
		}
		new_dp[i] = dp[i-1]*prob[i-1];
		swap(new_dp,dp);
	} 
	double ans = 0;
	for(int i=n/2+1;i<=n;i++){
		ans +=dp[i];
	}
	cout<<setprecision(10)<<ans;
	
	return 0;
	
	
	
}


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

namespace ConsoleApplication1
{
	class Program
	{
		static void Main(string[] args)
		{
			int a = int.Parse(Console.ReadLine());
			List<int> list  = new List<int>();
			for(int i = 0; i < a; i++)
			{
				list.Add(int.Parse(Console.ReadLine()));
			}
			var ret = list.Distinct().Count();

			//出力
			Console.WriteLine(ret.ToString());
			Console.ReadLine();
		}
	}
}

Measured memory_bytes: 13268
#include<stdio.h>
int main()
{
    int a,b,c;
    int jyuu,ichi,tas;
    int tmp;
    char s[101];
    // スペース区切りの整数の入力
    //scanf("%d %d %d",&a,&b,&c);
    scanf("%d ",&a);
    scanf("%d ",&b);
    scanf("%d ",&c);

	if(a > b) {
	tmp = a;
	ichi = b;
	}else{
	tmp = b;
	ichi = a;
	}

	if(tmp > c){
	jyuu = tmp;
	tas = c;
	}else{
	jyuu = c;
	tas = tmp;
	}


    // 出力
    printf("%d\n",jyuu*10+ichi+tas);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 

const int mod = 1000000007;
const int inf = 1e9;

int main(){
    while(1){
        int a = -1, b;
        cin >> a >> b;
        if(a == -1) break;
        cout << __gcd(a, b) << " " << (ll)a*b/__gcd(a,b)<< endl;
    }
}


Measured memory_bytes: 3068
#!/usr/bin/env python3
import sys


def solve(A: int, P: int):
    print((3*A+P)//2)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    solve(A, P)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#define llint long long

using namespace std;
typedef pair<int, int> P;

llint H, W, N;
vector<P> vec;
llint ans[10];

int main(void)
{
	cin >> H >> W >> N;
	llint a, b;
	for(int i = 0; i < N; i++){
		cin >> a >> b;
		for(int x = max(1LL, b-2); x <= min(b, W-2); x++){
			for(int y = max(1LL, a-2); y <= min(a, H-2); y++){
				vec.push_back( make_pair(y, x) );
			}
		}
	}
	sort(vec.begin(), vec.end());
	
	llint cnt = -1;
	P prev = make_pair(-1, -1);
	for(int i = 0; i < vec.size(); i++){
		if(vec[i] != prev){
			if(cnt != -1) ans[cnt]++;
			cnt = 0;
		}
		prev = vec[i];
		cnt++;
	}
	if(cnt != -1) ans[cnt]++;
	
	ans[0] = (H-2)*(W-2);
	for(int i = 1; i < 10; i++) ans[0] -= ans[i];
	
	for(int i = 0; i < 10; i++){
		cout << ans[i] << endl;
	}
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, r) for (int i = l; i < r; ++i)
typedef long long int_t;

const int N_MAX = 1000;
int n;
int a[N_MAX];

bool input() {
  if (cin >> n) {
    rep (i, n) cin >> a[i];
    return true;
  }
  return false;
}

int solve() {
  typedef set<int> set_t;
  set_t s;
  rep (i, n) rep3 (j, 1, 5) if (i+j-1 < n) {
    int sum = 0;
    int b = 1;
    rep (k, j-1) b *= 10;
    rep (k, j) {
      sum += a[i+k] * b;
      b /= 10;
    }
    s.insert(sum);
  }
  for (int i = 0; i <= 10000; ++i) {
    if (!s.count(i)) return i;
  }
  return -1;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  while (input()) {
    cout << solve() << endl;
  }
  return 0;
}

Measured memory_bytes: 3312
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int n = s.length();
		
		StringBuffer sb = new StringBuffer();
		
		if(s.startsWith("0")) {
			for(int i=0; i<n; i++) {
				if(i%2==0) {
					sb.append(0);
				}else {
					sb.append(1);
				}
			}
		}else {
			for(int i=0; i<n; i++) {
				if(i%2==0) {
					sb.append(1);
				}else {
					sb.append(0);
				}
			}
		}
		String string = sb.toString();
		int cnt = 0;
		for(int i=0; i<n; i++) {
			if(s.charAt(i)!=string.charAt(i)) {
				cnt++;
			}else {
				continue;
			}
		}
		System.out.println(cnt);
    }
}


Measured memory_bytes: 26568
#include <iostream>
#include <cmath>

using namespace std;


int main() {
    int N;
    int p[51];
    cin>>N;
    for(int i=0; i<N; i++)
        cin>>p[i];
    int count = 0;
    int left=-1;
    int right=-1;
    for(int i=0; i<N-1; i++){
        if(p[i]>p[i+1]){
            count++;
            if(left==-1){
                left = i;
            }else if(right == -1){
                right = i+1;
            }
        }
    }

    if(count==0) {
        cout << "YES" << endl;
        return 0;
    }

    if(count!=2) {
        cout << "NO" << endl;
        return 0;
    }



    if(p[right-1]<p[left] and p[right]<p[left+1]) {
        cout << "YES" << endl;

    }else{
        cout << "NO" << endl;

    }
        return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <string>
#include <tuple>
#include <vector>
#include <set>
#include <map>
#include <iterator>
#include <random>
#include <cmath>

using namespace std;
using lint = long long int;
static const lint MOD = 1e9 + 7;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	auto result = (a + b + c > 21) ? "bust" : "win";
	cout << result;

	return 0;

}

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


/* macro */
//#define int long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define sec second
#define fir first
#define pb push_back



/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;


/* constant */
//const int inf = pow(2, 62);
const int mod = 1e9 + 7;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};



/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }




/* main */



signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    
    int x, t; cin >> x >> t;
    print(max(x - t, 0));

    

    
    




    
    



    
    

    







   




    

    

    




    



    



    

 
    
    


    

    
   
    













}






    










    




    










Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)

par = Array.new(n+1) {[0, []]}
chi = Array.new(n+1) {[]}
(n-1+m).times do
    a, b = gets.split.map(&:to_i)
    chi[a] << b
    par[b][0] += 1
    par[b][1] << a
end

que = [par.rindex{|e| e[0] == 0}]
t = Array.new(n+1)
rt = []
i = -1
while now = que.shift
    t[now] = i += 1
    rt << now
    chi[now].each do |x|
        par[x][0] -= 1
        que << x if par[x][0] == 0
    end
end

1.upto(n) {|i| p rt[0] == i ? 0 : rt[par[i][1].map{|e| t[e]}.max]}

Measured memory_bytes: 38392
#include<iostream>
#include<set>

using namespace std;

int main(){

   int N, K;
   cin>> N>> K;
   int D[K];
   for(int i=0; i<K; i++) cin>> D[i];

   set<int> ng;
   for(int i=0; i<K; i++) ng.insert(D[i]);

   while(1){
      int k=1;
      int d;
      while(N/k){
         d=N/k%10;
         if(ng.count(d)) goto next;
         k*=10;
      }
      {
         cout<< N<< endl;
         break;
      }
      next:;
      N++;
   }

   return 0;
}


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

#define ll long long

int main() {
	int n, x, t;
	int ans;
	cin >> n >> x >> t;

	ans = n / x * t;
	if (n % x != 0)ans += t;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3640
from itertools import combinations_with_replacement

N, M, Q = map(int, input().split())
abcd = [map(int, input().split()) for _ in range(Q)]
a, b, c, d = [list(i) for i in zip(*abcd)]

As = list(combinations_with_replacement(range(1, M+1), N))

m = -10*100

for A in As:
    sum = 0
    for i in range(Q):
        if A[b[i]-1] - A[a[i]-1] == c[i]:
            sum += d[i]
    m = max(m, sum)


print(m)

Measured memory_bytes: 84564
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int Factr(int num, int prime=2){
    int val=0;
    while(num%prime==0){num/=prime; val++;}
    return val;
}

int main(){
    int N; cin>>N;
    vector<int> A(N);
    rep(n,0,N) cin>>A.at(n);

    rep(n,0,N) A.at(n)=Factr(A.at(n));
    sort(ToEnd(A));
    vector<int> B=A;
    reverse(ToEnd(B));

    string ans="Yes";
    rep(n,0,N/2) if(A.at(n)+B.at(n)<2) ans="No";

    cout<<ans<<endl;
}

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

string f[21];
int w,h;
bool ans = false;
int d_[256] = {0};

inline int pow2(int n){
    return ( 1 << n );
}

void solve( int x , int y , int d , int memory , vector<int> a[500] ){
    int state = pow2( memory+4 ) + d_[d];
    if( ans ){
        return;
    }

    if( count( a[y*w+x].begin() , a[y*w+x].end() , state ) ){
        return;
    }else{
        a[y*w+x].push_back( state );
    }

    if( f[y][x] == '<' ){
        d = '<';
    }else if( f[y][x] == '>' ){
        d = '>';
    }else if( f[y][x] == '^' ){
        d = '^';
    }else if( f[y][x] == 'v' ){
        d = 'v';
    }else if( f[y][x] == '_' ){
        d = ( memory )? '<' : '>' ;
    }else if( f[y][x] == '|' ){
        d = ( memory )? '^' : 'v' ;
    }else if( f[y][x] == '?' ){
        solve( (x+1)%w , y , '>' , memory , a );
        solve( x , (y+1)%h , 'v' , memory , a );
        solve( (x+w-1)%w , y , '<' , memory , a );
        solve( x , (y+h-1)%h , '^' , memory , a );
        return;
    }else if( f[y][x] == '.' ){
        ;
    }else if( f[y][x] == '@' ){
        ans = true;
        return;
    }else if( f[y][x] >= '0' && f[y][x] <= '9' ){
        memory = f[y][x] - '0';
    }else if( f[y][x] == '+' ){
        memory = (memory + 1) % 16 ;
    }else if( f[y][x] == '-' ){
        memory = (memory + 15) % 16;
    }
    if( d == '>' ){
        solve( (x+1)%w , y , d , memory , a );
    }else if( d == '<' ){
        solve( (x+w-1)%w , y , d , memory , a );
    }else if( d == 'v' ){
        solve( x , (y+1)%h   , d , memory , a );
    }else if( d == '^' ){
        solve( x , (y+h-1)%h , d , memory , a );
    }
}
int main(){
    vector<int> a[500];
    d_['<'] = 1;
    d_['>'] = 2;
    d_['^'] = 4;
    d_['v'] = 8;
    cin >> h >> w;
    for(int i=0 ; i<h ; ++i ){
        cin >> f[i];
    }
    int x = 0;
    int y = 0;
    int d = '>';
    solve( x , y , d , 0 , a );
    if( ans ){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 0
def main():
    n, q  = list(map(int, input().split()))
    s = list(input())
    queries = [list(map(int, input().split())) for _ in range(q)]
    
    dp = [0 for _ in range(n)] # 0文字目からi文字目に含まれるACの数

    for i in range(n - 1):
    	dp[i + 1] = dp[i] + ((s[i] + s[i + 1]) == "AC")
    
    for query in queries:
    	print(dp[query[1] - 1] - dp[query[0] - 1])

if __name__ == '__main__':
    main()

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

int main(void){
    int a,b,c,x,cnt=0;
    cin>>a>>b>>c>>x;
    rep(i,a+1)rep(j,b+1)rep(k,c+1){
        if(i*500+j*100+k*50 == x){
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


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

int main(){

    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    cout<<a[n-1]-a[0]<<endl;

    return 0;
}

Measured memory_bytes: 256
def inpl():
    return list(map(int, input().split()))


X, Y, A, B, C = inpl()
P = inpl()
Q = inpl()
R = inpl()
P.sort()
Q.sort()
R.sort(reverse=True)

ans = sum(P[A - X:]) + sum(Q[B - Y:])
P.append(10**10)
Q.append(10**10)


pi = A - X
qi = B - Y
for ri in range(C):
    if P[pi] >= R[ri] and Q[qi] >= R[ri]:
        break
    elif P[pi] > Q[qi]:
        ans -= Q[qi]
        qi += 1
        ans += R[ri]
    else:
        ans -= P[pi]
        pi += 1
        ans += R[ri]

print(ans)


Measured memory_bytes: 105444
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constexpr int MOD = 1000000007;
// constexpr int MOD = 998244353;
constexpr int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
constexpr int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int x; cin >> x;
  cout << (x ^ 1) << '\n';
  return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int sqrtn = 317;
vector<int> data;
vector<int> gather;
int K;
struct sqrtdecomp {
public:
    sqrtdecomp(int n) {
        K = (n + sqrtn - 1) / sqrtn; //n / sqrtnの切り上げ
        data.resize(n, 0);
        gather.resize(K, 0);
    }
    void update(int x, int y) {
        data[x] += y;
        gather[x / sqrtn] += y;
    }
    int find(int x, int y) {
        int val = 0;
        rep (k, K) {
            int l = k * sqrtn;
            int r = (k + 1) * sqrtn;
            if (r <= x || y <= l) continue;
            if (x <= l && r <= y) val += gather[k];
            else {
                rrep(i, max(x, l), min(y, r)) {
                    val += data[i];
                }
            }
        }
        return val;
    }
};
int main() {
    int n, q; cin >> n >> q;
    sqrtdecomp sd(n);
    rep(i, q) {
        int com, x, y;
        cin >> com >> x >> y;
        x--;
        if (com == 1) y--;
        if (com == 0) {
            sd.update(x, y);
        } else {
            cout << sd.find(x, y + 1) << endl;
        }
        /*
        cout << "gat ";
        rep(i, K) cout << gather[i] << " "; cout << endl;
        cout << "data ";
        rep(i, n) cout << data[i] << " "; cout << endl;
         */
    }
}



Measured memory_bytes: 3304
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e15+9
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

string s;

int main(){
	int ans = 0;
	cin >> s;
	int l = 0, r = s.size() - 1;
	while (r - l >= 0){
		if (r == l){
			if (s[r] != 'i'&&s[r] != 'w')ans++;
		}
		else{
			if (s[r] != s[l]){
				ans++;
				if (s[r] == '('&&s[l] == ')')ans--;
				else if (s[l] == '('&&s[r] == ')')ans--;
			}
			else{
				if (s[r] != 'i'&&s[r] != 'w')ans++;
			}
		}
		l++;
		r--;
	}
	cout << ans << endl;
}

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

#define MOD 1000000007
typedef unsigned long long ull;

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

  // n進数でk桁となるN = n^(k-1) <= N < n^k
  for (int keta = 0; ; keta++) {
      int max = pow(k, keta);
      if (n < max) {
          cout << keta;
          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)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)

class modint {
  public:
    using ll = long long;
    ll num;
    static const ll MOD = 1e9+7;
    static vector<modint> factorial;

    modint(): num(0) {};
    modint(ll n_): num((n_ + MOD) % MOD) {}
    modint(const modint &r): num(r.num) {}
    operator ll() const { return (num+MOD)%MOD; }
    friend istream& operator>>(istream& is, modint &r){
        ll num_;
        is >> num_;
        r = num_;
        return is;
    }
    modint operator+(const modint &r) const { return modint(num + r.num); }
    modint operator-(const modint &r) const { return modint(num - r.num); }
    modint operator*(const modint &r) const { return modint(num * r.num); }

    template<typename T>
    modint operator^(const T &r) const {
        if(r == 0) return 1;
        return (((*this)*(*this)) ^ (r/2)) * modint(r&1 ? num : 1);
    }
    modint operator/(const modint &r) const { return num * (r^(MOD-2)); }

    modint operator+=(const modint &r) { return *this = *this + r; }
    modint operator-=(const modint &r) { return *this = *this - r; }
    modint operator*=(const modint &r) { return *this = *this * r; }
    modint operator/=(const modint &r) { return *this = *this / r; }

    template<typename T>
    modint operator^=(const T &r) { return *this = *this ^ r; }

    static modint pow(const modint x, ll r) {
        return x^r;
    }

    static modint fact(int n){
        if((int)factorial.size() <= n) {
            int size = factorial.size();
            factorial.resize(n+1);
            for (int i = size; i <= n; i++) {
                factorial[i] = fact(i-1) * modint(i);
            }
        }
        return factorial[n];
    }

    static modint C(ll n,ll r){
        return n >= r ? fact(n)/(fact(n-r)*fact(r)) : modint(0);
    }
};
vector<modint> modint::factorial = {1};
#define fact(n) modint::fact(n)
#define C(n,r) modint::C(n,r)
#define H(a,b) C(a+b, a)

int main(void){
    int n;
    cin >> n;
    vector<modint> x(n);
    rep(i,n) cin >> x[i];
    vector<modint> a(n+1);
    a[0] = 0;
    rep(i,n){
        a[i+1] = modint(i+1)*a[i] + modint::fact(i);
    }
    modint res = 0;
    rep1(i,n-1){
        res += (x[i] - x[i-1]) * a[i] / modint::fact(i) * modint::fact(n-1);
    }
    cout << res << endl;

    return 0;
}


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

#define pb push_back

using ll=long long;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vpii=vector<pii>;
using vvpii=vector<vpii>;

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

    int n;
    cin >> n;
    vi xs(n);
    for(auto& xi: xs)
        cin >> xi;
    vi cs(n);
    for (int i=n; i>0; --i) {
        int mcsum = 0;
        for (int j=2*i; j<=n; j+=i)
            mcsum += cs[j-1];
        cs[i-1] = xs[i-1] ^ (mcsum%2);
    }
    vi sol;
    for (int i=0; i<n; ++i) {
        if (cs[i])
            sol.pb(i+1);
    }
    cout << sol.size() << "\n";
    for (int i=0; i<static_cast<int>(sol.size())-1; ++i)
        cout << sol[i] << " ";
    if (sol.size())
        cout << sol.back() << "\n";
}


Measured memory_bytes: 3192
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <functional>
#include <vector>
#include <queue>
#include <map>
#include <stack>

using namespace std;

typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)

string s;

int main() {
  cin >> s;
  int n = s.length();

  int count = 0;
  stack<int> t;
  rep(i, n) {
    char c = s[i];
    if (t.empty()) {
      t.push(c);
    } else {
      char b = t.top();
      if (c == b) {
        t.push(c);
      } else {
        t.pop();
        count += 2;
      }
    }
  }
  printf("%d\n", count);
}


Measured memory_bytes: 768
#include <stdio.h>
int main(){
  char s[11];
  scanf("%s",s);
  int ans=0;
  for(int i=0;s[i]!='\0';i++){
    int j=i;
    for(;s[j]=='A'||s[j]=='C'||s[j]=='G'||s[j]=='T';j++){}
    ans=(j-i>ans)?j-i:ans;
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);	
		
		int[] in = Stream.of(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		int x = in[2] - in[0];
		int y = in[3] - in[1];
	
		String S = "";
		for (int i = 0;i < y; i++) S += "U";
		for (int i = 0;i < x; i++) S += "R";
		for (int i = 0;i < y; i++) S += "D";
		for (int i = 0;i < x; i++) S += "L";
		S += "L";
		
		for (int i = 0;i < y + 1; i++) S += "U";
		for (int i = 0;i < x + 1; i++) S += "R";
		S += "D" + "R";
		for (int i = 0;i < y + 1; i++) S += "D";
		for (int i = 0;i < x + 1; i++) S += "L";
		S += "U";
		
		System.out.println(S);
	}
}


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

vector<int> root;
vector<int> Rank;

//通常バージョン
int find(int x){
    if (root[x] == x) return x;
    root[x] = find(root[x]);
    return root[x];
}

bool check(int x, int y){
    return find(x) == find(y);
}

void Union(int x, int y){
    x = find(x); y = find(y);
    if (check(x, y)){
        return;
    }
    if (Rank[x] >= Rank[y]) root[y] = x;
    else root[x] = y;
    if (Rank[x] == Rank[y]) Rank[x]++;
}

int main(void)
{
  int n, m;
  cin >> n >> m;
  vector<int> set_root(n);
  for (int i = 0; i < n; i++) set_root[i] = i;
  root = set_root;
  vector<int> set_Rank(n, 0);
  Rank = set_Rank;
  for (int i = 0; i < m; i++){
      int u, v;
      cin >> u >> v;
      u--; v--;
      Union(u, v);
  }
  vector<int> root_num(n, 0);
  for (int i = 0; i < n; i++) root_num[find(i)]++;
  int ans = 1;
  for (int i = 0; i < n; i++) ans = max(ans, root_num[i]);
  cout << ans << endl;
}

Measured memory_bytes: 7124
var n;

function CS(a,b,k){
    var c = new Array(k + 1);
    for(var i = 0;i <= k;i++)
        c[i] = 0;
    for(var j = 0;j < n;j++)
        c[a[j]]++;
    for(var i = 1;i <= k;i++)
        c[i] += c[i - 1];
    for(var j = 0;j < n;j++)
        b[-1 + c[a[j]]--] = a[j];
}

function Main(input){
    input = input.split("\n");
    n = parseInt(input[0],10);
    input[1] = input[1].split(" ");
    var a = Array(n),ans = Array(n);
    for(var i = 0;i < n;i++)
        a[i] = parseInt(input[1][i],10);
    CS(a,ans,10000);
    String(ans);
    var out = ans[0];
    for(i = 1;i < n;i++)
        out += " " + ans[i];
    console.log(out);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 206864
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test ll t;cin>>t;while(t-->0)
#define re return 0;
  int main()
{
   fast
   int n;
   cin>>n;
   int x=n%1000;
   cout<<(1000-x)%1000;
    re
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
  int N;
  double T, A;
  cin >> N >> T >> A;
  double H[N];
  double temp[N];
  int index = 0;
  double diff = 100000;
  for(int i=0; i < N; i++){
    cin >> H[i];
    temp[i] = T - H[i] * 0.006;

    if(diff > abs(A-temp[i])){
      diff = abs(A-temp[i]);
      index = i;
    }
  }
  cout << index+1 << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vecll>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
#define MM " "
// #define INF 100000000
using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
string stin() {string s;cin>>s;return s;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}



int ans=INT_MAX;
bool f(string s,string t){
    int n=min(s.size(),t.size());
    bool flag=true;
    rep(i,n) flag&= (s[i]=='?' or t[i]=='?' or s[i]==t[i]);
    return flag;
}
void solve(string a,string b,string c){
    int A=a.size(),B=b.size(),C=c.size();
    vec ab(6100,1),ac(6100,1),bc(6100,1);
    rep(i,A+1)ab[i] = f(a.substr(i,A-i),b);
    rep(i,A+1)ac[i] = f(a.substr(i,A-i),c);
    rep(i,B+1)bc[i] = f(b.substr(i,B-i),c);
    rep(i,A+1){
        rep2(j,i,i+max(A,B)){
            if(ab[i] and ac[j] and bc[j-i]) chmin(ans,max({A,B+(int)i,C+(int)j}));
        }
    }
}


int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);cout<<fixed<<setprecision(15);

    string a[3]; rep(i,3)cin>>a[i];
    sort(a,a+3);
    do solve(a[0],a[1],a[2]);
    while(next_permutation(a,a+3));
    cout << ans <<endl;
}




Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main(void) {
  int n;
  cin >> n;
  int ans = 0;
  char prev = '0';
  rep(i, n) {
    char c;
    cin >> c;
    if(c != prev)
      ans++;
    prev = c;
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  int n, x;
  cin >> n >> x;
  vector<int> l(n);
  for(int i = 0; i < n; i++) cin >> l[i];
  int cnt = 0, sum = 0;
  for(int i = 0; i < n; i++){
    sum += l[i];
    if(sum <= x){
      cnt++;
    }
  }
  cout << cnt + 1 << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;

int main() {
    int A, B;
    cin >> A >> B;

    bool possible = false;
    for (int i = B*10; i < (B+1)*10; i++) {
        if ((int)(i*0.08) == A) {
            cout << i;
            possible = true;
            break;
        }
    }

    if (!possible) {
        cout << -1;
    }

    return 0;
}


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

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i=a;i<=b;i++)
#define dep(i, a, b) for(int i=a;i>=b;i--)
#define mem(a, b) memset(a,b,sizeof(a))
#define debug(x) cout<<#x<<" = "<<x<<endl;
#define lson id<<1,l,mid
#define rson id<<1|1,mid+1,r
#define pii pair<int,int>
#define pil pair<int, long long>
#define pb push_back
#define mp make_pair
#define lowbit(x) (x&-x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double PI = acos(-1.0);
const double eps = 1e-9;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 1e5 + 5;
char s[20];
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    scanf("%s", s + 1);
    int n = strlen(s + 1);
    int pre = 0, ans = 0;
    for(int i = 1; i <= n; i++) {
        if(s[i] != '0') {
            int sum = s[i] - 49 + pre + (n - i) * 9;
            ans = max(ans, sum);
        }
        pre += s[i] - 48;
    }
    ans = max(ans, pre);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256