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

enum state { New, Working, Done };

int main()
{
	int n;
	cin >> n;
	vector<vector<int>> am(n, vector<int>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) cin >> am[i][j];
	}

	vector<int> d(n, INT_MAX), p(n, INT_MAX);
	vector<state> status(n);
	d[0] = 0;
	p[0] = -1;
	status[0] = Working;
	while (true) {
		int minv = INT_MAX;
		int node = -1;
		for (int i = 0; i < n; i++) {
			if (d[i] < minv && status[i] != Done) {
				minv = d[i];
				node = i;
			}
		}
		if (node == -1) break;
		status[node] = Done;
		for (int i = 0; i < n; i++) {
			if (am[node][i] != -1 && am[node][i] < d[i] && status[i] != Done) {
				d[i] = am[node][i];
				p[i] = node;
				status[i] = Working;
			}
		}
	}
	cout << accumulate(d.begin(), d.end(), 0) << endl;
}



Measured memory_bytes: 3176
# i>j とする.
# |i-j|=Ai+Aj
#  i-j = Ai+Aj

N=int(input())
A=list(map(int,input().split()))
cnt=[0]*300000
ans=0
for i in range(N):
    if i-A[i]>=0:
        ans=ans+cnt[i-A[i]]
    if i+A[i]<len(cnt):
        cnt[i+A[i]]=cnt[i+A[i]]+1
print(ans)


Measured memory_bytes: 32052
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  char in;
  
  cin >> in;
  
  if (in == 'a' || in == 'e' || in == 'i' || in == 'o' || in == 'u')
      cout << "vowel" << endl;
  else 
      cout << "consonant" << endl;
}

Measured memory_bytes: 3612
#include<iostream>
#include<cstdio>
#include<string>

using namespace std;

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

	string taro, hanako;
	int t = 0, h = 0;

	for (int i = 0; i < n; i++) {
		cin >> taro >> hanako;
		if (taro > hanako) t += 3;
		else if (taro == hanako) {
			t += 1;
			h += 1;
		}
		else h += 3;
	}

	cout << t << " " << h << endl;

	return 0;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {os << "{" <<p.first << ", " << p.second << "}";return os;}
struct fast_ios{ fast_ios(){cin.tie(0);ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; }fast_ios_;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#ifdef DEBUG
#define dump(x) cerr<<#x<<": "<<x<<endl;
#else
#define dump(x)
#endif

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const long double PI = acos(-1.0);

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    ll D, T, S;
    cin >> D >> T >> S;
    dump(D);
    cout << ((D + S - 1) / S <= T ? "Yes" :"No") << endl;
}


Measured memory_bytes: 3624
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll plus = 0;
    ll n;
    std::cin >> n;
    if(n==0){
        std::cout << 0 << std::endl;
        return 0;
    }
    for (int i = 0; i <= 16; i++) {
        plus += 2*pow(4,i);
    }
    
    ll n_plus =  n+plus;
    
    string sinsu  ="";
    while(n_plus>0){
        sinsu = to_string(n_plus%4) + sinsu;
        n_plus /= 4;
    }
    string result = "";
    bool mada = true;
    for (int i = 0; i <= 16; i++) {
        if(mada){
            if(sinsu[i] == '2'){
                continue;
            }else{
                mada = false;
            }
        }
        if(sinsu[i] == '2'){
            result =  result+"00";
        }else if(sinsu[i] == '3'){
            if( result ==""){
               result =  result+"1";
            }else{
                result =  result+"01";
            }
        }else if(sinsu[i] == '1'){
            result = result+"11";
        }else if(sinsu[i] == '0'){
            result =  result+"10";
        }
    }
    std::cout << result << std::endl;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
int main(){
   int r;
   cin >> r;
   cout << 3*r*r <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
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 <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

const string YES = "Yes";
const string NO = "No";

void solve(std::string S, std::string T)
{
  int n = S.size();

  if (T.substr(0, n) == S)
    cout << YES << endl;
  else
    cout << NO << endl;
}

int main()
{
  cout << setprecision(10);
  std::string S;
  std::cin >> S;
  std::string T;
  std::cin >> T;
  solve(S, T);
  return 0;
}


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

int lcm(int x, int y)
{
  int cand[] = {2, 3};
  int lcm = 1;

  do {
    bool flag = false;
    int factor = cand[0];

    if(x % factor == 0) {
      x /= factor;
      flag = true;
    }
    if(y % factor == 0) {
      y /= factor;
      flag = true;
    }

    if(flag) {
      lcm *= factor;
      continue;
    }

    cand[0] = cand[1];
    cand[1] += 2;
  } while (x != 1 || y != 1);

  return lcm;
}

int main() {
  int X, ans;
  std::cin >> X;

  ans = lcm(360, X) / X;
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 3632
r, g, b, n = map(int, input().split())

ans = 0
for i in range(n//r+1):
  for j in range(n//g+1):
    k = n - r*i -g*j
    if k >= 0 and k%b == 0:
      #print(i, j, k)
      ans += 1
      
print(ans)

Measured memory_bytes: 40812
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.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;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.nextInt();
            int M = in.nextInt();
            out.println(N == M ? "Yes" : "No");
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    }
}



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

int main(){
	int R,G,B,N,ans,r,g,b,A;
	double x;
	cin>>R>>G>>B>>N;
	
	for(int i=0;i<=N;i++){	
		r=i;
		for(int j=0;j<=N;j++){
			g=j;
			A=r*R+g*G;
			b=(N-A)/B;
			x=((double)N-(double)A)/(double)B;
			
			if(A<=N&&b==x)
				ans++;
		}
			
	}
	
	
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;


public class Main {

	public static void main(String[] args) throws Exception {
		new Main().solve();
	}
	void solve() throws Exception {
		FastScanner in = new FastScanner(System.in);

		long N = in.nextLong();
		long M = in.nextLong();

		if (M < N * 2) {
			System.out.println(M / 2);
			return;
		} else {
			M -= N * 2;
			System.out.println(N + M / 4);
		}

	}

	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	//
	class FastScanner {

		private InputStream _stream;
		private byte[] _buf = new byte[1024];
		private int _curChar;
		private int _numChars;
		private StringBuilder _sb = new StringBuilder();

		FastScanner(InputStream stream) {
			this._stream = stream;
		}

		public int read() {
			if (_numChars == -1) throw new InputMismatchException();
			if (_curChar >= _numChars) {
				_curChar = 0;
				try {
					_numChars = _stream.read(_buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (_numChars <= 0) return -1;
			}
			return _buf[_curChar++];
		}

		public String next() {
			int c = read();
			while (isWhitespace(c)) {
				c = read();
			}
			_sb.setLength(0);
			do {
				_sb.appendCodePoint(c);
				c = read();
			} while (!isWhitespace(c));
			return _sb.toString();
		}

		public int nextInt() {
			return (int) nextLong();
		}
		public long nextLong() {
			int c = read();
			while (isWhitespace(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9') throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isWhitespace(c));
			return res * sgn;
		}

		public boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//


Measured memory_bytes: 20564
import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))

for i in range(len(a)):
    a[i] = a[i]*-1.0

heapq.heapify(a)
while m != 0:
    price = heapq.heappop(a)
    price = price/2
    m -= 1
    heapq.heappush(a, price)

for i in range(len(a)):
    a[i] = int(a[i])
    
print(sum(a) * (-1))

Measured memory_bytes: 14180
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX=200000;

int main(){
int R[MAX],n;
cin >>n;
for(int i=0;i<n;i++) cin >>R[i];
int maxv=-2000000000;
int minv=R[0];
for(int i=1;i<n;i++){
maxv=max(maxv,R[i]-minv);
minv=min(minv,R[i]);
}
cout <<maxv <<endl;
return 0;
}

Measured memory_bytes: 3876
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;


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

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a, b; cin >> a >> b;
	ll ans = a * b / gcd(a, b);
	cout << ans << endl;
}

Measured memory_bytes: 256
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
 
#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)
 
#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
using namespace std;
 
const int MX = 100 * 1000 + 7;
 
bool win[MX];
 
int main() {
#ifdef FASTIO
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int& x : a) {
        cin >> x;
    }
 
    for (int i = 1; i <= k; i++) {
        for (int x : a) {
            if (x <= i && !win[i - x]) {
                win[i] = true;
            }
        }
    }
 
    if (win[k]) {
        cout << "First\n";
    } else {
        cout << "Second\n";
    }
    return 0;
}


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

int main(){
  int N,T;
  cin >> N >> T; 
  vector<int> cost(N),time(N),ans(0);
  for(int i=0;i < N;i++){
    cin >> cost[i] >> time[i];
  }
  for(int i=0;i < N;i++){
    if(time[i]<=T)
      ans.push_back(i);
  }
  for(int i=0;i < ans.size();i++){
    ans[i]=cost[ans[i]];
  }
  sort(ans.begin(),ans.end());
  if(ans.size() == 0)
    cout << "TLE" << endl;
  else
  	cout << ans[0] << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())

A = len(str(N))
ans = 0

for a in range(A-1):
    if a % 2 != 0:
        continue
    ans += 9*10**a

if A % 2 != 0:
    ans += N - 10**(A-1) + 1
print(ans)

Measured memory_bytes: 3060
import java.io.*;
import java.util.StringTokenizer;

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

    static class Solution {
        void solve(final InputReader in, final PrintWriter out) {
            final int R = in.nextInt();
            final int G = in.nextInt();
            out.println(2 * G - R);
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

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

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

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


Measured memory_bytes: 22740
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
using LL = long long;

int main() {
	char N[10];
	cin >> N;
	if (atoi(N) >= 100) {
		if (N[0] == N[2])cout << "Yes";
		else cout << "No";
		return 0;
	}
	else {
		int n = atoi(N);
		if (!(n % 11))cout << "Yes";
		else cout << "No";

	}
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int dp[3005][6005];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, t;
	cin >> n >> t;
	vector<P> x;
	rep(i,n){
		int a, b;
		cin >> a >> b;
		x.emplace_back(a, b);
	}
	sort(x.begin(), x.end());
	memset(dp, 0, sizeof(dp));
	rep(i,n){
		rep(j,t){
			chmax(dp[i+1][j], dp[i][j]);
			chmax(dp[i+1][j+x[i].first], dp[i][j] + x[i].second);
		}
		for(int j = t; j < 6005; j++){
			chmax(dp[i+1][j], dp[i][j]);
		}
	}
	int ans = 0;
	rep(j,6005){
		chmax(ans, dp[n][j]);
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> ii;

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

    string s;
    cin >> s;
    bool ok = false;
    for (auto c : s) {
      if (c == '7') {
        ok = true;
        break;
      }
    }
    if (ok)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
    
    return 0;
}


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

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

ipair operator+(const ipair &a, const ipair &b)
{
    return ipair(a.first + b.first, a.second + b.second);
}

const ipair d[] = {ipair(-1, 0), ipair(0, 1), ipair(1, 0), ipair(0, -1)};

bool cmp_snd(const ipair &a, const ipair &b)
{
    if(a.second == b.second) return a.first < b.first;
    return a.second < b.second;
}

int main()
{
    int n;
    while(cin >> n, n)
    {
        ipair ss[n];
        ss[0] = ipair(0, 0);
        for(int i=1; i<n; i++)
        {
            int c, dir;
            cin >> c >> dir;
            ss[i] = ss[c] + d[dir];
        }
        sort(ss, ss+n);
        int w = ss[n-1].first - ss[0].first + 1;
        sort(ss, ss+n, cmp_snd);
        int h = ss[n-1].second - ss[0].second + 1;
        cout << w << " " << h << endl;


    }
}

Measured memory_bytes: 3076
#include<stdio.h>
#include<string.h>
typedef long long ll;
const int mod=1000000007;
int mul(int a,int b){return(ll)a*b%mod;}
int ad(int a,int b){return(a+b)%mod;}
void inc(int&a,int b){(a+=b)%=mod;}
int h[5010],nex[10010],to[10010],M;
void add(int a,int b){
	M++;
	to[M]=b;
	nex[M]=h[a];
	h[a]=M;
}
int siz[5010],f[5010][5010][2],g[5010],p[5010][2];
void dfs(int fa,int x){
	int i,j,k,t1,t2;
	siz[x]=1;
	f[x][1][0]=1;
	for(i=h[x];i;i=nex[i]){
		if(to[i]!=fa){
			dfs(x,to[i]);
			memset(p,0,sizeof(p));
			for(j=1;j<=siz[x];j++){
				for(k=1;k<=siz[to[i]];k++){
					t1=ad(mul(f[x][j][0],f[to[i]][k][0]),mul(f[x][j][1],f[to[i]][k][1]));
					t2=ad(mul(f[x][j][0],f[to[i]][k][1]),mul(f[x][j][1],f[to[i]][k][0]));
					inc(p[j+k][0],t1);
					inc(p[j+k][1],t2);
					inc(p[j][0],mul(g[k],t2));
					inc(p[j][1],mul(g[k],t1));
				}
			}
			siz[x]+=siz[to[i]];
			memcpy(f[x],p,sizeof(p));
		}
	}
}
int main(){
	int n,i,x,y,s;
	scanf("%d",&n);
	for(i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	g[0]=1;
	for(i=2;i<=n;i+=2)g[i]=mul(g[i-2],i-1);
	dfs(0,1);
	s=0;
	for(i=2;i<=n;i+=2)inc(s,mul(g[i],f[1][i][0]-f[1][i][1]));
	printf("%d",ad(s,mod));
}

Measured memory_bytes: 196608
#include <cstdio>
#include <utility>

long n;

const double sqrt3_2 = 0.866025403784439;

typedef std::pair<double, double> P;

void koch(P st, P vec, long depth){
	if(depth == 0){
		printf("%lf %lf\n", st.first + vec.first, st.second + vec.second);
	}else{
		koch(st, std::make_pair(vec.first / 3, vec.second/3), depth-1);
		st.first += vec.first / 3;
		st.second += vec.second / 3;
		
		koch(st, std::make_pair((vec.first / 2 - vec.second * sqrt3_2)/3, (vec.second / 2 + vec.first * sqrt3_2)/3), depth-1);
		st.first += (vec.first / 2 - vec.second * sqrt3_2)/3;
		st.second += (vec.second / 2 + vec.first * sqrt3_2)/3;
		
		koch(st, std::make_pair((vec.first / 2 + vec.second * sqrt3_2) / 3, (vec.second / 2 - vec.first * sqrt3_2) / 3), depth-1);
		st.first += (vec.first / 2 + vec.second * sqrt3_2) / 3;
		st.second += (vec.second / 2 - vec.first * sqrt3_2) / 3;
		
		koch(st, std::make_pair(vec.first / 3, vec.second/3), depth-1);
	}
}

int main(){
	scanf("%ld", &n);
	printf("0 0\n");
	koch(P(0, 0), P(100, 0), n);
	return 0;
}


Measured memory_bytes: 2712
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#include<deque>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
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; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	ll a, b;
	cin >> a >> b;
	if (9 < a || 9 < b)cout << -1 << endl;
	else cout << a * b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int N, K; cin >> N >> K;
  vector<int> sunuke(N);
  for (int _ = 0; _ < K; ++_) {
    int d; cin >> d;
    for (int i = 0; i < d; ++i) {
      int a; cin >> a;
      --a;
      sunuke[a] = 1;
    }
  }
  auto ans = boost::count_if(sunuke, [](auto a) { return a == 0; });
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 3644
//52行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

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

vector<ll> divisors(ll n){
    vector<ll> res;
    ll i;
    for(i = 1;i * i < n;i++){
       if(n % i == 0){
           res.push_back(i);
           res.push_back(n / i);
       }
    }
    if(i * i == n){
        res.push_back(i);
    }
    sort(res.begin(),res.end());
    return res;
}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);

    ll n;cin >> n;
    vector<ll> d_n = divisors(n-1);
    vector<ll> d_n1 = divisors(n);
    set<ll> ans;
    for(auto i : d_n)if(i != 1)ans.insert(i);
    for(auto i : d_n1){
        if(i == 1){
            //ans.insert(i);
            continue;
        }else{
            ll m = n;
            while(m > 0 && (m % i == 0)){
                m = (m / i);
            }
            if(m % i == 1)ans.insert(i);
        }
    }
    cout << ans.size() << '\n';
    return 0;
}
/*
 *!!CHECK!! 
 * 制約をよく読め：まず最も愚直な解法を考えろ
 * intの掛け算をしてる場合：overflowは大丈夫？
 * 制約の下限・上限は大丈夫？
 * 木構造は一直線にした時TLEしない？
 * */


Measured memory_bytes: 384
<?php

function input_and_explode() {
    $input_line = trim(fgets(STDIN));
    return explode(' ', $input_line);
}

function array_head($array) {
    return isset($array[0]) ? $array[0] : null;
}
function array_tail($array) {
    return array_slice($array, 1);
}

function make_multi_dim_array($sizes, $initial_value) {
    $result = [];
    $size = array_head($sizes);
    $tail = array_tail($sizes);
    $M = count($tail) === 0 ? $initial_value : make_multi_dim_array($tail, $initial_value);
    foreach (range(1, $size) as $i) {
        $result[] = $M;
    }
    return $result;
}

// functions for mutual transformation between indices and ordinal
// index: 0, 1, 2, ...
// ordinal: 1, 2, 3, ...
function index_to_ordinal($index) {
    return $index + 1;
}
function ordinal_to_index($ordinal) {
    return $ordinal - 1;
}

// input and convert
$n = input_and_explode()[0];
$M = make_multi_dim_array([$n, $n], 0);
for ($i = 0; $i < $n; $i++) {
    $targets = array_slice(input_and_explode(), 2);
    foreach ($targets as $target) {
        $M[$i][ordinal_to_index($target)] = 1;
    }
}

// output
for ($i = 0; $i < $n; $i++) {
    $output = implode(' ', $M[$i]);
    echo "$output\n";
}



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

void solveA(){
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;

  if(e-a > k){
    cout << ":(" << endl;
  }
  else{
    cout << "Yay!" << endl;
  }
}
void solveB(){
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

  int min = 9;
  int minad = 0;

  for(int i=0;i<5;i++){
    if(a[i]%10 < min && a[i]%10 != 0){
      min = a[i]%10;
      minad = i;
    }
  }
  int ans = 0;
  for(int i=0;i<5;i++){
    if(i==minad || a[i]%10==0){
      ans += a[i];
    }
    else{
      ans = ans + 10-a[i]%10 + a[i];
    }
  }
  
  cout << ans << endl;

}
void solveC(){
  long long n;
  vector<long long> a(5);
  cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

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

  cout << (n+a[0]-1)/a[0] + 4 << endl;

}

void solveD(){

}

int main(){
  solveC();
}


Measured memory_bytes: 256
N, Q = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(lambda x:int(x)-1, input().split())
    G[a].append(b)
    G[b].append(a)
    
points = [0] * N 
for _ in range(Q):
    p, x = map(int, input().split())
    points[p-1] += x

from collections import deque
st = deque([[0, points[0]]])
result = ['0'] * N
visited = [0] * N
visited[0] = 1
while st:
    idx, count = st.pop()
    result[idx] = str(count)
    for ni in G[idx]:
        if visited[ni] != 1:
            visited[ni] = 1
            st.append([ni, count+points[ni]])
            
print(" ".join(result))

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

public class Main {
    static int n;
    static long t;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        t = sc.nextLong();

        long ans = 0;
        int lastTime = 0;
        for (int i = 0; i < n; i++) {
            int time = sc.nextInt();
            ans += Math.min(time - lastTime, t);
            lastTime = time;
        }
        System.out.println(ans+t);
    }
}


Measured memory_bytes: 63024
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
char ss[110];
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    scanf("%s",ss+1);int len=strlen(ss+1);
    for(int i=1;i<=len;i++)putchar('x');
    puts("");
    return 0;
}

Measured memory_bytes: 128
function main(input) {
  const rows = input.split('\n');
  const n = parseInt(rows[0].split(' ')[0]);
  const x = parseInt(rows[0].split(' ')[1]);
  const mn = [];
  for (var i = 1; i <= n; i++) {
    mn.push(parseInt(rows[i]));
  }
  const min = Math.min(...mn);
  const sum = mn.reduce((prev, current) => prev + current);
  console.log(Math.floor((x - sum) / min) + n);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

const static double pi = 4*atan(1.0);
int main(){

	for(int i=0;;i++){
		int a,b;
		char op;
		cin >> a >> op >> b;
		if(op=='+')
			cout << a+b << endl;
		else if(op=='-')
			cout << a-b << endl;
		else if(op=='*')
			cout << a*b << endl;
		else if(op=='/')
			cout << a/b << endl;
		else
			break;
	}

	return 0;
}

Measured memory_bytes: 1160
n = int(input())
if n < 2:
    print(1)
elif n < 4:
    print(2)
elif n < 8:
    print(4)
elif n < 16:
    print(8)
elif n < 32:
    print(16)
elif n < 64:
    print(32)
else:
    print(64)

Measured memory_bytes: 3060
/************************Code by Hardik Aggarwal!!!!***********************************/

#include<bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % mod; 
    p = (p * p) % mod; 
  
    return (y%2 == 0)? p : (x * p) % mod; 
}

int main()
{	

	IOS
	ll n,ans=0;
	cin>>n;
	ll h[n];
	for(ll i=0;i<n;i++)
	{
		cin>>h[i];
	}

	for(ll i=n-2;i>=0;i--)
	{
		if(h[i]-h[i+1]>1)
		{
			cout<<"No";return 0;
		}
		else if(h[i]-h[i+1]==1)
		{
			h[i]=h[i+1];
		}
	}

	cout<<"Yes";


}
    
 
    
    


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
const long long INF = 1LL<<60;
#define pairint pair<int,int>
int gcd(int a,int b)
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
}
}
signed main(){
  int x=0,y=0,z=0,w=0;
  std::cin >> x;
  std::vector<int> v(x);
  repone(i,x+1){
    Repone(j,x+1){
      for (size_t k = 1; k < x+1; k++) {
      y+=gcd(i,gcd(j,k));
      }
    }
  }
  std::cout << y << '\n';
}


Measured memory_bytes: 3632
n = int(input())
a=list(map(int, input().split()))
ans = a[:]
for i in range(n)[::-1]:
  if i+1 > n//2:
    continue
  add = 0
  for j in range(n):
    add += ans[(j+2)*(i+1)-1]%2
    if (j+3)*(i+1)-1 > n-1:
      break
  ans[i] = add + ans[i]
  ans[i] %= 2
m = sum(ans)
aa = []
for i in range(n):
  if ans[i]:
    aa.append(i+1)
print(m)
print(" ".join(tuple(map(str,aa))))

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;
    Vl A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }

    if (A[0] != 0) {
        cout << -1 << "\n";
        return;
    }

    ll ans = 0;
    for (ll i = 1; i < N; i++) {
        if (A[i] - A[i - 1] > 1) {
            ans = -1;
            break;
        }
        if (A[i] - A[i - 1] == 1) {
            ++ans;
        }
        else {
            ans += A[i];
        }
    }

    cout << ans << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

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

using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  cin.ignore();

  int ans_n;
  if(n <= 1){
    ans_n = 0;
  } else {
    ans_n = n * (n - 1) / 2;
  }

  int ans_m;
  if(m <= 1){
    ans_m = 0;
  } else {
    ans_m = m * (m - 1) / 2;
  }

  int ans = ans_n + ans_m;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int32_t main()
{
	//freopen("input.txt", "r", stdin);
	IOS;
	
	int n; cin >> n;
	vector<pair<int, int>> v(n);
	for(auto &x: v) cin >> x.first >> x.second;

	bool flag = false;
	for(int i = 0 ; i < n-2 ; i++)
	{
		if(v[i].first == v[i].second && v[i+1].first == v[i+1].second && v[i+2].first == v[i+2].second)
		{
			flag = true;
			break;
		}
	}

	if(flag) cout << "Yes" << '\n';
	else cout << "No" << '\n';
	return 0;
}

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

int main() {
  int H1, H2, M1, M2, K, time;
  time = 0;
  cin >> H1 >> M1 >> H2 >> M2 >> K;

  time = H2*60 + M2 -H1*60 - M1 - K; 
  
    cout << time << endl;
    
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstring>

using namespace std;

int dp[101][101][4];
const int mod =100000;
int main(){
    int w,h;
    while(cin>>w>>h,w){
        memset(dp,0,sizeof(dp));
        for(int i=0;i<h;++i) dp[i][0][0]=1;
        for(int i=0;i<w;++i) dp[0][i][1]=1;
        for(int i=1;i<h;++i){
            for(int j=1;j<w;++j){
                dp[i][j][0]=(dp[i-1][j][0]+dp[i-1][j][2])%mod;
                dp[i][j][1]=(dp[i][j-1][1]+dp[i][j-1][3])%mod;
                dp[i][j][2]=dp[i-1][j][1];
                dp[i][j][3]=dp[i][j-1][0];
            }
        }
        int sum=0;
        for(int i=0;i<4;++i) sum +=dp[h-1][w-1][i];
        cout<<sum%mod<<endl;
    }
    return 0;
}

Measured memory_bytes: 3196
#include <iostream>

#include<vector>

#include<string>

#include<algorithm>

#include<cmath>

#include<cstdlib>

#include<utility> 

#include<cstdio> 

#define vii vector< pair<int,int> >

#define vi vector<int>

#define INF 1000000007

#define ff first

#define ss second

#define lli long long int

#define ulli unsigned long long int

using namespace std;

int main() {

 ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int t;

    cin>>t;

    int tl=0,wa=0,ac=0,re=0;

    vector<string> v(t);

    for(int i=0; i<t; i++){

      cin>>v[i];

      if(v[i]=="TLE")

      tl++;

      if(v[i]=="AC")

      ac++;

      if(v[i]=="WA")

      wa++;

      if(v[i]=="RE")

      re++;

    

  }

    cout<<"AC x "<<ac<<endl<<"WA x "<<wa<<endl<<"TLE x "<<tl<<endl<<"RE x "<<re<<endl;

    

  

}

Measured memory_bytes: 6340
#include <iostream>
using namespace std;
int main(void){
    int N, M; //参加者、費用
    int A[100]; //参加者の所持金

    while(true){
        cin >> N >> M;
        if(N + M == 0) break;
        
        int sum = 0;
        for(int i = 0; i < N; i++){
            cin >> A[i];
            if(A[i] >= (M / N)) sum += (M / N);
            else sum += A[i];
        }
        cout << sum << endl;
    }

    return 0;
}


Measured memory_bytes: 3120
#nの素数判定
def isPrime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

times = int(input())
c = 0
for i in range(times):
    x = int(input())
    if isPrime(x):
        c = c + 1
print(c)


Measured memory_bytes: 5708
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;

    int l[2*n];
    for(int i =0; i <2*n;i++){
        cin>> l[i];
    }
    sort(l,l+2*n);
    int k  = 0;
    for(int i= 0;i<n;i++){
        k+= l[2*i];
    }
    cout << k ;
    return 0;
    
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
ll mod = 1000000007;

class UnionFind {
  private:
    ll num;
    vector<ll> par;
    vector<ll> sizes;
    vector<ll> rank;

  public:
    UnionFind(ll n) { init(n); }

    ~UnionFind() {}

    void init(ll n) {
        num = n;
        par.resize(n);
        sizes.resize(n);
        rank.resize(n);
        for (ll i = 0; i < n; i++) {
            par[i] = i;
            sizes[i] = 1;
            rank[i] = 0;
        }
    }

    ll root(ll x) {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = root(par[x]);
        }
    }

    void unite(ll x, ll y) {
        ll rx = root(x);
        ll ry = root(y);
        if (rx == ry)
            return;
        if (rank[rx] < rank[ry]) {
            par[rx] = ry;
        } else {
            par[ry] = rx;
            if (rank[rx] == rank[ry]) {
                rank[rx]++;
            }
        }
        ll temp = sizes[rx] + sizes[ry];
        sizes[rx] = temp;
        sizes[ry] = temp;
    }

    ll get_size(ll x) { return sizes[root(x)]; }

    bool same(ll x, ll y) {
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, m;
    cin >> n >> m;
    UnionFind u(n);
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        u.unite(a, b);
    }

    ll max_size = 0;
    rep(i, n) { max_size = max(max_size, u.get_size(i)); }
    cout << max_size << endl;
    return 0;
}



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

#define pb         push_back

const int INF = 100000000;

int main(void) {
	while(1){
		int n, m;
		vector<int> hana;
		vector<int> taro;
		int taros = 0;
		int hanas = 0;
		int as = 1000000000;
		int at = -1;
		int ah = -1;
		cin >> n >> m;
		if(n == 0 && m == 0) break;
		for(int i=0; i<n; i++){
			int t;
			cin >> t;
			taro.pb(t);
			taros += t;
		}
		for(int i=0; i<m; i++){
			int t;
			cin >> t;
			hana.pb(t);
			hanas += t;
		}

		for(int i=0; i<n; i++){
			for(int j=0; j<m; j++){
				if(taros - taro[i] + hana[j] == hanas - hana[j] + taro[i])	{
					if(as > hana[j] + taro[i]){
						ah = j;
						at = i;
						as = hana[j] + taro[i];
					}
				}
			}
		}

		if(ah == -1) cout << "-1" << endl;
		else printf("%d %d\n", taro[at], hana[ah]);
	}
	
	return 0;
}

Measured memory_bytes: 1236
#include <iostream>

using namespace std;

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

	long long ans = N / (A + B) * A;
	
	N %= (A + B);
	
	if (N < A) {
		ans += N;
	}
	else {
		ans += A;
	}
	cout << ans << endl;
}


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

int main() {
int N,x;
  cin >> N >> x;
  vector<int> a(N);
  for(int i=0; i<N; ++i) {
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
    int ans = 0;
  for(int i=0; i<N; ++i) {
    if(a.at(i)<=x){
      
      if(i==N-1){
        if(x==a.at(i)){
          ans++;
          break;
        }
      }
      else{
        ans++;
        x-=a.at(i);
      }
      
    }
    else{
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
      
    

Measured memory_bytes: 3608
n = int(input())
a = []
a = input().split()
a = list(map(int,a))
num = 0
for i in range(n):
    minj = i
    for j in range(i,n):
        if a[j] < a[minj]:
            minj = j
    if i != minj:
        a[i], a[minj] = a[minj], a[i]
        num = num + 1

print(*a)
print(num)



Measured memory_bytes: 5608
#include <bits/stdc++.h>
#include <iostream>
#include <cassert>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <vector>
#include <array>
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
	int d,g;
	int a[11][2];
	int max_num = 10000000;
	std::cin >> d >> g;
	for ( int i = 1 ; i <= d ; i++ ) {
		int p,c;
		std::cin >> a[i][0] >> a[i][1];
	}
	// {0, 1, ..., n-1} の部分集合の全探索
	for (int bit = 0; bit < (1<<d); ++bit)
	{
		/* bit で表される集合の処理を書く */
		std::bitset<10> b = std::bitset<10>(bit);
		int sum = 0;
		int num = 0;
		for ( int i = 1 ; i <= d ; i++ ) {
			if(b[i-1]){
				sum += 100*i*a[i][0] + a[i][1];
				num += a[i][0];
			}
		}
		if(sum < g) {
			for ( int i = d ; i >= 1  ; i-- ) {
				if(!b[i-1]){
					for ( int ii = 1 ; ii <= a[i][0] ; ii++ ) {
						if(sum >= g) break;
						sum += 100*i;
						num ++;
					}
					break;
				}
			}
		}
		if(sum >= g && max_num > num) max_num = num;
	}
	std::cout << max_num << std::endl;
	return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
//#define int long long

signed main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int cnt = 0;
    rep(i, n) {
        while (a[i] % 2 == 0) {
            a[i] /= 2;
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
   char c;
   cin >> c;
   if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
       
       cout << "vowel" << endl;
   }else {
       cout << "consonant" << endl;
   }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
using namespace std;
const int M = 1e5 + 10;
vector<int>vc[M];
int dp[M];
int dfs(int u , int pre) {
    int len = vc[u].size();
    for(int i = 0 ; i < len ; i++) {
        int v = vc[u][i];
        if(v == pre) continue;
        dp[u] ^= (dfs(v , u) + 1);
    }
    return dp[u];
}
int main() {
    int n;
    scanf("%d" , &n);
    for(int i = 1 ; i < n ; i++) {
        int u , v;
        scanf("%d%d" , &u , &v);
        vc[u].push_back(v);
        vc[v].push_back(u);
    }
    memset(dp , 0 , sizeof(dp));
    if(dfs(1 , -1)) printf("Alice\n");
    else printf("Bob\n");
    return 0;
}

Measured memory_bytes: 12416
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  ll n,k;
  cin>>n>>k;
  string s;
  cin>>s;
  char s11 = s[k-1];
  char s1 = s11+32;
  s[k-1] = s1;
  cout<<s;
  return 0;
}

Measured memory_bytes: 256