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

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;

vector<ll> G[212345];

int main() {
  ll N, Q;
  cin >> N >> Q;

  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  vector<int> S(N + 5, 0);
  vector<int> visited(N + 5, 0);

  for (int i = 0; i < Q; i++) {
    int p, x;
    cin >> p >> x;
    S[p] += x;
  }

  queue<int> q;
  q.push(1);
  while(!q.empty()) {
    int temp = q.front();
    q.pop();
    visited[temp] = 1;
    for (int i = 0; i < G[temp].size(); i++) {
      int index = G[temp][i];
      if (visited[index] == 0) {
        S[index] += S[temp];
        q.push(index);
      }
    }
  }

  cout << S[1];
  for (int i = 2; i <= N; i++) {
    cout << SP << S[i];
  }
  cout << BR;

  return 0;
}


Measured memory_bytes: 17392
#include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<intt>
#define ii pair<int,int>
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI           3.14159265358979323846 
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
int mod = 1000000007;
intt gcd(intt a, intt b) {return b ? gcd(b, a % b) : a;}
int lcm(int a, int b) {return a * b / gcd(a, b); }
intt bpow(intt a,intt b) 
{
  intt res = 1;
  while (b > 0) {
    if (b & 1)res = res * a;
      a = a * a;
      b >>= 1;
  }
  return res;
}
intt fact(intt n) { 
   if ((n==0)||(n==1))
      return 1; 
   else
      return (n*fact(n-1))%mod;
}

void go()
{
#ifndef ONLINE_JUDGE
  freopen("IN.txt","r",stdin);
  freopen("OUT.txt","w",stdout);
  #endif
}

int main(){
	go();
	fast_io
  int n;cin>>n;
  intt ans=0;
  ans+=((n-2)*2+1);
  for(int i=2;i*i<=n;i++){
    int temp=n/i;
    if(temp<=i-1)
       break;
    if(n%i==0)
      temp--;
    temp-=(i-1);
    if(temp<=0)
      continue;
    if(i*i <= n)
    ans+=((temp-1)*2);
    else
      ans+=(temp*2);

    if(i*i!=n)
      ans++;
  }
  cout << ans <<"\n";
}





































Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   for(int i=0;i<(n);++i)
#define SORT(c)    sort((c).begin(),(c).end())
#define CLR(a)     memset((&a), 0 ,sizeof(a))//clear memory
#define dump(x)    cerr << #x << " = " << (x) << endl;//debug
#define debug(x)   cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define EPS        1e-10//sample:if((double)>=(double)+EPS)
//cin,cout release
//std::cin.tie(0);
//ios::sync_with_stdio(false);

using namespace std;

struct node {
  int key,priority;
  node *parent,*right, *left;
};
typedef node* nodep;
nodep root,NIL;

nodep rightRotate(nodep t){
  nodep s=t->left;
  t->left=s->right;
  s->right=t;
  return s;
}
nodep leftrotate(nodep t){
  nodep s=t->right;
  t->right=s->left;
  s->left=t;
  return s;
}
nodep insert(nodep t,int key,int priority){
  if(t==NIL){
    nodep n=(nodep)malloc(sizeof(node));
    n->key=key;
    n->priority=priority;
    n->left=NIL;
    n->right=NIL;
    return n;
  }
  if(key==t->key)return t;
  if(key<t->key){
    t->left=insert(t->left,key,priority);
    if(t->priority<t->left->priority)t=rightRotate(t);
  }
  else{
    t->right=insert(t->right,key,priority);
    if(t->priority<t->right->priority)t=leftrotate(t);
  }
  return t;
}
nodep _delete(nodep,int);
nodep deletetree(nodep t,int key){
  if(t==NIL)return NIL;
  if(key<t->key) t->left=deletetree(t->left,key);
  else if(key>t->key)t->right=deletetree(t->right,key);
  else return _delete(t,key);
  return t;
}
nodep _delete(nodep t,int key){
  if(t->left==NIL&&t->right==NIL)return NIL;
  else if(t->left==NIL)t=leftrotate(t);
  else if(t->right==NIL)t=rightRotate(t);
  else{
    if(t->left->priority>t->right->priority)t=rightRotate(t);
    else t=leftrotate(t);
  }
  return deletetree(t,key);
}
nodep find(nodep d,int key){
  while(d!=NIL&&d->key!=key){
    if(key<d->key)d=d->left;
    else d=d->right;
  }
  return d;
}
void inorder(nodep u){
  if(u==NIL)return;
  inorder(u->left);
  cout<<" "<<u->key;
  inorder(u->right);
}
void preorder(nodep u){
  if(u==NIL)return;
  cout<<" "<<u->key;
  preorder(u->left);
  preorder(u->right);
}
int main(){
  string buf;
  int a,n,b;
  cin>>n;
  rep(i,n){
    cin>>buf;
    if(buf[0]=='i'){
      cin>>a>>b;
      root=insert(root,a,b);
    }
    else if(buf[0]=='f'){
      cin>>a;
      if(find(root,a)==NIL)cout<<"no"<<endl;
      else cout<<"yes"<<endl;
    }
    else if(buf[0]=='d'){
      cin>>a;
      root=deletetree(root,a);
    }
    else{
      inorder(root);
      cout<<endl;
      preorder(root);
      cout<<endl;
    }
  }



  return 0;
}


Measured memory_bytes: 12536
#include <iostream>
#include <set>
using namespace std;
#define rall(p) p.rbegin(),p.rend()
string train;
set<string> s;
void solve(){
	s.clear();
	s.insert(train);
	for(int i=1;i<train.size();i++){
		string s1=train.substr(0,i);
		string s2=train.substr(i);
		string s1r=string(rall(s1));
		string s2r=string(rall(s2));
		s.insert(s1+s2r);
		s.insert(s2r+s1);
		s.insert(s1r+s2r);
		s.insert(s2+s1);
		s.insert(s2+s1r);
		s.insert(s1r+s2);
		s.insert(s2r+s1r);
	}
	cout<<s.size()<<endl;
}
int main(){
	int m;
	cin>>m;
	for(;m>0;m--){
		cin>>train;
		solve();
	}
	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60


struct edge{
    ll u;
    ll v;
    ll cost;
    edge(){}
    edge(ll u,ll v, ll cost):u(u),v(v),cost(cost){}
};

void dijkstra(ll root,ll n,vector<vector<edge>>&T ,vector<ll>& dist){
    queue<ll> q;
    q.push(root);
    dist[root] = 0;
    while(!q.empty()){
        ll next = q.front(); q.pop();
        for(auto e:T[next]){
            if(dist[e.v] > dist[e.u] + e.cost){
                dist[e.v] = dist[e.u] + e.cost;
                q.push(e.v);
            }
        }
    }
}

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<vector<edge>> T(n);
    for(int i = 0; i < n - 1;i++){
        ll s,t, w; cin >> s >> t >> w;
        T[s].emplace_back(edge(s,t,w));
        T[t].emplace_back(edge(t,s,w));
    }
    
    
    ll root = 0;
    ll v1,v2;
    vector<ll> dist1(n,INF);
    dijkstra(root, n, T, dist1);
    v1 = max_element(dist1.begin(), dist1.end()) - dist1.begin();

    vector<ll> dist2(n,INF);
    dijkstra(v1, n, T, dist2);
    v2 = max_element(dist2.begin(), dist2.end()) - dist2.begin();
    
    vector<ll> dist3(n,INF);
    dijkstra(v2, n, T, dist3);
    
    for(int i = 0; i < n;i++){
        cout << max(dist2[i],dist3[i]) << endl;
    }
    return 0;
}

Measured memory_bytes: 4336
import itertools
import numpy as np

n,d = map(int, input().split())
x = np.asarray([list(map(int, input().split())) for i in range(n)])
c = 0
for v in itertools.combinations(x, 2):
  if np.linalg.norm(v[0] - v[1]).is_integer():
    c += 1
print(c)

Measured memory_bytes: 12508
#include<bits/stdc++.h>
using namespace std;
using Graph = vector< vector<int> >;

vector<int> friend_group(100000, -1);
vector<bool> is_reached;
int group_num = 0;

void dfs(Graph& g, int n, int s) {
    is_reached[n] = true;
    friend_group[n] = group_num;
    for(auto next : g[n]) {
        if(is_reached[next]) continue;
        dfs(g, next, s);
    }
}

int main() {
    int n, m, k;
    cin >> n >> m >> k;

    Graph g(n);
    vector< pair<int, int> > exclude_list(m + k);
    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
        exclude_list[i].first = a;
        exclude_list[i].second = b;
    }
    for(int i = 0; i < k; i++) {
        int c, d;
        cin >> c >> d;
        c--; d--;
        exclude_list[m + i].first = c;
        exclude_list[m + i].second = d;
    }
    sort(exclude_list.begin(), exclude_list.end());

    for(int i = 0; i < n; i++) {
        if(friend_group[i] >= 0) continue;
        is_reached.assign(n, false);
        dfs(g, i, i);
        group_num++;
    }

    vector<int> group_member_num(group_num + 1, 0);
    for(int i = 0; i < n; i++) {
        group_member_num[friend_group[i]]++;
    }

    vector<int> ans(n);
    for(int i = 0; i < n; i++) {
        ans[i] = group_member_num[friend_group[i]];
    }

    for(int i = 0; i < m + k; i++) {
        int p1 = exclude_list[i].first;
        int p2 = exclude_list[i].second;
        if(friend_group[p1] == friend_group[p2]) {
            ans[p1]--;
            ans[p2]--;
        }
    }

    for(int i = 0; i < n; i++) {
        cout << --ans[i] << " ";
    }
    cout << endl;

    return 0;
}

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

typedef long long ll;
#define pii pair<ll , ll>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 2005

ll max(ll a , ll b){
    if(a > b)   return a;
    return b;
}

ll n;
ll a[MAXX];
ll cnt[MAXX];
ll dp[MAXX][MAXX];

int main()
{
    _FastIO;
    cin >> n;
    for(ll i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a , a + n);
    for(ll i = 0; i < n; i++){
        for(ll j = a[i]; j < MAXX - 2; j++){
            cnt[j]++;
        }
    }
    for(ll i = 1; i < MAXX - 2; i++){
        for(ll j = i; j < MAXX - 2; j++){
            dp[i][j] = cnt[j] - cnt[i - 1];
        }
    }
    ll ans = 0;
    for(ll i = 0; i < n - 1; i++){
        for(ll j = i + 1 ; j < n; j++){
            ll l = a[j] - a[i] + 1;
            ll r = a[i] + a[j] - 1;
            if(a[i] >= l && a[i] <= r) ans--;
            if(a[j] >= l && a[j] <= r) ans--;
            ans += dp[l][r];

        }
    }
    cout << max(0 , ans / 3) << endl;
    return 0;
}


Measured memory_bytes: 31232
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

struct Mo {
    vector<int> left, right, order;
    vector<bool> v;
    int width;
    int nl, nr, ptr;

    Mo(int n) : width((int)sqrt(n)), nl(0), nr(0), ptr(0), v(n,false) {}

    // [l,r)
    void insert(int l, int r) {
        left.push_back(l);
        right.push_back(r);
    }

    void build() {
        order.resize(left.size());
        iota(begin(order),end(order),0);
        sort(begin(order),end(order),[&](int a, int b) {
            if (left[a]/width != left[b]/width) return left[a] < left[b];
            return bool((right[a] < right[b]) ^ (left[a] / width % 2));
        });
    }

    int process() {
        if (ptr == order.size()) return -1;
        const auto id = order[ptr];
        while (nl > left[id]) distribute(--nl);
        while (nr < right[id]) distribute(nr++);
        while (nl < left[id]) distribute(nl++);
        while (nr > right[id]) distribute(--nr);
        return order[ptr++];
    }

    inline void distribute(int idx) {
        v[idx].flip();
        if (v[idx]) add(idx);
        else del(idx);
    }

    void add(int idx);
    void del(int idx);
};

int n, q;
int a[500000];
int ans[500000];
int cnt[500001], sum;

void Mo::add(int idx) {
    if (cnt[a[idx]]++ == 0) sum++;
}

void Mo::del(int idx) {
    if (--cnt[a[idx]] == 0) sum--;
}

int main() {
    scanf("%d %d",&n,&q);
    rep(i,n) scanf("%d",&a[i]);
    Mo mo(n);
    rep(i,q) {
        int x, y;
        scanf("%d %d",&x,&y);
        mo.insert(--x,y);
    }
    mo.build();
    rep(i,q) {
        int idx = mo.process();
        ans[idx] = sum;
    }
    rep(i,q) printf("%d\n",ans[i]);
}

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

using namespace std;

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

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int n, k, S;
  scanf("%d%d%d", &n, &k, &S);
  vector<int> a(n);
  for (int i = 0; i < k; ++i) a[i] = S;
  if (S == 1000000000) {
    for (int i = k; i < n; ++i) a[i] = S - 1;
  } else {
    for (int i = k; i < n; ++i) a[i] = S + 1;
  }
  for (int i = 0; i < n; ++i) {
    printf("%d%c", a[i], " \n"[i + 1 == n]);
  }

  return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
struct UnionFind{
  vector<int> par,size;
  UnionFind(int N):par(N),size(N){
    for(int i=0;i<N;i++)par[i]=i,size[i]=1;
  }
  int root(int x){
    if(par[x]==x)return x;
    return par[x]=root(par[x]);
  }
  void unite(int x,int y){
    int rx=root(x),ry=root(y);
    if(rx==ry)return;par[rx]=ry;
    size[ry]+=size[rx];
  }
  bool same(int x,int y){
    int rx=root(x),ry=root(y);
    return rx==ry;
  }
  int s(int x){
    return size[x];
  }
};
signed main(){
  int N,M,i,ans=1;cin>>N>>M;
  UnionFind UF(N);
  REP(i,M){
    int A,B;cin>>A>>B;
    UF.unite(A-1,B-1);
  }
  REP(i,N)ans=max(ans,UF.s(i));
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4796
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string S;
	cin >> S;
	int n = 0;
	for(int i = 0; i < 4; i++) {
		n += (S[i]=='+')?1:-1;
	}
	cout << n << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string S;
  cin >> n >> S;
  int  ans = 0;
  for (int i=2;i<n;i++){
    if (S[i-2] == 'A' && S[i-1] == 'B' && S[i] == 'C') ans ++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    final Scanner scanner = new Scanner(System.in);
    final int N = scanner.nextInt();
    int[] a = new int[N];
    for (int i = 0; i < N; i++) a[i] = scanner.nextInt();
    Arrays.sort(a);
    int n = a[N - 1];
    int r = -1;
    for (int i = 0; i < N - 1; i++) if (Math.min(a[i], n - a[i]) > Math.min(r, n - r)) r = a[i];
    System.out.printf("%d %d\n", n, r);
  }
}


Measured memory_bytes: 48704
import java.util.*;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in = new Scanner(System.in);
		int c =0;
		String t = "0";
		while(in.hasNext())
		{
			char h[]=in.nextLine().toCharArray();
			for(int i=0; i<h.length; i++)
			{
				while(i<h.length&&(Character.isDigit(h[i])))
				{
					t+=h[i];
					i++;
				}
				c+=Integer.valueOf(t);
				t="0";
			}
		}
		System.out.println(c);
	}
}

Measured memory_bytes: 12000
#include <iostream>
using namespace std;
int main()
{
    double n,cnt = 0;
    double ans;
    cin >> n;
    for(int i = 1;i <= n;i++){
        if(i % 2 != 0){
            cnt++;
        }
    }
    ans = cnt / n;
    cout << ans << endl;
    return(0);
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;
 
int main(){
    int K,N;

    cin >> K >> N;
    vector<int> H;
    int m = 0;
    int mn;
    long long sum = 0;

    for(int i = 0; i < N; i++){
        int h;
        cin >> h;

        if(i != 0){
            if(m < h - H[i-1]){
                m = max(m, h - H[i-1]);
                mn = i;
            }
        }

        H.push_back(h);
    }

    if(m < H[0] + K - H[N-1]){
        mn = N;
    }

    for(int i = 0; i < mn-1; i++){
        sum += H[i+1] - H[i];
    }

    for(int i = mn; i < N-1; i++){
        sum += H[i+1] - H[i];
    }

    if(mn != N){
        sum += H[0] + K - H[N-1];
    }

    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 1400
#include <stdio.h>
 
int main(void)
 
{
 
  int ai,n,i,b,s;
 
  double w;
 
 
  b=-1000000;
 
 
  s=1000000;
 
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++)
 
 
  {
 
 
    scanf("%d",&ai);
 
 
    if(ai<s)
 
 
    {
 
 
      s=ai;
 
 
    }
 
 
    if(b<ai)
 
 
    {
 
 
      b=ai;
 
 
    }
 
 
    w=w+ai;
 
 
  }
 
 
  printf("%d %d %0.lf\n",s,b,w);
 
 
  return 0;
 
 
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int K, N;
  cin >> N >> K;
  
  char S[N];
  cin >> S;
  S[K - 1] = S[K - 1] - 'A' + 'a';
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int[] S = new int[4];
		for(int i = 0; i < S.length; i ++) {
			S[i] = 0;
		}
		for(int i = 0; i < N; i ++) {
			switch(stdIn.next()) {
			case "AC":
				S[0] ++;
				break;
			case "WA":
				S[1] ++;
				break;
			case "TLE":
				S[2] ++;
				break;
			case "RE":
				S[3] ++;
				break;
			}
		}
		System.out.println("AC x " + S[0]);
		System.out.println("WA x " + S[1]);
		System.out.println("TLE x " + S[2]);
		System.out.println("RE x " + S[3]);
	}
}

Measured memory_bytes: 58792
#include<stdio.h>
int main()
{
    int A1,A2,A3;
    scanf("%d %d %d",&A1,&A2,&A3);
    int B=A1+A2+A3;
    if(B >= 22){
        printf("bust \n");
    }
    else{
        printf("win \n");
    }
    return 0;
}

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



H, W = map(int, input().split())
C = [list(input()) for i in range(H)]
INF = 10 ** 9
go = [[1, 0], [0, 1], [-1, 0], [0, -1]]
que = deque()
ans  = -1
for sx in range(W):
    for sy in range(H): # スタート地点のループ
        if C[sy][sx] == "#":
            continue
        
        dist = [[-1 for _ in range(W)] for _ in range(H)]
        
        que.append((sy,sx))
        dist[sy][sx] = 0
        while que:
            y,x = que.popleft()
            for temp in go:
                gx,gy = temp
                nx = x + gx
                ny = y + gy
                if 0<= nx < W and 0<= ny < H and C[ny][nx] != "#":
                    if dist[ny][nx] == -1: # ここの更新にminはいらない(幅優先なので自明に最短距離を進む)
                        dist[ny][nx] = dist[y][x] + 1
                        que.append( (ny,nx))
        for temp in dist:
            cand = max(temp)
            ans = max(ans,cand)
print(ans)





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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, A, B;
    cin >> N >> A >> B;
    ll tmp = A + B;
    ll ans = A * (N / tmp);
    ans += min(A, N % tmp);
    cout << ans << '\n';
}

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


Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define EPS 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f3f3f3f3f
#define MEM(a, b) memset(a, b, sizeof(a))
#define PPER(i, n, m) for (int i = n; i >= m; i--)
#define REPP(i, n, m) for (int i = n; i <= m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define PER(i, n, m) for (int i = n; i > m; i--)
#define SA(n) scanf("%d", &(n))
#define SLLA(n) scanf("%lld", &(n))
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define DE(val) cout << #val << ": " << val << endl;
 
const int dx44[6] = {0, -1, -1, 1, 1};
const int dy44[6] = {0, -1, 1, -1, 1};
const int dx4[6] = {0, 0, 1,-1};
const int dy4[6] = {1, -1, 0,0};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int dx82[9] = {0, -1, -1, 1, 1, 2, 2, -2, -2};
const int dy82[9] = {0, 2, -2, 2, -2, 1, -1, 1, -1};

void update(ll& x,ll v){
    if(x==-1)x=v;
    else if(x>v)x=v;
}
 
ll po(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
void extgcd(ll a, ll b, ll &d, ll &x, ll &y)
{
    if (!b)
    {
        d = a;
        x = 1;
    }
    else
    {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
ll inverse(ll a, ll n)
{
    ll d, x, y;
    extgcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn = 2e5 + 15;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
#define mst(x, a) memset(x, a, sizeof(x))
/*************************************************************************/

void solve() {
    int a,b;
    cin>>a>>b;
    if(a<=b) {
        puts("unsafe");
    } else {
         puts("safe");
    }
} 

int main()
{   
#ifndef ONLINE_JUDGE
    // freopen("i.txt", "r", stdin);
    // freopen("o.txt", "w", stdout);
#endif

    solve();
    // int t;
    // SA(t);
    // REPP(i,1,t) {
    //     printf("Case #%d: ", i);
    //     solve();
    // }
    return 0;
 
}
 

Measured memory_bytes: 3100
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int v[] = new int[N];
		int c[] = new int[N];
      	int max=0;
      	
		for(int i=0;i<N;i++)v[i]=sc.nextInt();
      	for(int i=0;i<N;i++)c[i]=sc.nextInt();
      	sc.close();
      	for(int i=0;i<N;i++){
        	if(v[i]-c[i]>=0){
             max+= v[i]-c[i];
            }
        }
		System.out.println(max);
	}
}

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

using ll = long long;
using Pl = pair < ll, ll >;

constexpr ll LLINF = (1LL << 60);

template < typename T > 
struct BIT {
    vector < T > dat;
    BIT (int n) { dat.assign(n + 1, 0); }

    void add(int k, T x) {
        k++;
        while ( k <= dat.size() ) dat[k] += x, k += k & -k;
    }

    T query(int k) {
        T sum = 0;
        k++;
        while ( k > 0 ) sum += dat[k], k -= k & -k;
        return ( sum );
    }

    int lower_bound(T x) {
        int l, r;
        l = -1, r = dat.size();
        while ( l + 1 < r ) {
            int m = (l + r) / 2;
            if ( query(m) >= x ) r = m;
            else l = m;
        }
        return ( r );
    }
};

int Q;
int inst[200005], A[200005], B[200005];
ll sum = 0;
vector < Pl > compress;
int main()
{
    cin >> Q;
    for ( int i = 0; i < Q; i++ ) {
        cin >> inst[i];
        if ( inst[i] == 1 ) {
            cin >> A[i] >> B[i];
            compress.emplace_back(A[i], i);
        }
    }
    sort(begin(compress), end(compress));

    BIT < ll > tree1(compress.size());
    BIT < ll > tree2(compress.size());
    int cnt = 0; 

    for ( int i = 0; i < Q; i++ ) {
        if ( inst[i] == 1 ) {
            int pos = lower_bound(begin(compress), end(compress), Pl(A[i], i)) - begin(compress);
            tree1.add(pos, 1);
            tree2.add(pos, A[i]);
            sum += B[i], cnt++;
        } else {
            int pos = tree1.lower_bound((cnt + 1) / 2);
            ll x = compress[pos].first;
            int pos1 = lower_bound(begin(compress), end(compress), Pl(x, -LLINF)) - begin(compress);
            int pos2 = lower_bound(begin(compress), end(compress), Pl(x + 1, -LLINF)) - begin(compress);
            int num1 = tree1.query(pos1 - 1);
            int num2 = tree1.query(compress.size() - 1) - tree1.query(pos2 - 1);
            ll left = num1 * x - tree2.query(pos1 - 1);
            ll right = tree2.query(compress.size() - 1) - tree2.query(pos2 - 1) - num2 * x;

            cout << x << " " << left + right + sum << endl;
        }
    }


    return ( 0 );
}

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

int main(){
  int n,k,q;
  cin >> n >> k >> q;
  vector<int> anser(n);
  for(int i=0;i<n;i++) {
    anser[i]=k-q;
  }
  vector<int> ans(q);
  for(int i=0;i<q;i++) cin >> ans[i];

  for(int i=0;i<q;i++) anser[ans[i]-1]++;

  for(int i=0;i<n;i++) {
    if(anser[i]>0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 505

int table[SIZE][SIZE],work[SIZE][SIZE];


int main(){

	int N;
	scanf("%d",&N);

	if(N%2 == 1){

		if(N == 1){

			printf("Yes\n");
			printf("1\n");

		}else{

			printf("No\n");
		}
		return 0;
	}


	for(int row = 1; row <= N-1; row++){
		for(int col = 0; col < row; col++){

			work[row][col] = row+col;
			if(work[row][col] >= N){

				work[row][col] -= (N-1);
			}
		}
	}

	for(int i = 0; i < N; i++){

		table[i][i] = 2*N-1;
	}

	for(int col = 0; col <= N-2; col++){
		for(int row = col+2; row <= N-1; row++){
			table[row-1][col] = work[row][col];
		}
		table[N-1][col] = work[col+1][col];
	}
	for(int row = 0; row < N-1; row++){
		for(int col = row+1; col < N; col++){

			table[row][col] = (2*N-1)-table[col][row];
		}
	}

	printf("Yes\n");
	for(int row = 0; row < N; row++){
		printf("%d",table[row][0]);
		for(int col = 1; col < N; col++){

			printf(" %d",table[row][col]);
		}
		printf("\n");
	}

	return 0;
}



Measured memory_bytes: 5168
N = int(input())
A = [int(i) for i in input().split()]

ans = 0
flg = True

while flg:
    for i in range(N):
        if A[i] % 2:
            flg = False
            break
        else:
            A[i] >>= 1

    if flg:
        ans += 1

print(ans)


Measured memory_bytes: 2940
from sys import stdin
import math
from itertools import groupby

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

li.sort()

if len(li) == 1:
    if li[0] != 0:
        print(0)
        exit()
    else:
        print(1)
        exit()

if li[0] == 0 and li[1] == 0:
    print(0)
    exit()
    
lin = []
for key, value in groupby(li):
    lin.append(len(list(value)))

point = 1

for i in lin:
    if i >= 3:
        print(0)
        exit()
    point *= math.factorial(i)
    point %= 10**9+7

print(point)

Measured memory_bytes: 14256
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // int T;cin>>T;while(T--) 
    {
        ld a,b,c;
        cin>>a>>b>>c;
        ll x = 2*sqrt(a*b);
        ll l = a + b;
        if(a+b+x>=c)
            cout<<"No\n";
        else cout<<"Yes\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int h,w,l,i,j;
    char a[100][100];
    cin>>h>>w;
    for(i=0;i<h;i++)
    {
        for(j=0;j<w;j++)
        {
            cin>>a[i][j];
        }
    }

    for(i=0;i<w+2;i++)
    {
        cout<<"#";
    }
    cout<<endl;
    for(i=0;i<h;i++)
    {
        cout<<"#";
        for(j=0;j<w;j++)
        {
            cout<<a[i][j];
        }
        cout<<"#"<<endl;
    }
    for(i=0;i<w+2;i++)
    {
        cout<<"#";
    }
}


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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define FOR(i,c,num) for(ll (i)=(c);(i)<(num);++(i))
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){ T x; cin >> x; return (x); }
template<typename T=ll,typename C=vector<T>>
C vecin(int N){ C x(N);REP(i,N){ x[i]=in<T>(); }return x; }

void vout(){ cout << endl; }
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){ cout << ' ' << h;vout(forward<Tail>(t)...); }
void out(){ cout << endl; }
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){ cout << h;vout(forward<Tail>(t)...); }

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

vll M;

ll powermod(ll a,ll b,ll m){
	if(b==0){
		return 1LL;
	}
	if(b%2){
		return (a*powermod(a,b-1LL,m))%m;
	}
	return powermod((a*a)%m,b/2LL,m);
}

ll dfs(ll v){
	if(M[v]>=0) return M[v];

	ll B=0,V=v;
	while(V){
		if(V&1) B++;
		V/=2;
	}

	if(!B){
		M[v]=0;
		return 0;
	}
	if(!(v%B)){
		M[v] = 1;
		return 1;
	}

	ll C = dfs(v%B)+1;
	M[v] = C;
	return C;
}

ll safemod(ll a,ll m){
	return (a%m+m)%m;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	auto N=in();
	string X=in<string>();
	M.resize(N+1,-1);
	ll C=0;
	REP(i,N){
		if(X[i]=='1'){
			C++;
		}
	}
	ll modP=0,modD=0;
	if(C<N){
		REP(j,N){
			if(X[N-1-j]=='1'){
				modP += powermod(2,j,C+1);
				modP %= (C+1);
			}
		}
	}
	if(C>1){
		REP(j,N){
			if(X[N-1-j]=='1'){
				modD += powermod(2,j,C-1);
				modD %= (C-1);
			}
		}
	}

	ll K[2]={C-1,C+1};
	REP(i,N){
		ll B;
		ll mod=0;
		if(X[i]=='0'){
			B = 1;
			mod = modP;
			mod += powermod(2,N-1-i,K[B]);
			mod %= K[B];
		}
		else{
			B = 0;
			if(K[B]==0){
				out(0);
				continue;
			}
			mod = modD;
			mod -= powermod(2,N-1-i,K[B]);
			mod = safemod(mod,K[B]);
		}

		ll Z=dfs(mod)+1;
		out(Z);
	}


	return 0;
}


Measured memory_bytes: 5168
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	vector <int> h(10);
	for (int i = 0;i < 10;i++) {
		cin >> h[i];
	}
	sort(h.rbegin(), h.rend());
	cout << h[0] << endl << h[1] << endl << h[2] << endl;
}


Measured memory_bytes: 3084
n = int(input())
T = [int(i) for i in input().split()]
L = [0 for i in range(max(T))]

for i in range(n):
  L[T[i]-1] += 1

for i in range(len(L)):
  if L[i] >= 3:
    if L[i]%2 == 0:
    	L[i] = 2
    else:
        L[i] = 1

counttwo = L.count(2)
countone = L.count(1)

out = (counttwo//2)*2 + countone
print(out)

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

using namespace std;

int main() {
    char S[4];
    cin>>S;
    sort(S,S+4);
    if(S[0]==S[1] and S[1]!=S[2] and S[2]==S[3]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long  x;
  cin>>x;
  int count = 0;
  long long  p = 100;
  while(p < x)
  {
   p += p/100;
    count++;
  }
  cout<<count<<endl;
  
 return 0; 
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S="";
  vector<char> color(N);
  for(int n=0;n<N;n++){
    cin >> color.at(n);
    S+=color.at(n);
  }
  int length=S.size();
  int sum=S.size();

  for(int n=0; n<length-1;n++){
    if( S.at(n)==S.at(n+1) ) sum--;
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{

	int a[10000000];
	int N;
	cin >> N;
	int count=0;
	for (int i = 0; i < N; i++)
	{
		cin >> a[i];
	}
	for (int i = 0; i < N; i = i + 2)
	{
		if (a[i] % 2 == 1)
		{
			count++;
		}
	}
	cout << count << endl;
	return 0;
	
}

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

using namespace std;

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

typedef unsigned int uint;
typedef long long ll;
typedef pair<int,int> pii;

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

int a[100000],b[100000];

int main(){
	int n=read();
	REP(i,n)
		a[i]=b[i]=read();
	sort(b,b+n);
	int ans=0;
	REP(i,n){
		int x=lower_bound(b,b+n,a[i])-b;
		ans+=(x^i)&1;
	}
	cout<<ans/2<<endl;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int N;
vector<int>A, B;
map<int, int>mp;

int main(void)
{
	cin >> N;
	for (int i = 0; i < N; ++i) {
		int tmp; cin >> tmp;
		A.push_back(tmp);
		mp[tmp]++;
	}
	for (int i = 0; i < N; ++i) {
		int tmp; cin >> tmp;
		B.push_back(tmp);
		mp[tmp]--;
	}
	for (auto p : mp) {
		if (p.second > 0) {
			cout << "No" << endl;
			for (int i = 0; i < N; ++i) {
				cout << A[i] << " \n"[i == N - 1];
			}
			for (int i = 0; i < N; ++i) {
				if (A[i] == p.first)A[i] = A[(i + 1) % N];
				cout << A[i] << " \n"[i == N - 1];
			}
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 8732
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
using u8t = std::uint64_t;
using i8t = std::int64_t;
#define F(I,N) for(i8t I=0,_N=N;I<_N;I++)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(i,N){R(x)V.push_back(x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL0(line)
#define P(X) std::cout<<(X)<<std::endl;
i8t ipow10(i8t x){i8t r=1;F(i,x)r*=10;return r;}
int main() {
  R(D);
  i8t count = 0;
  //i8t dmin = std::ceil(std::log10(D/9+1)+1);//P(dmin);
  for(i8t d=2;d<=18;d++){
    i8t Dmin=(d&1? 99: 9)*(ipow10(d/2-1));
    //std::cout<<d<<":"<<Dmin<<std::endl;
    if(D<Dmin&&(d&1)==0)break;
    i8t poss = 1;
    auto Drest = D;
    for(i8t i=0;i<d/2;i++){
      i8t mod = ipow10(d-1-2*i)-1;
      i8t lsb = (Drest>=0?Drest:-Drest)%10;
      i8t c = (10-lsb)%10;
      if(Drest>=0){
        Drest -= c*mod;
        poss *= (i==0? 9: 10) - c;
      }else{
        Drest += c*mod;
        poss *= 10-c;
      }
      if(poss<=0||Drest%10!=0){poss=0;break;}
      Drest/=10;
    }
    if((d&1)&&d>1)poss*=10;
    if(Drest)poss=0;
    count+=poss;
  }
  P(count);
  return 0;
}

Measured memory_bytes: 256
from collections import deque
x, y, a, b, c = [int(i) for i in input().split()]
lp = sorted([int(i) for i in input().split()])
if len(lp) != x:
  del lp[:len(lp)-x]
lp = deque(lp)
lq = sorted([int(i) for i in input().split()])
if len(lq) != y:
  del lq[:len(lq)-y]
lq = deque(lq)
lr = sorted([int(i) for i in input().split()])
lr = deque(lr)


while True:
  if len(lr) == 0:
    break
  r_max = lr[len(lr)-1]
  p_min = lp[0]
  q_min = lq[0]
  if r_max <= p_min and r_max <= q_min:
    break
  elif r_max > q_min and p_min >= q_min:
    del lq[0]
    lq.append(lr.pop())
  elif r_max > p_min and q_min >= p_min:
    del lp[0]
    lp.append(lr.pop())


print(sum(lp) + sum(lq))

Measured memory_bytes: 109008
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		//String str = "4 5 6";
		String[] num = str.split(" ", 0);
		int a = Integer.parseInt(num[0]);
		int b = Integer.parseInt(num[1]);
		int c = Integer.parseInt(num[2]);

		if (a < b && b < c) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
}
}

Measured memory_bytes: 24428
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			int[] ans = new int[n];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < 5; j++)
					ans[i] += scanner.nextInt();
			}
			Arrays.sort(ans);
			System.out.println(ans[n - 1] + " " + ans[0]);
		}
	}
}

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

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


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

using namespace std;

typedef long long ll;

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

	int n, m;
	cin >> n >> m;

	vector<int> a(m);
	int sm = 0;
	rep(i, m){
		cin >> a[i];
		sm += a[i];
	}

	if(sm > n){
		cout << -1 << endl;
	}else{
		cout << n - sm << endl;
	}
}


Measured memory_bytes: 3656
import collections

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

c = collections.Counter(A)
cs = sorted(c.items(), key=lambda x:x[1])

cnt = 0
for i in range(len(cs)-K):
    cnt += cs[i][1]
print(cnt)

Measured memory_bytes: 39344
def main():
	a,b = map(int,input().split())
	av = 0
	for kame in range(101):
		for tsuru in range(101):
			if kame + tsuru == a and 4*kame + 2*tsuru == b:
				print("Yes")
				av = 1
				break
	if av == 0:
		print("No")
	


if __name__ == '__main__':
	main()

Measured memory_bytes: 62936
import java.util.*;
import java.lang.*;

class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                String S = sc.next();
                if (saiki(S)) {
                        System.out.println("Cat");
                } else {
                        System.out.println("Rabbit");
                }
        }

        public static boolean saiki(String S){
                if (S.equals("")) {
                        return true;
                }
                if (S.charAt(0) != 'm') {
                        return false;
                }
                int en = 1;
                int i;
                for (i = 1; i < S.length() && en != 0; i++) {
                        if (S.charAt(i) == 'm') {
                                en++;
                        } else if(S.charAt(i) == 'e'){
                                en--;
                        }
                }
                if (i == S.length()) {
                        return false;
                }
                int eindex = i;
                int mn = 1;
                i++;
                for (; i < S.length() && mn != 0; i++) {
                        if (S.charAt(i) == 'e') {
                                mn++;
                        } else if(S.charAt(i) == 'w'){
                                mn--;
                        }
                }
                if (i != S.length()) {
                        return false;
                }
                return saiki(S.substring(1, eindex - 1)) && saiki(S.substring(eindex, S.length() - 1));
        }
}

Measured memory_bytes: 26288
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <fstream>
#include <set>
#include <cmath>
#include <array>
#include <iomanip>


using namespace std;

int main(void) {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    std::string s;
    cin >> s;

    if (s[0] == s.back()) {
        if (s.size() % 2 == 0) {
            cout << "First" << std::endl;
        } else {
            cout << "Second" << std::endl;
        }
    } else {

        if (s.size() % 2 == 1) {
            cout << "First" << std::endl;
        } else {
            cout << "Second" << std::endl;
        }

    }

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
int mypow(int a,int b){
	if(b==0) return 1;
	if(b%2) return mypow(a,b-1)*a%mod;
	int z=mypow(a,b/2);
	return z*z%mod;
}
signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	f(i,a+1){
		f(j,b+1){
			if(i*b+j*(a-i*2)==c){
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
    return 0;
}


Measured memory_bytes: 256
n = int(input())
ac_cnt = 0
wa_cnt = 0
tle_cnt = 0
re_cnt = 0
for i in  range(n):
    s = input()
    if s == 'AC':
        ac_cnt += 1
    elif s == 'WA':
        wa_cnt += 1
    elif s == 'TLE':
        tle_cnt += 1
    elif s == 'RE':
        re_cnt += 1
print('AC x ' + str(ac_cnt))
print('WA x ' + str(wa_cnt))
print('TLE x ' + str(tle_cnt))
print('RE x ' + str(re_cnt))


Measured memory_bytes: 9200
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include<iomanip>
#include<unordered_map>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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; }

typedef long long ll;
using namespace std;






class UnionFind
{
public:
  UnionFind(int num)
  {
      parent=vector<int>(num,-1);
  }
  int root(int a)
  {
    if(parent[a]<0)return a;
    return parent[a]=root(parent[a]);
  }
  int size(int a)
  {
    return -parent[root(a)];
  }
  bool connect(int a,int b)
  {
    int pa=root(a),pb=root(b);
    if(pa==pb)return false;
    if(size(pa)>size(pb))swap(pa,pb);
    parent[pb]+=parent[pa];
    parent[pa]=pb;
    return true;

  }
  void print()
  {
    rep(i,10)cout<<parent[i]<<" ";
    cout<<endl;
  }
private:
  vector<int>parent;

};
ll calc(int a,int b)
{
  ll res=0;
  res+=(ll)a<<31;
  res+=b;
  return res;
}


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  int k,l;
  cin>>n>>k>>l;
  UnionFind uni1(n+1),uni2(n+1);

  rep(i,k){int a,b;cin>>a>>b;uni1.connect(a,b);}
  rep(i,l){int a,b;cin>>a>>b;uni2.connect(a,b);}
  unordered_map<ll,int>ma;
  repi(i,1,n+1)
  {
    ll a=calc(uni1.root(i),uni2.root(i));
    //cout<<a<<endl;
    if(ma.find(a)==ma.end())ma[a]=1;
    else ma[a]+=1;
  }
  repi(i,1,n+1)cout<<ma[calc(uni1.root(i),uni2.root(i))]<<"\n";
  cout<<flush;

  return 0;

}


Measured memory_bytes: 9928
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=16,mod=1e9+7;
int qpow(int a,int b)
{
	int ans=1;
	while(b)
	{
		if(b&1)ans=(ll)ans*a%mod;
		a=(ll)a*a%mod;
		b>>=1;
	}
	return ans;
}
int add(int a,int b)
{
	a+=b;return a>=mod?a-mod:a;
}
int p2[maxn*maxn]={1},dp[1<<maxn|10];
int n,m,yc[maxn+1][1<<maxn|10];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)p2[i]=add(p2[i-1],p2[i-1]);
    for(int i=1;i<=m;i++)
    {
    	int u,v;
    	scanf("%d%d",&u,&v);
    	for(int s=0;s<(1<<n);s++)
    	{
    		if((s>>v-1)&1)
    		{
    			yc[u][s]++;
			}
		}
	}
	for(int s=0;s<(1<<n);s++)
	{
		if(((s>>0)&1)==((s>>1)&1))
		{
		    for(int u=s;u;u=(u-1)&s)
		    {
		    	if(((u>>0)&1)==((u>>1)&1))
		    	{
		    		int v=s-u;
		    		int s1=0,s2=1;
		    		for(int i=1;i<=n;i++)
		    		{
		    			if((v>>i-1)&1)
		    			{
		    				s1=add(s1,yc[i][u]);
						}
						if((u>>i-1)&1)
						{
							s2=(ll)s2*(p2[yc[i][v]]-1)%mod;
						}
					}
					dp[s]=add(dp[s],(ll)dp[u]*s2%mod*p2[s1]%mod);
				}
			}
		}
		dp[s]=add(dp[s],1);
	}
	cout<<add(p2[m],mod-dp[(1<<n)-1]);
	return 0;
} 

Measured memory_bytes: 5608
#include<iostream>
using namespace std;
int main(void)
{
	int a,b,i;
	char s[10];
	cin>>a>>b>>s;
	for(i=0;i<a+b+1;i++) {
		if(i==a && s[i]!='-' || i!=a && s[i]=='-'){
			cout<<"No"<<endl;
			break;
		}
		if(i==a+b) cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256