akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  string s;
  cin>>s;
  int n=s.size();
  if(s[0]==s[n-1]){
    if(n%2)cout<<"Second"<<endl;
    else cout<<"First"<<endl;
  }else{
    if(n%2)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
  }
}


Measured memory_bytes: 512
function main(input) {
  const n = parseInt(input[0]);
  let c = input[1].split("");

  let cnt = 0;

  let edge_s = 0;
  let edge_e = n-1;

  while(edge_s<edge_e){
    let judge = true;
    while(c[edge_s]==="R"){
      if(edge_s>=edge_e){
        judge = false;
        break;
      }
      edge_s++;
    }
    while(c[edge_e]==="W"){
      if(edge_s>=edge_e){
        judge = false;
        break;
      }
      edge_e--;
    }
    if(judge){
      c[edge_s]="R";
      c[edge_e]="W";
      cnt++;
    }else{
      break;
    }
  }
  console.log(cnt);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

Measured memory_bytes: 34800
let rec seq a b = if a > b then [] else a :: seq (a+1) b
let (>>=) x f = List.map f x |> List.concat
let () =
  Scanf.scanf "%d %d %d %d" @@ fun a b c x ->
    (seq 0 a >>= fun i ->
     seq 0 b >>= fun j ->
     seq 0 c >>= fun k ->
       [if 500*i + 100*j + 50*k = x then 1 else 0])
    |> List.fold_left (+) 0
    |> Printf.printf "%d\n"

Measured memory_bytes: 8576
import math
import itertools

n, m = map(int, input().split(" "))
sL = []
for i in range(m):
    _, *s = map(int, input().split(" "))
    sL.append(s)
pL = list(map(int, input().split(" ")))

bz = list(itertools.product([0, 1], repeat=n))
ans = 0
for b1 in bz:
    for i in range(m):
        s = sL[i]
        p = pL[i]
        cnt = 0
        for si in s:
            if b1[si - 1] == 1:
                cnt += 1
        if cnt % 2 != p:
            break
    else:
        ans += 1

print(ans)


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char *argv[])
{
	LL n,a,b;
	cin >> n >> a >> b;
	VL h(n);
	cin >> h;
	sort(RALL(h));
	auto isOk = [&](LL mid){
		// ここになにか書く
		LL na = 0;
		for (int i = 0; i < n; i++) {
			LL tmp = max(0LL, h[i] - b*mid);
			na += tmp / (a-b) + (tmp%(a-b) > 0 ? 1 : 0);
		}
		if (na > mid) {
			return false;
		} else {
			return true;
		}
	};

	// ng:false，ok:true
	LL ng = 0, ok = h[0]/b+1;
	while (abs(ng - ok) > 1) {
		LL mid = (ok + ng) / 2;
		(isOk(mid) ? ok : ng) = mid;
	}

	cout << ok << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const long long N = 1e5 + 17;
ll x, sum, INF = (1ll << 32);
vector<ll> v;


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


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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> p(n);
  for (int i = 0;i < n;i++){
    cin >> p.at(i);
  }
  sort(p.begin(), p.end());
  
  int ans = 0;
  
  for (int i = 0;i < k;i++){
    ans += p.at(i);
  }
  cout << ans << endl;
}

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

void Swap(int* a, int* b) {
  int t = *a;
  *a = *b;
  *b = t;
}

int partition(int* array, int p, int r) {
  int x = array[r];
  int i = p - 1;
  for (int j = p; j < r; j++) {
    if (array[j] <= x) {
      i = i + 1;
      Swap(&array[i], &array[j]);
    }
  }
  Swap(&array[i + 1], &array[r]);
  return i + 1;
}

int main() {
  int n;
  cin >> n;
  int array[n];
  for (int i = 0; i < n; i++) {
    cin >> array[i];
  }
  int q = partition(array, 0, n - 1);

  for (int i = 0; i < n; i++) {
    if (i != 0) cout << " ";
    if (i == q) cout << "[";
    cout << array[i];
    if (i == q) cout << "]";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3468
#!/usr/bin/env python3
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

N, R = map(int, input().split())

if N >= 10:
    print(R)
else:
    print(R + 100*(10-N))

Measured memory_bytes: 12388
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
    string s; cin >> s;
    int c[128] = {};
    for (char x : s) c[x]++;
    long long ans = (long long)s.size() * (s.size() - 1) / 2 + 1;
    for (char x = 'a'; x <= 'z'; x++) ans -= (long long)c[x] * (c[x] - 1) / 2;
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。
int main () {
    ll N , K;
    cin >> N >> K;
    vector <ll> h(N);
    for(int i = 0; i < N; i++){
        cin >> h.at(i);
    }
    int ans = 10e8;
    sort(h.begin() , h.end());
    for(int i = 0; i < N - K + 1; i++){
        if(h.at(i + K - 1) - h.at(i) <= ans){
            ans = h.at(i + K - 1) - h.at(i);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;

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

    new Main().run();
  }

  public void run() {

    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      int week = Integer.parseInt(br.readLine());

      int amount = 100_000;

      for (int i = 0; i < week; i++) {
        amount += amount * 0.05;
        if (amount % 1000 != 0) {
          amount = (amount / 1000) * 1000 + 1000;
        }
      }

      System.out.println(amount);
    } catch (IOException e) {
      System.err.println(e);
    }
  }
}


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

#define ff              first1
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define sett             set<string>  //insert()
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
//mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
vector<int>v1;
int32_t main()
{
    FIO;
   int a[3];
   for(int i=0;i<3;i++)
   {
       cin>>a[i];
   }
   sort(a,a+3);
   if(a[0]+a[1]==a[2])
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;



    }


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

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second

typedef long long ll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

typedef tuple<int,int,int> t3;

const int MAX = 2e4+10;

int main(){ _

	int n; cin >> n;
	vector<t3> v(n);
	for(auto& u : v) cin >> get<0>(u) >> get<1>(u) >> get<2>(u);

	function<bool(t3,t3)> cmp = [&] (t3 a, t3 b) {
		return get<0>(a)+get<1>(a) > get<0>(b) + get<1>(b);
	};

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

	vector<vector<ll>> memo(2, vector<ll>(MAX));

	for(int i=n-1; i>=0; i--) {
		auto [w,s,val] = v[i];
		memo[i&1] = memo[(i&1)^1];
		for(int j=0; j < MAX; j++) {
			if(j >= w and s >= j-w) 
				memo[i&1][j] = max(memo[i&1][j], memo[(i&1)^1][j-w] + val);
		}
	}

	cout << *max_element(memo[0].begin(), memo[0].end()) << endl;

	return 0;
}


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

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


int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  ll x = n/(a+b);
  ll y = n%(a+b);
  if(y<a)cout << x*a+y << endl;
  else cout << x*a+a << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <numeric>
#include <iterator>

using namespace std;

#define all(c) (c).begin(), (c).end()

template<class ForwardIt>
pair<ForwardIt, ForwardIt> sieve(ForwardIt begin, ForwardIt end){
    return make_pair(begin, (*begin) * (*begin) <= *(end - 1) ?
            sieve(begin + 1, remove_if(begin + 1, end,
                    [=](typename iterator_traits<ForwardIt>::value_type x){return x % *begin == 0;})).second : end);
}

int main(){
    constexpr size_t N = 123456 << 1;
    array<int, N> p; iota(all(p), 2);
    auto itr = sieve(all(p));
    for(int n; cin >> n, n;){
        cout << upper_bound(itr.first, itr.second, n << 1) - upper_bound(itr.first, itr.second, n) << '\n';
    }
    return 0;
}

Measured memory_bytes: 2132
#include <bits/stdc++.h>
const double PI = acos(-1);
using namespace std;
int main() {
    int h, w;
    string a, b;
    a = "#";
    b = ".";
    while(1){
        cin >> h >> w;
        if(h == 0 && w == 0){
            break;
        }
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if(i % 2 == 0){
                    if(j % 2 == 0){
                        cout << a;
                    }
                    else
                    {
                        cout << b;
                    }
                }
                else{
                    if(j % 2 == 0){
                        cout << b;
                    }
                    else{
                        cout << a;
                    }
                }
                
            }
            cout << endl;
        }
        cout << endl;
    }
        
}



Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
int n,m,xh;
bool vv[55];
long long ans=0;
vector<pair<int,int> >v[55];
vector<int>pth,tpth[22];
map<pair<int,int>,int>mp;
void find_path(int x,int y,int needtofind)
{
	if(tpth[xh].size()!=0)
	{
		return;
	}
	if(x==needtofind)
	{
		tpth[xh]=pth;
		return;
	}
	for(int i=0;i<v[x].size();i++)
	{
		int z=v[x][i].first;
		if(z==y)
		{
			continue;
		}
		pth.push_back(v[x][i].second);
		find_path(z,x,needtofind);
		pth.pop_back();
	}
}
signed main()
{
	cin>>n;
	for(int i=0;i<n-1;i++)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		a--;
		b--;
		v[a].push_back(make_pair(b,i));
		v[b].push_back(make_pair(a,i));
	}
	cin>>m;
	for(int i=0;i<m;i++)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		a--;
		b--;
		pth.clear();
		find_path(a,-1,b);
		xh++;
	}
	for(int i=1;i<(1<<m);i++)
	{
		memset(vv,false,sizeof(vv));
		int x=__builtin_popcount(i),yyy=n-1;
		for(int j=0;j<m;j++)
		{
			if((i>>j)&1)
			{
				for(int k=0;k<(int)tpth[j].size();k++)
				{
					if(!vv[tpth[j][k]])
					{
						vv[tpth[j][k]]=true;
						yyy--;
					}
				}
			}
		}
		if(x%2==1)
		{
			ans-=(1ll<<yyy);
		}
		else
		{
			ans+=(1ll<<yyy);
		}
	}
	cout<<ans+(1ll<<(n-1))<<endl;
	return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long int ll;

int N;
int X,Y;

int a[20005];
int flag[2005][2005];

int main(){
    cin>>N>>X>>Y;
    /*for(int k=1;k<N;++k){
        cout<<"k="<<k<<endl;
        for(int i=1;i<N;++i){
            int dist;
            int cnt=0;
            if(i<=X){
                if(i+k>X){
                    dist=k-(Y-X)+1;
                    if(Y+dist-(X-i+1)<=N)cnt++;
                    if(dist==k&&i+k<=N)cnt++;
                }
                else {
                    dist=k;
                    if(i+dist<=N)cnt++;
                }
            }
            else {
                dist=k;
                if(i+dist<=N)cnt++;
            }
            a[dist]+=cnt;
            cout<<"i="<<i<<" dist="<<dist<<" cnt="<<cnt<<endl;
        }
    }*/
    for(int i=1;i<=N-1;++i){
        for(int j=i+1;j<=N;++j){
            int dist=min(j-i,abs(X-i)+1+abs(Y-j));
            /*if(i<=X&&j>=Y)dist=(X-i)+(j-Y)+1;
            else if(i<=X&&j<=Y)dist=min(j-i,(X-i)+1+(Y-j));
            else if(i>=X&&j<=Y)dist=min(j-i,(i-X)+1+(Y-j));
            else dist=(j-i);
            */
            a[dist]++;
            //cout<<"(i,j)="<<i<<" "<<j<<endl;
            //cout<<"dist="<<dist<<endl;
        }
    }
    for(int k=1;k<N;++k)cout<<a[k]<<endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<vector<int>> dp(110000, vector<int>(3));
    dp[0][0] = 0;
    dp[0][1] = 0;
    dp[0][2] = 0;
    for (int i = 0; i < n; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        for (int j = 0; j < 3; ++j) {
            if (j == 0) {
                dp[i + 1][1] = max(dp[i + 1][1], dp[i][j] + b);
                dp[i + 1][2] = max(dp[i + 1][2], dp[i][j] + c);
            } else if (j == 1) {
                dp[i + 1][2] = max(dp[i + 1][2], dp[i][j] + c);
                dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + a);
            } else {
                dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + a);
                dp[i + 1][1] = max(dp[i + 1][1], dp[i][j] + b);
            }
        }
    }
    cout << max(max(dp[n][0], dp[n][1]), dp[n][2]) << endl;
}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
#define ll long long
#define FOR(i,x,y) for(int i = x; i <= y; ++i)
#define rFOR(i,x,y) for(int i = x; i >= y; --i)
#define MS(a,x) memset(a,x,sizeof a)
#define pb push_back

using namespace std;

int n,m,k;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    bool ans = false;
    FOR(i,0,n) //if(i * m > k) break;
    {
        int rest = k - i * m;
        if(rest == 0)
        {
            ans = true;
            break;
        }
        int ck = n - i * 2;
        if(rest > 0 && ck > 0 && rest % ck == 0 && rest / ck <= m)
        {
            ans = true;
            break;
        }
        if(rest < 0 && ck < 0)
        {
            rest = -rest;
            ck = -ck;
            if(rest % ck == 0 && rest / ck <= m)
            {
                ans = true;
                break;
            }
        }
    }
    if(ans) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

bool check(int y, int m, int d) {
  if (y != 2019) return y < 2019;
  if (m != 4) return m < 4;
  return d <= 30;
}

int main() {
  int year, month, day;
  scanf("%d/%d/%d", &year, &month, &day);
  bool ret = check(year, month, day);
  puts(ret ? "Heisei" : "TBD");
  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#define Rint register int
#define mem(a,b) memset(a,(b),sizeof(a))
using namespace std;
typedef long long LL;
template<typename T>inline void read(T &x){
	x=0;T w=1,ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')w=-1,ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^'0'),ch=getchar();
	x=x*w;
}
inline void File(){
	freopen("escape.in","r",stdin);
	freopen("escape.out","w",stdout);
}

const int maxn=1e5+10;
LL n;
LL a[maxn],der[maxn];

inline LL _abs(LL x){
	if(x<0LL)return -x;
	return x;
}

int main(){ 
	//File();
	read(n);
	for(Rint i=1;i<=n;i++)read(a[i]);
	n++;
	for(Rint i=1;i<=n;i++)der[i]=_abs(a[i]-a[i-1])+der[i-1];
	for(Rint i=1;i<n;i++){
		LL ans=0LL;
		//cout<<der[i-1]<<' '<<_abs(a[i+1]-a[i-1])<<' '<<der[n]<<' '<<der[i+2]<<endl;
		ans+=der[i-1]+_abs(a[i+1]-a[i-1])+der[n]-der[i+1];
		printf("%lld\n",ans);
	}
	return 0;
}


Measured memory_bytes: 2816
S=list(input())
K=int(input())

check=0
for i in range(1,len(S)):
    if S[i]!=S[i-1]:
        check=1
#print(check)
if check==0:
    print(len(S)*K//2)
    exit()
import copy
s=copy.deepcopy(S)

cnt=0
for i in range(1,len(S)):
    if s[i]==s[i-1]:
        s[i]=str(i)
        cnt+=1

ss=S*2
cntss=0
#print(ss)
for i in range(1,len(ss)):
    if ss[i]==ss[i-1]:
        ss[i]=str(i)
        cntss+=1
print(cnt*(K)+(cntss-cnt*2)*(K-1))
#print(cnt,cntss)
#print(ss)
        

Measured memory_bytes: 9252
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 234567;
bool OK1[MAXN], OK2[MAXN];

int main() {
    int N, M;
    scanf("%d %d", &N, &M);
    for (int i = 0; i < M; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        if (x == 1) OK1[y] = 1;
        else if (y == 1) OK1[y] = 1;
        else if (x == N) OK2[y] = 1;
        else if (y == N) OK2[x] = 1;
    }
    bool ans = false;
    for (int i = 2; i <= N; i++) {
        if (OK1[i] && OK2[i]) ans = true;
    }
    puts(ans ? "POSSIBLE" : "IMPOSSIBLE");
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}

template<typename... T>
void write_space(T... a){
    ((cout << a << " "),...);
}

struct UF{
    int n;
    vi parent, rank, sub;
    UF(int n_){
        n = n_;
        parent = vi(n);
        REP(i, n) parent[i] = i;
        rank = vi(n, 1);
        sub = vi(n,1);
    }
    int find(int a){
        while( parent[a] != a){
            a = parent[a];
        }
        return a;
    }
    bool issame(int a, int b){
        return find(a) == find(b);
    }

    void joint(int a, int b){
        int pa = find(a);
        int pb = find(b);
        if( pa == pb){
            return;
        }

        if( rank[pa] > rank[pb]){
            parent[pb] = pa;
            sub[pa] += sub[pb];
            rank[pa] = max( rank[pa], 1 + rank[pb]);
        }else{
            parent[pa] = pb;
            sub[pb] += sub[pa];
            rank[pb] = max(rank[pb], 1 + rank[pb]);
        }
    }
};


void solve(){
    int n, m;
    read(n,m);
    UF uf(n);
    int ans = 1;
    REP(i,m){
        int a, b;
        read(a,b);
        a--; b--;
        uf.joint(a, b);
        ans = max(ans, uf.sub[uf.find(a)]);
    }
    cout << ans << endl;
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    solve();
    return 0;
}



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


using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(int)(n);i++)
#define foi(i,k,n) for(int i=(k); i<(int)(n); i+=1)
#define fod(i,n,k) for(int i=k; i>=(int)n; i-=1)
#define fast_io ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define endl "\n"


#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef long long int llint;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<llint> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
llint toint(string s) {stringstream ss(s); llint x; ss >> x; return x;}
//gp_hash_table<string, llint> table;


//int mpow(llint base, llint exp) {
  //base %= MOD;
  //llint result = 1;
  //while (exp > 0) {
    //if (exp & 1) result = ((llint)result * base) % MOD;
    //base = ((llint)base * base) % MOD;
    //exp >>= 1;
  //}
  //return result;
//}


//void makegraph(int n, int m){
	//int i, u, v;
	//while(m--){
		//cin>>u>>v;
		//u--, v--;
		//g[u].pb(v);
		//g[v].pb(u);
	//}
//}

//void dfs(int u, int par){
	//for(int v:g[u]){
		//if (v == par) continue;
		//dfs(v, u);
	//}
//}


// ------------------------------------------------------------------ILB----------------------------------------------------------------  //

// 3 3 4 4 5 5
// 3 3 4
// 3 3 5
// 3 4 4
// 3 4 5
// 4 4 5
// 4 5 5



void solve(){
	int n;
	cin >> n;
	VL v(n);
	llint ans = 0;
	loop(i, n) cin >> v[i];
	sort(v.begin(), v.end());
	set <pair <pair<int, int> , int>> s;
	for(int i = 0; i < n; ++i){
		for(int j = i + 1; j < n; ++j){
			if(v[j] == v[i]) continue;
			for(int k = j + 1; k < n; ++k){
				if(v[k] == v[j]) continue;
				if(v[i] + v[j] > v[k] && v[i] + v[k] > v[j] && v[j] + v[k] > v[i]){ ans++; }
			}
		}
	}
	cout << ans;
}




int main() {
	fast_io;
    int t = 1;
    //cin >> t;
    while(t--) {
      solve();
    }
    return 0;
}



Measured memory_bytes: 3664
import java.util.Scanner;
  
public class Main{
    public void solve(){
        Scanner sc=new Scanner(System.in);
          
        int n=sc.nextInt();
          
        for(int i=0;i<n;i++){
            int NR=sc.nextInt();
            int PR=sc.nextInt();
            int NM=sc.nextInt();
            int PM=sc.nextInt();
              
            int kei=NR*NM+PR*PM;
              
            if(NM>=5 && PM>=2){
                kei = (NR*NM + PR*PM)*4/5;
            }else{
                if(NM<5){
                NM=5;
                }
                if(PM<2){
                PM=2;
                }
                int wari = (NR*NM + PR*PM)*4/5;
                  
                if(kei>wari){
                    kei = wari;
                }
            }
            System.out.println(kei);
        }
    }
      
    public static void main(String[]args){
        Main obj = new Main();
        obj.solve();
    }
}

Measured memory_bytes: 23392
#include<bits/stdc++.h>
using namespace std;
int main(){
string S;
cin>>S;
  vector<int>ans(10);
  
  int ans2=0;
  
  for(int i=1;i<S.size();i++){
    if(S.at(i)==S.at(i-1)) {
cout<<"Bad"<<endl;
      ans2++;
      break;
    }

}
  
  if(ans2==0){
cout<<"Good"<<endl;
  }
}

  
    
    

Measured memory_bytes: 256
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

from collections import Counter

def solve():
    n = II()
    A = [II() for _ in range(n)]
    c = Counter(A)
    c = sorted(c.items())[::-1]
    mx = c[0][0]
    mx_n = c[0][1]
    if mx_n == 1:
        mx2 = c[1][0]
        for a in A:
            if a == mx:
                print(mx2)
            else:
                print(mx)
    else:
        for _ in A:
            print(mx)


if __name__ == '__main__':
    solve()


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

int main() {
  int x; cin >> x;
  int count = 0, deg = 0;
  while(true) {
    if(deg > 0 && deg % 360 == 0) {
      cout << count << endl;
      return 0;
    }
    count++;
    deg += x;
  }
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  string s;
  cin >> s;
  int n = sz(s);
  int cnt = 0;
  rep(i,n){
    if(s[i] == '1')cnt++;
  }
  int ans = min(cnt,n-cnt)*2;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
int main() {
	lli t,n,m,a,b,c,ans;
	cin >> a;
	b=a;
	b+=(a*a);
	b+=(a*a*a);
	cout<<b;
	return 0;
}

Measured memory_bytes: 3672
import java.util.Scanner;

class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int A = sc.nextInt();
		int B = sc.nextInt();
		for (int i = 1; i <= 20000; i++) {
			int ea = Math.floorDiv(i * 8, 100);
			int eb = Math.floorDiv(i * 10, 100);
			if (ea == A && eb == B){
				System.out.println(i);
				return;
			}
		}
		System.out.println(-1);
	}
}

class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

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

int main(void){
  int n; cin >> n; string s; cin >> s; int an = 0;
  for(int i=0;i<n-2;i++) {
    if (s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')an++;
  }
  cout << an<<endl;
}

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

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

    vector<int> b;
    int ans[n];
    for(int i = 0; i < n; i++){
        int k = 0;
        cin >> k;
        k--;
        b.push_back(k);
        ans[i] = 0;
    }

    int flag = 0;
    int now = n;
    for(int i = n - 1; i >= 0; i--){
        flag = -1;
        for(int j = 0; j < now; j++){
            if(j == b[j]){
                flag = j;
            }
        }

        if(flag == -1){
            break;
        }else{
            ans[i] = flag;
            b.erase(b.begin() + flag);
        }
        now--;
    }

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

Measured memory_bytes: 256
N, K = map(int, input().split())
d = []
A = []

for _ in range(K):
  d.append(int(input()))
  A.append(list(map(int, input().split())))

sunuke = [0] * (N+1)

for k in A:
  for a in k:
    sunuke[a] += 1

print(sunuke.count(0)-1)

Measured memory_bytes: 9192
import sys

sys.setrecursionlimit(10000)
mod = 1000000007


def mul(a, b):
    return ((a % mod) * (b % mod)) % mod


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y / 2) ** 2 % mod
    else:
        return power(x, y / 2) ** 2 * x % mod


def div(a, b):
    return mul(a, power(b, mod - 2))


# def gcd(a_gcd, b_gcd):
#     while b_gcd != 0:
#         a_gcd, b_gcd = b_gcd, a_gcd % b_gcd
#     return a_gcd
#
#
# def lcm(a_lcm, b_lcm):
#     return a_lcm * b // gcd(a_lcm, b_lcm)
#
#
# def max_sum(N_max_sum, a_max_sum):
#     dp = [0] * (N_max_sum + 1)
#     for i in range(N_max_sum):
#         dp[i + 1] = max(dp[i], dp[i] + a_max_sum[i])
#     return dp[N]
#
#
# def knapsack(N_knapsack, W, weight, value):
#     inf = float("inf")
#     dp = [[-inf for _ in range(W+1)] for j in range(N_knapsack + 1)]
#     for i in range(W+1):
#         dp[0][i] = 0
#
#     for i in range(N_knapsack):
#         for w in range(W+1):
#             if weight[i] <= w:
#                 dp[i+1][w] = max(dp[i][w-weight[i]]+value[i], dp[i][w])
#             else:
#                 dp[i+1][w] = dp[i][w]
#     return dp[N_knapsack][W]
#
#
# class UnionFind:
#     def __init__(self, n):
#         self.par = [i for i in range(n+1)]
#         self.rank = [0] * (n+1)
#
#     # 検索
#     def find(self, x):
#         if self.par[x] == x:
#             return x
#         else:
#             self.par[x] = self.find(self.par[x])
#             return self.par[x]
#
#     # 併合
#     def union(self, x, y):
#         x = self.find(x)
#         y = self.find(y)
#         if self.rank[x] < self.rank[y]:
#             self.par[x] = y
#         else:
#             self.par[y] = x
#             if self.rank[x] == self.rank[y]:
#                 self.rank[x] += 1
#
#     # 同じ集合に属するか判定
#     def same_check(self, x, y):
#         return self.find(x) == self.find(y)


# S = input()
# N = int(input())
# A = list(map(int, input().split()))
# X = [int(input()) for _ in range(N)]

N, A, B, C, D = map(int, input().split())
S = input()
block = "#"
ans = "Yes"
if C < D:
    for i in range(A, C):
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
    for i in range(B, D):
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
else:
    change_frag = False

    for i in range(A, C):
        # print(S[i])
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
    for i in range(B-1, D):
        #print(i+1, S[i])
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
        elif S[i-1] != block and S[i+1] != block:
                #print(i+1, S[i], "(●・▽・●)")
                change_frag = True

    if not change_frag:
        ans = "No"


print(ans)


Measured memory_bytes: 40176
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


class UF {
public:
	std::vector<int> parent;
	std::vector<int> level;
	std::vector<int> num_member; // 同じグループに属するメンバーの数
								 // 自身込み

public:
	// コンストラクタ　※注意※　0～nまでのn+1個を作る
	UF(int n) {
		for (int i = 0; i <= n; i++) {
			parent.push_back(i); //
			level.push_back(1);  // 木の深さ
			num_member.push_back(1);
		}
	}
	// 木の根を求める
	int root(int x) {
		if (parent[x] == x)return x;
		else return parent[x] = root(parent[x]);
	}

	// 同じ集合に属するメンバーの数を求める
	int numOfmember(int x) {
		if (parent[x] == x) return num_member[x];
		else return num_member[x] = numOfmember(parent[x]);
	}

	// xとyの属する集合を合併
	void unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx == ry) return; // 元々合併済みの場合
		if (level[rx] < level[ry]) {
			num_member[ry] = numOfmember(ry) + numOfmember(rx);
			parent[rx] = ry;
		}
		else {
			num_member[rx] = numOfmember(ry) + numOfmember(rx);
			parent[ry] = rx;
			if (level[rx] == level[ry]) level[rx]++;
		}
	}
	// xとyが同じ集合に属するか否か
	bool same(int x, int y) {
		return root(x) == root(y); // rootが同じなら同じ集合に含まれる
	}
};


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

	int N, M; cin >> N >> M;

	UF T(N);

	for (int i = 0; i < M; i++) {
		int tmp1, tmp2, tmp3; cin >> tmp1 >> tmp2 >> tmp3;
		T.unite(tmp1, tmp2);
	}

	ll ans = 0;
	for (int i = 1; i <= N; i++) {
		if (i == T.root(i)) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1644
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
typedef pair<int, int> PII;
typedef long long ll;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int n, ans, cnt;
int l[2001];
pair<pair<int, int>, int> tmp[4000002];

int main() {

	cin >> n;
	rep(i, n)cin >> l[i];

	sort(l, l + n);
	reverse(l, l + n);

	rep(i, n) {
		REP(j, i + 1, n) {
			tmp[cnt] = make_pair(make_pair(i, j), l[i] + l[j]);
			cnt++;
		}
	}

	rep(i, n) {
		for (int j = cnt - 1;j >= 0;j--) {
			if (i < tmp[j].first.first && i < tmp[j].first.second && l[i] < tmp[j].second) {
				ans++;
			}
			if (i > tmp[j].first.first&& i > tmp[j].first.second)break;
		}
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 24960
#include <algorithm>
#include <iostream>
#include <vector>
#include <string> 
#include <set>
typedef long long ll;
using namespace std;
int a, b, c, d;
int main() {
    ll n; cin >> n;
   
    while (n--) {
        string s; cin >> s;
        if (s == "AC")a++;
        else if (s == "WA")b++;
        else if (s == "TLE")c++;
        else d++;
        
    }
    cout << "AC" << " x " << a << endl;
    cout << "WA" << " x " << b << endl;
    cout << "TLE" << " x " << c << endl;
    cout << "RE" << " x " << d << endl;
    return 0;
}


Measured memory_bytes: 3640
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      int N = nextInt();
      int max = 0;
      int add = 0;
      for(int i = 0; i < N; i++){
        ArrayList<Integer> tmp = nextIntArray();
        if(max < tmp.get(0)){
          max = tmp.get(0);
          add = tmp.get(1);
        }
      }
      myout(max + add);
	}
	//Method addition frame start


  
	//Method addition frame end
}


Measured memory_bytes: 63332
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
// Welcome to my source code!

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll t = c - a - b;
    if (t > 0 && t * t > 4 * a * b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>0=
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
char s[110];
long long int k;
int main(){
    while (scanf("%s %lld",s,&k)!=EOF){
        int cnt = 0;
        for (int i=0;i<strlen(s);i++)
            if (s[i]=='1')
                cnt++;
            else{
                break;
            }
        if (k<=cnt)
            printf("1\n");
        else
            printf("%c\n",s[cnt]);
    }
    return 0;
}




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

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

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int n;
    scanf("%d", &n);

    int a, b, c, d;
    a = n / 1000;
    b = (n / 100) % 10;
    c = (n / 10) % 10;
    d = n % 10;

    if (a == b && b == c || b == c && c == d)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}


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

void bubbleSort(int A[],int n){
    bool flag=true;
    while(flag){
        flag=false;
        for(int j=n-1;j>=1;j--){
            if(A[j] < A[j-1]){
                swap(A[j],A[j-1]);
                flag=true;
            }
        }
    }
}

int main(){
    int n,k;
    cin>>n>>k;
    int array[n];
    for(int i=0; i<n; i++){
        cin>>array[i];
    }
    bubbleSort(array,n);
    
    int sum=0;

    for(int i=0; i<k; i++){
        sum+=array[i];
    }

    cout<<sum<<endl;

    return 0;
}

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCorder
{
    public static class Program
    {
        static public void Main(string[] args)
        {
            int output = 1;
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int num = input[0];
            while (true)
            {
                if (input[0] < input[1])
                {
                    break;
                }
                if (num / input[1] >= input[1])
                {
                    output++;
                    num = num / input[1];
                }
                else 
                {
                    output++;
                    break;
                }

            }
            
            Console.WriteLine(output.ToString());
        }
    }
}




Measured memory_bytes: 13268
#include <bits/stdc++.h>
typedef uint64_t ll;
using std::cout ;
using std::endl ;
using std::cin ;
using std::string ;
using std::vector ;
using std::set ;
using std::map ;
using std::pair ;
#define rep(i,n) for(int i=0, i##_end=(n); i<i##_end; i++)
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
template<class T>bool updateMax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool updateMin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(c) c.begin(),c.end()
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

int main() {
    int N;
    cin >> N;
    
    ll product = 1LL;
    bool overflow = false;
    rep(i, N) {
        ll A;
        cin >> A;
        
        if(A == 0ULL) {
            cout << 0 << endl;
            return 0;
        }
        ll test = product * A;
        if(test / A != product) {
            overflow = true;
        } else {
            product = test;
        }
    }
    if(product > 1000000000000000000ULL || overflow) {
        cout << "-1" << endl;
    } else {
        cout << product << endl;
    }
}


Measured memory_bytes: 3540
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main() {
  int K, N;
  cin >> K >> N;
  vector<int> A(N);
  for (auto &e : A)
    cin >> e;

  vector<int> dists(N);
  for (int houseIndex = 0; houseIndex < N; ++houseIndex) {
    auto to = (houseIndex + 1 < N) ? houseIndex + 1 : 0;
    dists[houseIndex] = A[to] - A[houseIndex];
    if (dists[houseIndex] < 0) {
      dists[houseIndex] = K + dists[houseIndex];
    }
  }
  for (auto e : dists)
    cerr << e << " ";
  cerr << "\n";

  sort(dists.begin(), dists.end());
  auto sumWithoutLongest = accumulate(dists.begin(), dists.end() - 1, 0);
  cout << sumWithoutLongest << "\n";
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    bool flag=false;
    for(int i=1;i<=n;i++)
    {
        int x;
        scanf("%d",&x);
        if(x&1) flag=true;
    }
    if(flag) cout<<"first"<<endl;
    else cout<<"second"<<endl;
}

Measured memory_bytes: 256
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n=0,x=0;
	cin>>n;
	int ct=0;
	for(int i=1;i<=n;++i)
	{
		cin>>x;
		if((i&1)&&(x&1))
			++ct;
	}
	cout<<ct<<endl;
}

Measured memory_bytes: 3612
#include <iostream>
using namespace std;
string s, ss;
int main()
{
    cin >> s >> ss;
    int mn = 0x3F3F3F3F;
    for(int i = 0;i <= s.length() - ss.length();i++)
    {
        int cnt = 0;
        for(int j = 0;j < ss.length();j++)
        {
            if(s[i + j] != ss[j])
                cnt++;
        }
        mn = min(mn, cnt);
    }
    cout << mn;
    return 0;
}


Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

void canP(bool x){
    if(x){
        cout << "Possible" << endl;
    }else{
        cout << "Impossible" << endl;
    }
}
int main(){
    int n; cin >> n;
    int ans = 0;
    rep(i,n){
        int tmp; cin >> tmp;
        ans += tmp;
    }

    cout << ans - n << endl;
}

Measured memory_bytes: 256