akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    if(n == 1 && m == 0){
      System.out.println(0);
      return;
    }
    String s[] = new String[3];
    s[0] = "1";
    s[1] = "0";
    s[2] = "0";
    int count[] = new int[3];
    count[0] = 0;
    count[1] = 0;
    count[2] = 0;
    String ss[] = new String[3];
    ss[0] = "";
    ss[1] = "";
    ss[2] = "";
    for(int i = 0;i<m;i++){
      int si = sc.nextInt();
      String ci = sc.next();
      if(si == 1){
        if(ci.equals("0") && !(n == 1)){
          System.out.println(-1);
          return;
        }
        count[0]++;
        ss[0] = ss[0] + ci;
      }else if(si == 2){
        count[1]++;
        ss[1] = ss[1] + ci;
      }else if(si == 3){
        count[2]++;
        ss[2] = ss[2] + ci;
      }
    }
    for(int i = 0;i<3;i++){
      if(count[i] == 0){
        continue;
      }else if(count[i] == 1){
        s[i] = ss[i];
      }else{
        String kiri = ss[i].substring(0,1);
        ss[i] = ss[i].replace(kiri,"");
        if(ss[i].length() == 0){
          s[i] = kiri;
        }else{
          System.out.println(-1);
          return;
        }
      }
    }
    for(int i = 0;i<n;i++){
      System.out.print(s[i]);
    }
  }
}


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

int main() {

  string s;
  cin >> s;

  int ans = 0;
  int cnt = 0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='R') {
      cnt++;
    } else {
      cnt=0;
    }
    if(cnt>ans){
      ans = cnt;
    }
  }

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


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 510000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> S >> N;
  rep(i,0,N){
    cin >> A;
    if(A==1)sum++;
    else{
      cin >> B >> T;
      if((sum+B)%2==1)S.insert(0,T);
      else S+=T;
      }
  }
  if(sum%2==1)Rev(S);
  Out(S);
}

Measured memory_bytes: 900
#include<stdio.h>
int main(){
  int n,i;
  scanf("%d",&n);
  int a[n+1],b[n+1],c[n];
  for(i=1;i<n+1;i++)
    scanf("%d",&a[i]);
  for(i=1;i<n+1;i++)
    scanf("%d",&b[i]);
  for(i=1;i<n;i++)
    scanf("%d",&c[i]);
  int sum;
  sum=0;
  for(i=1;i<n+1;i++)
    sum=sum+b[i];
  for(i=1;i<n;i++){
    if(a[i+1]==a[i]+1)
      sum=sum+c[a[i]];
  }
 
  printf("%d\n",sum);
  return 0;}


Measured memory_bytes: 128
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 1000000000
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


class union_find_t {
public:
  union_find_t(int T) : T_(T), parent_(new int[T]), rank_(new int[T]) {
    for (int i = 0; i < T_; i++) {
      parent_[i] = i;
      rank_  [i] = 0;
    }
  };

  ~union_find_t() {
    delete[] parent_;
    delete[] rank_;
  };

public:
  int find(int x) {
    if (parent_[x] == x) {
      return x;
    }
    else {
      return parent_[x] = find(parent_[x]);
    }
  };

  void unite(int x, int y) {
    x = find(x);
    y = find(y);

    if (x == y)
      return;

    if (rank_[x] < rank_[y]) {
      parent_[x] = y;
    }
    else {
      parent_[y] = x;

      if (rank_[x] == rank_[y])
        rank_[x] ++;
    }
  };

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

private:
  int T_;

  int* parent_;
  int* rank_;
};


int N, x[55], y[55];


int test(int dx, int dy)
{
  union_find_t uf(N);

  for (int i = 0; i < N; i ++)
    for (int j = i + 1; j < N; j ++) {
      int tdx = x[j] - x[i], tdy = y[j] - y[i];

      if ((tdx == dx && tdy == dy) || (tdx == - dx && tdy == - dy))
        uf.unite(i, j);
    }

  std::set<int> set;

  for (int i = 0; i < N; i ++)
    set.insert(uf.find(i));

  return set.size();
}


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  std::cin >> N;

  for (int i = 0; i < N; i ++)
    std::cin >> x[i] >> y[i];

  int cp = INF;
  
  for (int i = 0; i < N; i ++)
    for (int j = 0; j < N; j ++) {
      int dx = x[j] - x[i], dy = y[j] - y[i];

      int c = test(dx, dy);

      if (c < cp)
        cp = c;
    }

  std::cout << cp << std::endl;

  return 0;
}


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

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

    int n;
    cin >> n;

    vector<int> a(n+2);
    a[0] = 0;
    a[n+1] = 0;
    int sum = 0;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    rep(i, n+1) {
        sum += abs(a[i] - a[i+1]);
    }
    for(int i = 1; i <= n; ++i) {
        int ans = 0;
        ans = sum + abs(a[i-1] - a[i+1]) - (abs(a[i-1] - a[i]) + abs(a[i] - a[i+1]));
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <deque>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <climits>
#include <numeric>
#include <bitset>
#include <random>
#include <tuple>
#include <initializer_list>
#include <fstream>
std::vector<int> cal_primes() {
	std::vector<bool> is_prime(1000001, true);
	for (auto i = 2; i * i < is_prime.size(); ++i) {
		if (is_prime[i]) {
			for (auto j = i * i; j < is_prime.size(); j += i) {
				is_prime[j] = false;
			}
		}
	}
	std::vector<int> result;
	for (auto i = 2; i < is_prime.size(); ++i) {
		if (is_prime[i]) result.push_back(i);
	}
	return result;
}
int main() {
	const auto prime = cal_primes();
	long long int a; int b; std::cin >> a >> b;
	const auto min = std::max(2LL, a - b);
	const auto max = a + b;
	std::vector<int> last_exp(max - min + 1, INT_MAX);
	for (const auto p : prime) {
		int e = 0;
		long long int mul = 1;
		while ((min + mul - 1) / mul * mul <= max) {
			++e;
			mul *= p;
			for (auto i = (min + mul - 1) / mul; i * mul <= max; ++i) {
				if (i % p == 0) continue;
				if (last_exp[mul * i - min] >= e) last_exp[mul * i - min] = e;
				else last_exp[mul * i - min] = -1;
			}
		}
	}
	std::cout << std::count_if(last_exp.begin(), last_exp.end(), [](const int e) {return e != -1; }) << std::endl;
}



Measured memory_bytes: 7448
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
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()
#define SIZE(x) ll(x.size())
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI 3.14159265358979323846264338327950L

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define int long long
#define Graph vector<vector<int> >
#define PII pair<int,int>
#define VI vector<int>
#define VVI vecotor<vector<int> >
#define VPII vector<pair<int,int> >

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 H, W, sh, sw, gh, gw;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};//BFS関連







//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数宣言
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}










//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main() {
	//入力の高速化用のコード
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
int N,K;
cin>>N>>K;

int ans=0;

while(N>0){
	N/=K;
	ans++;
	
}


cout<<ans<<endl;




































return 0;

}







Measured memory_bytes: 3620
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {

	char str[1001];
	int tmp, i;
	while (1) {
		memset(str, '\0', sizeof(str));
		scanf("%s", str);
		//	printf("%s", str);
		if (atoi(&str[0]) == 0) break;
		tmp = 0;
		for (i = 0; str[i] != '\0'; ++i) {
			tmp += (int)(str[i] - '0');
				//printf("%d\n", tmp);
		}
		printf("%d\n", tmp);
	}

	
	return 0;
}

Measured memory_bytes: 544
#include<stdio.h>

#define INF 2000000000000000000000000000

int main(){
		int n,i;
		long a[200000];
		long long sum=0,subsum[200001],min=INF;
		scanf("%d",&n);
		subsum[0]=0;
		for(i=0;i<n;i++){
				scanf("%ld",&a[i]);
				subsum[i+1]=subsum[i]+a[i];
				sum+=a[i];
		}
		for(i=1;i<n;i++){
				long long tmp=sum-subsum[i]*2;
				if(tmp<0)tmp=(-1)*tmp;
				if(tmp<min){
						min=tmp;
				}
		}
		printf("%lld\n",min);
		return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int a,b;
vector<pair<pair<int,int>,pair<int,int> > >v;
main()
{
	int t;
    scanf("%d",&t);
    for(int i = 0;i < t;i++)
    {
        scanf("%d%d",&a,&b);
        v.push_back(make_pair(make_pair(a,b),make_pair(0,0)));
    }
    for(int i = 0;i < t;i++)
    {
        scanf("%d%d",&a,&b);
        v.push_back(make_pair(make_pair(a,b),make_pair(1,0)));
    }
    sort(v.begin(),v.end());
    int pa=0;
    for(int i = 0;i < 2*t;i++)
    {
        int mk=0;
        int ty=v[i].second.first;
        //printf("%d %d\n",ty,v.size());
        if(ty==1)
        {
            int tg=-1,pos=-1;
            for(int j = i-1;j >= 0;j--)
            {
                // printf("%d %d %d %d\n",v[i].first.first,v[i].first.second,v[j].first.first,v[j].first.second);
                if(ty^v[j].second.first==1 && v[j].second.second==0 && tg<v[j].first.second && v[i].first.second > v[j].first.second && v[i].first.first > v[j].first.first)
                {
                    pos=j;
                    tg=v[j].first.second;
                }
            }
            if(pos!=-1)
            {
                v[pos].second.second=1;
                pa++;
            }
        }
    }
    printf("%d",pa);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int LCS(char *,char *);
int minmin(int,int);

int main(){
  int n,i;
  char x[150][1000],y[150][1000];

  scanf("%d",&n);
  for(i = 0;i < n;i++){ //xyを繰り返す
    scanf("%s %s",&x[i],&y[i]);
    printf("%d\n",LCS(x[i],y[i]));
  }
  return 0;
}

int LCS(char *x,char *y){
  int xlen,ylen,c[1001][1001],high = 0,i,j;

  xlen = strlen(x);
  ylen = strlen(y);

  for(i = 1;i <= xlen;i++) c[i][0] = 0;
  for(i = 1;i <= ylen;i++) c[0][i] = 0;

  for(i = 1;i <= xlen;i++){
    for(j = 1;j <= ylen;j++){
      if(x[i - 1] == y[j - 1]) c[i][j] = c[i - 1][j - 1] + 1;
      else if(c[i - 1][j] >= c[i][j - 1]) c[i][j] = c[i - 1][j];
      else  c[i][j] = c[i][j - 1];
      high = minmin(high,c[i][j]);
    }
  }
  
  return high;
}

int minmin(int a,int b){
  if(a > b) return a;
  else return b;
}



Measured memory_bytes: 5684
#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 fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int cnt[211111]; //counts how many times the interval [i,i+1) is covered. we want cnt[0],cnt[1],...,cnt[n-1] = 1
int cov[211111];
int a[211111];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m; cin>>n>>m;
	for(int i=1;i<=n;i++) cov[i]=i-1;
	int res=n;
	for(int i = 0; i < n; i++)
	{
		int x; cin>>x;
		a[i]=x;
		if(cov[x]>=0) 
		{
			if(cnt[cov[x]]==0) res--;
			cnt[cov[x]]++;
		}
		cov[x]--;
	}
	for(int i = 0; i < m; i++)
	{
		int x, y; cin>>x>>y;
		x--;
		cov[a[x]]++;
		if(cov[a[x]]>=0)
		{
			if(cnt[cov[a[x]]]==1) res++;
			cnt[cov[a[x]]]--;
		}
		if(cov[y]>=0)
		{
			if(cnt[cov[y]]==0) res--;
			cnt[cov[y]]++;
		}
		cov[y]--;
		a[x]=y;
		cout<<res<<'\n';
	}
}


Measured memory_bytes: 3840
h,w=map(int,input().split())
a='abcdefghijklmnopqrstuvwxyz'
s=[input().split() for i in range(h)]
for i in range(h):
    ss=s[i]
    for j in range(len(ss)):
        if ss[j]=='snuke':
            print(a[j].upper()+str(i+1))
            exit()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> L(N, 0);
    for(auto &x: L){
        cin >> x;
    }

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

    int ans = 0;
    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j < i; ++j)
        {
            int r = lower_bound(L.begin(), L.end(), L[i] + L[j]) - L.begin();
            int l = i + 1;
            ans += r - l;
        }
    }

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

Measured memory_bytes: 256
import itertools

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for i in range(Q)]
# print(N)
# print(A)
# print(Q)
# print(B)

distribution = {}
max_A = max(A)
max_BC = max(list(itertools.chain.from_iterable(BC)))
maximum = max([max_A, max_BC])
# print(max_A, max_BC, maximum)
for i in range(maximum + 1):
    distribution[i] = 0

for Ai in A:
    distribution[Ai] += 1
# print(distribution)

total = sum(A)
for i in range(Q):
    Bi = BC[i][0]
    Ci = BC[i][1]
    num_Bi = distribution.get(Bi)
    diff = (Ci - Bi) * num_Bi

    distribution[Bi] = 0
    # print(num_Bi, distribution.get(Bi), Ci)
    distribution[Ci] += num_Bi

    total += diff
    print(total)
    

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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)

#define ll long long

#define pq(name,type) priority_queue<type> name
#define vec(name,type,length,value) vector<type> name(length,value)
#define vec2(name,type,length,width,value) vector<vector<type>> name(length,vector<type>(width,value));

int main(){
	double N;
  cin >> N;
	printf("%.12f",N*N*N / 27);

return 0;
}

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=1e9+7;


int main(){
    int N, M; cin >> N >> M;
    vi a(M), b(M);
    vii c(M);
    for(int i=0; i<M; i++){
        cin >> a[i] >> b[i];
        c[i].resize(b[i]);
        for(int j=0; j<b[i]; j++){
            cin >> c[i][j];
            c[i][j]--;
        }
    }
    vector<int> cost(1<<N, 1e9);
    cost[0]=0;
    for(int i=0; i<M; i++){
        int bit=0;
        for(int j=0; j<(int)c[i].size(); j++){
            bit=bit|(1<<c[i][j]);
        }
        cost[bit]=min(cost[bit], a[i]);
    }
    for(int i=0; i<(1<<N); i++){
        for(int j=0; j<(1<<N); j++){
            int bit=i|j;
            cost[bit]=min(cost[bit], cost[i]+cost[j]);
        }
    }
    if(cost[(1<<N)-1] == 1e9) cout << -1 << endl;
    else cout << cost[(1<<N)-1] << endl;
    return 0;   
}

Measured memory_bytes: 3672
import java.io.*;
import java.io.IOException;

class Main{
	public static void main(String args[]){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int  	m,
				f,
				r,
				num=0;
		
		String[] input = new String[3];
		String[] grade = new String[50];
		
		try{
			input = br.readLine().split("[\\s]+");
			
			while(true){
				m = Integer.parseInt(input[0]);
				f = Integer.parseInt(input[1]);
				r = Integer.parseInt(input[2]);
				
				//終了判定
				if(m == -1 && f == -1 && r == -1){
					break;
				}
				
				//成績判定
				if(m < 0 || f < 0 || m + f < 30){
					grade[num] = "F";
				}else if(m + f < 50 && r < 50){
					grade[num] = "D";
				}else if(m + f < 65){
					grade[num] = "C";
				}else if(m + f < 80){
					grade[num] = "B";
				}else{
					grade[num] = "A";
				}
				num++;
				input = br.readLine().split("[\\s]+");
			}
		}catch(IOException e){
			System.out.println(e);
			return;
		}
		
		//出力
		for(int i=0;i<num;i++){
			System.out.println(grade[i]);
		}
		
	}
}



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

int main() {
	int N;
	cin >> N;
	vector<int> point(N);
	int score = 0;
	int m = 101;
	rep(i, N) {
		cin >> point[i];
		score += point[i];
		if (point[i] % 10 != 0) {
			m = min(m, point[i]);
		}
	}
	if (score % 10 == 0) {
		if (m == 101) {
			cout << 0 << endl;
		}
		else {
			cout << score - m << endl;
		}
	}
	else {
		cout << score << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
bool check(char a[4]){
	for(int i =0; i < strlen(a); i++){
		if(a[i] == a[i + 1])
		   return 0;
	}
	return 1;
}
int main(){
	char a[4];
	gets(a);
	if(!check(a))
	   cout << "Bad" << endl;
	else
	   cout << "Good" << endl;
}

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

int main(){
    int N,M,tmp;
    cin>>N;
    vector<int> T(N);
    for (int i=0;i<N;i++){
        cin>>T.at(i);
    }
    cin>>M;
    vector<int> P(M),X(M);
    for(int i=0;i<M;i++){
        int sum = 0;
        cin>>P.at(i)>>X.at(i);
        tmp = T.at(P.at(i)-1);
        T.at(P.at(i)-1)=X.at(i);
        for (int j=0;j<T.size();j++){
            sum+= T.at(j);
        }
        cout<<sum<<endl;
        T.at(P.at(i)-1) = tmp;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N; 
    cin >> N;
    vector<long> a(N+1);
    vector<long> b(N);
    for(int i=0; i<N+1; i++){
        cin >> a[i];
    }
    for(int i = 0; i<N; i++){
        cin >> b[i];
    }
    long res = 0;

    for(int i=0; i<N; i++){
        // i番目を全部倒せる
        if(b[i] > a[i]){
            res+=a[i];
            b[i]-=a[i]; // 残機が減る
            // i+1番目を倒す
            if(b[i] > a[i+1]){ // i+1番目を全部倒せる
                res+=a[i+1];
                a[i+1]=0;
            }else{
                res+=b[i];
                a[i+1]-=b[i];
            }
        // i番目を倒すが残してしまう
        }else{
            res+=b[i];

        }
    }

    cout << res << endl;

    return 0;
}


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


int main(){
    int n; cin >> n;
    vector<pair<int,int>> p;
    for(int i=0;i<n;i++){
        int x,y; cin >> x >> y;
        p.push_back(make_pair(x+y,x-y));
    }
      
    sort(p.begin(),p.end());

    int ans=n,memo=p[0].first;
    for(int i=1;i<n;i++){
      if(p[i].second<memo) ans--;
      else memo=p[i].first;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

// グラフ
using Graph = vector<vector<int> >;

int main() {
    int N, M; cin >> N >> M;
    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b; cin >> a >> b; --a, --b;
        G[a].push_back(b);
    }

    int shortest = N+1;
    vector<int> res;
    for (int s = 0; s < N; ++s) {
        vector<int> dist(N, -1);
        vector<int> prev(N, -1);
        queue<int> que;
        que.push(s); dist[s] = 0;
        while (!que.empty()) {
            auto v = que.front(); que.pop();
            for (auto nv : G[v]) {
                if (dist[nv] == -1) {
                    dist[nv] = dist[v] + 1;
                    prev[nv] = v;
                    que.push(nv);
                }
            }
        }
        for (int t = 0; t < N; ++t) {
            if (t == s || dist[t] == -1) continue;
            for (auto nt : G[t]) {
                if (nt == s) {
                    vector<int> tmp({s});
                    int cur = t;
                    while (cur != s) tmp.push_back(cur), cur = prev[cur];
                    if (shortest > tmp.size()) {
                        shortest = tmp.size();
                        res = tmp;
                    }
                }
            }
        }
    }

    if (shortest == N+1) cout << -1 << endl;
    else {
        cout << res.size() << endl;
        for (auto v : res) cout << v+1 << endl;
    }
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
	int H,W;
  	cin >> H >> W;
  	int ans =0;
  	for(int i=0;i<H;i++)
      for(int j=0;j<W;j++){
      	char c;
        cin >> c;
        ans += c=='#'?1:0;
      }
  	cout << (ans==H+W-1?"Possible":"Impossible");
}

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

class ABC124B{
    public static void Main(){
        var N = int.Parse(Console.ReadLine());
        var Hs = Console.ReadLine().Split().Select(int.Parse);
        var max = 0;
        var count = 0;
        foreach(var H in Hs){
            if(H>=max){
                count++;
                max = H;
            }
        }
        Console.WriteLine(count);
    }
}

Measured memory_bytes: 11220
#define _CRT_SECURE_NO_WARNINGS
#include <string.h>
#include <stdio.h>
	int main(void) {


		int a, b, c, d, e;
		scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
		if (c < e || d < e || a - c < e || b - d < e) printf("No\n");
		else printf("Yes\n");

    return 0;
}

Measured memory_bytes: 584
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int A, B, C;
    cin >> A >> B >> C;
    cout << min(C, B / A) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	static final boolean debugMode = false;

	static final long DIV_INF = 1000000007l;

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

		int n = readInt(sc);
		long k = readLong(sc);

		int[] a = new int[n + 1];
		for (int i = 0; i < n; i++) {
			a[i + 1] = readInt(sc);
		}

		long[] seen = new long[n + 1];
		long cnt = 0; // 今の回数
		int now = 1; // 今の場所

		while (true) {
			if (cnt == k) {
				System.out.println(now);
				return;
			}

			now = a[now];
			cnt++;
			if (seen[now] != 0) {
				// already visited
				long diff = cnt - seen[now];
				long x = (k - cnt) / diff;

				cnt += diff * x;

			}
			seen[now] = cnt;
		}

	}

	static int readInt(Scanner sc) {
		return Integer.parseInt(sc.next());
	}

	static Long readLong(Scanner sc) {
		return Long.parseLong(sc.next());
	}

	static void log(String s) {
		if (debugMode) {
			System.out.println(s);
		}
		return;
	}
}

class KrmlUtil {
	// a >= b
	static int gcd(int a, int b) {
		while (true) {
			if (b == 0)
				break;

			int mod = a % b;
			a = b;
			b = mod;
		}
		return a;
	}

	// a >= b
	static int lcm(int a, int b) {
		return a * b / gcd(a, b);
	}

	// a >= b
	static long gcd(long a, long b) {
		while (true) {
			if (b == 0)
				break;

			long mod = a % b;
			a = b;
			b = mod;
		}
		return a;
	}

	// a >= b
	static long lcm(long a, long b) {
		return a * b / gcd(a, b);
	}

	static BigInteger gcd(BigInteger a, BigInteger b) {
		return a.gcd(b);
	}

	static BigInteger lcm(BigInteger a, BigInteger b) {
		return a.divide(a.gcd(b)).multiply(b);
	}
}

class Pair {
	private int x;
	private int y;

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public Pair() {

	}

	public Pair(int x, int y) {
		this.x = x;
		this.y = y;
	}

}


Measured memory_bytes: 59964
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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;
}

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

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

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------


int main(){
ll a,b,c;
cin>>a>>b>>c;
cout<<min(b/a,c)<<endl;
}









Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;
using System.Text;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var N = consoleReader.Int;
            var a = consoleReader.Split.Int;

            long count = 0;
            int l = 0;
            int current = 0;
            for (int r = 0; r < a.Length; r++)
            {
                while (l < r && (a[r] & current) != 0) current ^= a[l++];
                current ^= a[r];
                count += r - l + 1;
            }

            return count;
        }

        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }
#pragma warning disable
    public class ConsoleReader
    {
        private string[] line = Array.Empty<string>();
        private int linePosition;
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (linePosition >= line.Length)
                {
                    linePosition = 0;
                    line = textReader.ReadLine().Split();
                }
                return line[linePosition++];
            }
        }
        public class SplitLine
        {
            private string[] splited;
            public SplitLine(ConsoleReader cr) { splited = cr.textReader.ReadLine().Split(); }
            public int[] Int => String.Select(x => int.Parse(x)).ToArray();
            public long[] Long => String.Select(x => long.Parse(x)).ToArray();
            public double[] Double => String.Select(x => double.Parse(x)).ToArray();
            public string[] String => splited;
        }
        public SplitLine Split => new SplitLine(this);
        public class RepeatReader
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerable<T> Select<T>(Func<ConsoleReader, T> func) { for (int i = 0; i < count; i++) yield return func(cr); }
            public IEnumerable<string> String { get { for (int i = 0; i < count; i++) yield return cr.String; } }
            public IEnumerable<int> Int { get { for (int i = 0; i < count; i++) yield return cr.Int; } }
            public IEnumerable<double> Double { get { for (int i = 0; i < count; i++) yield return cr.Double; } }
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
}

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

int main() {
	int x, y;
    cin >> x >> y;
    bool finish = false;
    for (int i = 0; i <= x; i++) {
        if (2*i + 4*(x-i) == y) {
            finish = true;
            break;
        }
    }
    if (finish) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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


def solve(S: str):
    if S=='ABC':
        print('ARC')
    else:
        print("ABC")
    return


# Generated by 1.1.6 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()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 8980
import itertools
N,M,Q = [int(i) for i in input().split()]
a = []
for _ in range(Q):
    a.append([int(i) for i in input().split()])
ans = 0
for L in itertools.combinations_with_replacement(range(1,M+1), N):
    s = 0
    for i in range(Q):
        if L[a[i][1]-1]-L[a[i][0]-1] == a[i][2]:
            s += a[i][3]
    ans = max(ans,s)
print(ans)

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

unsigned long long calc_cnt(int same_cnt) {
	unsigned long long ret = 0;
	for (int i = 1; i <= same_cnt; i++) {
		ret += i;
	}
	return ret;
}

int main(void) {
	int N;
	cin >> N;
	vector <string> slist(N);
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		int c[26] = {0};
		// 並び変える
		for (int j = 0; j < 10; j++) {
			c[(int)(s[j]-'a')]++;
		}
		for (int j = 0; j < 26; j++) {
			for (int k = 0; k < c[j]; k++) {
				slist[i] += (char)('a'+j);
			}
		}
	}
	sort(slist.begin(), slist.end());
	
	unsigned long long ans = 0;
	unsigned long long same_cnt = 0;
	for (int i = 1; i < N; i++) {
		if (slist[i-1] != slist[i]) {
			ans += calc_cnt(same_cnt);
			same_cnt = 0;
		} else {
			same_cnt++;
		}
	}
	ans += calc_cnt(same_cnt);
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7296
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))
(defmacro dp (name args memo-size &body body)
  (let ((memo (gensym)))
    `(let ((,memo (make-array ,memo-size :initial-element nil)))
       (defun ,name ,args
         (or (aref ,memo ,@args)
             (setf (aref ,memo ,@args)
                   ,@body))))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
        (cons (subseq str 0 pos)
              (split x (subseq str (+ pos size))))
        (list str))))


(defun main (n m item)
  (dp f (p w) '(101 100010)
    (if (eq p n) 0
        (apply #'max
               (append (list 0)
                       (loop for i from 0 to 1
                             for nv = (* i (cdr (aref item p)))
                             for nw = (+ w (* i (car (aref item p))))
                             when (<= nw m)
                               collect (+ nv
                                          (f (1+ p)
                                             nw)))))))
  (f 0 0))


(let* ((n (read))
       (m (read))
       (item (make-array (list n) :initial-contents
                         (loop repeat n collect (cons (read) (read))))))
  (princ (main n m item)))


Measured memory_bytes: 142360
#include <iostream>

using namespace std;

int func1(int n, int m) {
    int i, c;
    for (i = 0; i < m; i++) {
        c = n % 10;
        n /= 10;
    }
    return c;
}

bool func(int n) {
    int i;
    bool f = true;
    for (i = 0; i < 2; i++) {
        if (func1(n, i+1) != func1(n, 5-i))
            f = false;
    }
    return f;
}

int main() {
    int a, b, count = 0;
    cin >> a >> b;
    int i;
    for (i = a; i <= b; i++) {
        if(func(i))
            count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 888
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
ll power(ll x, ll y); 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitcount(n) __builtin_popcountll(n)
#define in_edges(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"

const ll MOD = 1000000007;
const int MX = 1e6 + 5;

int a[MX], b[MX];
ll pa[MX], pb[MX];
int n, m;
ll k;

bool chk(int x){
    // if(n + m < x) return 0;
    repp(i, 0, x){
        int A = i, B = x - A;
        if(B > m || A > n) continue;
        if(pa[A] + pb[B] <= k) return 1;
    }
    return 0;
}
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    quickio
    cin >> n >> m >> k;

    repp(i, 1, n) cin >> a[i];
    repp(i, 1, m) cin >> b[i];

    rep(i, 1, MX) pa[i] = pa[i - 1] + a[i], pb[i] = pb[i - 1] + b[i];

    ll l = 0, r = n + m + 1;

    while(l <= r){
        ll mid = (l + r)/2;
        if(chk(mid)) l = mid + 1;
        else r = mid - 1;
    }

    cout << r;

}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Measured memory_bytes: 20828
(function(input) {
    var n = Number(input.replace(/\n$/, ''));
    var v = 100000;
    for (var i = 1; i <= n; i++) {
        v = add(v);
    }
    console.log(v);
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

function add(v) {
    v = v * 1.05;
    v = Math.ceil(v / 1000) * 1000;
    return v;
}

Measured memory_bytes: 7380
#include<iostream>
#include<algorithm>
using namespace std;
const int N=105;
int ar[N];
int main(){
	int n,i,j,k,l,sum=0;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>ar[i];
	}
	sort(ar+1,ar+1+2*n);
	for(i=2*n;i>1;i-=2){
		sum+=ar[i-1];
		//cout<<sum<<" "<<i<<" "<<ar[i-1];
	}
	cout<<sum;
}

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

char change(char a){
  char ret;
  if (a=='A') ret = 'a';
  if (a=='B') ret = 'b';
  if (a=='C') ret = 'c';
  return ret;
}

int main(){
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  s[k-1] = change(s[k-1]);
  cout << s << endl;
}
  

Measured memory_bytes: 256
# 迷路読み込み
h,w = map(int, input().split())
maze=[list(input()) for i in range(h)]

import collections
from collections import deque

INF = -10 ** 9
distance = [[INF for i in range(w)] for j in range(h)]
d = deque()
def bfs():
    cnt=0
    while len(d):
        x, y = d.pop()
        for i in range(0, 4):
            nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]

            if (0 <= nx <=h-1) and (0 <= ny<=w-1) and (distance[nx][ny] == INF):
                d.appendleft((nx, ny))
                distance[nx][ny] = distance[x][y] + 1
                if cnt<distance[nx][ny]:
                    cnt=distance[nx][ny]

    return cnt


for i in range(h):
    for j in range(w):
        if maze[i][j]=='#':
            d.append((i,j))
            distance[i][j]=0
print(bfs())

Measured memory_bytes: 122716
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
const int mod = 1'000'000'007;
struct UnionFind{
    //自身が親なら頂点数に−1かけたもの
    //そうでなければ親のID
    vector<int>r;
    UnionFind(int n){
        r = vector<int>(n,-1); 
    }
    int root(int x){
        if(r[x] < 0) return x;
        return r[x] = root(r[x]);
    }
    bool unite(int x,int y){
        x = root(x);
        y = root(y);
        if(x == y) return false;
        if(r[x] > r[y])swap(x,y);
        r[x] += r[y];
        r[y] = x;
        return true;

    }
    int size(int x){
        return -r[root(x)];
    }

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

    UnionFind UF(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        UF.unite(a,b);
    }

    int ans = 0;
    rep(i,n){
        ans = max(ans,UF.size(i));
    }
    cout << ans << endl;

}


Measured memory_bytes: 4032
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>
#include <regex>
#include <functional>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;


int main(void) {
	int n;
	bool flag = false;
	cin >> n;
	while (n > 0) {
		if (n % 10 == 7) {
			flag = true;
		}
		n /= 10;
	}
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3636
"use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }

function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function main(input) {
  var lines = input.split('\n');

  var _splitNum = splitNum(lines.shift()),
      _splitNum2 = _slicedToArray(_splitNum, 2),
      N = _splitNum2[0],
      X = _splitNum2[1];

  var result = eat(N, X);
  console.log(result);
}

var memo = new Array(51).fill(-1);

function eat(n, remains) {
  if (n < 0) throw null;
  var full = height(n) <= remains;

  if (full && memo[n] >= 0) {
    return memo[n];
  }

  if (remains <= 0) {
    return 0;
  }

  if (n === 0) {
    return 1;
  }

  if (remains === 1) {
    return 0;
  }

  var res1 = eat(n - 1, remains - 1);
  var rem1 = remains - 1 - height(n - 1);

  if (rem1 <= 0) {
    return res1;
  }

  if (rem1 === 1) {
    return res1 + 1;
  }

  var res2 = eat(n - 1, rem1 - 1);

  if (full) {
    memo[n] = res1 + res2 + 1;
  }

  return res1 + res2 + 1;
}

function height(n) {
  return Math.pow(2, n + 2) - 3;
}

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

function splitNum(line) {
  return line.split(/\s+/).map(function (n) {
    return parseInt(n);
  });
}


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

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

int h, w, k;
int _x1, _y1, _x2, _y2;

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

  cin >> h >> w >> k;
  cin >> _x1 >> _y1 >> _x2 >> _y2;
  _x1--; _x2--; _y1--; _y2--;
  char grid[h][w];
  int dist[h][w];
  memset(dist, 0x3f, sizeof dist);
  dist[_x1][_y1] = 0;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      cin >> grid[i][j];
    }
  }

  queue<ii> que;
  que.push({_x1, _y1});
  while (!que.empty()) {
    auto [x, y] = que.front();
    if (x == _x2 && y == _y2) break;
    int ndist = dist[x][y] + 1;
    que.pop();
    for (int i = 1; i <= k; ++i) {
      int nx = x - i; int ny = y;
      if (nx < 0 || grid[nx][ny] == '@' || dist[nx][ny] < ndist)
        break;
      if (dist[nx][ny] > ndist) {
        dist[nx][ny] = ndist;
        que.push({nx, ny});
      }
    }
    for (int i = 1; i <= k; ++i) {
      int nx = x + i; int ny = y;
      if (nx == h || grid[nx][ny] == '@' || dist[nx][ny] < ndist)
        break;
      if (dist[nx][ny] > ndist) {
        dist[nx][ny] = ndist;
        que.push({nx, ny});
      }
    }
    for (int i = 1; i <= k; ++i) {
      int nx = x; int ny = y - i;
      if (ny < 0 || grid[nx][ny] == '@' || dist[nx][ny] < ndist)
        break;
      if (dist[nx][ny] > ndist) {
        dist[nx][ny] = ndist;
        que.push({nx, ny});
      }
    }
    for (int i = 1; i <= k; ++i) {
      int nx = x; int ny = y + i;
      if (ny == w || grid[nx][ny] == '@' || dist[nx][ny] < ndist)
        break;
      if (dist[nx][ny] > ndist) {
        dist[nx][ny] = ndist;
        que.push({nx, ny});
      }
    }
  }
  if (dist[_x2][_y2] == 0x3f3f3f3f)
    cout << -1 << endl;
  else
    cout << dist[_x2][_y2] << endl;

  return 0;
}


Measured memory_bytes: 9284
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-9;
const int inf=1e8;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
bool h;
vvi G;
vi in,used;
void dfs(int a){
	used[a]=true;
	vi t;
	ll ma=-1;
	int co=0;
	rep(i,G[a].size()){
		int to=G[a][i];
		if(used[to])continue;
		co++;
		dfs(to);
		t.pb(in[to]);
	}
	if(t.size()==0)return;
	ll sum=0;
	rep(i,t.size())sum+=t[i];
	rep(i,t.size())ma=max(ma,t[i]);
	if(sum<in[a])h=false;
	ll q=sum-in[a];
	if(ma>sum-ma&&q>sum-ma)h=false;
	if(in[a]<q)h=false;
	if(q*2>sum)h=false;
	in[a]-=q;
//	if(t.size()&&in[a]==0)h=false;
	return;
}
int main(){
	int n;
	h=true;
	cin>>n;
	in=vi(n);
	rep(i,n)cin>>in[i];
	G=vvi(n);
	used=vi(n);
	rep(i,n-1){
		int a,b;
		cin>>a>>b;
		a--;b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	if(n==2){
		if(in[0]!=in[1])cout<<"NO"<<endl;
		else cout<<"YES"<<endl;
		return 0;
	}
	rep(i,n)if(G[i].size()!=1){
		dfs(i);
		if(in[i])h=false;
		break;
	}
	if(h)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}













Measured memory_bytes: 15232
#include<stdio.h>

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


Measured memory_bytes: 1932