akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
//        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
//        String s = sc.next();
//        Long x = sc.nextLong();
        String s = a+""+b+""+c;
        if(s.equals("557")||s.equals("575")||s.equals("755")){
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }
}


Measured memory_bytes: 21844
/* モイ！iPhoneから配信中！ */

#include <cstdio>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    while (1) {
        int i;
        int sum, now_min;
        vector<int> points;
        vector<int> line_y[1000];
        int direction_x[1000][1000];
        int get_point[1000];
        int one2one[1000][1000];
        vector<int> can_change[1000];
        int n, m, h, k;
    
        scanf("%d %d %d %d", &n, &m, &h, &k);
        if (n == 0 && m == 0) return 0;

        for (i=0;i<n;i++) {
            int j;
            for (j=0;j<h;j++) {
                one2one[i][j] = -1;
            }
        }
    
        for (i=0;i<n;i++) {
            int s;
    
            scanf("%d", &s);
            points.push_back(s);
        }
    
        for (i=0;i<m;i++) {
            int a, b;
    
            scanf("%d %d", &a, &b);
            a--;
            b--;
    
            line_y[a].push_back(b);
            line_y[a+1].push_back(b);
            direction_x[a][b] = a+1;
            direction_x[a+1][b] = a;
        }
    
        for (i=0;i<n;i++) {
            sort(line_y[i].begin(), line_y[i].end());
        }
    
        for (i=0;i<n;i++) {
            int pos_x = i;
            int pos_y = -1;
            vector<int>::iterator ind;
    
            while (1) {
                ind = upper_bound(line_y[pos_x].begin(), line_y[pos_x].end(), pos_y);
                if (ind == line_y[pos_x].end()) {
                    get_point[i] = points[pos_x];
                    break;
                } else {
                    pos_y = *ind;
                    if (one2one[pos_x][*ind] != -1 && one2one[direction_x[pos_x][pos_y]][*ind] == -1) {
                        can_change[one2one[pos_x][*ind]].push_back(i);
                        can_change[i].push_back(one2one[pos_x][*ind]);
                    } else {
                        one2one[direction_x[pos_x][pos_y]][*ind] = i;
                    }
    
                    pos_x = direction_x[pos_x][pos_y];
                }
            }
        }
    
        sum = 0;
        now_min = 0;
        for (i=0;i<k;i++) {
            sum += get_point[i];
            vector<int>::iterator it = can_change[i].begin();
            while (it != can_change[i].end()) {
                if (*it >= k && (get_point[*it] - get_point[i]) < now_min) {
                    now_min = (get_point[*it] - get_point[i]);
                }
                it++;
            }
        }
    
        printf("%d\n", sum + now_min);
    }
}

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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    while (true){
        C -= B;
        if (C <= 0){
            cout << "Yes" << endl;
            break;
        }
        A -= D;
        if (A <= 0){
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 3536
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;
const int MAX_V= 3002;
 
struct edge{
  int to,cap,cost,rev;
  edge(int to,int cap,int cost,int rev) :
    to(to),cap(cap),cost(cost),rev(rev) {}
};
  
vector<edge> G[MAX_V];
int dist[MAX_V];
int prevv[MAX_V],preve[MAX_V];
  
void add_edge(int from,int to,int cap,int cost){
  G[from].push_back(edge(to,cap,cost,G[to].size()));
  G[to].push_back(edge(from,0,-cost,G[from].size()-1));
}

int min_cost_flow(int s,int t,int f){
  int res = 0;
  while(f>0){
    fill(dist,dist+MAX_V,MAX); dist[s] = 0;
    bool update=true;
    while(update){
      update=false;
      for(int v=0; v<MAX_V; v++){
        if(dist[v]==MAX) continue;
        for(int i=0; i<(int)G[v].size(); i++){
          edge &e=G[v][i];
          if(e.cap>0 && dist[e.to]>dist[v]+e.cost){
            dist[e.to]=dist[v]+e.cost;
            prevv[e.to]=v; preve[e.to]=i; update=true;
          }
        }
      }
    }
    if(dist[t]==MAX) return -1;
    int d = f;
    for(int v=t; v!=s; v=prevv[v]){
      d=min(d,G[prevv[v]][preve[v]].cap);
    }
    f-=d;res+=d*dist[t];
    for(int v=t; v!=s; v=prevv[v]){
      edge &e=G[prevv[v]][preve[v]];
      e.cap-=d;G[v][e.rev].cap+=d;
    }
  }
  return res;
}

void Main() {
  int n;
  R n;
  int a[n],b[n];
  set<int> s;
  map<int,int> m;
  rep(i,n) {
    cin >> a[i] >> b[i];
    s.in(a[i]);
    s.in(b[i]);
  }
  tr(it,s) {
    int k=m.size();
    m[*it]=k;
    add_edge(n+k,3001,1,0);
  }
  ll ans=0;
  rep(i,n) {
    add_edge(i,n+m[a[i]],1,a[i]);
    add_edge(i,n+m[b[i]],1,b[i]);
    add_edge(i,3001,1,a[i]+b[i]);
    add_edge(3000,i,1,0);
    ans+=a[i]+b[i];
  }
  pr(ans-min_cost_flow(3000,3001,n));
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 3704
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

int root(int arr[],int i){
    while(arr[i]!=i){
         arr[i]=arr[arr[i]];
        i=arr[i];
    }
    return i;
}
void Union(int arr[],int Size[],int a,int b){
int rootA=root(arr,a);
int rootB=root(arr,b);
if(Size[rootA]<Size[rootB]){
    arr[rootA]=arr[rootB];
    Size[rootB]+=Size[rootA];
}else{
arr[rootB]=arr[rootA];
Size[rootA]+=Size[rootB];
}
}
bool findRoot(int a,int b,int arr[]){
 if(root(arr,a)==root(arr,b))return true;
 else return false;
}
 vector<vector<int> >adj(105);
bool nCyc=false;
/*void dijkstra(int v,long long dis[]){
dis[v]=0;
multiset<pair<int,int> >s;
s.insert({0,v});
while(!s.empty()){
    pair<int,int>p= *s.begin();
    s.erase(s.begin());
    int x=p.second;
  if(vis[x])continue;
    vis[x]=1;
    for(int i=0;i<adj[x].size();i++){
        int e=adj[x][i].first,w=adj[x][i].second;
      //  cout<<dis[e]<<" "<<dis[x]+w<<endl;
        if(dis[e]>dis[x]+w){
            dis[e]=dis[x]+w;
            s.insert(make_pair(dis[e],e));
        }
    }
}
}*/
/*void bfs(int s){
    queue<int>q;
    q.push(s);
    while(!q.empty()){
        int v=q.front();
        q.pop();
        for(int i=0;i<adj[v].size();i++){
            if(!vis[adj[v][i]]){
                 q.push(adj[v][i]);
                 vis[adj[v][i]]=1;
            }
        }
    }
}*/
int vis[55][55];
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
/*bool isVal(int i,int j){
      if(i<0 || j<0 || j>=m || i>=n)return false;
      return true;
}*/
/*void dfs(int i,int j) {

    if(!isVal(i,j) || vis[i][j] || arr[i][j]=='#')return;
      vis[i][j]=1;
	  if(arr[i][j]=='G'){
	  check++;
	  }
	  if(arr[i][j]=='B'){
        b=1;
        return;
	  }
	for(int k=0;k<4;k++){
     int pos1=i+dx[k],pos2=j+dy[k];
   //  cout<<pos1<<" "<<pos2<<endl;
     if( isVal(pos1,pos2) && (arr[pos1][pos2]=='#'))continue;
               dfs(pos1,pos2);
	}
}
void dfs2(int i,int j){
 if(isVal(i,j)==false || arr[i][j]!='.')return;
  arr[i][j]='#';
}*/
/*
double prim(int x){
    priority_queue<pair<double,int>,vector<pair<double,int> >,greater<pair<double,int> > >q;
    double min_cost=0.0;
    pair<double,int>p;
     q.push(make_pair(0.0,x));
     while(!q.empty()){
      p=q.top();
      q.pop();
      x=p.second;
      if(vis[x])continue;
      min_cost+=p.first;
      vis[x]=1;
      for(int i=0;i<adj[x].size();i++){
         int y=adj[x][i].second;
         if(!vis[y]){
            q.push(adj[x][i]);
        }
      }
     }
   return min_cost;
}*/
int n,m;
char arr[1005][1005];
int dp[1005][1005];
int solve(int i,int j){
    if(arr[i][j]=='#' || i==n || j==m)return 0;
    if(i==n-1 && j==m-1)return 1;
    if(dp[i][j]!=-1)return dp[i][j];
    int ans=solve(i,j+1)%1000000007;
    ans+=solve(i+1,j)%1000000007;
    return dp[i][j]=ans%1000000007;
}
int freq[200005],check[100005];
int main()
{
    cin>>n>>m;
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
           cin>>arr[i][j];
    cout<<solve(0,0);
return 0;
}


Measured memory_bytes: 8620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int n, a, b, c;
int ans = inf;

void dfs(int cost, vector<int> l) {
    rep(i, sz(l)) rep(j, sz(l)) rep(k, sz(l)) {
        if (i == j || j == k || k == i) continue;
        chmin(ans, cost + abs(a - l[i]) + abs(b - l[j]) + abs(c - l[k]));
    }
    rep(i, sz(l)) rep3(j, i + 1, sz(l)) {
        vector<int> nxt;
        rep(k, sz(l)) if (k != i && k != j) nxt.eb(l[k]);
        nxt.eb(l[i] + l[j]);
        if (cost + 10 < ans) dfs(cost + 10, nxt);
    }
    
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n >> a >> b >> c;
    vector<int> l;
    rep(i, n) { int x; cin >> x; l.eb(x); }
    dfs(0, l);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using vec_i = std::vector<int>;
using vec_ll = std::vector<ll>;
using vec_ld = std::vector<ld>;

#define in(i) int i; cin >> i
#define in_ll(i) ll i; cin >> i
#define in_ld(i) ll i; cin >> i
#define in_c(c) char c; cin >> c
#define in_str(s) std::string s; cin >> s

#define vec_in(v, n)    auto v=vec_i(n); for(auto &x:v){cin>>x;}
#define vec_in_ll(v, n) auto v=vec_ll(n);for(auto &x:v){cin>>x;}
#define vec_in_ld(v, n) auto v=vec_ld(n);for(auto &x:v){cin>>x;}

#define print(x)   cout << x
#define println(x) cout << x << "\n"

#define rep(i, n) for (auto i = 0; i < n; ++i)

using namespace std;
int main () {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    in(N);
    map<int, int> A;
    ll sum = 0;
    rep(i, N) {
        in(a);
        A[a]++;
        sum += a;
    }
    in(Q);
    rep(i, Q) {
        in(b);
        in(c);
        int nb = A[b];
        sum += nb * c - nb * b;
        A[c] += A[b];
        A[b] = 0;
        println(sum);
    }

    return 0;
}


Measured memory_bytes: 8008
import numpy as np

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

sums = np.zeros(n // 2 + n % 2 + 1, dtype=np.uint32)

mod = int(1e9 + 7)

ans = 0

for i in range(len(sums)):
    sums[i] = (((2 * n - i + 1) * i) // 2 - (i * (i - 1)) // 2 + 1) % mod

for i in range(k, n + 2, 1):
    if i > (n // 2 + n % 2):
        ans += sums[n + 2 - (i + 1)]
        ans %= mod
    else:
        ans += sums[i]
        ans %= mod

print(ans)


Measured memory_bytes: 27248
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  vector<int> a(n);
  int ma1 = 0, ma2 = 0;
  int argma = 0;
  for(int i=0;i<n;++i) {
    cin >> a[i];
    if(a[i] >= ma1) {
      ma2 = ma1;
      ma1 = a[i];
      argma = i;
    } else if(a[i] >= ma2) {
      ma2 = a[i];
    }
  }
  for(int i=0;i<n;++i) {
    if(i == argma) cout << ma2 << endl;
    else cout << ma1 << endl;
  }
}


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

// #define MULTI_TEST
#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#define pc(...)
#endif

#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
auto TimeStart = chrono::steady_clock::now();
auto seed = TimeStart.time_since_epoch().count();
std::mt19937 rng(seed);
using ll = long long;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using Random = std::uniform_int_distribution<T>;

const int NAX = 2e5 + 5, MOD = 1000000007;

const int sz = 20;

int dp[1 << sz][sz];
int a[sz], b[sz];

class Solution
{
private:
public:
    Solution() {}
    ~Solution() {}
    void solveCase()
    {
        int n;
        cin >> n;
        for (size_t i = 0; i < n; i++)
            cin >> a[i];
        for (size_t i = 0; i < n; i++)
            cin >> b[i];
        memset(dp, -1, sizeof dp);
        for (size_t i = 0; i < n; i++)
            dp[1 << i][i] = 0;
        for (int mask = 1; mask < (1 << n); mask++)
        {
            int c = __builtin_popcount(mask);
            for (int i = 0; i < n; i++)
            {
                if (!(mask >> i & 1) || dp[mask][i] == -1)
                    continue;
                int w = (i % 2) == (c % 2) ? b[i] : a[i];
                int cost = c;
                for (int j = 0; j < n; j++)
                    if (mask >> j & 1)
                        cost--;
                    else
                    {
                        int v = j % 2 == c % 2 ? a[j] : b[j];
                        if (w <= v)
                        {
                            int vl = dp[mask][i] + cost;
                            if (dp[mask | 1 << j][j] == -1 || dp[mask | 1 << j][j] > vl)
                                dp[mask | 1 << j][j] = vl;
                        }
                    }
            }
        }
        int ret = -1;
        for (int i = 0; i < n; i++)
            if (dp[(1 << n) - 1][i] != -1)
                if (ret == -1 || ret > dp[(1 << n) - 1][i])
                    ret = dp[(1 << n) - 1][i];
        cout << ret << '\n';
    }
};

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
#ifdef MULTI_TEST
    cin >> t;
#endif
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef TIME
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}

Measured memory_bytes: 82176
n,m = map(int,input().split())
l = []
for i in range(m):
    l.append([i]+list(map(int, input().split())))
l = sorted(l, key=lambda x:(x[1],x[2]))
ind = 0
id = []
for i in range(n):
    nature = i+1
    j = 1
    while ind<len(l) and l[ind][1]==nature:
        id.append([l[ind][0],nature,j])
        j+=1
        ind+=1
id = sorted(id, key=lambda x:x[0])
for i in range(len(id)):
    print('{:0=6}'.format(id[i][1])+'{:0=6}'.format(id[i][2]))


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

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

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

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

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

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

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

const ll maxf = 10000000;
ll fact[maxf+5];
ll ifact[maxf+5];

void fact_init(){
  fact[0] = 1;
  for(ll i=1; i<=maxf; i++) fact[i] = (fact[i-1] * i) % MOD;
  ifact[maxf]=modpow(fact[maxf],MOD-2);
  for(ll i=maxf; i>=1; i--) ifact[i-1] = (ifact[i] * i) % MOD;
}

ll comb(ll n, ll r){
  if(n<r || n<0 || r<0) return 0;
  if(fact[0] == 0) fact_init();
  return ((fact[n] * ifact[n-r]) % MOD * ifact[r]) % MOD;
}

ll naive_comb(ll n, ll r){
  ll res = 1;
  for (ll i = n; i > n - r; i--) res = res * i % MOD;
  for (ll i = 1; i <= r; i++) res = (res * modpow(i, MOD-2)) % MOD;
  return res;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n,m; cin>>n>>m;
  
  vll x(n), y(m);
  rep(i,n) cin>>x[i];
  rep(i,m) cin>>y[i];
  vll d1(n-1), d2(m-1);
  rep(i,n-1) d1[i]=abs(x[i]-x[i+1]);
  rep(i,m-1) d2[i]=abs(y[i]-y[i+1]);
  
  n--, m--;
  
  ll sum_x=0, sum_y=0;
  rep(i,n){
    ll l=i+1, r=n-i-1;
    ll cnt=(l+l*r)%MOD;
    sum_x+=d1[i]*cnt%MOD;
    sum_x%=MOD;
  }
  rep(i,m){
    ll l=i+1, r=m-i-1;
    ll cnt=(l+l*r)%MOD;
    sum_y+=d2[i]*cnt%MOD;
    sum_y%=MOD;
  }
  
  // cout<<sum_x<<endl;
  // cout<<sum_y<<endl;
  
  ll ans=sum_x*sum_y%MOD;
  cout<<ans<<endl;
  
  
  
}

Measured memory_bytes: 6300
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    print((n>>1)+(n&1))
    return

#Solve
if __name__ == "__main__":
    solve()


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

class UnionFind{
    vector<int>p,sz;
public:
    UnionFind(int n){
        p.resize(n,-1);
        sz.resize(n,1);
    }
    int find(int x){
        if(p[x] == -1)return x;
        else return p[x] = find(p[x]);
    }
    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y)return;
        if(sz[x] > sz[y])swap(x,y);
        p[x] = y;
        sz[y] += sz[x];
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
    int size(int x){
        return sz[find(x)];
    }
};

int main(){
    int n,m;
    cin>>n>>m;
    UnionFind uf(n);
    vector<int>a(m),b(m);
    rep(i,m){
        cin>>a[i]>>b[i];
        a[i]--; b[i]--;
    }
    vector<ll>ans;
    ll now=(ll)n*(n-1)/2;
    ans.push_back(now);
    for(int i=m-1; i>=0; --i){
        if(!uf.same(a[i],b[i])){
            ans.push_back(now-(ll)uf.size(a[i])*uf.size(b[i]));
            now-=(ll)uf.size(a[i])*uf.size(b[i]);
        }
        else{
            ans.push_back(now);
        }
        uf.unite(a[i],b[i]);
    }
    reverse(ans.begin(),ans.end());
    for(int i=1; i<ans.size(); ++i)cout<<ans[i]<<endl;
}

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

// int/long:            -2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:      -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define MOD 1000000007

#define Rep0(i, n)      for (auto i=0; i<n; i++)
#define Rep1(i, n)      for (auto i=1; i<=n; i++)
#define Sort(P) sort(P.begin(), P.end())
#define Rev(P)  reverse(P.begin(), P.end())

int     main() {
        string S;
        cin >>S;
        if (S=="ABC")
                cout <<"ARC" <<endl;
        else
                cout <<"ABC" <<endl;
        return 0;
}


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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define size_of(a) (int)(a).size()
#define allof(a) (a).begin(),(a).end()

int to[8][3] = {
	{1, 4, -1},
	{0, 2, 5},
	{1, 3, 6},
	{2, 7, -1},
	{0, 5, -1},
	{1, 4, 6},
	{2, 5, 7},
	{3, 6, -1},
};

struct State {
	int step, p[8];
	
	int zero() {
		for_(i,0,8) if (p[i] == 0) return i;
		return -1;
	}
	
	int getHash() {
		int hash = 0;
		for_(i,0,8) hash = 10 * hash + p[i];
		return hash;
	}
};

int main() {
	State ini;
	ini.step = 0;
	for_(i,0,8) ini.p[i] = i;
	
	map< int, int > hash;
	hash[ini.getHash()] = 0;
	
	queue< State > que;
	que.push(ini);
	
	while (!que.empty()) {
		State s = que.front(); que.pop();
		
		s.step++;
		
		int t = s.zero();
		
		for_(i,0,3) {
			int nxt = to[t][i];
			
			if (nxt != -1) {
				swap(s.p[t], s.p[nxt]);
				
				int hs = s.getHash();
				
				if (hash.find(hs) == hash.end()) {
					que.push(s);
					hash[hs] = s.step;
				}
				
				swap(s.p[t], s.p[nxt]);
			}
		}
	}
	
	int dumy;
	while (cin >> dumy) {
		ini.p[0] = dumy;
		for_(i,1,8) cin >> ini.p[i];
		cout << hash[ini.getHash()] << endl;
	}
}

Measured memory_bytes: 2204
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <iomanip>
using namespace std;
int main(){
	int h,w;
	char c[400][400];
	cin>>h>>w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>c[i][j];
		}
	}
	int dx[4]={-1,0,1,0};
	int dy[4]={0,-1,0,1};
	int cnt=0;
	int id[400][400];
	bool used[400][400]={};
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(used[i][j]){
				continue;
			}
			id[i][j]=cnt;
			used[i][j]=1;
			queue<pair<int,int> > que;
			que.push(make_pair(i,j));
			while(!que.empty()){
				int x=que.front().first;
				int y=que.front().second;
				que.pop();
				for(int i=0;i<4;i++){
					int nx=x+dx[i];
					int ny=y+dy[i];
					if(0<=nx&&nx<h&&0<=ny&&ny<w&&!used[nx][ny]){
						if(c[nx][ny]!=c[x][y]){
							used[nx][ny]=1;
							id[nx][ny]=cnt;
							que.push(make_pair(nx,ny));
						}
					}
				}
			}
			cnt++;
		}
    }
	long long sum[160001][2]={};
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(c[i][j]=='#'){
				sum[id[i][j]][0]++;
			}else{
				sum[id[i][j]][1]++;
			}
		}
	}
	long long ans=0;
	for(int i=0;i<cnt;i++){
		ans+=sum[i][0]*sum[i][1];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3712
// Bismillahir Rahmanir Rahim
//============================
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define endl        "\n"
#define infL        LLONG_MAX
#define infI        INT_MAX
#define pb          push_back
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define MAX         100
#define yes         cout<<"YES"<<endl
#define no          cout<<"NO"<<endl
#define bye         return 0
#define PEREGRINE_FALCON {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

ll mod=1e9+7;

int main()
{
      PEREGRINE_FALCON
      //freopen("inputNew.txt", "r", stdin);

      ll tt=1;
      //cin>>tt;
      while(tt--){
            ll n,a,b,mn,mx,temp,cnt;
            string str;
            cin>>str;
            ll len=str.length();
            if(str[len-1]=='s') str+="es";
            else str+="s";

            cout<<str<<endl;
      }


      bye;
}



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

int main()
{

    int N, M, C;
    cin >> N >> M >> C;
    int A[30][30] = {0};
    int B[30] = {0};
    for (int i = 0; i < M; i++)
    {
        int temp;
        cin >> temp;
        B[i] = temp;
    }
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < M; j++)
        {
            int temp;
            cin >> temp;
            A[i][j] = temp;
        }
    }
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int temp = C;
        for (int j = 0; j < M; j++)
        {
            temp += A[i][j] * B[j];
        }
        if (temp > 0)
        {
            ans++;
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
n = int(input())
s = input()
S = ''
list = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']*2
 
for i in s:
  S += list[list.index(i) + n]
  
print(S)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<set>
#include<algorithm>
using namespace std;
typedef long long ll;
set<ll> s;
ll n,x;
bool ok;
inline void read(ll &x)
{
	ll f;char c;
	for (f=1,c=getchar();c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for (x=0;c<='9'&&c>='0';c=getchar()) x=x*10+(c&15);x*=f;
}
int main()
{
	ok=true;
	read(n);
	for(ll i=1;i<=n;i++)
	{
		read(x);
		if(s.count(x))
		{
			ok=false;
			break;
		}
		s.insert(x);
	}
	if(ok) puts("YES");
	else puts("NO");
	return 0;
}



Measured memory_bytes: 9600
<?php
 
function input($func = null)
{
    if ($func === null) {
        return trim(fgets(STDIN));
    } else {
        return $func(trim(fgets(STDIN)));
    }
}

function input_array($func = null)
{
    if ($func === null) {
        return explode(' ', input());
    } else {
        return array_map(function ($v) use ($func) {
            return $func($v);
        }, explode(' ', input()));
    }
}

list($N, $M) = input_array('intval');

$As = input_array('intval');

$total_vote_count = array_sum($As);

$popular_candidate_count = count(
    array_filter(
        $As,
        function ($A) use ($M, $total_vote_count) {
            return $A * 4 * $M >= $total_vote_count;
        }
    )
);

if ($popular_candidate_count >= $M) {
    echo "Yes\n";
} else {
    echo "No\n";
}


Measured memory_bytes: 4604
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    while(true){
        int n;
        cin >> n;
        if(n == 0){
            break;
        }
        vector<int> a(n);
        rep(i, n) cin >> a[i];

        int ans = INF;
        rep(i, n){
            rep(j, n){
                if(i == j){
                    continue;
                }

                int tmp = abs(a[i] - a[j]);
                if(tmp < ans){
                    ans = tmp;
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int N;
  cin>>N;
  vector<int> A(N),B(N);
  for(int i=0;i<N;i++)
    cin>>A[i],B[i]=A[i];
  sort(A.begin(),A.end());
  int cnt=0;
  for(int i=0;i<N;i++)
    if(A[i]!=B[i])cnt++;
  puts(cnt<=2?"YES":"NO");
}

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

int main()
{
	int N;
	scanf("%d", &N);
	int d[N];
	int i, j, k;
	for (i = 0; i < N; i++)
		scanf("%d", &d[i]);

	for (i = 0; i < N; i++) {
		for (j = i + 1; j < N; j++) {
			if (d[i] > d[j]) {
				int tmp = d[i];
				d[i] = d[j];
				d[j] = tmp;
			}
		}
	}

	int step = 1;
	for (i = 1; i < N; i++) {
		if (d[i] == d[i-1])
			continue;
		else
			step++;
	}

	printf("%d\n", step);

	return 0;
}


Measured memory_bytes: 128
while True:
    try:
        a,b,c,d,e,f = map(int, raw_input().split())
        
        x = float(c*e-b*f)/(a*e-b*d)
        y = float(-d*c+a*f)/(a*e-b*d)
        print '%.3f %.3f' %(round(x,3) + 0, round(y,3) + 0)
        
    except EOFError:
        break

Measured memory_bytes: 4236
#include <stdio.h>

int main(void)
{
	int a, b, c;
	int i;
	int n = 0;	//?´???°?????°?????????.

	scanf("%d %d %d", &a, &b, &c);

	for (i = a; i <= b; i++)
	{
		if (c % i == 0)
			n++;
	}

	printf("%d\n", n);

	return 0;
}

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

int main() {
  int x, y;
  cin >> x;
  cin >> y;
  while ((x != 0 || y != 0)) {
    if (x > y) {
      cout << y << " " << x << endl;
    } else {
      cout << x << " " << y << endl;
    }
    cin >> x;
    cin >> y;
  }
}


Measured memory_bytes: 3080
#include<stdio.h>
int main(void){
    int n,k,x,y,ans=0;
    scanf("%d %d %d %d",&n,&k,&x,&y);
    if(n>k)
    ans=x*k+y*(n-k);
    else
    ans=x*n;
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const long long mods=1000000007ll;
long long dp[2050][2050];
long long sum[2050][2050];
long long a[2050],b[2050];
int main(){
	ios::sync_with_stdio(false);
	long long n=0,m=0;
	cin>>n>>m;
	for(long long i=1;i<=n;i++)
		cin>>a[i];
	for(long long j=1;j<=m;j++)
		cin>>b[j];
	for(long long i=1;i<=n;i++)
		for(long long j=1;j<=m;j++){
			if(a[i]==b[j])dp[i][j]=(sum[i-1][j-1]+1)%mods;
			sum[i][j]=(dp[i][j]+sum[i][j-1]+sum[i-1][j]+mods-sum[i-1][j-1])%mods;
		}
	cout<<sum[n][m]+1<<endl;
}

Measured memory_bytes: 65792
#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 1000 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n, res;

bool read() {
    if (!(cin >> n))
        return false;

    return true;
}

void solve() {
    for (int x; n > 0; --n, cin >> x, res |= x) { }
    cout << ((res & 1) ? "first\n" : "second\n");
}
 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 256
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let (a, b) = read_touple::<i64>();
    let ans = a*b / gcd(a, b);
    println!("{}", ans);
}

fn gcd(a: i64, b: i64) -> i64 {
  if a < 0 {
    gcd(-a, b);
  }

  if b < 0 {
    gcd(a, -b);
  }

  if b > a {
    gcd(b, a);
  }

  if a % b == 0 {
    return b;
  }

  let r:i64 = a % b;

  return gcd(b, r);
}


Measured memory_bytes: 4352
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

int n, m;
int r;
vector<int> e[100010];
vector<int> topo;
// bool used[100010];
int in[100010];
int parent[100010];

void init() {

}

// void dfs(int i) {
//   if (used[i]) return;
//   used[i] = true;
//   REP(j, SZ(e[i])) dfs(e[i][j]);
//   topo.push_back(i);
// }
//
// void makeTopo() {
//   topo.clear();
//   REP(i, n) dfs(i);
//   reverse(ALL(topo));
// }

void input() {
  REP(i, 100010) {
    e[i].clear();
    parent[i] = -1;
    in[i] = 0;
  }
  cin >> n >> m;
  REP(i, n+m-1) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    e[a].push_back(b);
    in[b]++;
  }
  queue<int> q;
  REP(i, n) if (in[i] == 0) q.push(i);
  while(!q.empty()) {
    int i = q.front();
    topo.push_back(i);
    q.pop();
    REP(j, SZ(e[i])) {
      in[e[i][j]]--;
      if (in[e[i][j]] == 0) {
        q.push(e[i][j]);
        parent[e[i][j]] = i;
      }
    }
  }
  // REP(i, n) {
  //   REP(j, SZ(e[topo[i]])) {
  //     parent[e[topo[i]][j]] = topo[i];
  //   }
  // }
  REP(i, n) cout << parent[i] + 1 << endl;
}

void solve() {

}

int main() {
	init();
	input();
	solve();
	return 0;
}


Measured memory_bytes: 7544
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
 
using namespace std;
int MOD = 1000000007;
int gcd(int a,int b){
    if(a < b){
        int c = a;
        a = b;
        b = c;
    }
    if(a%b == 0) return b;
    else return gcd(b,a%b);
}
signed main(){

    int n;
    cin >> n;
    if(n == 3){
        cout << 2 << " " << 5 << " " << 63 << endl;
        return 0;
    }else if(n == 4){
        cout << 2 << " " << 5 << " " << 20 << " " << 63 << endl;
        return 0;
    }else if(n == 5){
        cout << 2 << " " << 3 << " " << 4 << " " << 6 << " " << 9 << endl;
        return 0;
    }else if(n == 6){
        cout << 2 << " " << 3 << " " << 4 << " " << 8 << " " << 9 << " " << 10 << endl;
        return 0;
    }else if(n == 7){
        cout << 6 << " " << 2 << " " << 3 << " " << 4 << " " << 8 << " " << 9 << " " << 10 << endl;
        return 0;
    }
    int x = n/8;
    rep(i,x){
        cout << 12*i+2 << " ";
        cout << 12*i+3 << " ";
        cout << 12*i+4 << " ";
        cout << 12*i+6 << " ";
        cout << 12*i+8 << " ";
        cout << 12*i+9 << " ";
        cout << 12*i+10 << " ";
        cout << 12*i+12 << " ";
    }
    if(n%8 == 1){
        cout << 12*x+6 << " ";
    }else if(n%8 == 2){
        cout << 12*x+2 << " ";
        cout << 12*x+4 << " ";        
    }else if(n%8 == 3){
        cout << 12*x+2 << " ";
        cout << 12*x+4 << " ";        
        cout << 12*x+6 << " ";        
    }else if(n%8 == 4){
        cout << 12*x+2 << " ";
        cout << 12*x+4 << " ";        
        cout << 12*x+3 << " ";        
        cout << 12*x+9 << " ";        
    }else if(n%8 == 5){
        cout << 12*x+2 << " ";
        cout << 12*x+4 << " ";        
        cout << 12*x+3 << " ";        
        cout << 12*x+9 << " ";        
        cout << 12*x+6 << " ";        
    }else if(n%8 == 6){
        cout << 12*x+2 << " ";
        cout << 12*x+4 << " ";        
        cout << 12*x+3 << " ";        
        cout << 12*x+9 << " ";       
        cout << 12*x+8 << " ";       
        cout << 12*x+10 << " ";       
    }else if(n%8 == 7){
        cout << 12*x+2 << " ";
        cout << 12*x+4 << " ";        
        cout << 12*x+3 << " ";        
        cout << 12*x+9 << " ";       
        cout << 12*x+8 << " ";       
        cout << 12*x+10 << " ";       
        cout << 12*x+6 << " ";       
    }


    return 0;   
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://arc096.contest.atcoder.jp/tasks/arc096_b


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


typedef struct {
	int men[6];
}dice;



void dice_change(dice *d, char c, int a[])
{
	int j;
	for(j=0;j<6;j++)
		a[j] = d->men[j];

 if(c == 'E')
		{
		d->men[0] = a[3];
		d->men[1] = a[1];
		d->men[2] = a[0];
		d->men[3] = a[5];
		d->men[4] = a[4];
		d->men[5] = a[2];
		}
		
		else if(c == 'W')
		{
		d->men[0] = a[2];
		d->men[1] = a[1];
		d->men[2] = a[5];
		d->men[3] = a[0];
		d->men[4] = a[4];
		d->men[5] = a[3];
		}
		
		else if(c == 'S')
		{
		d->men[0] = a[4];
		d->men[1] = a[0];
		d->men[2] = a[2];
		d->men[3] = a[3];
		d->men[4] = a[5];
		d->men[5] = a[1];
		}
		else if(c == 'N')
		{
		d->men[0] = a[1];
		d->men[1] = a[5];
		d->men[2] = a[2];
		d->men[3] = a[3];
		d->men[4] = a[0];
		d->men[5] = a[4];
		}

}

int main()
{

	int i;
	int dice_copy[6];
	dice s;
	char way[100];


	for (i = 0; i < 6; i++)
		scanf("%d", &s.men[i]);
	scanf("%s", way);

	for(i = 0;i < strlen(way);i++){
		dice_change(&s,way[i],dice_copy);
	}
	printf("%d\n",s.men[0]);

	return 0;
}


Measured memory_bytes: 2104
R_1 = list(map(int,input().split()))
R_2 = list(map(int,input().split()))
R_3 = list(map(int,input().split()))

C_1 = [R_1[0],R_2[0],R_3[0]]
C_2 = [R_1[1],R_2[1],R_3[1]]
C_3 = [R_1[2],R_2[2],R_3[2]]

S_R = [R_1[2],R_2[1],R_3[0]]
S_L = [R_1[0],R_2[1],R_3[2]]

n = int(input())
for i in range(n):
    tmp = int(input())
    R_1 = [j for j in R_1 if j != tmp]
    R_2 = [j for j in R_2 if j != tmp]
    R_3 = [j for j in R_3 if j != tmp]
    C_1 = [j for j in C_1 if j != tmp]
    C_2 = [j for j in C_2 if j != tmp]
    C_3 = [j for j in C_3 if j != tmp]
    S_R = [j for j in S_R if j != tmp]
    S_L = [j for j in S_L if j != tmp]

if len(R_1)*len(R_2)*len(R_3)*len(C_1)*len(C_2)*len(C_3)*len(S_R)*len(S_L) == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int a, p;
    cin >> a >> p;
    p += a * 3;
    cout << p / 2 << endl;

    return 0;
}


Measured memory_bytes: 888
w, h, n = map(int, input().split())

s = [list(map(int, input().split())) for i in range(n)]

min_x = 0
max_x = w
min_y = 0
max_y = h

for i in range(n):
  if s[i][2] == 1:
    if s[i][0] > min_x:
      min_x = s[i][0]

  elif s[i][2] == 2:
    if s[i][0] < max_x:
      max_x = s[i][0]
      
  elif s[i][2] == 3:
    if s[i][1] > min_y:
      min_y = s[i][1]
      
  else:
    if s[i][1] < max_y:
      max_y = s[i][1]

if (max_x - min_x) > 0 and (max_y - min_y) > 0:
  print((max_x - min_x) * (max_y - min_y))
  
else:
  print(0)


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

using namespace std;

typedef long long ll;
typedef long double ld;
int n, x;
const int mod = (int)1e9 + 7;
const int maxN = 2 * (int)1e5 + 100;
int sum(int a, int b) {
    int s = a + b;
    if (s >= mod) s -= mod;
    return s;
}
int mult(int a, int b) {
    return (1LL * a * b) % mod;
}
int inv2[maxN];
int inv[maxN], fact[maxN], invfact[maxN];
int cnk(int a, int b) {
    if (a < b) return 0;
    return mult(fact[a], mult(invfact[a - b], invfact[b]));
}
int sub(int a, int b) {
    int s = a - b;
    if (s < 0) s += mod;
    return s;
}
int f[maxN], g[maxN];
signed main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    fact[0] = fact[1] = invfact[0] = invfact[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < maxN; i++) {
        inv[i] = mult(inv[mod % i], mod - mod / i);
        fact[i] = mult(fact[i - 1], i);
        invfact[i] = mult(invfact[i - 1], inv[i]);
    }
    inv2[0] = 1;
    for (int i = 1; i < maxN; i++) inv2[i] = mult(inv[2], inv2[i - 1]);
    int b, w;
    cin >> b >> w;
    for (int i = 1; i <= b + w; i++) {
        f[i] = f[i - 1];
        g[i] = g[i - 1];
        if (i > 1) {
            f[i] = sum(f[i], mult(inv2[i - 1], cnk(i - 2, w - 1)));
            g[i] = sum(g[i], mult(inv2[i - 1], cnk(i - 2, b - 1)));
        }
       // cout << f[i] << " " << g[i] << " here" << endl;
        cout << sum(inv2[1], mult(inv2[1], sub(f[i], g[i]))) << '\n';
    }
    return 0;
}

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

int main () {
    int A, B, s;
    string op;
    cin >> A >> op >> B;
    if (op == "+") {
        s = A + B;
    }
    else if (op == "-") {
        s = A - B;
    }
    cout << s << endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
P = tuple(map(lambda x: int(x)-1, input().split()))
C = tuple(map(int, input().split()))
from collections import deque
ans = -2*10**9
for idx, root in enumerate(P):
    scores = [C[root]]
    p = P[root]
    while True:
        scores.append(scores[-1] + C[p])
        p = P[p]
        if p == root:
            break

    sc = scores[-1]
    if sc <= 0:
        if k < len(scores):
            ans = max(ans, max(scores[:k]))
        else:
            ans = max(ans, max(scores))
    else:
        kk, r = divmod(k, len(scores))
        if r == 0:
            ans = max(ans, kk*sc, (kk-1)*sc + max(scores))
        else:
            ans = max(ans, kk*sc + max(scores[:r]))
print(ans)


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

#define f first
#define s second
#define pb push_back
#define all(c) c.begin(),c.end()

#define gi(x) scanf("%d", &x)
#define pi(x) printf("%d", x)
#define gl(x) scanf("%lld", &x)
#define pl(x) printf("%lld", x)
#define sp printf(" ")
#define nl printf("\n")

typedef long long int lld;
typedef long double ldb;

int f[2*100010][30];
int dp[2*100010];
const lld inf = 1e6;
main(){
    string str;
    cin >> str;
    int n = str.size();
    for(int i = 0; i < n; ++i) dp[i] = inf;
    for(int i = 0; i < 26; ++i) f[n][i] = n;
    dp[n+1] = -1;
    for(int i = n-1; i >= 0; --i){
        for(int j = 0; j < 26; ++j) f[i][j] = f[i+1][j];
        f[i][str[i]-'a'] = i;
        for(int j = 0; j < 26; ++j){
            dp[i] = min(dp[f[i][j]+1]+1, dp[i]);
        }
    }
    int pos = 0;
    string ans;
    while(pos < n){
        char curr = 'X';
        for(int i = 0; i < 26; ++i){
            if(dp[pos] == dp[f[pos][i]+1]+1){
                curr = (char)('a'+i);
                pos = f[pos][i]+1;
                break;
            }
        }
        if(curr != 'X') ans = ans + curr;
    }
    cout << ans << endl;
}


Measured memory_bytes: 24836
package main

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

func main() {
	m := uint64(1)
	N := nextInt()

	A := make([]uint64, N)

	max := uint64(1e18)

	for i := 0; i < N; i++ {
		A[i] = uint64(nextInt64())
		if A[i] == 0 {
			fmt.Println(0)
			return
		}
	}

	for i := 0; i < N; i++ {
		ma := m * A[i]
		if ma < m || ma > max {
			fmt.Println(-1)
			return
		}
		m = ma
	}

	fmt.Println(m)
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}


Measured memory_bytes: 6116
// Alapan
// IIITH

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

// data types
#define ll long long int
#define ld long double

//funtion macros


// stl
#define lp(var,start,end) for (ll var = start; var <=end ; ++var)
#define ilp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))

#define mod 1000000007

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

ll min(ll a, ll b){
	if(a<b)return a;
    return b;
}

ll power(ll x, ll y, ll m=mod){
	if(y<0){
		x = power(x,m-2);
		y = -y;
	}
	ll ans=1;
	x = x % m;
	while(y){
		if(y&1) ans = (ans*x)%m;
		y=y/2;
		x=(x*x)%m;
	}
	return ans;
}

ll factorial(ll n, ll m=mod){
    ll ans = 1;
	ll i = 1;
    while(i<=n){
        ans = (ans*i)%m;
        i++;
    }
    return ans;
}

///////////////////////////////////////////////////////////
ll n,m,v,p;
bool f(ll arr[], ll mid){
    // cout << mid << "\n";
    ll temp[n];
    for(ll i=0;i<n;i++){
        temp[i] = arr[i];
    }
    ll val = temp[mid] + m;
    ll i=0;
    ll cnt = (v-1)*m;
    ll more=0;
    ll alreadymore = 0;
    for(ll i=0;i<n;i++){
        if(val < temp[i]) alreadymore++;
        if(alreadymore >= p) return 0;
    }
    while(more < p-1 && i<n){
        if(i!= mid) cnt -= m;
        if(cnt <= 0) return true;
        if(temp[i]+m > val) more++;
        i++;
    }
    if(temp[i] > val) return false;
    while(i<n){
        if(i!=mid) cnt = cnt - min((val-temp[i]),m);
        if(cnt <= 0) return true;
        i++;
    }
    return false;
}
int main(){
    cin >> n >> m >> v >> p;
    ll arr[n];
    for(ll i=0;i<n;i++){
        cin >> arr[i];
    }
    sort(arr,arr+n);
    reverse(arr,arr+n);
    // for(ll i=0;i<n;i++) cout << arr[i] << " ";
    // cout << endl;
    ll l = 0;
    ll r = n-1;
    while(l < r){
        ll mid = l + (r-l+1)/2;
        if(f(arr,mid)) l = mid;
        else r = mid-1;
    }
    cout << l+1 << endl;
	return 0;
}

Measured memory_bytes: 1792