akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

    int N, M;
    cin >> N >> M;
    vector<pair<int, int> > G[N], GG[N];

    rep(i, 0, M) {
        int l, r, d;
        cin >> l >> r >> d;
        l--; r--;
        G[l].push_back(make_pair(r, d));
        G[r].push_back(make_pair(l, -d));
    }

    int vis[N], col[N];
    memset(vis, 0, sizeof(vis));
    memset(col, 0, sizeof(col));
    rep(i, 0, N) {
        if(not vis[i]) {
            col[i] = 0;
            vis[i] = 1;
            queue<int> q;
            q.push(i);
            while(!q.empty()) {
                int v = q.front(); q.pop();
                rep(p, 0, G[v].size()) {
                    if(vis[G[v][p].first]) {
                        if(col[v] + G[v][p].second != col[G[v][p].first]) {
                            cout << "No" << endl;
                            return 0;
                        }
                    } else {
                        col[G[v][p].first] = col[v] + G[v][p].second;
                        vis[G[v][p].first] = 1;
                        q.push(G[v][p].first);
                    }
                }

            }
        }
    }
    cout << "Yes" << endl;

}


Measured memory_bytes: 12160
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int dcnt(int n) {
  if(n==0)
    return 1;
  int c=0;
  while(n!=0) {
    c++;
    n/=10;
  }
  return c;
}

int digit(int n, int x) {
  if(x==1) {
    return n % 10;
  }
  return digit(n/10,x-1);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int n,m;
  cin>>n>>m;
  vector<int> s(m);
  vector<int> c(m);
  rep(i,m)cin>>s[i]>>c[i];
  rep(i,1000) {
    if(n==dcnt(i)) {
      bool fl = true;
      rep(j,m) {
	if(digit(i,n-s[j]+1)!=c[j]) {
	  fl=false;
	  break;
	}
      }
      if(fl) {
	cout << i << endl;
	return 0;
      }
    }
  }
  cout << -1 << endl;
  return 0;
}


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

prime = []
for i in range(2, 1000):
    j = 2
    while j ** 2 <= i:
        if i % j == 0:
            break
        j += 1
    if j ** 2 > i:
        prime.append(i)
        
ans = 1

for p in prime:
    soinsu = 1
    for i in range(2, n + 1):
        while True:
            if i % p == 0:
                soinsu += 1
                i = int(i / p)
            else:
                break
    ans = (ans * soinsu) % (10 ** 9 + 7)
         
print(ans)

Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
#define DEBUG 0
#define ll long long
#define Pll pair<ll, ll>
#define Pii pair<int, int>
 
using namespace std;
struct edge{int from, to; ll cost;};

signed main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(n){
        cin >> a[i];
        b[i] = abs(a[i]);
    }
    int maxi = (int)(max_element(all(b)) - b.begin());

    int cnt = 2*n-2;
    vector<Pii> ans;
    rep(n){
        if(i == maxi)continue;
        ans.emplace_back(maxi+1, i+1);
    }
    if(a[maxi] > 0){
        rep(n-1) ans.emplace_back(i+1, i+2);
    }else{
        for(int i=n-2;i>=0;i--) ans.emplace_back(i+2, i+1);
    }
    
    cout << cnt << endl;
    for(Pii p: ans){
        cout << p.first << " " << p.second << endl;
    }

}

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

using namespace std;

typedef long long ll;

inline void add(int &x,ll y) {
  x=(x+y)%MOD;
}

ll facd[305];

void pre(int n) {
  facd[0]=1;
  for(int i=1;i<=n;i++) facd[i]=facd[i-1]*(2LL*i-1)%MOD;
}

int num[605];
int f[2][305];

int main() {
  int n,m;
  scanf("%d%d",&n,&m);
  pre(n);
  for(int i=1;i<=m;i++) {
  	int x,y;
  	scanf("%d%d",&x,&y);
  	num[x]=y;
  	num[y]=x;
  }
  int ans=0;
  for(int i=1;i<=2*n;i++) {
  	int cur=0;
  	memset(f[cur],0,sizeof(f[cur]));
  	f[cur][0]=1;
  	int sz1=0,sz2=0;
  	for(int j=i;j<=2*n;j++) {
  	  if (num[j]) {
  	  	  if (num[j]>j) sz1++;
  	  	  else if (num[j]<i) break;
  	  	  else sz1--;
		}
	  else {
	  	  sz2++;
	  	  cur^=1;
	  	  memset(f[cur],0,sizeof(f[cur]));
	  	  for(int k=0;k<=min(n,sz2);k++)
	  	    if (f[cur^1][k]) {
	  	    	if (k) add(f[cur][k-1],(ll)f[cur^1][k]*k);
	  	    	add(f[cur][k+1],f[cur^1][k]);
			  }
	  }
	  if (!sz1&&f[cur][0]) {
	  	add(ans,(ll)f[cur][0]*facd[n-m-(sz2>>1)]);
	  	f[cur][0]=0;
	  }
	}
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define in_range(x, y, r, c) (x < r && y < c && x >= 0 && y >= 0)
const int mod  = 998244353;
using namespace std;
const int d = 24 * 60;

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

Measured memory_bytes: 256
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

const int MAX_V = 1e4;
const int INF = 1e4;
struct edge{
  edge(int t_to, int t_cap, int t_rev){
    to = t_to;
    cap = t_cap;
    rev = t_rev;
  }
  int to, cap, rev;
};
vector<edge> G[MAX_V];
bool used[MAX_V];
void add_edge(int from, int to, int cap){
  G[from].push_back(edge(to, cap, G[to].size()));
  G[to].push_back(edge(from, 0, G[from].size()-1));
}

int dfs(int v, int t, int f){
  if(v == t) return f;
  used[v] = true;
  REP(i, G[v].size()){
    edge &e = G[v][i];
    if(!used[e.to] && e.cap > 0){
      int d = dfs(e.to, t, min(f, e.cap));
      if(d > 0){
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s, int t){
  int flow = 0;
  while(true){
    memset(used, 0, sizeof(used));
    int f = dfs(s, t, INF);
    if(f == 0) return flow;
    flow += f;
  }
}

int
main(void){  
  ios_base::sync_with_stdio(false);

  int V, E;
  cin >> V >> E;
  REP(i, E){
    int u,v,c;
    cin >> u >> v >> c;
    add_edge(u,v,c);
  }

  int flow = max_flow(0, V-1);

  cout << flow << endl;
  
  return 0;
}



Measured memory_bytes: 3472
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;

 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int n = sc.nextInt();
    int[] ss = new int[n];
    for(int i = 0; i < n; i++){
      ss[i] = sc.nextInt();
    }
    int m = sc.nextInt();
    int[] ts = new int[m];
    for(int i = 0; i < m; i++){
      ts[i] = sc.nextInt();
    }

    int ans = 0;
    for(int i = 0; i < m; i++){
      int target = ts[i];
      int res = Arrays.binarySearch(ss, target);
      if(0 <= res && res < n && ss[res] == target){
        ans++;
      }
    }
    System.out.println(ans);
  }
 
  
// LinkedList<Integer>[] setsu = new LinkedList[n];
// for(int i = 0; i < n; i++){
//   setsu[i] = new LinkedList<Integer>();
// } 

 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;

      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }

      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

Measured memory_bytes: 19796
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main() {                                                                                                int N;                                                                                                  cin >> N;
    vector<int> vec(N);
    for (int i = 0; i< N;i++) {                                                                                 cin >> vec[i];                                                                                      }
    int max_point = 0;
    int count = 0;                                                                                          for (auto &x: vec) {                                                                                        if (max_point <= x) {
            max_point = x;
            count += 1;
        }
    }
    cout << count;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int N; cin >> N;
    vector<ll> h(N); repp(i,0,N) cin >> h[i];

    int i = N-1;
    int count = 0;
    int ans = 0;
    while(i > 0) {
        if (h[i-1] >= h[i]) {
            ++count;
            ans = max(ans, count);
        } else {
            count = 0;
        }
        --i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
	int n; cin>>n;
	vl a(n);
	rep(i,0,n)cin>>a[i];
	ll memo=0;
	ll now=1000;
	ll kabu=0;
	rep(i,0,n-1){
		ll add=0;
		if(a[i]<a[i+1])add=now/a[i];
		now+=(a[i+1]-a[i])*add;
	}
	cout<<now<<endl;
	return 0;
}

Measured memory_bytes: 3592
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::vector<i64> H;
  tools::read(H, N);

  std::vector<i64> maxes({0});
  for (const i64& H_i : H) {
    maxes.push_back(std::max(maxes.back(), H_i));
  }

  i64 answer = 0;
  for (i64 i = 0; i < N; ++i) {
    if (H[i] >= maxes[i]) ++answer;
  }

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

Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
count = 0
max_i = 0
H.append(10**9 + 2)
for i in range(N):
  if H[i] > H[i + 1] + 1:
    count += 1
  if max_i - H[i] > 1:
    count += 1
  max_i = max(max_i,H[i])

    
if count == 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 63856
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
using R = long double;

R a, b, T;

bool check(R x){
    R S;
    if(a * tan(x) <= b){
        S = a * b - a * a * tan(x) / 2;
    }
    else {
        S = b * b * tan(PI/2 - x) / 2;
    }

    return T <= S;
}

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

    cin >> a >> b >> T;

    T /= a;
    R S = a * b;

    R lb = 0.0, ub = PI / 2;
    rep(_, 1000){
        R mid = (lb + ub) / 2;

        if(check(mid)){
            lb = mid;
        }
        else {
            ub = mid;
        }
    }
    lb *= 180 / PI;

    cout.precision(10);
    cout << fixed << lb << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define re return 0
#define distance(x1,y1,x2,y2) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}

template<typename T>
void maxi(T &a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T &a, T b) {
	a = min(a, b);
}

void exact_say(double x) {
	cout << setprecision(numeric_limits<double>::max_digits10) << x << endl;
}

int main() {
	const double up = 0.006;
	int ans;
	double dif = 1000000;
	makei(n);
	makei(t);
	makei(a);
	rep(n) {
		makei(x);
		double difi = abs(a - (t - up * x));
		if (difi < dif) {
			ans = i + 1;
			dif = difi;
		}
	}
	say(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fup(i,a,b) for(int i=a;i<=b;++i)
#define fdw(i,a,b) for(int i=a;i>=b;--i)
#define sync ios::sync_with_stdio(false);cin.tie(0)
#define cl(a) memset(a,0,sizeof(a))
#define gcd __gcd
#define fi first
#define se second
#define pb push_back
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
//ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//ll ksm(ll a,ll b,ll mod){ll ans=1;a%=mod;for(;b;b>>=1){if(b&1) ans=ans*a%mod;a=a*a%mod;}return ans;}
//ll oula(ll n){ ll res=n;for(ll i=2;i*i<=n;i++){if(n%i==0){ res=res-res/i;while(n%i==0) n/=i;}}if(n>1) res=res-res/n;return res;}
//bool MRT(ll x){if(x==2)return true;fup(i,1,50){ll now=rand()%(x-2)+2;if(ksm(now,x-1,x)!=1)return false;}return true;}
//void shai(int n)fup(i,2,n){if(isprime[i]){v.push_back(i);for(int j=2*i;j<=10000;j+=i)isprime[j]=0;}}//"埃氏筛筛选素数"
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
const int N = 1e6 + 10;
int a[N];
int main()
{

    int n,x;
    cin>>n;
    bool f=true;
    fup(i,1,n)
    {
        cin>>a[i];

    }
    fup(i,1,n)
    {
        if(a[i]%2==0)
        {
            if(a[i]%3!=0&&a[i]%5!=0)
            {
                f=false;
                break;
            }
        }
    }
    if(f==true)
    {
        puts("APPROVED");
    }else puts("DENIED");
    return 0;
}


Measured memory_bytes: 256
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define MAX(a,b) (a>b?a:b)
using namespace std;

int main(){
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  vector<int> x;
  vector<int> y;

  rep(i,31){
    rep(j,31){
      if(100*A*i+100*B*j<=F) x.push_back(100*A*i+100*B*j);
      else break;
    }
  }

  //double maxsuger = (double) F*E/(100.+E);
  rep(i,3001){
    rep(j,3001){
      //if(C*i+D*j<=maxsuger) y.push_back(C*i+D*j);
      if(C*i+D*j<=F) y.push_back(C*i+D*j);
      else break;
    }
  }
  int water=0;
  int suger=0;
  double maxconce=0.;
  rep(i,x.size()){
    rep(j,y.size()){
      double conce =0.;
      if(x[i]+y[j]>0)
	conce = (double) 100.*y[j]/(x[i]+y[j]);
      if(x[i]+y[j]<=F&&conce<=100.*E/(100.+E)&&maxconce<=conce){
	maxconce = conce;
	water = x[i];
	suger = y[j];
      }
    }
  }

  cout << water+suger << " " << suger << endl;
  return 0;
}


Measured memory_bytes: 1400
def resolve():
    n=int(input())
    xyh=[list(map(int,input().split())) for _ in range(n)]
    xyh.sort(key=lambda x:x[2],reverse=True)
    ans=[]
    for cx in range(101):
        for cy in range(101):
            x,y,h=xyh[0]
            ch=h+abs(x-cx)+abs(y-cy)
            if all([h==max(ch-abs(x-cx)-abs(y-cy),0) for x,y,h in xyh[1:]]):
                ans=[cx,cy,ch]
                break
    print(*ans)
resolve()

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

ab = [0]*N

for i in range(N):
    ab[i]=list(map(int, input().split()))


ab.sort(key=lambda x: x[1])


sum0 = 0
ans = 'Yes'
for i in range(N):
    sum0 += ab[i][0]
    if sum0 > ab[i][1]:
        ans = 'No'
        break

print(ans)


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

int main() {
  int A, B;
  cin >> A >> B;
  if (A > B) {
    cout << 2*A -1 << endl;
  }
  if (A < B) {
    cout << 2*B - 1 << endl;
  }
  if (A == B) {
    cout << A+B << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long       ll;
#define MOD ((int)1e9+7)
#define N ((int)2e5+123)
void reads(string& x){ char kk[N]; scanf("%s",kk); x = kk;}

int n;
string ans;
int main(){
    ios_base::sync_with_stdio(0);
    scanf("%d", &n);
    n = n%10;
    if(n == 3)ans = "bon";
    else if(n==0 ||n==1 ||n==6 ||n==8) ans = "pon";
    else ans = "hon";
    
    printf("%s", ans.data());
}

Measured memory_bytes: 3776
A, B, C = map(int, input().split())
K = int(input())
M = 0
if (A >= B) and (A >= C):
    M = B + C + ( A * ((2)**K))
elif (B > A) and (B >= C):
    M = A + C + (B * ((2)**K))
else:
    M = B + A + (C * ((2)**K))
print(M)

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

signed main() {
  vector<int> vec(3);
  cin >> vec.at(0) >> vec.at(1) >> vec.at(2);
  sort(vec.begin(), vec.end());
  
  int ans = 0; //操作回数
  
  //操作1
  while( vec.at(1) < vec.at(2) ){
    vec.at(0)++;
    vec.at(1)++;
    ans++;
  }
  
  if( (vec.at(1)-vec.at(0))%2 == 0 ){
    ans = ans +  (vec.at(1)-vec.at(0)) / 2;
  }else{
    vec.at(1)++;
    ans++;
    ans = ans +  (vec.at(1)-vec.at(0)) / 2;
  }
  
  cout << ans << endl;
}


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

void solve()
{
	int n,k;
	cin>>n>>k;
	int has_cookie[n+1]={0};
	while(k--){
		int p;
		cin>>p;
		for(int i=0;i<p;++i){
			int cookie;
			cin>>cookie;
			has_cookie[cookie]=1;
		}
	}
	int victim=0;
	for(int i=1;i<=n;++i) if(!has_cookie[i]) victim++;
	cout<<victim;
	return;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
 
ll powmod(ll x,ll y){
    ll res=1;
    for(ll i=0;i<y;i++){
        res=res*x%mod;
    }
    return res;
}
int main(){
    ll n;
    cin>>n;
    ll ans=powmod(10,n)-powmod(9,n)-powmod(9,n)+powmod(8,n);
    ans%=mod;
    ans=(ans+mod)%mod;
    cout<<ans<<"\n";
}

Measured memory_bytes: 3608
n = gets.chomp.chars
if n.size == 1
  puts n[0].to_i
elsif n.size == n.count('9')
  puts n.map { |a| a.to_i }.inject(:+)
elsif (n.size - 1) == n.count('9') && n[0] != '9'
  puts n.map { |a| a.to_i }.inject(:+)
else
  puts (n.size-1) * 9 + (n[0].to_i - 1)
end

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
int main() {
        int N,ans=0,x=1;
        cin>>N;
        vector<int> a(N);
        for(int i=0; i<N; i++)
                cin>>a.at(i);

        for(int i=0; i<N; i++) {
                x=a.at(x-1);
                ans++;
                if(x==2)
                        break;
        }
        if(x==2) cout<<ans<<endl;
        else cout<< -1<<endl;
}


Measured memory_bytes: 640
import java.io.*;
import java.util.*;


public class Main {
    static int n,count;
    static int[] id;
    public static void main(String[] args) throws Exception{
        //Scanner sc = new Scanner(System.in);
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] buf = reader.readLine().split(" ");
        n = Integer.parseInt(buf[0]);
        int m = Integer.parseInt(buf[1]);
        count = n;
        id = new int[n+1];
        for(int i=0;i<=n;i++) id[i]=i;
        for(int i=0;i<m;i++){
            buf = reader.readLine().split(" ");
            int u = Integer.parseInt(buf[0]), v = Integer.parseInt(buf[1]);
            int len = Integer.parseInt(buf[2]);
            union(u,v);
        }
        System.out.println(count);
    }
    static int find(int p){
        while(id[p]!=p){
            id[p] = id[id[p]];
            p = id[p];
        }
        return p;
    }
    static void union(int p, int q){
        int i = find(p), j = find(q);
        if(i==j) return;
        id[j]=i;
        count--;
    }
}



Measured memory_bytes: 46948
#include<stdio.h>
#include<stdlib.h>
int a[200005],temp[200005];
int inc(const void *a, const void *b)
{
    return *(int*)a-*(int*)b;
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&a[i]);
	for(int i=0;i<n;i++)temp[i]=a[i];
	qsort(a,n,sizeof(int),inc);
	for(int i=0;i<=n/2-1;i++)
	{
		if(temp[i]>=a[n/2])printf("%d\n",a[n/2-1]);
		else printf("%d\n",a[n/2]);
	}
	for(int i=n/2;i<n;i++)
	{
		if(temp[i]>a[n/2-1])printf("%d\n",a[n/2-1]);
		else printf("%d\n",a[n/2]);
	}
}

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

using namespace std;
typedef long long ll;

void debug() {

}

int main () {
  ll n;
  scanf("%lld", &n);
  map<char, ll> mp = {
    {'M', 0ll},
    {'A', 0ll},
    {'R', 0ll},
    {'C', 0ll},
    {'H', 0ll},
  };
  char cmb[10][3] = {
    {'M', 'A', 'R'},
    {'M', 'A', 'C'},
    {'M', 'A', 'H'},
    {'M', 'R', 'C'},
    {'M', 'R', 'H'},
    {'M', 'C', 'H'},
    {'A', 'R', 'C'},
    {'A', 'R', 'H'},
    {'A', 'C', 'H'},
    {'R', 'C', 'H'},
  };

  vector<string> s(n);
  for (ll i=0; i<n; i++) {
    char x[11];
    scanf("%s", x);
    mp[x[0]]++;
    s[i] = x;
  }

  ll ans = 0;
  for (int i=0; i<10; i++) {
    ans += mp[cmb[i][0]] * mp[cmb[i][1]] * mp[cmb[i][2]];
  }

  printf("%lld\n", ans);

  return 0;
}


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

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

  unsigned cmin=n+1,ans=0,curn;
  for (int i=0;i<n;i++) {
    cin >> curn;
    if (cmin > curn) {
      ans++;cmin=curn;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    x = int(input())
    ans = (x // 11) * 2
    rest = x % 11
    if 1 <= rest <= 6:
        ans += 1
    elif 7 <= rest:
        ans += 2

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3944
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.typecons;

alias Pair = Tuple!(int, "a", int, "b");
Pair[10^^5+1] ARRAY;

void main()
{
    int n;
    long k;
    readf("%d %d", &n, &k); readln;
    auto array = ARRAY[0..n];

    foreach (i; 0..n) {
        int a, b;
        readf("%d %d", &a, &b); readln;
        array[i] = tuple(a, b);
    }

    array.sort!"a.a < b.a";
    long i;
    foreach (ab; array) {
        i += ab.b;
        if (i >= k) {
            writeln(ab.a);
            break;
        }
    }
}

Measured memory_bytes: 2044
#include <iostream>
using namespace std;
int main(){
    long long ans[20];
    int i,n;
    cin>>n;
    for(i=0;i<=n;i++){
        if(i==0){
            ans[0]=1;
        }else{
            ans[i]=ans[i-1]*i;
        }
    }
    cout<<ans[n]<<endl;
    return 0;
}

Measured memory_bytes: 3080
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
T = input()

if len(S) + 1 == len(T) and S == T[:-1]:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 9944
#include<algorithm>
#include<stack>
#include<ctime>
#include<cstring>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<queue>
#include<map>
using namespace std;
inline int read(){
	int num=0,f=1;char x=getchar();
	while(x<'0'||x>'9'){if(x=='-')f=-1;x=getchar();}
	while(x>='0'&&x<='9'){num=num*10+x-'0';x=getchar();}
	return num*f;
}
const int maxn=1005;
int h,w;
int bx,by,ex,ey;
char s[maxn][maxn];
int mx[25]={-2,-2,-2,-2,-2,-1,-1,-1,-1,-1,0,0,0,0,0,1,1,1,1,1,2,2,2,2,2};
int my[25]={-2,-1,0,1,2,-2,-1,0,1,2,-2,-1,0,1,2,-2,-1,0,1,2,-2,-1,0,1,2};
int dx[4]={1,-1,0,0};
int dy[4]={0,0,-1,1};
typedef pair<int,int> pr;
bool vst[maxn*maxn];
int dis[maxn*maxn];
int prt[maxn*maxn];
bool met[maxn][maxn];
int bh(int x,int y){return (x-1)*w+y;}
int getf(int x){
	if(x==prt[x])return x;
	else return prt[x]=getf(prt[x]);
}
void dfs(int x,int y){
	met[x][y]=true;
	for(int i=0;i<4;++i){
		int nx=x+dx[i],ny=y+dy[i];
		if(nx<=0||nx>h||ny<=0||ny>w||s[nx][ny]=='#')continue;
		if(met[nx][ny])continue;
		int f1=getf(bh(x,y)),f2=getf(bh(nx,ny));
		prt[f1]=f2;dfs(nx,ny);
	}	
}
vector<int> e[maxn*maxn];
map<int,bool> m[maxn*maxn];
#define INF 1e9
queue<int> Q;
void bfs(){
	for(int i=1;i<=h;++i)
		for(int j=1;j<=w;++j)dis[bh(i,j)]=INF;
	int b=getf(bh(bx,by));
	dis[b]=0;Q.push(b);
	while(Q.size()){
		int x=Q.front();Q.pop();
		for(auto y:e[x]){
			if(dis[y]>dis[x]+1){
				dis[y]=dis[x]+1;
				Q.push(y);
			}
		}
	}
	int ed=getf(bh(ex,ey));
	if(dis[ed]==INF)puts("-1");
	else printf("%d\n",dis[ed]);
}
int main(){
	h=read();w=read();
	bx=read();by=read();
	ex=read();ey=read();
	for(int i=1;i<=h;++i)scanf("%s",s[i]+1);
	for(int i=1;i<=h;++i)
		for(int j=1;j<=w;++j)prt[bh(i,j)]=bh(i,j);
	for(int i=1;i<=h;++i)
		for(int j=1;j<=w;++j)if(!met[i][j])dfs(i,j);
	for(int i=1;i<=h;++i)
		for(int j=1;j<=w;++j)
			if(s[i][j]!='#'){
				for(int k=0;k<25;++k){
					int nx=i+mx[k],ny=j+my[k];
					if(nx<=0||nx>h||ny<=0||ny>w||s[nx][ny]=='#')continue;
					int f1=getf(bh(i,j)),f2=getf(bh(nx,ny));
					if(f1>f2)swap(f1,f2);
					if(f1==f2||m[f1][f2]==true)continue;
					m[f1][f2]=true;
					e[f1].push_back(f2);
					e[f2].push_back(f1);
				}
			}
	bfs();
	return 0;
}


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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int k,a,b; cin>>k>>a>>b;
	for (int i=a; i<=b; i++) {
		if (i%k==0) {   
			cout<<"OK"<<endl;
			return 0;
		}
	}
	cout<<"NG"<<endl;
	return 0;
}


Measured memory_bytes: 3620
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>  // assert(x>=10), 部分点問題
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <set>

#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
#define SORT(v,n) sort(v,v+n)
#define VSORT(v) sort(all(x))
#define FILL(v, value) (v+(sizeof(v) / sizeof *(v)), value);
#define inf 999999999
#define dbg(x) cout<<#x<<":"<<x<<endl;
#define pb(a) push_back((a))
#define mp(a) make_pair((a))
#define pi 2*acos(0.0)
#define in scanf
#define out printf
#define fi first
#define se second

// --
#define bit(n) (1LL<<(n)) // 左bitシフト
// --

using namespace std;

typedef long long llong;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
typedef pair<llong, pll> plp;

const int MOD=1000000007;
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};  // 右下左上


int main(int argc, char**argv){
  int a, b, k;
  cin >> a >> b >> k;

  int maxoutted = 0;

  cout << a << endl;
  maxoutted = a;
  for (int i = 1; i < k; i++){
    if (a+i <= b){
      cout << a+i << endl;
      maxoutted = a+i;
    }else{
      return 0;
    }
  }

  int start = max(b-(k-1), maxoutted+1);
  if (start > b){
    return 0;
  }
  for (int i = start; i <= b; i++){
    cout << i << endl;
  }

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#define GYD
using namespace std;
//const int maxn = 200000 + 10;
typedef long long ll;
ll k, n;

int main()
{
    #ifdef GYD
    freopen("..//out.txt", "w", stdout);
    #endif // GYD
    scanf("%lld", &k);
    n = 50;
    printf("%lld\n", n);
    ll a = k / n, b = k % n;
    int cot = 0;
    for(ll i = 1; i <= b; i++)
    {
        cot++;
        cout << 49 + a + 50 - (b-1) << (cot == n ? '\n' : ' ');
    }
    for(ll i = 1; i <= (n - b); i++)
    {
        cot++;
        cout << 49 + a - b << (cot == n ? '\n' : ' ');
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int h,m,s,S;
		
	scanf("%d",&S);
	h=S/3600;
	m=S/60-h*60;
	s=S-(h*3600+m*60);
	
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)

N,M = mint()
X = lint()
X.sort()
D = [X[i+1]-X[i] for i in range(M-1)]
D.sort()
print(0 if N>=M else sum(D[:M-N]))

Measured memory_bytes: 92948
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    string s; cin >> s;
    vl c(3,0);
    REP(i, s.size()){
        if(s[i] == 'a') c[0]++;
        else if(s[i] == 'b') c[1]++;
        else c[2]++;
    }
    sort(c.begin(), c.end());
    ll fx = c[1]-c[0];
    ll sx = c[2]-c[0];
    if(fx > 1 || sx > 1){
        cout << "NO" << endl;
    }
    else{
        cout << "YES" << endl;
    }
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if (abs(b - c) % 2 == 0)cout << "Alice" << endl;
    else cout << "Borys" << endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
v = gets.chomp.split(' ').map(&:to_i).sort!.reverse!

def mix(a, b)
  (a + b) / 2.0
end
def mixes(elements)
  return elements.first if elements.size == 1
  a = elements.pop
  b = elements.pop
  elements.push(mix(a, b))

  mixes(elements)
end
puts mixes(v)


Measured memory_bytes: 1788
n, k = map(int, input().split())
p = [int(i) for i in input().split()]
expp = [(i + 1) / 2 for i in p]
cumu, cumu_expp = 0, []
for i in expp:
    cumu += i
    cumu_expp.append(cumu)

max_expp = cumu_expp[k - 1]
for i in range(n - k):
    sumpk = cumu_expp[i + k] - cumu_expp[i]
    if max_expp < sumpk:
        max_expp = sumpk
print(max_expp)

Measured memory_bytes: 25188
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

vector<int> graph[100010];
map<pair<int, int>, int> mp;
set<int> st;

int main()
{
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N - 1);
  std::vector<long long> b(N - 1);
  for (int i = 0; i < N - 1; i++)
  {
    scanf("%lld", &a[i]);
    scanf("%lld", &b[i]);
    a[i]--;
    b[i]--;
    graph[a[i]].push_back(b[i]);
    graph[b[i]].push_back(a[i]);
  }
  vector<int> color(N, 0);
  vector<bool> used(N, false);
  used[0] = true;
  queue<int> q;
  q.push(0);
  while (!q.empty())
  {
    int x = q.front();
    q.pop();
    int c = 1;
    for (int i = 0; i < graph[x].size(); ++i)
    {
      int y = graph[x][i];
      if (used[y])
        continue;
      if (c == color[x])
        c++;
      st.insert(c);
      color[y] = mp[{x, y}] = mp[{y, x}] = c++;
      used[y] = true;
      q.push(y);
    }
  }

  cout << st.size() << endl;
  for (int i = 0; i < N - 1; ++i)
  {
    cout << mp[{a[i], b[i]}] << endl;
  }

  return 0;
}


Measured memory_bytes: 20480
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <string>
#include <set>
#include <cmath>
#include <stack>
#include <cctype>
#define MOD 1000000007
#define ll  long long int
using namespace std;
ll memo[51][5001] ;
ll rec(ll arr[] ,ll n ,ll cur,ll p,ll sum)
{
    if(cur == n)
    {
        if(sum % 2 == p)
            return 1 ;
            else
                return 0 ;
    }
    if(memo[cur][sum] != -1)
        return memo[cur][sum] ;


    return memo[cur][sum] = rec(arr , n , cur + 1 , p , sum + arr[cur]) + rec(arr ,  n , cur + 1 ,p ,  sum ) ;



}






 int main(){
    ll n , p ;
    cin>>n>>p ;


    for(ll i  = 0 ; i < 51 ; ++i)
    {
        for(ll j =  0 ;  j < 5001 ; ++j)
        {
            memo[i][j] = -1 ;
        }
    }

    ll arr[n] ;
    for(ll i =  0 ; i< n ; ++i)
        cin>>arr[i] ;



  cout<<rec(arr,n,0,p,0)<<"\n"; ;




return 0
;}

Measured memory_bytes: 2304
#include<stdio.h>

#define N 10000
#define INF 1000000000
#define WHITE 0
#define BLACK 1
#define GRAY 2


int main(){
  int n,i,j,k,cnt=0,u,m[500000][3];
  int d[N],color[N];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    d[i] = INF;
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      m[cnt][0] = u;
      scanf("%d%d",&m[cnt][1],&m[cnt][2]);
      cnt++;
    }
    
  }
  d[0] = 0;
  color[u] = GRAY;

  while(color[u] != WHITE){
    color[u] = WHITE;
    for(i=0;i<cnt;i++){
      if(d[m[i][1]] > d[m[i][0]] + m[i][2]){
        d[m[i][1]] = d[m[i][0]] + m[i][2];
        color[u] = GRAY;
      }
    }
  }

  
  for(i=0;i<n;i++)printf("%d %d\n",i,d[i]);



  return 0;
}



Measured memory_bytes: 7720
import java.util.Scanner
import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    val initialState: Int = sc.nextLine.toInt

    @annotation.tailrec
    def go(n: Int, prevValue:Int, acc: mutable.Set[Int]): Int = {
      val value: Int = prevValue % 2 match {
        case 0 => prevValue / 2
        case 1 => 3 * prevValue + 1
      }
      if (acc.contains(value)) n
      else {
        acc += value
        go(n + 1, value, acc)
      }
    }
    val initialSet: mutable.Set[Int] = mutable.Set(initialState)
    println(go(2, initialState, initialSet))
  }

}


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

int main() {

    string s;
    cin >> s;
    int c[2];
    c[0] = 0;
    c[1] = 0;
    for (int i=0; i<s.size(); i++) {
        if (s[i] == '0') c[0]++;
        else c[1]++;
    }
    cout << 2 * min(c[0], c[1]);

}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

int main(){
	int N, W;
	long long dp[101][500];
	while(cin >> N >> W){
		vector<int> w(N), v(N);
		for(int i=0;i<N;i++){
			cin >> w[i] >> v[i];
		}
		int w1 = w[0];
		for(int i=0;i<N;i++) w[i] -= w1;
		long long res = 0;
		for(int u=1;u<=N;u++){
			long long rest = W - (long long)u * w1;
			if(rest < 0) break;
			rest = min(rest, 499LL);
			memset(dp, -1, sizeof(dp));
			dp[0][0] = 0;
			for(int i=0;i<N;i++){
				for(int num=u-1;num>=0;num--){
					for(int j=rest;j>=0;j--){
						if(dp[num][j] == -1) continue;
						if(j + w[i] > rest) continue;
						dp[num+1][j+w[i]] = max(dp[num+1][j+w[i]], dp[num][j]+v[i]);
					}
				}
			}
			for(int i=0;i<500;i++) res = max(res, dp[u][i]);
		}
		cout << res << endl;
	}
}



Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
b = 0

for i in range(N):
    if A[i] - B[i] >= 0:
        ans += B[i]
    else:
        if A[i + 1] - (B[i] -A[i]) >= 0:
            ans += B[i]
            A[i + 1] -= (B[i] -A[i])
        else:
            ans += A[i] + A[i + 1]
            A[i + 1] = 0

print(ans)

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

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

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
    ll n,m; std::cin >> n >> m;
    std::vector<ll> h(n);
    std::map<int, std::set<int>> path;
    REP(i,n)std::cin >> h[i];
    REP(i,m) {
        int a, b; std::cin >> a >> b;
        path[a-1].insert(b-1);
        path[b-1].insert(a-1);
    }

    // std::cout << "path" << "\n";
    // REP(i,n) {
    //     std::cout << "i " << i << " item ";
    //     // for(auto j : path[i]) std::cout << j << " ";
    //     std::cout  << "\n";
    // }
    // REP(i,n) {
    //     auto temp = path[i];
    //     sort(ALL(temp));
    //     temp.erase(std::unique(ALL(temp),temp.end()));
    //     path[i] = temp;
    // }

    ll ans = 0;

    REP(i,n) {
        bool flag = true;
        for (auto temp : path[i]) {
            ll now_height = h[i];
            ll comp_height = h[temp];
            if (now_height <= comp_height) {
                flag = false;
                break;
            }
        }
        if (flag) {
            ans++;
            // std::cout << "i " << i << "\n";
        }
    }
    std::cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 22796