akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n;
	vector<string> v;

	cin>> n;
	v.resize(n);
	for(int i=0;i<n;i++) cin>> v[i];

	for(int i=1;i<v.size();i++){
		for(int j=0;j<i;j++){
			if(v[j]==v[i]){
				cout<< "No" << endl;
				return 0;
			}
		}
				
		//cout<< v[i-1][v[i-1].size()-1] << " " << v[i][0] << endl;
		if(v[i-1][v[i-1].size()-1]!=v[i][0]){
			cout<< "No" << endl;
			return 0;
		}
	}

	cout<< "Yes" << endl;


}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int x = a[0];
  for (int i = 1; i < n; i++) {
    x ^= a[i];
  }
  vector<int> ans(n, x);
  for (int i = 0; i < n; i++) {
    ans[i] ^= a[i];
    cout << ans[i] << ' ';
  }
  cout << '\n';
  return 0;
}

Measured memory_bytes: 4784
#include <bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<n;++i)
#define repe(i,k,n) for(int i=k;i<=n;++i)

using namespace std;

int main()
{
    cin.tie(0);cout.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int len=s.size();
    reverse(s.begin(),s.end());

    

    string t,temp;
    for (auto c:s){
        temp += c;
        if (temp== "maerd" or temp == "remaerd" or temp == "esare" or temp == "resare"){
            t += temp;
            temp = "";
        }
    }


    if (s == t) cout << "YES";
    else cout << "NO";
    return 0;
}


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

#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(int i=1; i<= (int)n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,l,r) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define ri(n) scanf("%d",&n)
#define sz(v) ((int)v.size())
#define all(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<char,int> pci;
typedef tuple<int, int, int> tiii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

const ll inf = 1e18;
const int nax = 1e2+2, V = 1e5+2;

ll dp[nax][V];
int w[nax], v[nax];

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cout<< setprecision(20)<< fixed;
  int n, W;
  cin>> n>> W;
  forn(i,n){
    cin>> w[i]>> v[i];
  }
  forn(i,n){
    forn(j,V){
      dp[i][j] = inf;
    }
  }
  dp[0][0] = 0;
  dp[0][v[0]] = w[0];
  for(int i= 1; i<n; ++i){
    for(int j = 0; j < V; ++j){
      dp[i][j] = min(dp[i][j], dp[i-1][j]);
      if(j>= v[i]){
        dp[i][j] = min(dp[i][j], dp[i-1][j-v[i]] + w[i]);
      }
    }
  }
  int ans = 0;
  for(int i= 0; i<V; ++i){
    if(dp[n-1][i]<= W) ans = i;
  }
  cout<< ans<<el;
  return 0;
}



Measured memory_bytes: 81744
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <iomanip>
using namespace std;
#define rep(i, N) for (ll i = 0; i < (N); i++)
typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll sum = 0;
    for (ll i = 1; i <= n; i++)
    {
        if (i % 3 != 0 && i % 5 != 0)
        {
            sum += i;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3660
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iX = int.Parse(sS[0]);
            int iN = int.Parse(sS[1]);
            List<int> lstP = new List<int>();
            if (iN > 0)
            {
                sS = System.Console.ReadLine().Trim().Split(' ');
                for (int i = 0; i < sS.Length; i++)
                {
                    lstP.Add(int.Parse(sS[i]));                                     // 入力
                }
            }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            lstP.Sort();
            int iOut = 0;
            int iAdd = 0;
            if (lstP.Count == 0) { iOut = iX; }                                     // 数列空
            else
            {
                while (true)
                {
                    int iPus = iX + iAdd;                                           // Xに近い方からの整数プラス方面
                    int iMus = iX - iAdd;                                           // Xに近い方からの整数マイナ方面
                    Boolean bPus = true;
                    Boolean bMus = true;
                    for (int i = 0; i < lstP.Count; i++)                            // 数列内に存在すればなし
                    {
                        if (iPus == lstP[i]) { bPus = false; }
                        if (iMus == lstP[i]) { bMus = false; }
                    }
                    if      (bMus) { iOut = iMus; break; }                          // 数列内に存在しなければ終了マイナ方面が先
                    else if (bPus) { iOut = iPus; break; }                          // 数列内に存在しなければ終了プラス方面が後
                    iAdd += 1;                                                      // 次に近い整数
                }
            }

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 27732
object Main extends App {
  val nk =  scala.io.StdIn.readLine()
  val nkArray = nk.split(" ").map(_.toInt).toSeq
  val n = nkArray(0)
  val k = nkArray(1)

  val pInput = scala.io.StdIn.readLine()
  val pArray = pInput.split(" ").map(_.toInt).toVector.sorted

  var result = 0
  (0 to k -1).foreach { p =>
    result = result + pArray(p)
  }
  println(result)
}

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

#define ll long long
#define pb push_back
#define pob pop_back

vector<int> dp;

int solve( vector<int> &numbers , int current_stone) {
    if(current_stone >= numbers.size()-1) return 0;
    if(dp[current_stone] != INT_MAX) return dp[current_stone];

    if(current_stone == numbers.size()-2) dp[current_stone] = abs(numbers[current_stone] - numbers[current_stone+1]);
    else 
    dp[current_stone] = min(abs(numbers[current_stone] - numbers[current_stone + 1]) + solve(numbers,current_stone+1),
    abs(numbers[current_stone] - numbers[current_stone + 2]) + solve(numbers,current_stone+2));

    return dp[current_stone];
}

int main(){
    int t = 1;
    // scanf("%d",&t);
    while(t--) {
        int ans = 0;
        int n = 0;
        vector<int> numbers;
        scanf("%d",&n); // Input size of array
        for(int i = 0; i < n; i++) { // Input array
            int temp;
            scanf("%d",&temp);
            numbers.push_back(temp);
        }
        dp.reserve(n);
        for(int i = 0;i < n; i++) {
            dp.push_back(INT_MAX);
        }
        cout << solve(numbers,0) << "\n";
        
    }
}

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

int main() {
  int n; cin >> n;
  vector<int> x(n);
  
  for(int i=0; i<n; i++){
    cin >> x[i];
  }
  
  int ans;
  int sum;
  for(int p=1; p<101; p++){
    sum = 0;
    for(int i=0; i<n; i++){
      int shouhi = x[i]*x[i] -2*x[i]*p +p*p;
      sum += shouhi;
    }
    if(p==1) ans = sum;
    else{
      if(ans >= sum) ans = sum;
    }
  }
  
  cout << ans << endl;
}
    

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

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            var in1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x.ToString())).ToList();
            var H = in1[0];
            var W = in1[1];
            var in2 = Console.ReadLine().Split(' ').Select(x => int.Parse(x.ToString())).ToList();
            var h = in2[0];
            var w = in2[1];


            var ans = (H * W) - ((H * w) + ((W - w) * h ));
            if (ans <= 0 || H < h || W < w)
                ans = 0;
            Console.WriteLine(ans.ToString());
        }
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;

int main(){
    long N; cin>>N;
    long max_num;
    long mark;
    long sum=0;
    long i=0;
    while(sum<=N){
        sum+=i;
        i++;
    }
    max_num=i;
    mark=sum-N;
    for(int j=1;j<max_num;j++){
        if(j!=mark)cout<<j<<endl;
    }
}

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

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    char c;
    cin >> c;
    if(c%97<=26)
    {
        cout << 'a';
    }
    else
    {
        cout << 'A';
    }
    
    return 0;
}




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

using i64 = long long int;

int main(){
    int n;
    cin >> n;
    for(int i=7;i>=0;--i){
        if(n & (1<<i)){
            cout << (n&(1<<i)) << endl;
            break;
        }
    }

    return 0;
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;

const int MOD = 998244353;

int main() {
    int N,K; cin >> N >> K;
    vector<int> L(K),R(K);
    REP(i,K){
        cin >> L[i] >> R[i];
    }
    vector<ll> dp(N+1,0);
    dp[0] = 1;

    REP(i,N-1){
        if(i!=0) dp[i] += dp[i-1];
        dp[i] = (dp[i]+MOD)%MOD;
        REP(k,K){
            if(i+L[k] <= N-1){
                dp[i+L[k]] += dp[i];
                dp[i+L[k]] = (dp[i+L[k]]+MOD)%MOD;
            }
            if(i+R[k]+1 <= N-1){
                dp[i+R[k]+1] -= dp[i];
                dp[i+R[k]+1] = (dp[i+R[k]+1]+MOD)%MOD;
            }

        }
        // REP(i,N){
        //     cout << dp[i] << " ";
        // }
        // cout << endl;
    }
    cout << (dp[N-1]+MOD)%MOD << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

int main( int argc, char *argv[] ) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	queue<ll> lun;
	for ( int i = 1 ; i < 10 ; i++ ){
		lun.push(i);
	}
	ll k, res;
	cin >> k;
	while ( k ){
		res = lun.front();
		lun.pop();
		if ( res % 10 != 0 )
			lun.push(res * 10 + res % 10 - 1);
		lun.push(res * 10 + res % 10);
		if ( res % 10 != 9 )
			lun.push(res * 10 + res % 10 + 1);
		k--;
	}
	cout << res << "\n";


	return 0;
}


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

int solve(int* s, int N){

  sort(s,s+N);

  int sum = 0;

  for(int i = 0; i < N; i++) sum += s[i];

  if(sum % 10 != 0)
    return sum;
  
  for(int i = 0; i < N; i++)
    if(s[i] % 10 != 0){
      return sum - s[i];
    }
  return 0;
}

int main(){
  int N;
  int s[101];
  cin >> N;
  for(int i = 0; i < N; i++) cin >> s[i];
  cout << solve(s, N);
  return 0;
}

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

int main()
{
  int a,b,c,k;
  cin >> a >> b >> c;
  cin >> k;
  int x=0,y=0;
  if(b<=a){
        while(b<=a){
            b*=2;
            x++;
        }
  }
  if(c<=b){
        while(c<=b){
            c*=2;
            y++;
        }
  }

  if(x+y>k)
    cout << "No" << endl;
    
  else
    cout << "Yes" << endl;
  return 0;
    
}

Measured memory_bytes: 3620
def distance(coordinate1, coordinate2):
    x1 = coordinate1[0]
    y1 = coordinate1[1]
    x2 = coordinate2[0]
    y2 = coordinate2[1]
    return abs(x1 - x2) + abs(y1 - y2)


def main():
    n, m = map(int, input().split())
    ab_lst = [list(map(int, input().split())) for _ in range(n)]
    cd_lst = [list(map(int, input().split())) for _ in range(m)]
    point_lst = []

    for i in range(n):

        distance_lst = []
        for j in range(m):

            coordinate1 = ab_lst[i]
            coordinate2 = cd_lst[j]
            distance_lst.append(distance(coordinate1, coordinate2))

        minimum = min(distance_lst)
        for k in range(m):
            if distance_lst[k] == minimum:
                point_lst.append(k + 1)
                break

    for i in range(n):
        print(point_lst[i])


if __name__ == '__main__':
    main()

Measured memory_bytes: 9156
#include<bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
using namespace std;
const int inf=0x3f3f3f3f;
const long long inf2=(1<<62)-1;
const double eps=1e-6;
const int mod=1000000007;
void sol(char &x){
if(x=='1')x='9';
else if(x=='9')x='1';
}
int main(){
	int a;
	cin>>a;
	cout<<(a+110)/111*111<<endl;
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define forz(i,n) for(lli i=0;i<n;i++)
 
#define pb push_back
#define fi first
#define se second
#define mp make_pair 
#define pll pair < lli , lli >
#define vll vector < lli > 

#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
 
 
 
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0) 
#define deb(x) cout << #x << "=" << x << endl
#define debvec(v) {cout<<#v<<'=';for(auto itr=v.begin();itr!=v.end();itr++)cout<<*itr<<' ';cout<<endl;}
#define deb2(x,y) cout << #x << ',' << #y << "=(" << x << "," << y << ")" << endl;
#define deb2dvec(v) cout<<#v<<"=";for(auto x:v){for(auto y:x)cout<<y<<' ';cout<<endl;}



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


lli power(lli x, lli y, lli p)  
{  
    lli res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  

lli modInverse(lli n, lli p) 
{ 
    return power(n, p-2, p); 
} 

lli nCrModPFermat(lli n, lli r, lli p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    lli fac[n+1]; 
    fac[0] = 1; 
    for (lli i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%p; 
  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
} 

vector<int> flip(string A) {
    int max_so_far = INT_MIN, max_ending_here = 0, 
       start =0, end = 0, s=0,r=0,l=0,maxsum = 0; 
  vector < int > v;
  int a[A.size()+10];
    for (int i=0; i< A.size(); i++ ) 
    { 
        if(A[i]=='1')
        {
            s--;
            start++;
        }
        else
        s++;
        
        s= max(s,0);
        a[i] = s;
        if(maxsum<s)
        {
            maxsum = s;
            r = i;
        }
    } 
    
    
    int v1 = r,er = 0;
    while(v1>=0)
    {
        if(A[v1]=='1')
        er--;
        else
        er++;
        if(er==maxsum)
        l = v1;
        
        v1--;
    }
    
    if(start==A.size())
    return v;
    else
    {
        v.push_back(l+1);
        v.push_back(r+1);
        return v;
    }
    
}
lli a[1000010]={0};


lli solve(lli n)
{
	lli i=1;
	while(a[i]<=n)
	{
		i++;
	}
	i--;
	n = n - a[i];
	if(n<0 || i==0)
	return 0;
	else
	{
		return (lli)1 + solve(n);
	}
}





int main()
{
	kira;
	lli a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k<=a)
	cout<<k;
	else if(k<=a+b && k>a)
	cout<<a;
	else
	{
		cout<<a-(k-(a+b));
	}
	return 0;
}







Measured memory_bytes: 3640
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
template <typename T>
using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);

int main(){
	int a,b;
  cin >> a >> b;
  cout << 6- a - b;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;
typedef pair<ll,ll> pii;

int main(){
    int N;cin >> N;
    vector<pii> a(N);
    rep(i,N){
        cin >> a[i].first >> a[i].second;
    }

    vector<pii> b;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(i!=j){
            pii p = make_pair(a[i].first-a[j].first,a[i].second-a[j].second);
            b.push_back(p);
            } 
        }
    }
    int res = N;
    for(int i=0;i<b.size();i++){
        int tmp = N;
        for(int j=0;j<b.size();j++){
            if(b[j]==b[i])tmp--;
        }
        res = min(res,tmp);
    }
    cout << res << endl;
    return 0;
}

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

int sumofdigits(int n){
  int sum = 0;
  while(n > 0){
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int n;
  cin >> n;
  int ans = 10000000;
  for(int i = 1; i < n; i++){
    int k = sumofdigits(i) + sumofdigits(n-i);
    if(k < ans){
      ans = k;
    }
  }
  cout << ans << endl;
}

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

int main() {
	string s, t;
	cin >> s >> t;

	int ans = 0;

	for (int i = 0; i < s.length(); i++) {
		if (s[i] != t[i]) ans++;
	}

	cout << ans << endl;
}

Measured memory_bytes: 3832
#include <iostream>
using namespace std;
int main() {
	int A, B, C;
	bool can = false;
	cin >> A >> B >> C;

	for (int i = 1; i <= B; i++)
	{
		if ((A*i) % B == C) {
			can = true;
		}
	}

	if (can) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)

p_s = s[:((n+1) // 2 )-1]
s_s = s[((n+3) // 2) - 1:]

if s == s[::-1] and p_s == p_s[::-1] and s_s == s_s[::-1]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;




struct UnionFind{
    vector<ll> par;
    vector<ll> rank;
    vector<ll> sizeth;
    
    void init(ll N){
        rep(i, N){
            par.push_back(i);
            rank.push_back(0);
            sizeth.push_back(1);
        }
    }
    
    ll root(ll x) {
        if(par[x]==x) return x;
        else return par[x]=root(par[x]);
    }
    
    bool isSame(ll x, ll y) {
        return root(x)==root(y);
    }
    
    bool merge(ll x, ll y) {
        x=root(x);
        y=root(y);
        if(x==y) return false;
        if(rank[x]>rank[y]) swap(x, y);
        sizeth[y] += sizeth[x];
        par[x]=y;
        if(rank[x]==rank[y]) rank[x]++;
        return true;
    }
    
    ll size(ll x){
        return sizeth[root(x)];
    }
};UnionFind unifi;
int main(void){
    ll N, M;
    cin>>N>>M;
    ll A, B;
    unifi.init(N);
    rep(i, M){
        cin>>A>>B;
        unifi.merge(A-1, B-1);
    }
    ll Max=0;
    rep(i, N){
        Max=max(unifi.size(i), Max);
    }
    cout<<Max<<endl;
    return 0;
}




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

using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;

const ll linf = 1LL << 62;
const int inf = 99999999;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };
const ll atcoder = 1e9 + 7;

#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back
#define pr(x) cout << x << endl
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define rep(i,n) for(int i= 0;i<n;i++)
#define FOR(i,a,b) for(int i = a;i<b;i++)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll gcd(ll a, ll b) {//最大公約数
	if (a < b)swap(a, b);
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	if (a < b)swap(a, b);
	return (a / gcd(a, b))*b;
}

int main() {
	
	ll ans = linf;
	int x[60], y[60];

	vector<pi>v;

	int n, k;
	cin >> n >> k;

	rep(i, n) {
		cin >> x[i] >> y[i];
		v.pb(mp(x[i],y[i]));
	}

	sort(x, x + n);
	sort(y, y + n);

	rep(xl, n) {
		FOR(xr,xl+1, n) {
			rep(yu,n){
				FOR(yt,yu+1, n) {
					int cnt = 0;

					rep(i, n) {
						int a = v[i].first;
						int b = v[i].second;
						if (x[xl] <= a && a <= x[xr] && y[yu] <= b && b <= y[yt])cnt++;
					}

					if (cnt >= k)chmin(ans,1LL*(x[xr]-x[xl])*(y[yt]-y[yu]));
				}
			}
		}
	}

	pr(ans);

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[1100];
int main()
{
	int n;cin>>n;scanf("%s",a+1);
	if(n&1)
	{
		puts("No");return 0;
	}
	for(int i=1;i<=n/2;i++)
	{
		if(a[i]!=a[i+n/2])
		{
			puts("No");return 0;
		}
	}puts("Yes");return 0;
}


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

int main()
{
	int a,b;
	cin>>a>>b;

	int ans = -1;
	for(int i=0;i<=10000;i++)
	{
		if((i*8)/100 == a && (i*10)/100 == b)
		{
			ans = i;
			break;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
//atcoder problemsに反映されてないので再提出
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
const int INF = 1e9;
 
int x, a, b;
 
signed main()
{
    cin >> x >> a >> b;
 
    if (abs(a - x) < abs(b - x)) {
        cout << "A" << endl;
    } else {
        cout << "B" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(a,n) for (int a = 0; a < (n); ++a)
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
typedef vector<vector<ll> > Graph;
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 ll INF = 1e18;

int main(){
    ll d,t,s;
    cin >> d >> t >> s;
    if(s*t>=d){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int a, b, c;
  cin >> a >> b >> c;

  if(a + b == c || a + c == b || a == b + c) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
#define N 301
int n,m;
int a[N][N];
int num[N];
bool v[N];
int ans;
int main(){
    scanf("%d%d",&n,&m);
    int s;
    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j)
            scanf("%d",&a[i][j]);
        int b=a[i][1];
        if(++num[b]>ans){
            ans=num[b];
            s=b;
        }
    }
    for(int i=1;i<m;++i){
        memset(num,0,sizeof num);
        v[s]=1;
        int tans=0;
        for(int j=1;j<=n;++j){
            for(int k=1;k<=m;++k){
                int b=a[j][k];
                if(!v[b]){
                    if(++num[b]>tans){
                        tans=num[b];
                        s=b;
                    }
                    break;
                }
            }
        }
        ans=min(ans,tans);
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 512
N = int(input())
b = [0, 0, 0]
for i in map(int, input().split()):
    b[i - 1] += 1
k1, k2, k3 = b
dp = [[[0] * (k3 + 1) for _ in range(k2 + k3 + 1)] for _ in range(k1 + k2 + k3 + 1)]
dp[0][0][0] = 0

for k in range(k3 + 1):
    for j in range(k2 + k3 + 1 - k):
        for i in range(k1 + k2 + k3 + 1 - j - k):
            if not i + j + k:
                continue
            dp[i][j][k] = ((dp[i - 1][j][k] * i if i else 0) + (dp[i + 1][j - 1][k] * j if j else 0) + (
                dp[i][j + 1][k - 1] * k if k else 0) + N) / (i + j + k)


print(dp[k1][k2][k3])


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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
#define length(a) (hypot((a).imag() , (a).real()))
#define eps 1e-8
#define vec(a,b) ((b)-(a))
#define dot(a,b) ( (conj(a)*(b)).real() )
#define polar(r,t) ((r)*exp(point(0,(t))))
#define cross(a,b) ( (conj(a)*(b)).imag() )
#define point complex <ld>
#define x real()
#define y imag()
#define pi acos(-1)

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll s,w;
    cin >> s >> w;
    if (w >= s) cout << "unsafe\n";
    else cout << "safe\n";

    return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;

void solve() {

}

int main() {
  int N,L;
  cin >> N >> L;
  vector<int> vec;
  int sum = 0;
  REP(i,1,N+1) {
    vec.pb(L+i-1);
    sum += ( L + i - 1 );
  }
  int ans = INT_MAX;
  rep(i,(int)vec.size()) {
    int tmp = sum - vec[i];
    if( ans == INT_MAX ) ans = tmp;
    else {
      if( abs(sum-tmp) < abs(sum-ans) ) ans = tmp;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)

struct UnionFind{
    vector<ll> par,siz;

    UnionFind(ll N):par(N+1),siz(N+1,1){
        rep1(i,N) par[i]=i; //親を自分自身として初期化
    }

    ll root(ll x){
        if(par[x]==x){
            return x;
        }
        else{
            return  par[x]=root(par[x]);
        }
    }
    void unite(ll x,ll y){
        x=root(x);
        y=root(y);
        if(x==y) return;

        if(siz[x]<siz[y]) swap(x,y);
        
		siz[x]+=siz[y];
		siz[y]=siz[x];
		par[y]=x;
    }
    bool same(ll x,ll y){
        return root(x)==root(y);
    }
    ll size(ll x){
        return siz[root(x)];
    }
};

int main(){
	//input
	ll N,M; cin>>N>>M;
	vector<ll> A(M+1);
	vector<ll> B(M+1);
	rep1(i,M) cin>>A[i]>>B[i];

	vector<ll> ans(M+1);
	ans[M]=N*(N-1)/2;

	UnionFind tree(N);
	rrep1(i,M){
		if(tree.same(A[i],B[i])) ans[i-1]=ans[i];
		else ans[i-1]=ans[i]-tree.size(A[i])*tree.size(B[i]);
		tree.unite(A[i],B[i]);
	}
	
	rep1(i,M) cout<<ans[i]<<endl;
}

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

int f[50];
int main() {
	int n; scanf("%d", &n);
	f[0] = f[1] = 1;
	for (int i = 2; i <= n; i++)f[i] = f[i - 2] + f[i - 1];
	printf("%d\n", f[n]);
}

Measured memory_bytes: 3208
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

//組み合わせを線形で
//参考:https://drken1215.hatenablog.com/entry/2018/06/08/210000

const int MXN=1000001;//変更可
ll fac[MXN],inv[MXN],finv[MXN];

void COMinit(int M) {
    fac[0]=fac[1]=1;
    inv[1]=1;
    finv[0]=finv[1]=1;
    for(int i=2;i<MXN;i++){
        fac[i]=fac[i-1]*i%M;
        inv[i]=M-M/i*inv[M%i]%M;
        finv[i]=finv[i-1]*inv[i]%M;
    }
}

ll COMBI(int N,int K,int M){
    if(N<K){
        return 0;
    }
    if(N<0||K<0){
        return 0;
    }
    return fac[N]*finv[N-K]%M*finv[K]%M;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,K;
    cin >> N >> K;
    COMinit(MOD2);
    ll res=0;
    rep(i,K+1){
        int B=i,R=K-i;
        if(R>=N){
            if(R==B) res+=COMBI(K-1,B-1,MOD2)-COMBI(K-1,N+B-R-2,MOD2);
            if(R>B) res+=COMBI(K,B,MOD2)-COMBI(K,N+B-R-1,MOD2);
            res%=MOD2;
        }
    }
    cout << (res+MOD2)%MOD2 << '\n';
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/


Measured memory_bytes: 27072
#include<stdio.h>

int main(){
  int i,j,n,m,mini,count=0,a[100];
  
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);

  for(i=0;i<=n-1;i++){
    mini=i;
    for(j=i;j<=n-1;j++){
      if(a[j]<a[mini]) mini = j;
    }

    if(i!=mini){
      m=a[i];
      a[i]=a[mini];
      a[mini]=m;
      count++;
    }
  }

  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    printf("%d",a[i]);
  }
  printf("\n%d\n",count);
  
  return 0;
}

Measured memory_bytes: 604
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n, m, c = LI()
b = LI()
a = LIR(n)
ans = 0

for i in range(n):
    s = 0
    for j in range(m):
        s += a[i][j] * b[j]
    if s + c > 0:
        ans += 1
print(ans)


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

int main() {
	string S;
	llong N;

	cin >> S;
	N = S.size();

	vector<llong> r, l;
	for (int i = 0; i < N; ++i) {
		if (S[i] == 'R') {
			r.push_back(i);
		} else {
			l.push_back(i);
		}
	}

	vector<llong> ans(N, 0);
	for (int i = 0; i < N; ++i) {
		if (S[i] == 'R') {
			llong pos = *upper_bound(ALL(l), i);
			// cerr << i << " " << pos << " " << pos - i <<  endl;
			if ((pos - i) % 2 == 0) {
				ans[pos]++;
			} else {
				ans[pos-1]++;
			}
		} else {
			llong pos = *(--upper_bound(ALL(r), i));
			// cerr << i << " " << pos << " " << pos - i << endl;
			if ((i-pos) % 2 == 0) {
				ans[pos]++;
			} else {
				ans[pos+1]++;
			}
		}
	}

	for (int i = 0; i < N; ++i)
		cout << ans[i] << " ";
	cout << endl;

	return 0;
}

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

int a, b, c, d, N;
cin >> N;
a=N/1000;
b=(N%1000)/100;
c=((N%1000)%100)/10;
d=N%10;
if(N%1111==0){
cout <<"Yes" << endl;
}
else if(a==b && b==c){
cout <<"Yes" << endl;
}
else if (b==c && c==d){
cout << "Yes" << endl;
}
else{
cout <<"No" << endl;
}
}

Measured memory_bytes: 3628
#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);
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << '\n';


    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(llint i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define Pll pair<llint,llint>
#define keta(a)  fixed << setprecision(a)
const ll mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
const ll INF = 1000000000;


int main() {
	int n;
	cin >> n;
	hei(llint) a(n), b(n);
	rep(i, 0, n)cin >> a[i] >> b[i];
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	llint ans;
	if (n % 2) {
		ans = b[n / 2] - a[n / 2] + 1;
	}
	else {
		ans = b[n / 2]+b[(n-1)/2] - a[n / 2]-a[(n-1)/2] + 1;
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6408
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n+1];
    int[] arr1 = new int[n];
    for(int i=0;i<n+1;i++){
      arr[i]=sc.nextInt();
    }
    for(int i=0;i<n;i++){
      arr1[i]=sc.nextInt();
    }
    long sum=0;
    for(int i=0;i<n;i++){
 
      if(arr[i]+arr[i+1]<=arr1[i]){
     //   System.out.println("verma");
        sum=sum+arr[i]+arr[i+1];
        arr[i]=0;
        arr[i+1]=0;
      }
      else{
       
        if(arr[i]<=arr1[i]){
   //        System.out.println("anuj");
          arr[i+1]=arr[i+1]-(arr1[i]-arr[i]);
          arr[i]=0;
       //   System.out.println(arr[i+1]);
        }
        else{
   //       System.out.println("anuj1");
          arr[i]=arr[i]-arr1[i];
        }
         sum=sum+arr1[i];
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 65112
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;
using ull = unsigned long long;

int main() {
    int N;
    cin >> N;
    set<int> d;
    for (int i = 0; i < N; ++i) {
        int tmp;
        cin >> tmp;
        d.insert(tmp);
    }
    cout << d.size() << endl;
}


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

using namespace std;

#define ll long long

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

    double i;
    for(i = 0; pow(k, i) <= n;i+=1.0);

    if(i == 0) i = 1;
    cout << i << endl;

    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int k,a,b;
    scanf("%d%d%d",&k,&a,&b);
   	if(a%k==0)
    printf("OK");
    else
    {
    	if(k*((a/k)+1)<=b)
        printf("OK");
        else
        printf("NG");
    }
    return 0;
}

Measured memory_bytes: 1704
import Data.List
import Data.Char
import Data.Functor
import Text.Printf
import Control.Monad
import System.IO
import qualified Data.ByteString.Char8 as B

getInts :: IO[Int]
getInts = unfoldr (B.readInt . B.dropWhile isSpace) <$> B.getLine

eps :: Float -> Float
eps x = if x==0.0 then 0.0 else x

main = do
  end <- isEOF
  if end then return ()
  else do
    xs <- getInts
    let [a,b,c,d,e,f] = map fromIntegral xs
        x = eps $ (c * e - b * f) / (a * e - b * d)
        y = eps $ (c * d - a * f) / (b * d - a * e)
        in putStrLn $ printf "%.3f %.3f" x y
    main

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	int h, w, i, j, k;
	scanf("%d%d", &h, &w);
	vector< vector<char> > s(h + 2, vector<char>(w + 2,'.'));
	for (i = 1; i <= h; i++) {
		for (j = 1; j <= w; j++) {
			scanf(" %c", &s[i][j]);
		}
	}
	vector< vector<char> > ans(h, vector<char>(w));
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			if (s[i + 1][j + 1] == '#') {
				ans[i][j] = '#';
			}
			else {
				int cnt = 0;
				for (k = 0; k < 8; k++) {
					if (s[i + 1 + dy2[k]][j + 1 + dx2[k]] == '#') {
						cnt++;
					}
				}
				ans[i][j] = '0' + cnt;
			}
		}
	}
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			printf("%c", ans[i][j]);
		}
		printf("\n");
	}
}

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

using namespace std;

const int MAX_N = 1e5 + 200;

int n, head[MAX_N], current, deg[MAX_N], cdeg[MAX_N], odeg[MAX_N], ans[MAX_N], seq[2][MAX_N];
bool tag[MAX_N];

struct edge
{
    int to, nxt;
} edges[MAX_N << 1];

void addpath(int src, int dst)
{
    edges[current].to = dst, edges[current].nxt = head[src];
    head[src] = current++;
}

void solve(int curt, int idx)
{
    int u = curt, fa = 0, ptr = 0;
    seq[idx][++ptr] = 1;
    while (u != fa)
    {
        int cptr = ++ptr;
        for (int i = 1; i <= odeg[u]; i++)
            seq[idx][ptr] = ptr + 1, ptr++;
        seq[idx][ptr] = cptr, cptr = u;
        for (int i = head[u]; i != -1; i = edges[i].nxt)
            if (edges[i].to != fa && !tag[edges[i].to])
            {
                u = edges[i].to;
                break;
            }
        fa = cptr;
    }
    seq[idx][++ptr] = n;
}

int main()
{
    memset(head, -1, sizeof(head));
    scanf("%d", &n);
    for (int i = 1, u, v; i <= n - 1; i++)
        scanf("%d%d", &u, &v), addpath(u, v), addpath(v, u), deg[u]++, deg[v]++;
    for (int i = 1; i <= n; i++)
        if (deg[i] == 1)
            tag[i] = true;
    int max_deg = 0;
    for (int u = 1; u <= n; u++)
        if (tag[u] == false)
        {
            for (int i = head[u]; i != -1; i = edges[i].nxt)
                if (tag[edges[i].to] == false)
                    cdeg[u]++;
                else
                    odeg[u]++;
            max_deg = max(max_deg, cdeg[u]);
            if (cdeg[u] >= 3)
                puts("-1"), exit(0);
        }
    if (max_deg == 0)
    {
        ans[1] = 1, ans[n] = n;
        if (n >= 3)
            ans[n - 1] = 2;
        for (int i = 2, j = 3; i <= n - 2; i++, j++)
            ans[i] = j;
        for (int i = 1; i <= n; i++)
            printf("%d ", ans[i]);
        return 0;
    }
    for (int i = 1; i <= n; i++)
        if (cdeg[i] == 1)
            odeg[i]--;
    for (int i = 1, opt = 0; i <= n; i++)
        if (cdeg[i] == 1)
            solve(i, opt++);
    int verdict = true;
    for (int i = 1; i <= n; i++)
        if (seq[0][i] != seq[1][i])
        {
            verdict = seq[0][i] > seq[1][i];
            break;
        }
    for (int i = 1; i <= n; i++)
        printf("%d ", seq[verdict][i]);
    return 0;
}

Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace   std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define double    long double
#define ull       unsigned long long
#define mod       1000000007
#define vi        vector<ll>
#define extreme   inline
#define ppi       pair<ll,pair<ll,ll>>
#define pb        push_back
#define mp        make_pair
#define str       string
#define pi        2*acos(0.0)
#define pr(a,x,n) for(int i=x;i<n;i++){cout<<a[i]<<" ";}
#define p(a)      cout<<a;
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define test      cout<<"THIS_AND_THIS"<<endl;
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
void solve(){
	ll n,m,sum=0;cin>>n>>m;
	ll arr[m];
	for(int i=0;i<m;i++){
		cin>>arr[i];sum+=arr[i];
	}
	if(sum>=n){cout<<"Yes";}
	else{cout<<"No";}
}
int32_t main(){
	kehsihba();
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}

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

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

	N--;

	cout << 1 + (N % 99) + (N / 99) * 100;

	for (int i = 0; i < D; i++) {
		cout << "00";
	}
	cout << '\n';

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>

using namespace std;
const int INFTY = (1<<21);

int n;
int A[101][101];
int d[101];

void bfs(int s) {
  queue<int> q;
  q.push(s);
  d[s] = 0;

  int u;
  while(!q.empty()) {
    u = q.front(); q.pop();
    for (int v = 0; v < n; ++v) {
      if (A[u][v] == 1 && d[v] == INFTY) {
        d[v] = d[u] + 1;
        q.push(v);
      }
    }
  }
}

int main() {
  
  cin >> n;
  
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      A[i][j] = 0;
    }
  }
  for (int i = 0; i < n; ++i) {
    d[i] = INFTY;
  }

  int u, v;
  int k;
  for (int i = 0; i < n; ++i) {
    cin >> u >> k;
    for (int j = 0; j < k; ++j) {
      cin >> v;
      A[u-1][v-1] = 1;
    }
  }

  bfs(0);

  for (int i = 0; i < n; ++i) {
    if (d[i] == INFTY) {
      cout << i+1 << " " << -1 << endl;
    } else {
      cout << i+1 << " " << d[i] << endl;
    }
  }
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
const ll INF = 9e18;

void print() { cout << endl; }
template <typename Head, typename... Tail>
void print(Head head, Tail... tail) {
    int size = sizeof...(Tail);
    cout << head;
    if (size > 0) {
        cout << " ";
    }
    print(tail...);
}

void print0() {}
template <typename Head, typename... Tail>
void print0(Head head, Tail... tail) {
    cout << head;
    print0(tail...);
}

ll fn(ll a, ll b, ll n) {
    if (a >= b) {
        return a - b;
    } else {
        return a - b + n;
    }
}

int main() {
    ll N, M;
    cin >> N >> M;
    vector<bool> pexist(200001, false);
    vector<bool> nexist(200001, false);
    ll cnt = 0;

    ll S = N / 2;

    for (ll i = 1;; i++) {
        ll j = S - i + 1;
        //print(M, S, i, j);
        if (i >= j) {
            break;
        }
        print(i, j);
        cnt++;
        if (cnt == M) {
            return 0;
        }
    }

    for (ll i = 1;; i++) {
        ll p = S + i;

        ll q = N - i + N % 2;
        print(p, q);
        cnt++;
        if (cnt == M) {
            return 0;
        }
    }
}


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

int main() {    
    string s;
    cin >> s;
    cout << s[0] << s.size() -2 << s[s.size() -1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int cnt=0,cnt1=0,i;
    for(i=0;i<3;i++)
    {
        cin>>s[i];
        if(s[i]=='A')
            cnt++;
        else
            cnt1++;
    }
    if(cnt==0||cnt1==0)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;

}


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

int rec(int k,ll mask){
    if(k == 12){
        int ans = 12;
        mask |= mask<<24;
        rep(i,48)rep(j,i){
            if((mask&(1LL<<i)) && (mask&(1LL<<j))){
                ans = min(ans,i-j);
            }
        }
        return ans;
    }
    if(mp[k]==1){
        return max(rec(k+1,mask|(1<<k)),rec(k+1,mask|(1<<(24-k))));
    }else{
        return rec(k+1,mask);
    }
}

int solve(){
    int n;
    cin>>n;
    mp[0]++;
    rep(i,n){
        int d;
        cin>>d;
        mp[d]++;
        if(mp[d] >= 3) return 0;
    }
    if(mp[0] >= 2 || mp[12] >= 2) return 0;
    ll mask = 1;
    if(mp[12]==1) mask |= 1<<12;
    rep(i,12) if(mp[i]==2) mask |= (1<<i)|(1<<(24-i));
    return rec(1,mask);
}

int main(void){
    cout<<solve()<<endl;
    return 0;
}


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

int main() {
  int N, M;
  
  cin >> N >> M;
  
  vector<int> a(M);
  vector<ll> dp(N+1);

  rep(i,M){
    cin >> a.at(i);
    dp.at(a.at(i)) = -1;
  }

  dp.at(0) = 1;
  if(dp.at(1) == -1) dp.at(1) = 0;
  else dp.at(1) = 1;

  for(int i = 2; i <= N; i++){
    if(dp.at(i) == -1){
      dp.at(i) = 0;
      continue;
    }
    else{
      dp.at(i) = dp.at(i-1) + dp.at(i-2);
      dp.at(i) %= 1000000007;
    }
  }

  cout << dp.at(N)%1000000007 << endl;
  return 0;
}

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

int main(){
	int n;
	std::cin >> n;
	std::vector<int> v(1e5 + 1, 0);
	int a;
	for(int i = 0; i < n; i++){
		std::cin >> a;
		v[a]++;
		v[a + 1]++;
		if(a != 0)v[a - 1]++;
	}

	int ans = 0;
	for(int i = 0; i < 1e5 + 1; i++)ans = std::max(ans, v[i]);

	std::cout << ans << std::endl;

}


Measured memory_bytes: 640