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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

const ll dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const ll dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

inline bool inside(ll y, ll x, ll H, ll W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

ll h,w;
char G[405][405];
bool visited[405][405];
ll black=0, white=0;
void dfs(ll y, ll x){
  visited[y][x]=true;
  if(G[y][x]=='#') black++;
  else white++;
  
  rep(i,4){
    ll ny=y+dy[i];
    ll nx=x+dx[i];
    if(inside(ny,nx,h,w) && G[y][x]!=G[ny][nx] && !visited[ny][nx]){
      dfs(ny,nx);
    }
  }
}


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>h>>w;
  rep(i,h) rep(j,w) cin>>G[i][j];
  
  ll ans=0;
  rep(i,h){
    rep(j,w){
      if(G[i][j]=='.' || visited[i][j]) continue;
      black=white=0;
      dfs(i,j);
      ans+=black*white;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 10624
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
struct segtree{
  VI l,r,mn,tad;
  void ad(in a, in b, in v, in id){
    if(b<l[id] || a>r[id])
      return;
    if(a<=l[id] && b>=r[id]){
      mn[id]+=v;
      tad[id]+=v;
      return;
    }
    prop(id);
    ad(a,b,v,2*id);
    ad(a,b,v,2*id+1);
    pul(id);
  }
  void prop(in id){ 
    if(tad[id]!=0 && l[id]!=r[id]){
      ad(l[id],r[id],tad[id],2*id);
      ad(l[id],r[id],tad[id],2*id+1);
    }
    tad[id]=0;
  }
  void pul(in id){
    assert(l[id]!=r[id]);
    mn[id]=min(mn[2*id],mn[2*id+1]);
  }
  void qr(in a, in b, in& tt, in id){
    if(b<l[id] || a>r[id])
      return;
    if(a<=l[id] && b>=r[id]){
      tt=min(tt,mn[id]);
      return;
    }
    prop(id);
    pul(id);
    qr(a,b,tt,2*id);
    qr(a,b,tt,2*id+1);
  } 
  void build(in m){
    in rm=m;
    while(m&(m-1))
      ++m;
    l.clear();
    r.clear();
    tad.clear();
    mn.clear();
    l.resize(2*m);
    r.resize(2*m);
    tad.resize(2*m,0);
    mn.resize(2*m,0);
    forn(i,m){
      l[i+m]=r[i+m]=i;
    }
    for(in i=m-1;i>=1;--i){
      l[i]=l[2*i];
      r[i]=r[2*i+1];
    }
    for(in i=m;i<m+rm;++i)
      mn[i]=m+rm-i-1;
    for(in i=m-1;i>=1;--i){
      mn[i]=min(mn[2*i],mn[2*i+1]);
    }
  }
};
segtree st;
vector<pair<in,in> > tvls;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n,m;
  cin>>n>>m;
  st.build(m+1);
  in l,r;
  forn(z,n){
    cin>>l>>r;
    tvls.PB(MP(l,r-1));
  }
  sort(all(tvls));
  in mx=max(n-m,0LL);
  in q;
  forn(z,n){
    st.ad(0,tvls[z].second,-1,1);
    q=1e9;
    st.qr(0,m,q,1);
    mx=max(mx,-(tvls[z].first+q));
  }

  cout<<mx<<endl;
  return 0;
}


Measured memory_bytes: 22768
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#define ll long long
#define inf 6000000000000000000
#define norm 0
#define mod 1000000007
#define IO                    \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
using namespace std;
int main()
{
    IO
    string arr[2];
    cin>>arr[0];
    cin>>arr[1];
    if(arr[0][0]==arr[1][2]&&arr[0][1]==arr[1][1]&&arr[0][2]==arr[1][0])
    {
        cout<<"YES";
    }
    else cout<<"NO"<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
using ll = long long;
const ll MOD = 1e9 + 7;
const long long INF = 1LL << 60;

int main()
{
    string s, t;
    cin >> s >> t;
    cout << t << s << endl;
}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

int euclid(int a, int b)
{
    if (a < b)
        euclid(b, a);
    if (b == 0)
        return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int n;
    cin >> n;
    bool f = false;
    for (int i = 0; i < n; i++)
    {
        char c;
        cin >> c;
        if (c == 'Y')
            f = true;
    }

    if (f)
        cout << "Four" << endl;
    else
        cout << "Three" << endl;
}


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

 using namespace std;
 
 #define inf ((1<<31)-1)
 #define inf64 ((1<<63)-1)
 #define odd(x) (x&1)
 #define pow2(x) (1<<x)
 #define log2bin(x) (32-__builtin_clz(x)-1)
 #define popcnt(x) __builtin_popcount(x)
 #define m7(x) (x%1000000007)
 #define swapi(x,y) x^=y;y^=x;x^=y
 #define forinc(var,from,to) for(auto var=from,To=to;var!=To;var++) // bisa untuk iter jg
 #define fordec(var,from,to) for(auto var=from,To=to;var!=To;var--)
 #define fors(var,s) for(int var=0;s[var];var++)
 #define ll long long
 #define rational tuple<bool,long long,long long>
 #define point pair<long long,long long>
 #define mpr make_pair
 #define mtp make_tuple
 #define pb emplace_back

 #define _tab '\t'
 #define $ <<_tab<<

 #define cinarr(A,len) for(int i=0;i<len;i++){cin>>A[i];}
 #define coutarr(A,len) for(int i=0;i<len;i++){cout<<A[i]<<' ';}cout<<endl
 #define coutin(V) for(auto& i : V){cout << i << ' ';}cout<<endl // for vect and set
 #define coutmap(U) for(auto& i : U){cout << i.first << "->" << i.second << ", ";}cout<<endl // for map

 // DEBUG
 #define deb(x) cout << #x << '\t' << x << endl

 // ==== fast function ====
 /*
 #define sortsec(T1,T2) [](const pair<T1,T2> &a,const pair<T1,T2> &b){ return a.second<b.second;}
 #define sortsecgreater(T1,T2) [](const pair<T1,T2> &a,const pair<T1,T2> &b){ return a.second>b.second;}
 */

/*========================================================================*/
/* strategi/note:



/================================*/



bool solved=0;
void solve(){solved=1;
    string s;
    cin >> s;
    if(s[1]=='S'){
        if(s[0]=='R' or s[2]=='R'){
            cout << 1 << endl;return;
        }
        else{
            cout << 0 << endl;return;
        }
    }
    else{
        if(s[0]=='R' and s[2]=='R'){
            cout << 3 << endl;return;
        }
        else if(s[0]=='R' or s[2]=='R'){
            cout << 2 << endl;return;
        }
        else{
            cout << 1 << endl;return;
        }
    }

}

int main(){
     ios_base::sync_with_stdio(0);
     cin.tie(0);
     //cout<<fixed<<setprecision( ); // iomanip **

	solve();
//	int t;cin>>t;while(t--){solve();}

     if(!solved)cout<<"solve() function blm dipanggil!"<<endl;
	 //cout.flush(); cin.get();
     return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define _size(X) (int)((X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_Q = 100;
int Q;
ll A[MAX_Q], B[MAX_Q];

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

  cin >> Q;
  rep(i, Q) cin >> A[i] >> B[i];

  for (int q = 0; q < Q; ++q) {
      ll a = A[q], b = B[q];
      ll score = a*b;

      if (score == 1 || score == 2) {
          cout << 0 << endl;
          continue;
      }

      ll lb = 1, ub = 1e18, mid;
      while ((ub-lb)>1) {
          mid = (ub+lb)/2;
          ll t1 = (score-1)/mid;
          ll t2 = (score-1)/(mid+1);
          if (t1 > t2 && t2+1 >= mid) {
              lb = mid;
          } else {
              ub = mid;
          }
      }

      ll t1 = (score-1)/lb;
      ll t2 = (score-1)/(lb+1);
      if (lb == t2+1 && (t1-t2) == 1) {
          cout << 2*(lb-1) + 1 - ((a <= lb || b <= lb) ? 1 : 0) << endl;
      } else {
          cout << 2*lb - ((a <= lb || b <= lb) ? 1 :0) << endl;
      }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iterator>
using namespace std;

//https://beta.atcoder.jp/contests/arc083/tasks/arc083_b

#define RESIDUE(u,v) (capacity[u][v] - flow[u][v])
#define RCOST(u,v) (cost[u][v] + h[u] - h[v])
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

//vector<int> v[10001];
//vector<int> v_old[10001];

/*
int ans(int k,int w){
  int i,ind,s=0;
  vector<int>::iterator m;
  if(v[w].size() <= k){
    return accumulate(v[w].begin(),v[w].end(),0);
  }
  REP(i,k){
    m = max_element(v[w].begin(),v[w].end());
    s += *m;
    ind = distance(v[w].begin(),m);
    v[w].erase(v[w].begin()+ind);
  }
  return s;
}
*/

LL mind[300][300];
LL mind_dum[300][300];
LL d[300][300];
LL min_gd[300][300];

int main(){
  int n;
  cin>>n;
  int i,j,k;
  LL tmp;
  REP(i,n){
    REP(j,n){
      cin >> tmp;
      mind[i][j]=tmp;
      min_gd[i][j]= tmp;
      d[i][j]= (i==j)?0:-1;
    }
  }
  REP(i,n){
    REP(j,n){
      REP(k,n){
	min_gd[i][j] = min(min_gd[i][j],min_gd[i][k]+min_gd[k][j]);
      }
    }
  }
  int bl=0;
  REP(i,n){
    REP(j,n){
      if(i>=j || bl)
	continue;
      if(min_gd[i][j] < mind[i][j])
	bl=1;
      if(min_gd[i][j] > mind[i][j])
	d[i][j] = mind[i][j];
      else{
	REP(k,n){
	  if(k != i && k != j && mind[i][j] == mind[i][k] + mind[k][j])
	    break;
	  if(k==n-1)
	    d[i][j]=mind[i][j];
	}
      }
      d[j][i] = d[i][j];
    }
    if(bl)
      break;
  }
  /*
    REP(i,n){
    REP(j,n){
    cout << d[i][j] << " ";
    }
    cout<<endl;
    }
  */
  LL ret=0;
  if(!bl){
    REP(i,n){
      REP(j,n){
	ret += (i < j && d[i][j] >= 0)? d[i][j]:0;
      }
    }
  }
  cout << (bl?-1:ret) << endl;
  return 0;
}


Measured memory_bytes: 2304
import java.util.Map.Entry;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] A = new int[N];
		int M = 0;
		for(int i = 0; i < N; i++){
			A[i] = sc.nextInt();
			M = Math.max(M, A[i]);
		}
		
		int G = gcd(A);
		
		if(K <= M && K % G == 0)
			System.out.println("POSSIBLE");
		else
			System.out.println("IMPOSSIBLE");
	}
	
	public static int gcd(int a, int b){
		return b == 0 ? a : gcd(b, a % b);
	}
	
	public static int gcd(int[] list){
		if(list.length == 0) return -1;
		if(list.length == 1) return list[0];
		
		int result = list[0];
		for(int i = 1; i < list.length; i++){
			result = gcd(list[i], result);
		}
		return result;
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}


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

#define int ll

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

const int INF = 9E18, LMT = 1E9;
int n, cost[10];
map<int, int> dp;
set<int> vis;

int get_sol(int x) {
	if(x == 1)
		return cost[1];
	if(vis.count(x))
		return dp[x];
	vis.insert(x);
	dp[x] = INF;
	for(int d : {2, 3, 5}) {
		dp[x] = min(dp[x], get_sol(x/d) + (x % d) * cost[1] + cost[d]);
		if(x - x/d < LMT)
			dp[x] = min(dp[x], (x - x/d) * cost[1] + get_sol(x/d));
		dp[x] = min(dp[x], get_sol((x + d - 1)/d) + ((d - x % d) % d) * cost[1] + cost[d]);
		if(x - x/d < LMT)
			dp[x] = min(dp[x], (x - (x + d - 1)/d) * cost[1]  + get_sol((x + d - 1)/d));
	}
	return dp[x];
}

void solve() {
	dp.clear();
	vis.clear();
	cin >> n >> cost[2] >> cost[3] >> cost[5] >> cost[1];
	cout << get_sol(n) << '\n';
	// cout << dp[0] << '\n'/
}

int32_t main() {
	int t;
	cin >> t;
	while(t--)
		solve();
}


Measured memory_bytes: 5032
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
#include <set>
using namespace::std;

int main(){
	set<string> st;
	string s;
	cin >> s;
	int K;
	cin >> K;

	for(int i = 0; i < s.size(); i++){
		string temp="";
		for(int j = i; j < i+K; j++){
			if(j>=s.size()) break;
			temp += s[j];
			st.insert(temp);
		}
	}
	for(int i = 0; i < K-1; i++){
		st.erase(st.begin());
	}
	auto itr = st.begin();
	cout << *itr << endl;
	return 0;
}

Measured memory_bytes: 1664
#include <cstdio>

int x;

int main()
{
	scanf("%d",&x);
	if(x>=400&&x<=599)printf("8");
	if(x>=600&&x<=799)printf("7");
	if(x>=800&&x<=999)printf("6");
	if(x>=1000&&x<=1199)printf("5");
	if(x>=1200&&x<=1399)printf("4");
	if(x>=1400&&x<=1599)printf("3");
	if(x>=1600&&x<=1799)printf("2");
	if(x>=1800&&x<=1999)printf("1");
}

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

using namespace std;
typedef long long ll;
typedef long double ld;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))

int main(){
    FAST
    int n, k; cin >> n >> k;
    ld arr[n];
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        ld num = arr[i];
        arr[i] = arr[i]* (arr[i] + 1);
        arr[i] /= 2.0;
        arr[i] /= num;
    }
    ld sum = 0;
    for(int i = 0; i < k; i++){
        sum += arr[i];
    }
    ld ans = sum;
    int p1 = 0;
    for(int i = k; i < n; i++){
        sum -= arr[p1];
        sum += arr[i];
        ans = max(ans, sum);
        p1++;
    }
    cout << setprecision(10) << ans << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;

namespace
{
	struct Node {
		int parent;
		int dist;
		set<int> children;
	};
	vector<Node>tree;

	void dfs(Node& node, ll& ct, int K) {
		const int MAXINT = 1000000007;
		int nC = node.children.size();
		auto p = node.children.begin();
		int x = node.dist ==0 ? 1 : 2;
		for (int i = 0; i < nC; ++i, ++p)
		{
			ct *= K - x - i;
			ct %= MAXINT;
			dfs(tree[*p], ct, K);
		}

	};
}

void ABC133E()
{
	int N, K;
	cin >> N >> K;
	vector<set<int> > graph(N);
	for (int i = 0; i < N - 1; ++i)
	{
		int a, b;
		cin >> a >> b;
		graph[a - 1].insert(b - 1);
		graph[b - 1].insert(a - 1);
	}

	tree.resize(N);
	tree[0] = Node{ -1,0,graph[0] };
	queue<int> qu;
	qu.push(0);
	while (!qu.empty())
	{
		int i = qu.front(); qu.pop();
		for (auto& x : tree[i].children)
		{
			graph[x].erase(i);
			Node theNode{ i,tree[i].dist + 1, graph[x] };
			tree[x] = theNode;
			qu.push(x);
		}
	}

	ll ct = K;
	dfs(tree[0], ct, K);
	cout << ct << endl;
}
int main()
{
	ABC133E();
	return 0;
}

Measured memory_bytes: 29312
n = int(input())
# s = [None] * n
dic = {}
for i in range(n):
    s_tmp = input()
    try:
        dic[s_tmp] += 1
    except KeyError:
        dic[s_tmp] = 1

s = []
for k, v in dic.items():
    s.append((k, v))
s.sort(reverse=True, key=lambda x: x[1])
max_n = s[0][1]
ans = []
for i in range(len(s)):
    if (s[i][1] == max_n):
        ans.append(s[i][0])
    else:
        break

ans.sort()
for a in ans:
    print(a)


Measured memory_bytes: 113136
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
void Main()
{
    string n;
    ll K;
    cin >> n >> K;

    vector<ll> _D(K);
    rep(i, K) cin >> _D[i];

    vector<ll> use(10, 1);
    rep(i, K) use[_D[i]] = 0;
    
    ll minUse = 0;
    rep(i, 10) {
        if (use[i]) {
            minUse = i;
            break;
        }
    }

    for (ll i = atoi(n.c_str()); ; i++) {
        bool ok = true;
        ll t = i;
        while (t > 0) {
            if (use[t % 10] == 0) {
                ok = false;
                break;
            }
            t /= 10;
        }
        if (ok) {
            put(i);
            break;
        }
    }

    // ll p = 0;
    // reverse(all(n));
    // rep(_i, n.size()) {
    //     ll v = n[_i] - '0' + p;
    //     p = v / 10;
    //     v = v % 10;

    //     bool ok = false;
    //     for (int i = v; i <= 9; i++) {
    //         if (use[i]) {
    //             n[_i] = '0' + i;
    //             ok = true;
    //             break;
    //         }
    //     }

    //     if (!ok) {
    //         n[_i] = minUse + '0';
    //         p += 1;
    //     }
    // }

    // if (p >= 1) {
    //     for (int i = p; i <= 9; i++) {
    //         if (use[i]) {
    //             n.push_back('0' + i);
    //             break;
    //         }
    //     }
    // }

    // reverse(all(n));
    // put(n);

}
signed main(){ Main();return 0;}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

bool dp[2][16161];
string s; 

bool solve(int g, int mod, vector<int> a) {
	
	rep(i,2) rep(j,16161) dp[i][j]=false;

	dp[0][8000]=true;
	
	int i=0;
    
	if (!mod) {
		rep(j,16161) {
			if (!dp[0][j]) continue;
			dp[0][j]=false;
			dp[1][j+a[0]]=true;
			// cout << "i = "<<i<<", j+a[i] = "<<j+a[0] << endl;
		}
	}

	for (; i < a.size(); ++i) {
		rep(j,16161) {
			if (!dp[i%2][j]) continue;
			dp[i%2][j]=false;
			dp[(i+1)%2][j+a[i]]=true;
			dp[(i+1)%2][j-a[i]]=true;
			// cout<< "i = "<<i%2<<", j+a[i] = "<<j+a[i]<<", j-a[i] = "<<j-a[i]<< endl;
		}
	}

	if (dp[a.size()%2][g+8000]) return true;
	else return false;
}

int main(int argc, char const *argv[]) {
	int x,y;
	cin>>s>>x>>y;
	int n = s.length();
	vector<int> a;
	vector<int> X,Y;

	// ランレングス変換をします
	int cnt=0;
	rep(i,n) {
		if (s[i]=='F') cnt++;
		else {
			a.push_back(cnt);
			cnt=0;
		}
	}
	if (cnt) a.push_back(cnt);

	rep(i,a.size()) {
		if (i%2==0) X.push_back(a[i]);
		else Y.push_back(a[i]);
	}

	if (solve(x,0,X)&&solve(y,1,Y)) cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

int gcd(int a, int b){
	return (b > 0)? gcd(b, a % b) : a ;
}

int main(void) {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) {
        cin >> A.at(i);
    }
    vector<int> before(N);
    vector<int> after(N);
    before.at(0) = A.at(0);
    for(int i=1; i<N; i++) {
        before.at(i) = gcd(A.at(i), before.at(i-1));
    }
    after.at(N-1) = A.at(N-1);
    for(int i = N-2; i>=0; i--) {
        after.at(i) = gcd(A.at(i), after.at(i+1));
    }
    int ans = max(before.at(N-2), after.at(1));
    for(int i=1; i<N-1; i++) {
        ans = max(ans, gcd(before.at(i-1), after.at(i+1)));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <climits>

const int MAX_H = 251;

int main(){
  int H = 0;
  int tree[MAX_H] = {0};

  std::cin >> H;

  for (int i = 1; i <= H; i++) {
    std::cin >> tree[i];
  }

  for (int i = 1; i <= H; i++) {
    std::cout << "node " << i << ": key = "<< tree[i] << ", ";

    if (i != 1){
      std::cout << "parent key = " << tree[i / 2] << ", ";
    } 
    if ((2 * i) <= H) {
      std::cout << "left key = " << tree[2 * i] << ", ";
    }
    if ((2 * i + 1) <= H) {
      std::cout << "right key = " << tree[2 * i + 1] << ", ";
    }

    std::cout << std::endl;
     
  }
  
  return 0;
}

Measured memory_bytes: 1164
import numpy as np
N, T = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]


def knapsack(ab):
    dp = np.zeros(T, dtype=np.int64)
    res = [dp]
    for a, b in ab:
        newDP = res[-1].copy()
        newDP[a:] = np.maximum(newDP[a:], newDP[:-a] + b)
        res.append(newDP)
    return res


dp1 = knapsack(AB)
dp2 = knapsack(AB[::-1])
dp2 = dp2[::-1]

ans = 0

for i in range(N):
    _, b = AB[i]
    l = dp1[i]
    r = dp2[i + 1][::-1]
    tmp = (l + r).max() + b
    ans = max(ans, tmp)
print(ans)


Measured memory_bytes: 154212
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	while(cin >> n , n){
		double g[n][n];
		for(int i = 0; i < n; i++)
			for(int j = 0; j < n; j++)
				g[i][j] = 100000000;
		int b, x[n] , y[n];
		for(int i = 0; i < n; i++){
			cin >> b;
			b--;
			cin >> x[b] >> y[b];
		}
		for(int i = 0; i < n; i++)
			for(int j = 0; j < n; j++){
				int xx = x[i] - x[j],
					   yy = y[i] - y[j];
				if(sqrt(xx * xx + yy * yy) <= 50 && i != j)
					g[i][j] = g[j][i] = sqrt(xx * xx + yy * yy);
			}
		int m;
		cin >> m;
		int s , go;
		for(int i = 0; i < m; i++){
			cin >> s >> go;
			s--; go--;
			vector <int> used(n,false);
			vector <int> gone(n,false);
			vector <double> dist(n,100000000);
			dist[s] = 0;
			gone[s] = 0;
			while(1){
				int va = -1;
				for(int j = 0; j < n; j++)
					if(used[j] == false && (va == -1 || dist[va] > dist[j]))
						va = j;
				if(va == -1)
					break;
				used[va] = true;
				for(int j = 0; j < n; j++){
					if(dist[j] >= dist[va] + g[va][j])
						gone[j] = va;
					dist[j] = min(dist[j] , dist[va] + g[va][j]);
				}
			}
			if(s == go)
				cout << s + 1 << " " << go + 1 << endl;
			else if(dist[go] == 100000000)
				cout << "NA" << endl;
			else{
				int kari = go;
				stack <int> out;
				while(1){
					out.push(gone[kari] + 1);
					kari = gone[kari];
					if(kari == s)
						break;
				}
				while(!out.empty()){
					cout << out.top() << " ";
					out.pop();
				}
				cout << go + 1 << endl;
			}
		}
	}
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
void wf(vector<vector<int> > &dist,int n)
{
    for(int k = 0;k < n;k++)
    {
        for(int i = 0;i < n;i++)
        {
            for(int j = 0;j < n;j++)
            {
                dist[i][j] = min(dist[i][j],dist[i][k] + dist[k][j]);
            }
        }
    }
}
int main()
{
    int n,m;
    cin >> n >> m;
    vector<vector<int> > dist(n,vector<int>(n,20000));
    vector<tuple<int,int,int> > v;
    for(int i = 0;i < n;i++)
    {
        dist[i][i] = 0;
    }
    for(int i = 0;i < m;i++)
    {
        int a,b,c;
        cin >> a >> b >> c;
        v.push_back(make_tuple(a - 1,b - 1,c));
        dist[a - 1][b - 1] = c;
        dist[b - 1][a - 1] = c;
    }
    wf(dist,n);
    /*cout << "\n";
    for(int i = 0;i < n;i++)
    {
        for(int j = 0;j < n;j++)
        {
            cout << dist[i][j] << " ";
        }
        cout << "\n";
    }*/
    int ans = m;
    for(int i = 0;i < v.size();i++)
    {
        for(int j = 0;j < n;j++)
        {
            if(dist[j][get<1>(v[i])] == (dist[j][get<0>(v[i])] + get<2>(v[i])))
            {
                ans--;
                break;
            }
        }
    }
    cout << ans;

    return 0;
}

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

int main(){
  int n;
  cin >> n;
  int m = n;
  int h = 0;
  while (m > 0){
    h += m % 10;
    m /= 10;
  }
  if (n % h == 0) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
 
#include <stdio.h>
#include <bits/stdc++.h>
 
using namespace std;
 
#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  
#define pb push_back
#define mp make_pair
#define in insert
#define f first
#define s second
#define ll long long
#define dd double
  
const int mod = 1e9 + 7;
const int N = 2e5 + 7;
const int inf = 2e9;
const ll INF = 1e18;

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	// freopen("*.in", "r", stdin);freopen("*.out", "w", stdout);
	int x, y, z;
	cin >> x >> y >> z;
	cout << z << " " << x << " " << y;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"os"
	"strconv"
	"bufio"
	"strings"
)

// define
var (
	sc = bufio.NewScanner(os.Stdin)
)

func scanIntLine(len int) []int{
	arr := make([]int, len)
	for i:=0; i<len; i++{
		sc.Scan()
		tmp, err := strconv.Atoi(sc.Text())
		if err == nil{
			arr[i] = tmp
		}
	}
	return arr
}

func scanStringLine(len int) []string{
	arr := make([]string, len)
	for i:=0; i<len; i++{
		sc.Scan()
		arr[i] = sc.Text()
	}
	return arr
}

func scanIntSplit(len int) []int{
	arr := make([]int, len)
	sc.Scan()
	for i, v := range strings.Split(sc.Text(), " "){
		tmp, err := strconv.Atoi(v)
		if err == nil{
			arr[i] = tmp
		}
	}
	return arr
}

func main(){
	var n int
	m := make(map[string]int, 0)
	fmt.Scan(&n)
	for i:=0; i<n; i++{
		sc.Scan()
		m[sc.Text()] = 1
	}
	fmt.Println(len(m))
}

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl

using namespace std;
using i64 = long long;

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

    int c = 0;
    while (h > 0)
    {
        h -= a;
        c++;
    }

    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256
#define NDEBUG

#include <unordered_map>
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <utility>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <tuple>
#include <set>
#include <map>

// [0, max)
#define FOR0(var, max) for (sl (var) = 0; (var) < (max); ++(var))
// [min, max)
#define FORi(var, min, max) for (sl (var) = (min); (var) < (max); ++(var))
// [min, max)
#define FORi_INV(var, min, max) for (sl (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

// a < b < c
#define LTLT(a, b, c) (((a) < (b)) && ((b) < (c)))
// a <= b < c
#define LELT(a, b, c) (((a) <= (b)) && ((b) < (c)))
// a < b <= c
#define LTLE(a, b, c) (((a) < (b)) && ((b) <= (c)))
// a <= b <= c
#define LELE(a, b, c) (((a) <= (b)) && ((b) <= (c)))

#ifndef NDEBUG
#  define MASSERT(cond) m_assert(cond, __LINE__, #cond);
#else
#  define MASSERT(...)
#endif

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

using sc = signed char;
using si = signed int;
using sl = signed long long int;

using ld = long double;

void m_assert(const bool& cond, const sl& line, const char *condstr) {
  if (!cond) {
    cerr << "Assertion Failed: " << condstr << " at line " << line << endl;
    exit(1);
  }
}

static sl N, K;
static vector<sl> Hi;

void solve(void) {
  if (N <= K) {
    cout << 0 << endl;
  } else {
    sort(Hi.rbegin(), Hi.rend());
    cout << accumulate(next(Hi.begin(), K), Hi.end(), 0LL) << endl;
  }
}

int main(void) {
  cin >> N >> K;
  Hi.resize(N, 0);
  FOR0(i, N) {
    cin >> Hi[i];
  }
  solve();
  return 0;
}



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


int main() {


    int64_t n;
    cin>>n;

    int64_t sum_min=100000000;
    for(int64_t a=1;a<n;a++){
      int64_t b=n-a;

      string swk1 = to_string(a);
      string swk2 = to_string(b);
      int64_t sum_wk=0;
      for(int64_t i=0;i<swk1.size();i++){
        sum_wk += swk1.at(i)-'0';
      }

      for(int64_t i=0;i<swk2.size();i++){
        sum_wk += swk2.at(i)-'0';
      }

      sum_min=min(sum_min,sum_wk);
    }

    cout<<sum_min<<endl;

	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N = 200000 + 10;
int n;
LL a[N], b[N];
LL x[N], y[N];
LL add[N];
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i ++) {
        scanf("%lld", &a[i]);
    }
    for (int i = 1; i <= n; i ++) {
        scanf("%lld", &b[i]);
    }

    LL ans = 0;
    for (int bit = 0; bit < 29; bit ++) {
        for (int i = 1; i <= n; i ++) {
            x[i] = a[i] & ( (1 << (bit+1)) - 1 );
            y[i] = b[i] & ( (1 << (bit+1)) - 1 );
        }
        sort(x+1, x+1+n);
        sort(y+1, y+1+n);
        for (int i = 1; i <= n; i ++) {
            int pos = lower_bound(y+1, y+1+n, (1<<(bit+1))-x[i]) - y - 1;
            pos = n - pos;
            add[bit+1] += pos;
        }
    }


    for (int bit = 0; bit < 29; bit ++) {
        LL cnt1 = 0, cnt2 = 0;
        for (int i = 1; i <= n; i ++) {
            if ((a[i] >> bit) & 1) cnt1 ++;
            if ((b[i] >> bit) & 1) cnt2 ++;
        }
        LL cnt = cnt1 * (n - cnt2) + cnt2 * (n - cnt1) + add[bit];
        if (cnt % 2) ans += (1 << bit);
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a, b;
    cin >> a >> b;

    if((a+b) % 2 == 0){
        cout << (a+b) / 2 << endl;
    }else{
        cout << (a+b) / 2 + 1 << endl;
    }
}

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

int main(){
  string c;
  cin >> c;
  if(c == "a" or c == "i" or c == "u" or c == "e" or c == "o"){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    string s;
    cin >> s;
    rep(i, 12) {
        cout << s[i];
        if (i == 3) cout << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n){
    Int res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
    return a * b / gcd(a, b);
}
// a x + b y = gcd(a, b)
Int extgcd(Int a, Int b, Int &x, Int &y) {
    Int g = a; x = 1; y = 0;
    if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
    return g;
}




int main(){
    string S;
    cin >> S;
    int ans = 700;
    for (int i = 0; i < 3; i++){
        if (S[i] == 'o') ans += 100;
    }
    cout << ans << endl;
    return 0;
} 


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

int main()
{
	set <ll> x;
	ll n;
	cin >> n;
	for(ll i=0;i<n;i++)
	{
		ll a;
		cin >> a;
		x.insert(a);
	}
	if(x.size()==n)
		cout << "YES";
	else
		cout << "NO";
}

Measured memory_bytes: 9600
N = int(input())
blocks = [input().rstrip() for x in range(2)]

MOD = 1000000007
result = 0
count = 0
prev = False
while count <= N-1:
  if count == 0:
    if blocks[0][count] == blocks[1][count]:
      result = 3
      prev = True
    else:
      result = 6
      count += 1
  else:
    if prev:
      result = (result*2) % MOD
      # a bb
      # a cc 
      if blocks[0][count] != blocks[1][count]:
        prev = False
        count += 1
    else:
      if blocks[0][count] == blocks[1][count]:
        prev = True
      else:
        result = (result*3) % MOD
        count += 1
  count += 1
print(result)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
int main(){
    string s,t;
    cin >> s >> t;
    reverse(s.begin(),s.end());
    reverse(t.begin(),t.end());
    int lens=s.size();
    int lent=t.size();
    if(lent > lens){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    string k=s;
    vector<string> ans;
    int cnt=0;
    rep(i,lens-lent+1){
        bool flag = true;
        rep(j,lent){
            if(!(s[i+j]=='?' || s[i+j]==t[j])){
                flag=false;
                break;
            }
        }
        if(flag){
            cnt++;
            k=s;
            rep(j,lent){
                k[i+j]=t[j];
            }    
            rep(i,lens){
                if(k[i]=='?'){
                    k[i]='a';
                }
            }
            reverse(k.begin(),k.end());
            ans.push_back(k);
        }
    }
    sort(ans.begin(),ans.end());
   
    if(!cnt){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    cout << ans[0] << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <boost/math/common_factor_rt.hpp>
using namespace std;
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ll long long

int main(){
  string n;
  cin >> n;
  rep(i, 3){
    if(n[i]=='1')  n[i] = '9';
    else n[i] = '1';
  }
  
  cout << n << endl;
    
}

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

using namespace std;

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

        map<long long int, long long int> m;
        long long int a, ans = 0;
        for (int i = 0; i < n; ++i) {
                cin >> a;
                m[a]++;
        }

        for (auto& p : m) {
                if (p.first > p.second) {
                        ans += p.second;
                } else if (p.first < p.second) {
                        ans += p.second - p.first;
                }
        }

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

Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, ac = 0, wa = 0, tle = 0, re = 0;
    cin >> n;
    
    string str;
    for(int i = 0;i < n;i++){
        cin >> str;
        if(str == "AC"){
            ac++;
        }
        if(str == "WA"){
            wa++;
        }
        if(str == "TLE"){
            tle++;
        }
        if(str == "RE"){
            re++;
        }
    }
    
    cout << "AC x " << ac << "\n" << "WA x " << wa << "\n" << "TLE x " << tle << "\n" << "RE x " << re << "\n";
    
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
    using namespace std;
    #define int long long int
    #define pb push_back
    #define vi vector<int>
    #define loop(i,a,b) for(int i=a;i<b;i++)
    int32_t main()
    {
       
        #ifndef ONLINE_JUDGE
  freopen("input.txt" , "r" , stdin);
  freopen("output.txt" , "w" , stdout);
  #endif
           int n;
           cin>>n;
           int l=1,r=26,cnt=1;
           while(1)
           {
           		if(n>=l && n<=r)
           			break;
           		else
           			cnt++ , l=r+1 , r=l*26;
           }
          // cout<<cnt<<endl;
           char arr[26]={'z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y'};
           int ans=0;
           string s;
        //   cout<<l<<" "<<r<<endl;
           while(n>0)
           {
           		ans=n%26;
           		s=arr[ans] + s;
           		n=n/26;
           		if(ans==0)
           			n--;
           }
           
           cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll imos[555555];
map<ll,ll>zip;
ll unzip[555555];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  vector<pair<ll,ll>>pll(n);
  set<ll>se;
  for(int i=0;i<n;i++){
    cin>>pll[i].F>>pll[i].S;
    se.insert(pll[i].F);
    se.insert(pll[i].S);
  }
  ll cnt=0;
  for(auto a:se){
    zip[a]=cnt;
    unzip[cnt]=a;
    cnt++;
  }
  for(int i=0;i<n;i++){
    ll a=zip[pll[i].F],b=zip[pll[i].S];
    imos[a]++;
    imos[b+1]--;
  }
  ll ma=0;
  for(int i=0;i<555554;i++){
    imos[i+1]+=imos[i];
    ma=max({ma,imos[i],imos[i+1]});
  }
  if(ma%2){
    for(int i=cnt-1;i>=0;i--){
      if(ma==imos[i]){
	cout<<(ma-1)*m+unzip[i]<<endl;
	return 0;
      }
    }
  }else{
    for(int i=0;i<cnt;i++){
      if(ma==imos[i]){
	cout<<ma*m-unzip[i]<<endl;
	return 0;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 57332
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int ans = 0;

		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			if (Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= d) {
				ans++;
			}
		}

		System.out.println(ans);

		sc.close();
	}

}


Measured memory_bytes: 59324
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vector<string> W(N);
  bool ans = true;
  rep(i,N)
  {
    cin >> W[i];
  }
  rep(i,N-1)
  {
    int M = W[i].size();
    if(W[i].back()!=W[i+1].front())
    {
      ans = false;
    }
    for(int j=i+1;j<N;j++)
    {
      if(W[i]==W[j])
      {
        ans = false;
      }
    }
  }
  if(ans == true)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
def get_answer(n, a):
    n = int(n)
    a = [int(v) for v in a.split(" ")]
    aa = [1/v for v in a]

    return 1 / sum(aa)


if __name__ == "__main__":
    input1 = input()
    input2 = input()
    print(get_answer(input1, input2))

Measured memory_bytes: 2940
#include <stdio.h>

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


Measured memory_bytes: 2032
/*==============================================*\
ID:          shahidul_brur
 
Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh
 
 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
 
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = (int)1e9+7;
const int maxn = 300005;
const int logn = 20;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
//    cin>>t; 
    while(t--)
    {
        int n; cin>>n;
        int d = (n+999)/1000;
        cout << d*1000 - n << "\n";
    }
    return 0;
}


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

int main(){
  string S; cin >> S;
  int ans = 700;
  if(S.at(0) == 'o') ans += 100;
  if(S.at(1) == 'o') ans += 100;
  if(S.at(2) == 'o') ans += 100;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

const int maxn = 1e5 + 10;

int n, m, lst;
int a[maxn], q[maxn];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", a + i);
	}
	if(n == 1) {
		puts((a[0] & 1) ? "Second" : "First");
		return 0;
	}
	std::sort(a, a + n);
	lst = a[0];
	q[m++] = (lst & 1) - n - 1;
	for (int i = 1; i < n; ++i) {
		if(a[i] == lst) {
			--lst;
		}
		else {
			if(~a[i] - lst & 1) {
				q[m++] = lst + i - n + 1;
			}
			lst = a[i];
		}
	}
	q[m] = q[m - 1] + 1048577;
	for (int i = 0; i < m; ++i) {
		if(q[i] <= 0 && 0 < q[i + 1] && (q[i + 1] & 1)) {
			puts("First");
			return 0;
		}
	}
	puts("Second");
	return 0;
}

Measured memory_bytes: 640
N, M= gets.chomp.split.map(&:to_i)
arr = readlines.map(&:chomp).map{|row| row.split(' ').map(&:to_i)}

l_max = 0
r_min = N
for row in arr do
    l_max = row[0] if row[0] > l_max
    r_min = row[1] if row[1] < r_min
end
p r_min >= l_max ? r_min - l_max + 1 : 0

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9


int main(){ 
  string S;
  cin >> S;
  int N = S.size(), cnt = 0;
  REP(i, N/2){
    if(S[i] != S[N-i-1]){
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 256