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


using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> pii;

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define Rep(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える

using field = vector<vector<int>>;

field c;

int w, h;

void dfs(field &c, int x, int y) {

	c[x][y] = 0;
	

	for (int dx = -1; dx <= 1; dx++) for (int dy = -1; dy <= 1; dy++) {
		int nx = x + dx, ny = y + dy;

		if (nx == x && ny == y) continue;

		else if (nx >= 0 && nx < h && ny >= 0 && ny < w && c[nx][ny] == 1) dfs(c, nx, ny);

	}
}


int main(void){
	

	while (cin >>w >> h) {		

		if (w == 0 && h == 0) break;

		c.assign(h, vector<int>(w));

		rep(i, h) rep(j, w) cin >> c[i][j];

		int cnt = 0;

		rep(i, h) rep(j, w) {
			if (c[i][j] == 1) {
				dfs(c, i, j);
				cnt++;
			}
		}

		cout << cnt << endl;
	}
}


Measured memory_bytes: 3312
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(x) cout<<#x<<"="<<x<<endl;
#define endl '\n'
#define M 1000000007
#define int long long
#define INF 1e18
#define max_n 1000000

using namespace std;

void solve()
{
	ll n,W;
	cin>>n>>W;
	ll w[n],v[n];
	ll tv=0;

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

	ll dp[n+1][tv+1];

	for (int i = 0; i <= n; ++i)
	{
		for (int j = 0; j <= tv; ++j)
		{
			if(j==0)dp[i][j]=0;
			else if(i==0)dp[i][j]=1e18;
			else if(j-v[i-1]>=0)dp[i][j]=min(w[i-1]+dp[i-1][j-v[i-1]],dp[i-1][j]);
			else dp[i][j]=dp[i-1][j];
		}
	}

	ll ans=0;
	for (int i = 0; i <= tv; ++i)
	{
		if(dp[n][i]<=W)ans=i;
	}
	cout<<ans<<endl;
}

int32_t main() 
{
	IOS	
	ll T=1;
	// cin>>T;
	for(ll i=1;i<=T;++i)
	{		
		// cout<<"Case #"<<i<<": ";
    	solve();
	}
	return 0;
}

Measured memory_bytes: 82460
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n,k,l;
  cin>>n>>k;
  vector<int> rod(n);
  for(int i=0;i<n;i++){
    cin>>l;
    rod.push_back(l);
  }
  int ans=0;
  sort(rod.rbegin(),rod.rend());
  for(int i=0;i<k;i++){
    ans+=rod[i];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <stdlib.h>
#include <limits.h>
#include <string>
#include <iostream>

using namespace std;
#define pi 3.14159265

int main()
{
	long long ans = 0, i = 0, j = 0, k = 0, l = 0;
	long long N, a[200001], b[200001];
	cin >> N;
	for (i = 0; i < N; i++) { cin >> a[i]; b[i] = a[i] - i; }

	sort(b, b + N);
	for (i = 0; i < N; i++) {
		ans += llabs(b[i] - b[N / 2]);
	}

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

Measured memory_bytes: 3328
S = int(input())
S_ms = S % 3600
S_h = int((S - S_ms) / 3600)
S_s = S_ms % 60
S_m = int((S_ms - S_s) / 60)
print(str(S_h) + ":" + str(S_m) + ":" + str(S_s))


Measured memory_bytes: 5588
import os, sys, re, math

(H, W) = [int(i) for i in input().split()]
a = []
for i in range(H):
    r = input()
    if '#' in r:
        a.append(r)

a = [''.join(r) for r in zip(*a)]
a = filter(lambda r: '#' in r, a)
a = [''.join(r) for r in zip(*a)]

for r in list(a):
    print (r)


Measured memory_bytes: 3188
#include <cstdio>
#include <vector>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int N, M, Q, s, t, a[400009], b[400009], c[400009], p[400009], par[4009], d[4009][4009]; vector<pair<int, int> > g[4009];
int root(int x) { return x == par[x] ? x : par[x] = root(par[x]); }
void dfs(int pos, int pre, int st, int val) {
	d[st][pos] = val;
	for (pair<int, int> i : g[pos]) {
		if (i.first == pre) continue;
		dfs(i.first, pos, st, max(val, i.second));
	}
}
int main() {
	scanf("%d %d", &N, &M);
	for (int i = 0; i < M; i++) scanf("%d %d %d", &a[i], &b[i], &c[i]), a[i]--, b[i]--, p[i] = i;
	sort(p, p + M, [](int i, int j) { return c[i] < c[j]; });
	for (int i = 0; i < N; i++) par[i] = i;
	long long sum = 0;
	for (int i = 0; i < M; i++) {
		int pa = root(a[p[i]]), pb = root(b[p[i]]);
		if (pa != pb) {
			par[pa] = pb; sum += c[p[i]];
			g[a[p[i]]].push_back(make_pair(b[p[i]], c[p[i]]));
			g[b[p[i]]].push_back(make_pair(a[p[i]], c[p[i]]));
		}
	}
	for (int i = 0; i < N; i++) dfs(i, -1, i, 0);
	scanf("%d", &Q);
	for (int i = 0; i < Q; i++) {
		scanf("%d %d", &s, &t); s--, t--;
		printf("%lld\n", sum - d[s][t]);
	}
	return 0;
}

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

#define forw(m,i,n) for(i=m; i<n; i++)
#define done return 0
#define in(x) cin >> x
#define out(x) cout << x << endl
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;



int main() {
    //freopen("output.txt","w",stdout);
    //freopen("input.txt","r",stdin);

    ll n;
    in(n);
    ll i,x,counts=1,minm=0;
    in(minm);
    for(i=1; i<n; i++) {
        in(x);
        if(x<=minm) counts++;
        minm=min(minm,x);
    }

    cout << counts << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

struct Date {
    int y, m, d;
    Date(int y, int m, int d) : y(y), m(m), d(d) {}
    Date() = default;
    Date& operator++() {
        bool f = m % 2 == 1;
        f |= y % 3 == 0;
        d++;
        int maxi = 20;
        if (f) maxi = 21;
        if (d == maxi) {
            d = 1;
            m++;
        }
        if (m == 11) {
            m = 1;
            y++;
        }
        return *this;
    }
};

int n;
int y, m, d;

void solve() {
    auto date = Date(y, m, d);
    int ans = 0;
    while (1) {
        if (date.y == 1000) break;
        ans++;
        ++date;
        // cout << date.y << ", " << date.m << ", " << date.d << endl;
    }
    cout << ans << endl;
}
int main() {
    cin >> n;
    rep(i, n) {
        cin >> y >> m >> d;
        solve();
    }
    return 0;
}

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

#define pb push_back
#define mp make_pair
#define all(n) (n).begin(),(n).end()
#define fi first
#define se second
#define mset(x,v) memset((x),(v),sizeof(x))

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

const int MOD = 1e9+7;

int main() {

	ios::sync_with_stdio(0);
	cin.tie(0);

	string s;
	cin >> s;
	if (s[s.length()-1]=='s') cout << (s+"es") << "\n";
	else cout << s << "s\n";
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int cnt[30];

int main(){
	char s[100005];
	scanf("%s", &s);
	for(int i=0; i<strlen(s); i++) {
		cnt[s[i]-'a']++;
	}
	int flag = 0;
	for(int i=0; i<26; i++) {
		if(cnt[i] == 0){
			printf("%c\n", 'a'+i);
			flag = 1;
			break;
		}
	}
	if(flag == 0) cout << "None" << endl;
	return 0;
} 

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

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)

#define ll long long
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)

#define xx first
#define yy second
#define mp make_pair
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define pdd pair<double,double>
#define ALL(v) (v).begin(), (v).end()

const ll MOD=1e9+7;
const ll inf=1e10;

#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;


ll power(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a);
        n>>=1;
        a=(a*a);
    }
    return ans;
}


ll powerMod(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%MOD;
        n/=2;
        a=(a*a)%MOD;
    }
    return ans;
}

ll powerMod1(ll a,ll n,ll mod){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%mod;
        n>>=1;
        a=(a*a)%mod;
    }
    return ans;
}

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

ll sumdigit(ll n){
    ll sum=0;
    while(n){
        sum+=n%10;
        n=n/10;
    }
    return sum;
}

ll countSetBit(ll a){
    return __builtin_popcount(a);
}
ll countBit(ll a){
    ll sum=0;
    while(a){
        sum++;
        a>>=1;
    }
    return sum;
}

ll length(ll a){
    ll ans=0;
    while(a){
        ans++;
        a=a/10;
    }
    return ans;
}

int main()
{
    fast;
    ll t;
    //cin>>t;
    t=1;

    while(t--){
        ll n;
        cin>>n;
        ll a[n];
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        ll ans=INT_MIN;
        ll curr=0;
        for(int i=1;i<n;i++){
            if(a[i-1]>=a[i]){
                curr++;
                ans=max(ans,curr);
            }else{
                curr=0;
            }

        }
        if(ans==INT_MIN)
            ans=0;
        cout<<ans;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#define GYOU_MAX 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define s_pri(str) printf("%s\n",str);
#define PRINT(str) printf(#str "\n")
#define v_pri(val) printf("%d\n",val);
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define pi acos(-1.0)
#define sca(x) scanf("%d",&x);

typedef long long int ll;

/*
puts("aa");
//*/

int cmp(const void *a, const void*b) {
	return *(int*)b - *(int*)a;
}

int main(void) {


	

	int N, K;
	sca(N);
	sca(K);

	int H[200000];
	int sum = 0;
	rep(i, N) {
		sca(H[i]);
	}
	ll count = 0;

	qsort(H, N, sizeof(int), cmp);
	rep(i, K) {
		H[i] = 0;
	}
	rep(i, N) {
		count += H[i];
	}


	printf("%lld", count);
	return 0;
}


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    string s;
    cin >> s;
    
    if(s[0]!=s[1] and s[2]==s[3] and s[4]==s[5])
    cout << "Yes" << endl;
    else
    cout << "No" << endl;
    
	return 0;
    
}

Measured memory_bytes: 8832
s=input()
m=s[5:7]
d=s[-2:]
if m[0]=="0":
    m=int(m[1])
else:
    m=int(m)
if d[0]=="0":
    d=int(d[1])
else:
    d=int(d)
if m<=4:
    print("Heisei")
else:
    print("TBD")

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

int main()
{

ll n,d=0;
cin>>n;
if(n%2==0)
{
 d=n/2;
}
else if(n%2)
d=(n/2)+1;

double f= d/(n*1.0);

printf("%0.10lf\n",f);
	return 0;
}

Measured memory_bytes: 3764
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}


int main(){
  string S;
  cin >> S;
  auto A = S[0];
  ll T = 0,K=INF;
  rep(i,S.size()){
    if(S[i]!=A){
      K = min(max(T,(ll)S.size()-T),K);
    }
    A = S[i];
    T++;
  }
  if(K==INF){
    K=S.size();
  }
  cout << K << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		String a = stdIn.next();
		String b = stdIn.next();
		String c = stdIn.next();
		
		String d = a.toUpperCase();
		String e = b.toUpperCase();
		String f = c.toUpperCase();
		
	    char g = d.charAt(0);
	    char h = e.charAt(0);
	    char i = f.charAt(0);
	    
	    String j = String.valueOf(g);
	    String k = String.valueOf(h);
	    String l = String.valueOf(i);
	    
	    String m = j + k + l;
	    
	    System.out.println(m);
	}
}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

/*--- year??´month???day??\????????\????±??????? ---*/
tm dayofweek(int year, int month, int day)
{
	struct tm  t;

	t.tm_year = year - 1900;    /* ??´????????´ */
	t.tm_mon = month - 1;        /* ???????????´ */
	t.tm_mday = day;            /* ??\ */
	t.tm_hour = 0;                /* ??? */
	t.tm_min = 0;                /* ??? */
	t.tm_sec = 0;                /* ?§? */
	t.tm_isdst = -1;            /* ????????? */

	return t;
}
int main() {
	while (1) {
		int y1, m1, d1, y2, m2, d2; cin >> y1 >> m1 >> d1 >> y2 >>m2>> d2;
		if (y1 == -1)break;
		tm a = dayofweek(y1, m1, d1);
		tm b = dayofweek(y2, m2, d2);
		double diff = difftime(mktime(&b),mktime(&a));
		cout << int(diff / 60 / 60 / 24 + 0.5) << endl;
	}
	return 0;
}

Measured memory_bytes: 3048
#include<bits/stdc++.h>
using namespace std;
int getColor(int n){
	if( n<=399 )return 0;
	else if( n<=799 )return 1;
	else if( n<=1199 )return 2;
	else if( n<=1599 )return 3;
	else if( n<=1999 )return 4;
	else if( n<=2399 )return 5;
	else if( n<=2799 )return 6;
	else if( n<=3199 )return 7;
	else return -1;
}
int main(){
	
	int n;cin>>n;
	int a[n];

	unordered_set<int> st;

	int free = 0;

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

		if(a[i]==-1)free++;
		else st.insert(a[i]);
	}
	//get min
	if(st.size()==0)cout<<1<<endl;
	else cout<<st.size()<<" ";

	//get max
	cout<<st.size()+free<<endl;


	return 0;

}

Measured memory_bytes: 3572
# -*- coding: utf-8 -*-
import sys
import math

#tmp = input().split()
#n,m = list(map(lambda a: int(a), tmp))

s = input()
#s = int(input())
#tmp = input().split()
#n,m,k = list(map(lambda a: int(a), tmp))


if(s[-1]=="3"):
	print("bon")
	sys.exit()
if(s[-1]=="0"):
	print("pon")
	sys.exit()
if(s[-1]=="1"):
	print("pon")
	sys.exit()
if(s[-1]=="6"):
	print("pon")
	sys.exit()
if(s[-1]=="8"):
	print("pon")
	sys.exit()
print("hon")



Measured memory_bytes: 9124
#coding:utf-8

if __name__ == "__main__":
    N = int(input())
    string = input()

    right = 0
    left = 0

    for char in string:
        if char == '(':
            right += 1
        else:
            right -= 1

        if right == -1:
            left += 1
            right = 0

    L = '(' * left
    R = ')' * right

    print(L + string + R)


Measured memory_bytes: 2940
// complete binary tree
#include<iostream>
int parent(int);
int left(int);
int right(int);
int main(){
  int *T, n, i;
  std::cin >> n;
  T = new int[n+1];
  for(i=1; i<=n; i++) std::cin >> T[i];
  for(i=1; i<=n; i++){
    std::cout << "node " << i << ": key = " << T[i] <<", ";
    if(i != 1) std::cout << "parent key = " << T[parent(i)] << ", ";
    if(left(i) <= n) std::cout << "left key = " << T[left(i)] << ", ";
    if(right(i) <= n) std::cout << "right key = " << T[right(i)] << ", ";
    std::cout << "\n";
  }
  return 0;
}
int parent(int n){
  return n/2;
}
int left(int n){
  return 2*n;
}
int right(int n){
  return 2*n+1;
}

Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
#include <iomanip>
#define FI first
#define SE second
#define EB emplace_back
#define MP make_pair
#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 1100000000
#define LLINF 1100000000000000000LL
#define Decimal fixed << setprecision(20)
#define ALL(c) c.begin(),c.end()
#define SHOWVEC(v, sz) for(int i = 0; i < sz; i++) cerr << v[i] << ' '; cerr << endl;
#define SHOWX(x) cerr << #x << ": " << x << endl;
#define SHOWP(p) cerr << "[" << p.first << ',' << p.second << "]";

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main()
{
  string S; cin >> S;
  string T(S); reverse(ALL(T));
  int ans = 0;
  REP(i, S.size()/2) {
    if (S[i] != T[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
#define gr vector<vpii>
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define GAME_OVER return 0
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n, k;
    cin >> n >> k;
    vi a;
    while (n)
    {
        a.push_back(n % k);
        n /= k;
    }
    cout << sz(a) << endl;
    GAME_OVER;
}

Measured memory_bytes: 256
def all_your_paths_are_different_lengths(L: int)->tuple:
    if L == 1:
        return 2, [(1, 2, 0)]

    r = 0
    while 2 ** (r+1) <= L:
        r = r + 1

    N = r + 1
    edges = []
    power2 = 1
    for i in range(1, N):
        edges.append((i, i+1, 0))
        edges.append((i, i+1, power2))
        power2 = power2 * 2

    for t in range(N-1, 0, -1):
        if L - (2**(t-1)) >= 2**r:
            edges.append((t, N, L - 2**(t-1)))
            L = L - 2**(t-1)

    return N, edges


if __name__ == "__main__":
    L = int(input())
    N, edges = all_your_paths_are_different_lengths(L)
    print(N, len(edges))
    for u, v, w in edges:
        print(u, v, w)


Measured memory_bytes: 3064
#include <iostream>

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

    if (a <= 9 && b <= 9)
    {
        std::cout << a * b << std::endl;
    }
    else
    {
        std::cout << -1 << std::endl;
    }
    
    return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


string S;
int num[100000];

signed main(){
    cin >> S;
    int N = S.length();
    REP(i, N) num[i] = 0;
    int cnt = 0, prev = 0;
    REP(i, N - 1){
        if(S[i] == 'R' && S[i + 1] == 'R'){
            cnt++;
        }else if(S[i] == 'R' && S[i + 1] == 'L'){
            num[i] += cnt / 2 + 1;
            num[i + 1] += (cnt + 1) / 2 + 1;
            cnt = 0; prev = i;
        }else if(S[i] == 'L' && S[i + 1] == 'L'){
            cnt++;
            if(i + 1 == N - 1){
                num[prev] += (cnt + 1) / 2;
                num[prev + 1] += cnt / 2;
                cnt = 0;
            }
        }else if(S[i] == 'L' && S[i + 1] == 'R'){
            num[prev] += (cnt + 1) / 2;
            num[prev + 1] += cnt / 2;
            cnt = 0;
        }
    }
    REP(i, N){
        cout << num[i];
        if(i < N - 1) cout << " ";
        else cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
H, W = map(int, input().split())
grid = []
for i in range(H):
    grid.append(input())

visit = [[False for j in range(W)] for i in range(H)]


queue = [[0,0]]
count = 0
while len(queue) > 0:
    count += 1
    next = []
    for now in queue:
        visit[now[0]][now[1]] = True
        for i, j in [[0,-1], [1,0], [0,1], [-1,0]]:
            if 0 <= now[0]+i <= H-1 and 0 <= now[1]+j <= W-1:
                if [now[0]+i,now[1]+j] not in next and not visit[now[0]+i][now[1]+j] and grid[now[0]+i][now[1]+j] == ".":
                    next.append([now[0]+i, now[1]+j])

    if visit[-1][-1]:
        break
    queue = next[:]


black = count
for i in range(H):
    black += grid[i].count("#")

if visit[-1][-1]:
    print(H*W-black)
else:
    print(-1)


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

int main()
{
	char a;
	cin >> a;
	if (0 <= a-'a' && a-'a' <= 25) cout << "a" << endl;
	else cout << "A" << endl;
	return 0;
}

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

static class CodeJam
{
    static int[] Z(string S)
    {
        int N = S.Length;
        var A = new int[N];
        A[0] = N;
        int i = 1, j = 0;
        while (i < N)
        {
            while (i + j < N && S[j] == S[i + j])
            {
                ++j;
            }
            A[i] = j;
            if (j == 0)
            {
                ++i;
                continue;
            }
            int k = 1;
            while (i + k < N && k + A[k] < j)
            {
                A[i + k] = A[k];
                ++k;
            }
            i += k;
            j -= k;
        }
        return A;
    }

    static int Solve(int N, string S)
    {
        int max = 0;
        for (int i = 0; i < N - 1; ++i)
        {
            int[] A = Z(S.Substring(i));
            for (int j = 0; j < A.Length; ++j)
            {
                max = Math.Max(Math.Min(A[j], j), max);
            }
        }
        return max;
    }

    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();
        Console.WriteLine(Solve(N, S));
    }
}


Measured memory_bytes: 36784
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        x: usize,
    };

    println!("{}", 1000*(x/500) + 5*((x%500)/5));
}


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

void dfs(int i, int n, int mxChar, const string& s) {
  if (i == n) {
    // cout << s << endl;
    printf("%s\n", s.c_str());
    return;
  }
  rep(j, mxChar + 1) {    
    string ss(s);
    ss.push_back((char)('a' + j));
    dfs(i + 1, n, j == mxChar ? (mxChar + 1) : mxChar, ss);
  }
}

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

  int n;
  cin >> n;
  dfs(0, n, 0, "");
}

Measured memory_bytes: 1536
# coding: utf-8
N = gets.to_i
ss = []
N.times do |i|
  ss << gets.chomp!
end

sh = {}
sh.default = 0

ss.each do |s|
  sh[s] += 1
end

# find max
m = sh.max{ |x, y| x[1] <=> y[1] }
fkey = m[1]
ans = sh.select {|k, v| v == fkey }
ansa = ans.map {|k, v| k}

puts ansa.sort


Measured memory_bytes: 60264
#include <iostream>

using namespace std;

int main() {
    int d, t, s;

    cin >> d;
    cin >> t;
    cin >> s;

    double result;
    result = (double)d / s;

    if (result <= t) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

int main(){

char *s1 = "ABC";
char *s2 = "ARC";
char s[5];
char *s3 = s;

scanf("%s",s);

if(strcmp(s1,s3)==0){
  printf("ARC\n");
}else if(strcmp(s2,s3)==0){
  printf("ABC\n");
}

return 0;
}


Measured memory_bytes: 1644
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}

const ll inf=10000000000;
int main(){
  string S;cin>>S;
  int a=0;
  int n=S.size();
  rep(i,n/2){
    if(S.at(i)!=S.at(n-i-1)){
      a++;
    }
  }
  
       
  rep(i,(n-1)/2/2){
    if(S.at(i)!=S.at((n-1)/2-i-1)){
      a++;
    }
    if(S.at(n-1-i)!=S.at((n+1)/2+i)){
      a++;
    }
       }
          
  ans1(a==0);
}
       
       
       
  

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val d = Array(n) { sc.nextInt() }
    val m = sc.nextInt()
    val t = Array(m) { sc.nextInt() }
    val map = mutableMapOf<Int, Int>()
    for (i in 0 until n) {
        map[d[i]] = (map[d[i]] ?: 0) + 1
    }
    var ok = true
    for (i in 0 until m) {
        if ((map[t[i]] ?: 0) == 0) {
            ok = false
            break
        }
        map[t[i]] = map[t[i]]!! - 1
    }
    println(if (ok) "YES" else "NO")
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 74208
#include <bits/stdc++.h>
using namespace std;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
 
typedef long long ll;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define DBGV(v,n) forn(i,n) cout << v[i] << " "; cout << endl
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl
#define MAXN 2005
#define INF 1000000007
 
 
int main()
{ 
	FIN;
	
	#ifdef input
		//freopen("test1.txt", "r", stdin);
	#endif
	
	int x, y;
	cin >> x >> y;
	if(y%2 == 1) cout << "No\n";
	else if(4*x < y) cout << "No\n";
	else if(2*x > y) cout << "No\n";
	else cout << "Yes\n";
	
	
	
	return 0;
}

Measured memory_bytes: 3648
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstring>
#include <math.h>
#include <set>
#include <vector>
#include <algorithm>
#include <map>


using namespace std;

typedef long long ll;
const double PI = acos(-1.0);
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

int main(){
    ios::sync_with_stdio(false);
    int a, b;
    while(scanf("%d%d", &a, &b)!=EOF){
        printf("%d\n", a*b-(a+b)+1);
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  int A, B, C;
  while (cin >> A >> B >> C) {
    int res = A + B + C + max({A, B, C}) * 9;
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin>>n>>m;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    reverse(a,a+n);
    int total = 0;
    for(int i=0;i<n;i++)total+=a[i];
    int ans = 0;
    double req = (1/((double)4*m))*total;
    for(int i=0;i<n;i++){
        if(a[i]<req)break;
        ans++;
    }
    if(ans>=m)cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
import sys

N = int(input())
NList = list(map(int, input().split()))

for i in range(N):
    if NList[i] % 2 == 0:
        if NList[i] % 3 != 0 and NList[i] % 5 != 0:
            print('DENIED')
            sys.exit(0)

print('APPROVED')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define pii pair<int,int>
using namespace std;
bool cmp(pii p1,pii p2){
    if(p1.first!=p2.first) return p1.first<p2.first;
    else return p1.second<p2.second;
}
int main() {
    int n;
    cin>>n;
    vector<pii> v(n);
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        v[i]={a,b};
    }
    sort(v.begin(),v.end(),cmp);
    for(int i=0;i<n;i++){
        cout<<v[i].first<<" "<<v[i].second<<endl;
    }
    return 0;
}


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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    H -= h;
    W -= w;
    cout << H * W << endl;
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i + 1];
  }

  for (int i = 0; i < n; i++) {
    a[i + 1] += a[i];
  }
  map<ll, ll> m;
  for (auto e : a) {
    m[e]++;
  }
  ll r = 0;
  for (auto e : m) {
    if (e.second > 1) {
      r += e.second * (e.second - 1) / 2;
    }
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 14336
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut m: usize = read();
    if n * 2 >= m {
        println!("{}", std::cmp::min(n, m/2));
        return;
    }
    m -= n * 2;
    println!("{}", n + m / 4);
}

Measured memory_bytes: 2060
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

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

  ll a2 = max(0ll, a - k);
  k = max(0ll, k - a);
  b = max(0ll, b - k);

  cout << a2 << " " << b << endl;
  return 0;
}


Measured memory_bytes: 256
import numpy as np
import math

N, K = (int(i) for i in input().split())  
A = [int(i) for i in input().split()] 

count = 1

if (N-K) % (K-1) == 0:
  count += (N-K) // (K-1)
else:
  count += (N-K) // (K-1) + 1
  
print(count)

Measured memory_bytes: 23416
#include<iostream>
using namespace std;
int main(){
  int ans=0;
  char a,b,c,d,e,f;
  cin >> a >> b >> c;
  cin >> d >> e >> f;
  if(a==d){
    ans++;
  }
  if(b==e){
    ans++;
  }
  if(c==f){
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;


int main(){
    int X; cin >> X;
    int num = X/100;
    int mm = X%100;
    cerr << num << " " << mm << endl;
    for(int i=0;i<num;i++){
        if(mm>=5){ mm -= 5; continue;}
        if(mm==4){ mm -= 4; continue;}
        if(mm==3){ mm -= 3; continue;}
        if(mm==2){ mm -= 2; continue;}
        if(mm==1){ mm -= 1; continue;}
    }
    if(mm == 0){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll x,y;
    cin >>x>>y;

    ll gx,gy;

    if(x==2){
        gx=1;

    }else if(x==4||x==6||x==9||x==11){
        gx=2;
    }else{
        gx=3;
    }
    if(y==2){
        gy=1;

    }else if(y==4||y==6||y==9||y==11){
        gy=2;
    }else{
        gy=3;
    }
    
    if(gx==gy){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }



    return 0;
    

}

Measured memory_bytes: 3532
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

#define INF (int64_t)(1e+14)

using namespace std;

int main(int argc, const char * argv[]) {
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n; cin >> n;
    set<int> st;
    for (int i = 0; i < n; i++) {
        int d; cin >> d;
        st.insert(d);
    }
    
    cout << st.size() << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>

using namespace std;

 
int main(){
	int P[100005]={};
	for(int i=0;i<10001;i++){
		P[i]=i;
		if(i%15==0)P[i]=70000;
		else if(i%5==0)P[i]=50000;
		else if(i%3==0)P[i]=30000;
	}

	
	int n,m;
	while(1){
		string s;
	bool F[1005]={};
	cin>>n>>m;if(n==0&&m==0)break;

	for(int i=1;i<=n;i++)
		F[i]=true;

	int K=1;
	bool FF=false;
	for(int I=1;I<=m;I++){

		cin>>s;int x=K;
		if(FF==false){
		int Q=0;
		for(int i=0;i<s.size();i++)
			{
				Q*=10;
				Q+=s[i]-'0';
		}
		
		if(I%15==0&&s!="FizzBuzz"){F[K]=false;}//cout<<"W";}
		else if(I%5==0&&s!="Buzz"){F[K]=false;}//cout<<"$";}
		else if(I%3==0&&s!="Fizz"){F[K]=false;}//cout<<"#";}
		
		else if(Q!=I&&s!="FizzBuzz"&&s!="Buzz"&&s!="Fizz"){F[K]=false;}//cout<<"P";}
		
		if(I%15==0&&s=="FizzBuzz"){F[K]=true;}//cout<<"W";}
		else if(I%5==0&&s=="Buzz"&&s!="FizzBuzz"){F[K]=true;}//cout<<"$";}
		else if(I%3==0&&s=="Fizz"&&s!="FizzBuzz"){F[K]=true;}//cout<<"#";}
	//	else F[K]=false;
		//if(F[K]==false)cout<<"%%"<<" "<<Q;

		for(int i=K+1;i<=n;i++){
			if(F[i]==true){x=i;break;}
		}
		if(x==K){
			for(int i=1;i<K;i++){
				if(F[i]==true){x=i;break;}
			}
		}
		}//if(x==K)FF=true;}
		K=x;
		int y=K;
		for(int i=K+1;i<=n;i++){
			if(F[i]==true){y=i;break;}
		}
		if(y==K){
			for(int i=1;i<K;i++){
				if(F[i]==true){y=i;break;}
			}
		}
		if(y==K)FF=true;





		//cout<<K<<endl;
	}
	bool H=false;

	
	for(int i=1;i<=n;i++)
	{
		if(F[i]==true){
			if(H==true)cout<<" ";
			cout<<i;
			H=true;
		}
	}
	cout<<endl;
	}
	return 0;
}
		

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

dicts = {}

for _ in range(N):
    S = input()
    if S in dicts:
        dicts[S] += 1
    else:
        dicts[S] = 1

dicts = sorted(dicts.items(), key=lambda x:x[1], reverse=True)
max_list = []

buf = dicts[0][1]
for k, v in dicts:
    if v == buf:
        max_list.append(k)
    else:
        break

for k in sorted(max_list):
    print(k)

Measured memory_bytes: 43224
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vct vector<ll>
#define vpp vector<pair<ll,ll> >
#define ump unordered_map<ll,ll>
#define smp map<ll,ll>
#define st set<ll>
int main()
{
    // Sunny, Cloudy, Rainy
    string s;cin>>s;
    if(s=="Sunny")
    {
        cout<<"Cloudy";
    }
    else if(s=="Cloudy")
    {
        cout<<"Rainy";
    }
    else
    {
        cout<<"Sunny";
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#define LL long long
#define MP make_pair
#define PII pair<int, int>
#define F first
#define S second
using namespace std;
int n;
int a[200010][25];
LL res=0;
inline void work(int x,int y)
{
	int t=0;
	while (x)
	{
		a[y][t]=x%2;
		x/=2;
		t++;
	}
}
int main()
{
	cin >>n;
	for (int i=0;i<n;i++)
	{
		int x;
		cin >>x;
		work(x,i+1);
	}
	for (int j=0;j<20;j++)
	{
		for (int i=2;i<=n;i++)
		    a[i][j]+=a[i-1][j];
	}
	for (int i=0;i<n;i++)
	{
		int l=0,r=i;
		while (l<r)
		{
			int mid=(l+r)/2;
			bool fl=1;
			for (int j=0;j<20;j++)
			{
				if (a[i+1][j]-a[mid][j]>1)
				{
					fl=0;
					break;
				}
			}
			if (fl) r=mid;
			else l=mid+1;
		}
		res+=i-l+1;
	}
	cout <<res;
	return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	ll a[3];
  	int k;
  	rep(i,3) cin >> a[i];
  	cin >> k;
	sort(a,a+3);
  	
  	rep(i,k) a[2] *= 2;

	cout << a[0]+a[1]+a[2] << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int N;
int P[271828];

int main(void) {
	int i;
	int count = 0;
	int min;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &P[i]) != 1) return 1;
	}
	min = 99999999;
	for (i = 0; i < N; i++) {
		if (P[i] < min) min = P[i];
		if (min >= P[i]) count++;
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 896
import sys
from collections import deque
input = sys.stdin.readline

n, m, k = list(map(int, input().split()))

ab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(k)]

ff = [[] for _ in range(n+1)]
for a, b in ab:
    ff[a].append(b)
    ff[b].append(a)

visited = [False] * (n+1)
visited[0] = True

com = [-1] * (n+1)


def dfs(v, ff, visited, com, g):
    q = deque([v])
    visited[v] = True
    com[v] = g
    k = 1
    while len(q) > 0:
        w = q.pop()
        for x in ff[w]:
            if not visited[x]:
                q.append(x)
                visited[x] = True
                com[x] = g
                k += 1
    return k

g = 0
group_num = []

for i in range(1, n+1):
    if visited[i]:
        pass
    else:
        k = dfs(i, ff, visited, com, g)
        group_num.append(k)
        g += 1

#print(com)

friends = [0] * (n+1)

for i in range(1, n+1):
    friends[i] += group_num[com[i]] - 1

for a, b in ab:
    if com[a] == com[b]:
        friends[a] -= 1
        friends[b] -= 1

for c, d in cd:
    if com[c] == com[d]:
        friends[c] -= 1
        friends[d] -= 1

print(" ".join(map(str, friends[1:])))

Measured memory_bytes: 125196
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    ll n,k; cin >> n >> k;
    vector<ll> x(n);
    for(ll i=0;i<n;i++) cin >> x[i];

    ll cur = 0;
    ll ans = INF;
    int flag;

    for(ll i=0;i<=n-k;i++){
        if(x[i] < 0  and  x[i+k-1] <= 0) flag = 0;
        else if (x[i] >= 0  and  x[i+k-1] > 0) flag = 1;
        else flag = 2;

        cur = 0;
        if(flag == 0) cur = abs(x[i]);
        if(flag == 1) cur = x[i+k-1];
        if(flag == 2) cur = x[i+k-1] - x[i] + min(abs(x[i]),x[i+k-1]);

        ans = min(ans,cur);
    }

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


Measured memory_bytes: 3968
from collections import Counter


def is_feasible(N, cntA):
    if N % 2 == 0:
        if len(cntA) != N // 2:
            return False

        for i in range(1, N, 2):
            if cntA[i] != 2:
                return False

        return True
    else:
        if len(cntA) != (N + 1) // 2:
            return False

        for i in range(0, (N + 1) // 2, 2):
            if i == 0:
                if cntA[i] != 1:
                    return False
            else:
                if cntA[i] != 2:
                    return False

        return True


MOD = 10 ** 9 + 7
N = int(input())
cntA = Counter(map(int, input().split()))

if is_feasible(N, cntA) is False:
    print(0)
else:
    if N % 2 == 0:
        ans = 1
        for i in range(N // 2):
            ans *= 2
            ans %= MOD
        print(ans % MOD)
    else:
        ans = 1
        for i in range(N // 2):
            ans *= 2
            ans %= MOD
        print(ans % MOD)


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

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

    int h, w;
    cin >> h >> w;
    int C[10][10], A[h][w];
    REP(i, 10) REP(j, 10) cin >> C[i][j];

    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            for(int k = 0; k < 10; k++){
                C[j][k] = min(C[j][k], C[j][i] + C[i][k]);
            }
        }
    }

    int cost = 0;
    REP(i, h){
        REP(j, w){
            int a;
            cin >> a;
            if(a == -1) continue;
            cost += C[a][1];
        }
    }

    cout << cost << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#define LL long long
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 20160116
#define pb push_back
#define mp make_pair
using namespace std;
//orz mqy
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}
int p[9];
bool adj[9][9];
int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	for (int i=0;i<m;i++){
		int a,b;
		scanf("%d %d",&a,&b);
		adj[a][b]=true;
		adj[b][a]=true;
	}
	for (int i=0;i<n;i++){
		p[i]=i+1;
	}
	int cnt=0;
	do{
		bool flag=true;
		for (int i=0;i<n-1;i++){
			if (!adj[p[i]][p[i+1]]){
				flag=false;
			}
		}
		if (flag) cnt++;
	}while (next_permutation(p+1,p+n));
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 256