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


int main() 
{
    string S; cin >> S;
    int count[2] = {0};

    for( int i=0 ; i<S.size() ; i++ )
    {
        if( S[i] == '0' ) count[0]++;
        else              count[1]++;
    }
  
  	cout << min( count[0], count[1] ) * 2 << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

const int maxn = 505;
string a[maxn];
bool red[maxn][maxn];
int n, m;

int main() {
    #ifdef LOCAL
    assert(freopen("c.in", "r", stdin));
    #else
    #endif
    cin >> n >> m;
    forn (i, n)
        cin >> a[i];
    for (int j = 1; j + 1 < m; ++j)
        red[1][j] = true;
    for (int i = 1; i + 1 < n; ++i)
        for (int j = 1; j + 1 < m; j += 2)
            red[i][j] = true;
    forn (i, n)
        forn (j, m)
            if (a[i][j] == '#')
                red[i][j] = true;
    forn (i, n) {
        forn (j, m)
            cout << (red[i][j] ? '#' : '.');
        cout << '\n';
    }
    cout << '\n';
    forn (i, n) {
        forn (j, m)
            cout << (!red[i][j] || a[i][j] == '#' ? '#' : '.');
        cout << '\n';
    }
}

Measured memory_bytes: 1280
#include<iostream>
int main()
{
	int n, m, l;
	std::cin >> n >> m >> l;
	long int a[200][200], b[200][200];
	long int c[200][200];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			std::cin >> a[i][j];
		}
	}
	for ( int i=0; i<m; i++)
	{
		for ( int j=0; j<l; j++)
		{
			std::cin >> b[i][j];
		}
	}

	for (int i=0; i<n; i++)
	{
		for ( int j=0; j<l; j++)
	{
		c[i][j] = 0;
	}
	}
	
	for ( int i=0; i<n; i++ )
	{
		for ( int j=0; j<l; j++ )
		{
			for ( int h=0; h<m; h++ )
			{
				c[i][j] += a[i][h]*b[h][j]; 
			}
		}
	}

	for (int i=0; i<n; i++)
	{
		for ( int j=0; j<l; j++ )
	{
		if (j<l-1)
		{
		std::cout << c[i][j] << " ";
		}
		else
		{
		std::cout << c[i][j];
		}
	}
		std::cout << "\n";
	}
	return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


int kek(int x){
    return max(0LL,(3-x+1)*100000);
}

void smain() {

    int x,y;
    cin>>x>>y;
    cout<<kek(x)+kek(y)+(x+y==2)*400000;



}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>

using namespace std;

int main() {
	long i, j, N;
	//long A[100001] = { 0 };
	map<string, int> mp;

	cin >> N;

	int num;
	string str;
	for (i = 0; i < N; i++) {
		cin >> str;
		
		auto itr = mp.find(str);        // "xyz" が設定されているか？
		if (itr != mp.end()) {
			//設定されている場合の処理
			if (itr->second == 333) {
				itr->second = 222;
				continue;
			}
			itr->second = 333;
		}
		else {
			//設定されていない場合の処理
			mp.insert(pair<string, int>(str, 222));


		}

	}

	int cnt = 0;
	for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
		//std::cout << "key = " << itr->first           // キーを表示
		//	<< ", val = " << itr->second << "\n";    // 値を表示

		if (itr->second == 222) {
			cnt++;
		}

	}

	cout << cnt << endl;


	return 0;
}

Measured memory_bytes: 12544
import math
import itertools
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

a = int(input())
list_a = [i for i in range(1, a + 1)]
res = 0
# kumi = list(itertools.product(list_a, repeat=3))
kumi = list(itertools.combinations_with_replacement(list_a, 3))
for i in kumi:
    ans = gcd_list(i)
    if i[0] == i[1] and i[0] == i[2]:
        res += ans
    elif i[0] != i[1] and i[0] != i[2] and i[2] != i[1]:
        res += ans*6
    elif i[0] == i[1] or i[0] == i[2] or i[1] == i[2]:
        res += ans*3

print(res)

Measured memory_bytes: 105952
import java.util.*;

public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[]str = new String[N];
        
        Set<String> set = new HashSet<String>();
        for(int i=0;i<N;i++){
            str[i]=sc.next();
            set.add(str[i]);
        }
            
        
        
        System.out.println(set.size());
    }
}

Measured memory_bytes: 78056
//Utkarsh-raj

#include<bits/stdc++.h>

#define ll long long int
#define vc vector
#define mod 100000000007
#define mp make_pair
#define pb push_back
#define nl cout<<endl;
#define ff first
#define ss second

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ifstream myFile("task.in");
    if(!myFile.fail())
    {
        assert(freopen("task.in", "r", stdin));
    }

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

    vector<ll> v(n);

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

    vector<ll> dp(n, INT_MAX);
    dp[0] = 0;

    for(int i=1; i<n; i++){
        for(int j=i-1; j >= max(i-k, 0); j--){
            dp[i] = min(dp[i], dp[j] + abs(v[i] - v[j]));
        }
    }

    cout<<dp[n-1]<<endl;

    return 0;
}


Measured memory_bytes: 4756
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
#define mp make_pair
// GCD inbuilt func: __gcd(a,b)
// LCM formula: (a*b)/__gcd(a,b)

int main(){
	ios::sync_with_stdio(false);
    cin.tie(NULL);
	// CODE goes here
    string s;
    cin >> s;
    int maxi=0,count;
    for(int i=0;i<s.size();){
    	count=0;
    	if(s[i]=='S') i++;
    	else{
    	    while(i<s.size() && s[i]=='R'){
    		    i++;
    		    count++;
    	    }
    	}
    	maxi=max(maxi,count);
    }
    cout << maxi;
	return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define f first
#define s second
#define pli pair<long long,int>
#define pii pair<int,int>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back

const int maxn=1e6+10;
const int maxt=2e5+10;
const long long inf=1e16;
const int mod=1e9;

using namespace std;

int a,b,c,x,m;

inline void init(){
    cin>>a>>b>>c;
    m=max(a,max(b,c));
}

inline void prepare(){
    if(((3*m)-(a+b+c))%2==0) x=m;
    else x=m+1;
}

inline void solve(){
    cout<<(3*x-(a+b+c))/2;
}

inline void file(){
    #define task "TEST"
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    freopen(task".INP","r",stdin);
    freopen(task".OUT","w",stdout);
}

int main(){
    //file();
    init();
    prepare();
    //while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i++)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
#define MOD 1000000007
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm


signed main(){
  int n,k;
  cin >> n >> k;
  map<int,int> mapp;
  int memo;
  rep(i,0,n){
    cin >> memo;
    mapp[memo]++;
  }
  
  priority_queue<int, vector<int>, greater<int>> pq;
  
  int kind = 0;
  
  for (auto p : mapp) {
    auto k = p.first;
    auto v = p.second;
    pq.push(v);
    kind++;
  }
  
  if(k >= kind){
    cout << 0 << endl;
    return 0;
  }

  int ans = 0;
  
  rep(i,0,kind-k){
    ans += pq.top();
    pq.pop();
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 14964
#include <iostream>
#include <complex>
using namespace std;
typedef long long ll;
typedef complex<ll> P;
P p[50],c[50];
ll md(P x,P y){
  return abs(x.real()-y.real())+abs(x.imag()-y.imag());
}
int main(){
  int n,m;
  cin >> n >> m;
  for(int i=0;i<n;++i){
    ll x,y; cin >> x >>y;
    p[i]=P(x,y);
  }
  for(int j=0;j<m;++j){
    ll x,y; cin >>x>>y;
    c[j]=P(x,y);
  }
  for(int i=0;i<n;++i){
    ll dist = 1e10;
    int ans = -1;
    for(int j=0;j<m;++j){
      ll d = md(p[i],c[j]);
      if(d<dist){
	ans = j;
	dist = d;
      }
    }
    cout << ans+1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n =int(input())
W=[]
w=''
for i in range(n):
    s=str(input())
    if i !=0 and w[-1] != s[0]:
        print('No')
        exit()
    else:
        w=s
        W.append(w)
if len(W) != len(list(set(W))):
    print('No')
    exit()
print('Yes')

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

typedef long long ll;

int N;
ll A[100010],sum[100010];

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++)scanf("%lld",A + i);

    sort(A,A + N);

    for(int i = 0; i < N; i++)
    {
        sum[i] = A[i];
        if(i != 0)sum[i] += sum[i - 1];
    }

    int mem = 0;

    for(int i = N - 1; i > 0; i--)
    {
        if(sum[i - 1] * 2 < A[i])
        {
            printf("%d\n",N - i);
            return 0;
        }
    }
    printf("%d\n",N);
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int gcd(int i, int j, int l){
    int gcd;
    for(int a(1);a<=i;a++){
        if(i%a == 0 && j%a == 0 && l%a == 0)gcd = a;
    }
    return gcd;
}
int main(void){
    int k;
    cin>>k;
    long long sum(0);
    for(int i(1);i<=k;i++){
        for(int j(i);j<=k;j++){
            for(int l(j);l<=k;l++){
                if(i == j && j == l)sum += gcd(i,j,l);
                else if((i == j && j != l) || (i == l && i != j) || (i != j && j == l))sum += 3 * gcd(i,j,l);
                else sum += 6 * gcd(i,j,l);
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3180
#include<stdio.h>

#define MAX_NUMBER 100

int main(void) {

	int number = 0;	scanf("%d", &number);
	int array[MAX_NUMBER];

	for (int i = 0; i < number; i++) {
		scanf("%d", &array[i]);
	}

	for (int i = 0; i <= number - 1; number--) {

		if (number - 1 == 0) {
			printf("%d", array[number - 1]);
		}
		else {
			printf("%d ", array[number - 1]);
		}
	}

	printf("\n");

	return 0;
}


Measured memory_bytes: 2108
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){
    int i,j,k;
    unsigned long A,B;
    long K;
    
    scanf("%ld %ld",&A,&B);
    
    K = (A + B) / 2;
    
    if((A+B) % 2 == 0){
        printf("%ld\n",K);
    }else{
        printf("IMPOSSIBLE\n");
    }
    
    return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <random>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0)
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n;
int main() {
  cin >> n;
  double ans = 0;
  for (lli i=0; i<n; ++i) {
    double x; string u;
    cin >> x >> u;
    if (u=="JPY") ans += x;
    else ans += 380000 * x;
  }
  printf("%.10lf\n", ans);
  return 0;
}


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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 k,t;
  cin >> k >> t;
  vector<int32> a(t);
  REP(i,t)cin >> a[i];
  if(t == 1){
    ANS(k-1);
    return 0;
  }
  if(t == 2){
    sort(all(a));
    ANS(max<int32>(0,a[1] - a[0]-1));
    return 0;
  }
  priority_queue<pii> que;
  REP(i,t){
    que.emplace(a[i],i);
  }
  int32 ans = 0;
  int32 pre = -1;
  REP(i,k){
    auto [rem, ki] = que.top();que.pop();
    if(ki != pre){
      pre = ki;
      rem--;
      if(rem > 0)
        que.emplace(rem,ki);
    }else{
      if(que.empty()){
        ans = rem;
        break;
      }else{
        auto [rem2,ki2] = que.top();que.pop();
        rem2--;
        pre = ki2;
        if(rem > 0)
          que.emplace(rem,ki);
        if(rem2 > 0)
          que.emplace(rem2,ki2);
      }
    }
    // ANS(pre);
  }
  ANS(ans);
  return 0;
}

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

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair

using namespace std;

typedef long long ll;

int read(){
	int i;
	scanf("%d",&i);
	return i;
}

int idx[1000],p[1000],s[1000];
typedef pair<int,int> pii;
pii e[100000];


int main(){
	while(1){
		int n=read(),m=read(),h=read(),k=read();
		if(n==0)
			break;
		REP(i,n)
			idx[i]=i;
		REP(i,n)
			p[i]=read();
		REP(i,m){
			e[i].second=read();
			e[i].first=read();
		}
		sort(e,e+m);
		REP(i,m){
			int a=e[i].second-1,b=a+1;
			e[i]=MP(idx[a],idx[b]);
			swap(idx[a],idx[b]);
		}
		REP(i,n)
			s[idx[i]]=p[i];
		int sum=accumulate(s,s+k,0);
		int ans=sum;
		REP(i,m){
			int t=sum;
			if(e[i].first<k&&k<=e[i].second)
				t+=s[e[i].second]-s[e[i].first];
			if(e[i].second<k&&k<=e[i].first)
				t+=s[e[i].first]-s[e[i].second];
			ans=min(ans,t);
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 3912
#include<stdio.h>

int main(void)
{
    char s[4];
    scanf("%s",&s);

	
    if(s[0]==s[1])
    {
		if(s[2]==s[3]&&s[0]!=s[2])
            printf("Yes");
        else printf("No");
        return 0;
      }

    if(s[0]==s[2])
    {
        if(s[1]==s[3]&&s[0]!=s[1])
            printf("Yes");
        else printf("No");
        return 0;
    }
    if(s[0]==s[3])
    {
        if(s[1]==s[2]&&s[0]!=s[1])
            printf("Yes");
        else printf("No");
        return 0;
    }
      
    printf("No");
    return 0;

}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 55;

string s[MAXN];
int n, t, sum[MAXN];
int main(){
    #ifdef Irene
    freopen("in.txt", "r", stdin);
    #endif // Irene
    ios_base::sync_with_stdio(false); cin.tie(0);

    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> s[i] >> t;
        sum[i] = sum[i - 1] + t;
    }
    cin >> s[n + 1];
    for(int i = 1;i <= n;i++){
        if(s[i] == s[n + 1]){
            cout << sum[n] - sum[i] << '\n';
            return 0;
        }
    }
}


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

using namespace std;
using ll = long long;

vector<vector<int>> hen;
vector<int> dp;

int dfs(int v) {
	if(dp[v])return dp[v];
	for(auto i : hen[v]) {
		dp[v] = max(dp[v], dfs(i) + 1);
	}
	return dp[v];
}


int main()
{
	int n, m;
	cin >> n >> m;
	hen.resize(n);
	dp.resize(n);
	for(int i = 0; i < m; i++) {
		int a, b; cin >> a >> b; a--, b--;
		hen[a].push_back(b);
	}

	for(int i = 0; i < n; i++) dfs(i);
	cout << *max_element(dp.begin(), dp.end()) << endl;
}

Measured memory_bytes: 8192
// ABC153_D
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <cstring>  // std::memset
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> pll;
#define rep(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define rep1(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define repr(i, n) for (ll i=n-1; i >= 0; i++)  // n-1 ~ 0
#define all(vec) (vec).begin(), (vec).end()
#define sum(vec) accumulate(all(vec), 0LL)  // 0 は初期値
#define min_vec(vec) min_element(all(vec))  // iterator: * を先頭につける
#define max_vec(vec) max_element(all(vec))  // iterator: * を先頭につける
#define idx(vec, element_iter) distance((vec).begin(), element_iter)
const ll INF = 1LL<<60;  // 10^18（const int inf = 1<<29;）
const double PI = acos(-1);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    // input(sunippets: inpv, inpn, inps)
    ll N;
    cin >> N;
    
    // calculation
    ll times = 1;
    while(N != 1) {
        N /= 2;
        times *= 2;
        times++;
    }
    cout << times << "\n";
    
    return 0;
}



Measured memory_bytes: 256
s = input()

if s == "SUN":
  print(7)
elif s == "MON":
  print(6)
elif s == "TUE":
  print(5)
elif s == "WED":
  print(4)
elif s== "THU":
  print(3)
elif s == "FRI":
  print(2)
elif s == "SAT":
  print(1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
typedef pair<int,int> P;
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
	int n,k;
	cin>>n>>k;
	set<int> st;
	rep(i,k){
		int d;
		cin>>d;
		rep(j,d){
			int a;
			cin>>a;
			st.insert(a);
		}
	}
	cout<<n-st.size()<<endl;
}


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

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

    vector<int> L(N);
    for( int i = 0; i < N; ++i )
        cin >> L[i];

    int idx = 0;
    for( int i = 0; i < N; ++i )
        if( L[idx] < L[i] ) idx = i;

    int sum = 0;
    for( int i = 0; i <N; ++i )
        if( idx != i ) sum += L[i];

    if( L[idx] < sum ) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())

X1 = int((N) / 1.08)
X2 = int((N+1) / 1.08)

if (int(X1 * 1.08) == N):
    print(X1)
elif (int(X2 * 1.08) == N):
    print(X2)
else:
    print(":(")



Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] s = new String[n];
        int ab = 0;
        int startBEndA = 0;
        int startB = 0;
        int endA = 0;
        for (int i = 0; i < n; i++) {
            s[i] = sc.next();
            for (int j = 0; j < s[i].length() - 1; j++) {
                if (s[i].charAt(j) == 'A' && s[i].charAt(j + 1) == 'B') {
                    ab++;
                }
            }
            if (s[i].startsWith("B") && s[i].endsWith("A")) {
                startBEndA++;
                continue;
            }
            if (s[i].startsWith("B")) {
                startB++;
            }
            if (s[i].endsWith("A")) {
                endA++;
            }
        }
        int ans = ab;
        if (startBEndA == 0) {
            ans += Math.min(startB, endA);
        } else {
            if (startB + endA > 0) {
                ans += startBEndA + Math.min(startB, endA);
            } else {
                ans += startBEndA - 1;
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 32000
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

n,m,x = map(int,input().split())
a = list(map(int,input().split()))
flag = [False]*(n+1)
for i in range(len(a)):
    flag[a[i]] = True
cnt1 = 0
cnt2 = 0
for i in range(x):
    if flag[i] == True:
        cnt2 += 1
for i in range(x+1,n+1):
    if flag[i] == True:
        cnt1 += 1
print(min(cnt1,cnt2))

Measured memory_bytes: 12496
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  string a,b,c;
  cin>>a>>b>>c;
  int A=a.size(),B=b.size();
  if(a[A-1]==b[0] && b[B-1]==c[0]) cout<<"YES"<<'\n';
  else cout<<"NO"<<'\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int A, B, C, D;
        Scanner sc = new Scanner(System.in);
        A = sc.nextInt();
        B = sc.nextInt();
        C = sc.nextInt();
        D = sc.nextInt();
        if(B >= C) System.out.println("Yes");
        else
        {
          int check = ((C/B+(C%B == 0 ? 0 : 1)) <= (A/D+(A%D == 0 ? 0 : 1))) ? 1 : 0;
          switch (check)
          {
              case 1:
                  System.out.println("Yes");
                  break;
              case 0:
                  System.out.println("No");
                  break;
          }

        }

    }
}


Measured memory_bytes: 35892
class Item():
    def __init__(self, state, wrongCount):
        self.state = state
        self.wrongCount = wrongCount


N, M = map(int, input().split())
items = {}
pena = 0
correct = 0
for i in range(0, M):
    p, S = input().split()

    if p not in items:
        items[p] = Item("", 0)

    if items[p].state == "AC":
        continue

    if S == "AC":
        items[p].state = S
    else:
        pena = pena + 1
        items[p].state = S
        items[p].wrongCount = items[p].wrongCount + 1

items = {k: v for k, v in items.items() if v.state == "AC"}
print("{0} {1}".format(len(items), sum(v.wrongCount for v in items.values())))


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

int main(){
    int n;
    cin >> n;
    int ans=0;
    for(int i=0;i<n/2+n%2;i++){
        int a=i+1,b=n-a;
        string aa=to_string(a),bb=to_string(b);
        int awa=0,bwa=0,tmp=0;
        for(int j=0;j<aa.size();j++){
            awa += aa[j] -'0';
        }
        for(int j=0;j<bb.size();j++){
            bwa += bb[j] -'0';
        }
        tmp = awa + bwa;
        if(i==0)ans=tmp;
        if(ans>tmp)ans=tmp;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
using namespace std;

int main(void){
    string s;
    int K;
    cin >> s >> K;
    bool only1 = true;
    char ans;
    for(int i=0; i<K; i++){
        if(s[i] != '1'){
            ans = s[i];
            only1 = false;
            break;
        }
    }
    if(only1){
        ans = s[K-1];
    }
    cout << ans << endl;
    return 0;
}

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

int main() 
{
    char ch,c[6];
    int i,j;
    for(i=0;1;i++)
    {
    	
    	c[i]=getchar();
    	if(i==5)
    	 break;
	}
	if(c[2]==c[3]&&c[4]==c[5])
	   printf("Yes");
	else printf("No");
    return 0;
}








Measured memory_bytes: 128
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ

int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int ret=0;
	for(int i=0;i<a;i++){
		int p,q;scanf("%d%d",&p,&q);
		if(p>=b&&q>=c)ret++;
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n;cin>>n;
  ll t[n],a[n];for(ll i=0;i<n;i++)cin>>t[i]>>a[i];
  ll taka=t[0],ao=a[0];
  for(ll i=1;i<n;i++){
    if(taka>=ao){
      for(ao=max(ao,taka/t[i]*a[i]);;ao++){
        if(ao%a[i]==0)break;
      }
      for(;;){
        if(ao%a[i]==0&&(ao/a[i])*t[i]>=taka)break;
        ao+=a[i];
      }
      taka=(ao/a[i])*t[i];
    }
    else{
      for(taka=max(ao/a[i]*t[i],taka);;taka++){
        if(taka%t[i]==0)break;
      }
      for(;;){
        if(taka%t[i]==0&&(taka/t[i])*a[i]>=ao)break;
        taka+=t[i];
      }
      ao=(taka/t[i])*a[i];
    }
  }
  cout<<ao+taka<<endl;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main() {
	int n;
	string s;
	cin >> n >> s;
	vector<int> a(n);
	rep(i, n) {
		if (s[i] == 'R') a[i] = 0;
		if (s[i] == 'G') a[i] = 1;
		if (s[i] == 'B') a[i] = 2;
	}
	vector<ll> cnt(3);
	rep(i, n) cnt[a[i]]++;
	ll ans = 1;
	rep(i, 3) ans *= cnt[i];
	rep(j, n)rep(i, j) {
		int k = j + (j - i);
		if (k < n) {
			if (a[i] == a[j]) continue;
			if (a[i] == a[k]) continue;
			if (a[k] == a[j]) continue;
			ans--;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int A,B,M,minA=100001,minB=100001,ans=1000000000;
    cin>>A>>B>>M;
    vector<int>a(A),b(B);
    for(int i=0;i<A;i++){
        cin>>a[i];
        minA=min(minA,a[i]);
    }
    for(int i=0;i<B;i++){
        cin>>b[i];
        minB=min(minB,b[i]);
    }
    ans=min(ans,minA+minB);
    for(int i=0;i<M;i++){
        int x,y,c;
        cin>>x>>y>>c;
        ans=min(ans,a[x-1]+b[y-1]-c);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1024
var i,j,k:longint;
    first,last:string;
    ch:array[char]of char;
begin
  readln(first);
  last:=first;
  for i:=1 to length(last) do
  last[i]:=first[length(first)-i+1];
  ch['p']:='q';
  ch['q']:='p';
  ch['b']:='d';
  ch['d']:='b';
  for i:=1 to length(last) do
  last[i]:=ch[last[i]];
  if first=last then write('Yes') else write('No');
end.

Measured memory_bytes: 384
#!/usr/bin/env python
# coding: utf-8

# In[1]:


N = int(input())


# In[12]:


ans = N
for i in range(N+1):
    x = 0
    y = i
    while y:
        x += y%6
        y //= 6
    y = N-i
    while y:
        x += y%9
        y //= 9
    ans = min(x, ans)
print(ans)


# In[ ]:






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

int main() {
  int x;
  cin >> x;
  if (x >= 30)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n;
    cin >> n;
    vector<vector<ll>> a(n, vector<ll>(n));
    vector<vector<ll>> dist(n, vector<ll>(n));
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            cin >> a[i][j];
            dist[i][j] = a[i][j];
        }
    }
    for(int k = 0; k < n; ++k){
        for(int i = 0; i < n; ++i){
            for(int j = 0; j < n; ++j){
                chmin(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            ans += a[i][j];
            if(a[i][j] != dist[i][j]){
                cout << -1 << endl;
                return 0;
            }
        }
    }
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            if(i == j)  continue;
            for(int k = 0; k < n; ++k){
                if(k == i || k == j)    continue;
                if(a[i][j] == a[i][k] + a[k][j]){
                    ans -= a[i][j];
                    break;
                }
            }
        }
    }
    cout << ans / 2 << endl;
}

Measured memory_bytes: 1664
N=int(input())
l=[]
for i in range(N):
  l.append(list(map(int,input().split())))
def pat(j):
  if j==0:
    return [1,2]
  elif j==1:
    return [0,2]
  else:
    return [0,1]
dp=[[0]*3 for _ in range(N+1)]
for i in range(1,N+1):
  for j in range(3):
    dp[i][j]=l[i-1][j]+max(dp[i-1][k] for k in pat(j))
print(max(dp[-1]))

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

int main(){
	int A,B;
	cin >> A >> B;
	int a = A + B,b = A - B,c = A * B;
	if(a >= b && a >= c){
		cout << a << endl;
	}
	else if (b >= a && b >= c){
		cout << b << endl;
	}
	else{
		cout << c << endl;
	}
}

Measured memory_bytes: 256
// https://onlinejudge.u-aizu.ac.jp/problems/0118
// Property Distribution
// 输出分割成几片

#include <iostream>
#include <queue>
#include <map>

using namespace std;

char m[102][102];
typedef pair<int, int> pii;
pii dir[4] = {pii(0, 1), pii(0, -1), pii(-1, 0), pii(1, 0)};

int M, N;   // 行、列

// dfs
void kill(int x, int y)
{
    char t = m[y][x];
    queue<pii> q;
    q.push(pii(x, y));
    m[y][x] = 0;
    while (!q.empty())
    {
        pii cur = q.front();
        q.pop();
        for (int i = 0; i < 4; ++i)
        {
            pii tmp = pii(cur.first + dir[i].first, cur.second + dir[i].second);
            if (tmp.first >= 0 && tmp.second >= 0
                && tmp.first < N && tmp.second < M
                && m[tmp.second][tmp.first] == t)
            {
                m[tmp.second][tmp.first] = 0;
                q.push(tmp);
            }
        }
    }
}

int main()
{
    while (cin >> M >> N && M + N != 0)
    {
        for (int i = 0; i < M; ++i)
            cin >> m[i];
        int ans = 0;
        for (int i = 0; i < M; ++i)
            for (int j = 0; j < N; ++j)
                if (m[i][j] != 0)
                    kill(j, i), ans++;

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


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

signed main() {
    vector<int> fp;
    vector<int> is_prime(60000, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= 60000; ++i) {
        if (is_prime[i]) {
            for (int j = i + i; j <= 60000; j += i) {
                is_prime[j] = false;
            }
            if (i % 5 == 1) fp.push_back(i);
        }
    }

    int n;
    cin >> n;
    rep(i, n) cout << fp[i] << ' ';
    cout << endl;
}


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

int main() {
  while (true){
    string s;
    int a=0,b=0;
    cin >> s;
    if (s=="0") break;
    for (int i=0;i<s.size();i++){
      if (i==0) continue;
      if (s.at(i)=='A') a++;
      if (s.at(i)=='B') b++;
    }
    if (a>b) a++;
    else b++;
    cout << a << " " << b << endl;
  }
}


Measured memory_bytes: 3108
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdlib>

using namespace std;

int main(){

	int h,w;
	cin >> h >> w;
	char a[h+2][w+2];

	for(int i = 0; i < h+2; i++){
		for(int j = 0; j < w+2; j++){
			a[i][j] = '#';
		}
	}

	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cin >> a[i+1][j+1];
		}
	}


	for(int i = 0; i < h+2; i++){
		for(int j = 0; j < w+2; j++){
			cout << a[i][j];
		}
		cout << '\n';
	}

	return 0;
}

Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll x,sum=100;
  cin >> x;
  for(int i=1;;i++){
    sum = sum + (sum/100);
    if(sum>=x){
      cout << i<<endl;
      break;
    }
  }
}


Measured memory_bytes: 3652
def gcd(a,b):
    while b != 0:
        a,b=b,a%b
    return a

n=int(input())
a=[0] + list(map(int,input().split())) + [0]#a[n+1]=0とするため

l=[0]*(n+2)
r=[0]*(n+2)#r[n+1]=0としたいから
for i in range(1,n+1):
    l[i] = gcd(l[i-1],a[i])
for i in range(n,0,-1):
    r[i] = gcd(r[i+1],a[i])

z=[gcd(l[i-1],r[i+1]) for i in range(1,n+1)]

print(max(z))


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

int main(){
	int n;
	cin >> n;
	int cnt=0,k=n;
	while(k){
		k /= 10;
		cnt++;
	}
	if(cnt==1) cout << n << endl;
	if(cnt==2) cout << "9" << endl;
	if(cnt==3) cout << 9+n-99 << endl;
	if(cnt==4) cout << "909" << endl;
	if(cnt==5) cout << 909+n-9999 << endl;
	if(cnt==6) cout << "90909" << endl;
	return 0;
	
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, acos, asin, atan, sqrt, tan, cos, pi
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
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 = 998244353


n = I()
A = LI()
B = LI()
q = [(-B[i], i) for i in range(n)]
heapify(q)
ans = 0
while q:
    _, idx = heappop(q)
    if A[idx] == B[idx]:
        continue
    total = B[(idx-1)%n] + B[(idx+1)%n]
    t = (B[idx] - A[idx]) // total
    B[idx] -= t * total
    if not t:
        print(-1)
        exit()
    ans += t
    heappush(q, (-B[idx], idx))

print(ans)









Measured memory_bytes: 146516
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
using namespace std;


int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  vector<int> c(n);
  for(int i = 0; i < n; ++i){
    cin >> v[i];
  }
  for(int i = 0; i < n; ++i){
    cin >> c[i];
  }

  vector<int> diff(n);

  for(int i = 0; i < n; ++i){
    diff[i] = v[i] - c[i];
  }

  sort(diff.begin(), diff.end());
  reverse(diff.begin(), diff.end());
  int ans = 0;
  for(int i = 0; i < n; ++i){
    if(diff[i] <= 0) break;
    ans += diff[i];
  }

  cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int n,a[N],b[N];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=n;i>=1;i--) scanf("%d",&b[i]);
    for(int i=1;i<=n;i++){
        if(a[i]==b[i]){
            bool flag=0;
            for(int j=1;j<=n;j++){
                if(b[j]!=a[i]&&b[i]!=a[j]){
                    swap(b[i],b[j]);
                    flag=1;
                    break;
                }
            }
            if(!flag){
                printf("No");
                return 0;
            }
        }
    }
    printf("Yes\n");
    for(int i=1;i<=n;i++) printf("%d ",b[i]);
    return 0;
}


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

#define F first 
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 110, M = 5, mod = 1e9 + 7;

int n;
int f[N][M][M][M];

int main()
{
	cin >> n;
	f[0][0][0][0] = 1;
	
	for (int i = 0; i < n; i ++ )
		for (int a = 0; a <= 4; a ++ )
			for (int b = 0; b <= 4; b ++ )
				for (int c = 0; c <= 4; c ++ )
					for (int j = 1; j <= 4; j ++ )
					{
						if (b == 1 && c == 2 && j == 3) continue;
						if (b == 1 && c == 3 && j == 2) continue;
						if (b == 2 && c == 1 && j == 3) continue;
						if (a == 1 && b == 2 && j == 3) continue;
						if (a == 1 && c == 2 && j == 3) continue;
						f[i + 1][b][c][j] = (f[i + 1][b][c][j] + f[i][a][b][c]) % mod;
					}
	
	int res = 0;
	for (int i = 1; i <= 4; i ++ )
		for (int j = 1; j <= 4; j ++ )
			for (int k = 1; k <= 4; k ++ )
				res = (res + f[n][i][j][k]) % mod;
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 3688
n,t = map(int,input().split())
lst = [[int(i) for i in input().split()] for i in range(n)]

cst = 'TLE'
for i in range(n):
    if lst[i][1] <= t:
        if cst == 'TLE':
            cst = lst[i][0]
        elif lst[i][0] < cst:
            cst = lst[i][0]
print(cst)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

vector<int> vec;
int freq[100001];
vi a;
vi inv;
bool visited[100001];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, m, q;
	cin >> n >> m >> q; vec.resize(q);
	for(int i = 0; i < q; i++)
	{
		cin >> vec[i]; vec[i]--;
	}
	freq[0] = n;
	reverse(vec.begin(), vec.end());
	for(int i = 0; i < q; i++)
	{
		if(!visited[vec[i]])
		{
			visited[vec[i]] = 1;
			a.pb(vec[i]);
		}
	}
	for(int i = 0; i < m; i++)
	{
		if(!visited[i]) a.pb(i);
	}
	//cerr << a.size() << ' ' << n << '\n';
	inv.resize(m);
	for(int i = 0; i < m; i++)
	{
		inv[a[i]] = i;
	}
	
	for(int i = 0; i < q; i++)
	{
		int f = inv[vec[i]];
		if(freq[f])
		{
			freq[f]--; freq[f+1]++;
		}
	}
	int idx = 0;
	for(int i = 0; i <= m; i++)
	{
		if(freq[i])
		{
			idx = i; break;
		}
	}
	for(int i = idx; i < m - 1; i++)
	{
		if(a[i] >= a[i+1]) {cout << "No"; return 0;}
	}
	cout << "Yes"; return 0;
}


Measured memory_bytes: 2040
attrs = Array.new
while line = $stdin.gets
    attrs << line.chomp.split.map{|v| v.to_i }
end

tmp = attrs.shift
N = tmp.shift
K = tmp.shift
H = attrs.shift
result = 0
if N == 1 then
  result += 1 if H[0] >= K
else
  H.each {|h| result += 1 if h >= K}
end
puts result

Measured memory_bytes: 8204
#include <stdio.h>
 
int main(){
 
int n,i,j,max,min;
int R[200000];
 
scanf("%d",&n);
 
for(i=0 ; i<n ; i++){
  scanf("%d",&R[i]);
  }
 
max=R[1]-R[0];
min=R[0];
 
for(i=1 ; i<n ; i++){
if(R[i]-min>max) max=R[i]-min;
if(R[i]<min) min=R[i]; 
}
 
printf("%d\n",max);
 
    return 0;
}



Measured memory_bytes: 2632
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    N = int(input())
    A = read_lists(N)
    
    res = 0
    for i in range(N):
        for j in range(i + 1, N):
            if i == j:
                continue

            for k in range(N):
                if k in (i, j):
                    continue

                if A[i][j] == A[i][k] + A[k][j]:
                    break

                if A[i][j] > A[i][k] + A[k][j]:
                    print(-1)
                    return
            else:
                res += A[i][j]
    
    print(res)


if __name__ == "__main__":
    main()



Measured memory_bytes: 46168
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=1e5+50;
int n,k;
int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
#endif
	read(n),read(k); 	
	printf("%d\n",(n-1+k-2)/(k-1));
	return 0;
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

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

int main()
{
    int n;
    cin>>n;
    vector<vector<int>>v(n,vector<int>(3,0));
    vector<vector<int>>dp(n,vector<int>(3,0));
    int a=0;
    for(int i=0;i<n;i++)
      for(int j=0;j<3;j++)
         cin>>v[i][j];
    
    dp[0][0]=v[0][0];
    dp[0][1]=v[0][1];
    dp[0][2]=v[0][2];
    
    for(int i=1;i<n;i++)
     {
        
             dp[i][0]=v[i][0]+max(dp[i-1][1],dp[i-1][2]);
              dp[i][1]=v[i][1]+max(dp[i-1][0],dp[i-1][2]);
               dp[i][2]=v[i][2]+max(dp[i-1][1],dp[i-1][0]);
     }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
    
    return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define mod ((ull)(1e9)+7)

int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int> cnt(26,0);
    for(int i=0; i<n; i++) cnt[(int)(s[i]-'a')]++;
    ll ans=1;
    for(int i=0; i<26; i++) ans=ans*(cnt[i]+1)%mod;
    cout << ans-1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

int main() {
   int a;
   cin>>a;
   long long t,u;
   vector<pair <long long,long long>> vec(a);
   rep(i,a){
      cin>>t>>u;
      vec.at(i)=make_pair(u,t);
   }
   sort(vec.begin(),vec.end());
   long long c,d;
   long long time=0;
   bool flag=true;
   rep(i,a){
      tie(c,d)=vec.at(i);
      //cout<<c<<d<<endl;
      if(time+d<=c){
         time+=d;
      }
      else{
         flag=false;
         break;
      }
   }
   if(flag){
      cout<<"Yes"<<endl;
   }
   else{
      cout<<"No"<<endl;
   }
}



Measured memory_bytes: 3328
N, M = map(int,input().split())
A = sorted([list(map(int,input().split())) for k in range(M)])
R = [0 for k in range(N)]

for p in A:
    R[p[0]-1] += 1
    R[p[1]-1] += 1

for c in R:
    print(c)

Measured memory_bytes: 3060