akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int partition(vector<int> &a,int p,int r){
    int x = a[r];
    int i = p-1;
    for(int j=p;j<r;j++){
        if(a[j]<=x){
            i = i+1;
            swap(a[i],a[j]);
        }
    }
    swap(a[i+1],a[r]);
    return i+1;
}
int main(){
    int n;cin >> n;
    vector<int> a(n);
    for(auto &i:a) cin >> i;
    int kizyun = partition(a,0,n-1);
    for(int i=0;i<n;i++){
        if(i!=kizyun) cout << a[i];
        else cout << "[" << a[i] << "]";

        if(i==n-1) cout << endl;
        else cout << " ";
        
    }
}


Measured memory_bytes: 3144
using System;

class BackAndForth {
    static void Main() {
        string input = Console.ReadLine();

        int x_start = int.Parse(input.Split(' ')[0]);
        int y_start = int.Parse(input.Split(' ')[1]);
        int x_goal  = int.Parse(input.Split(' ')[2]);
        int y_goal  = int.Parse(input.Split(' ')[3]);

        int x_difference = x_goal - x_start;
        int y_difference = y_goal - y_start;

        // 往路１
        string path1 = new string('U', y_difference);
        string path2 = new string('R', x_difference);

        // 復路１
        string path3 = new string('D', y_difference);
        string path4 = new string('L', x_difference);

        // 往路２
        string path5 = 'L' + new string('U', y_difference + 1);
        string path6 = new string('R', x_difference + 1) + 'D';

        // 復路２
        string path7 = 'R' + new string('D', y_difference + 1);
        string path8 = new string('L', x_difference + 1) + 'U';

        Console.WriteLine(path1 + path2 + path3 + path4 + path5 + path6 + path7 + path8);
    }
}

Measured memory_bytes: 2776
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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

    vector<char> lr(n, 0);
    for(int i=0; i<n; i++){ cin >> lr[i]; }
    int s=n-1, e=0;
    for(int i=0; i<n; i++){
        if(lr[i]=='>'){
            s=i;
            break;
        }
    }
    for(int i=n-1; i>=0; i--){
        if(lr[i]=='<'){
            e=i;
            break;
        }
    }

    cout << max(e+1, n-s) << endl;
    return 0;
}

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

using namespace std;

int p[20000];
int a[20000], b[20000];

int main() {
    int N; scanf("%d", &N);
    for(int i = 0; i<N; ++i) scanf("%d", p+i);
    a[0] = 1;
    for(int i = 1; i<N; ++i) a[i] = a[i-1]+20000;
    b[N-1] = a[N-1]+20000;
    for(int i = N-2; i>=0; --i) b[i] = b[i+1]+20000;
    for(int i = 0; i<N; ++i)
        a[p[i]-1] += i;
    for(int i = 0; i<N; ++i)
        printf("%d%c", a[i], " \n"[i==N-1]);
    for(int i = 0; i<N; ++i)
        printf("%d%c", b[i], " \n"[i==N-1]);
}


Measured memory_bytes: 896
from collections import Counter

n = int(input())
al = [int(input()) for _ in range(n)]
al_s = sorted(al, reverse=True)
c = Counter(al_s)
ck = list(c.keys())
cv = list(c.values())


for a in al:
    if a == ck[0]:
        if cv[0] == 1:
            print(ck[1])
        else:
            print(ck[0])
    else:
        print(ck[0])



Measured memory_bytes: 27376
#!/usr/bin/env python
#-*- coding: utf-8 -*-

# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_2_A

if __name__ == '__main__':
    a, b = map(int, raw_input().split())
    if a > b:
        print "a > b"
    elif a < b:
        print "a < b"
    else:
        print "a == b"


Measured memory_bytes: 4624
#include<bits/stdc++.h>
using namespace std;
int cnt=-1;
int res=0;
int s[10000];
int main()
{
	int x;
	cin>>x;
	for(int i=0;i<x;i++)
	{
		cin>>s[i];
		cnt=max(cnt,s[i]);
	}
	for(int j=0;j<x;j++)
	{
		res=res+s[j];
	}
	cout<<res-cnt/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
long double EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////////////////

ll po2(ll n){
    return mod(mod(n)*mod(n));
}


int main(){fastio;
    ll n,m;cin>>n>>m;
    ll s,t;cin>>s>>t;
    s--;t--;
    vector<l_l>v[n];
    rep(i,1,m){
        ll u,q,d;cin>>u>>q>>d;u--;q--;
        v[u].pb(l_l(d,q));
        v[q].pb(l_l(d,u));
    }
    ll md[n];fill(md,md+n,inf);
    md[s]=0;
    priority_queue<l_l,vector<l_l>,greater<l_l>>q;
    q.push(l_l(0,s));
    while(!q.empty()){
        l_l t=q.top();q.pop();
        ll nowp=t.second;
        for(auto xx:v[nowp]){
            ll to=xx.second,cost=xx.first;
            if(md[nowp]+cost<md[to]){
                md[to]=md[nowp]+cost;
                q.push(l_l(md[to],to));
            }
        }
    }
    
    
    ll com[n];memset(com,0,sizeof(com));
    com[s]=1;
    vector<l_l>jun;
    rep(i,0,n-1){
        jun.pb(l_l(md[i],i));
    }
    sort(jun.begin(),jun.end());
    rep(i,0,n-1){
        for(auto x:v[jun[i].second]){
            if(md[x.second]==md[jun[i].second]+x.first){
                Add(com[x.second],com[jun[i].second]);
            }
        }
    }
    ll ans=mod(com[t]*com[t]);
    
    ll comb[n];memset(comb,0,sizeof(comb));
    comb[t]=1;
    priority_queue<l_l>qb;
    qb.push(l_l(md[t],t));
    reverse(jun.begin(),jun.end());
    rep(i,0,n-1){
        for(auto x:v[jun[i].second]){
            if(md[x.second]==md[jun[i].second]-x.first){
                Add(comb[x.second],comb[jun[i].second]);
            }
        }
    }
    
    rep(i,0,n-1){
        if(md[i]*2==md[t]){
            Add(ans,-po2(mod(com[i]*comb[i])));
        }
    }
    rep(i,0,n-1){
        for(auto x:v[i]){
            if(md[i]*2<md[t]&&md[t]<md[x.second]*2&&md[i]+x.first==md[x.second]){
                Add(ans,-po2(com[i]*comb[x.second]));
            }
        }
    }
    
    /*rep(i,0,n-1){
        cout<<com[i]<<" "<<comb[i]<<endl;
    }*/
    cout<<mod(ans)<<endl;
    
    return 0;
}


Measured memory_bytes: 18288
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
#define inf 100000000/*10^8*/
#define rep(i,l,r) for(int i=l;i<=r;i++)

////////////////////////////////////////



int main(){
    ll n;cin>>n;
    ll a[20];memset(a,0,sizeof(a));
    int i=0;
    for(i=0;;i++){
        if(n==0)break;
        a[i]=n%10;
        n=n/10;
    }
    bool flag=true;
    for(int j=0;j<=i-2;j++){
        if(a[j]!=9){
            flag=false;
            break;
        }
    }
    ll ans=0;
    if(flag){
        ans=9*(i-1)+a[i-1];
    }else{
        ans=9*(i-1)+a[i-1]-1;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
function main(input) {
  var x = input[0].split(" ")[0]-0;
  var a = input[0].split(" ")[1]-0;
  var b = input[0].split(" ")[2]-0;
  console.log(Math.abs(x-a)>Math.abs(x-b)?"B":"A");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 22084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    string ss[7] = { "SUN","MON","TUE","WED","THU","FRI","SAT"};
    string s;
    cin >> s;
    rep(i, 7){
        if(s==ss[i]){
            cout << 7-i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using Weight = long;
using Graph = map<int, map<int, Weight>>;

constexpr Weight MAX = numeric_limits<Weight>::max();
constexpr Weight MIN = numeric_limits<Weight>::min();

void bellmanFord(const Graph& g, int n, int source,
                 vector<Weight>& distance, vector<int>& predecessors)
{
    distance.resize(n, MAX);
    predecessors.resize(n, -1);
    distance[source] = 0;

    for (int i = 0; i < n - 1; ++i) {
        for (auto& p1 : g) {
            for (auto& p2 : p1.second) {
                int u = p1.first;
                int v = p2.first;
                Weight w = p2.second;
                if (distance[u] == MAX)
                    continue;
                if (distance[v] > distance[u] + w) {
                    distance[v] = distance[u] + w;
                    predecessors[v] = u;
                }
            }
        }
    }

    vector<bool> negative(n, false);
    for (int i = 0; i < n; ++i) {
        for (auto& p1 : g) {
            for (auto& p2 : p1.second) {
                int u = p1.first;
                int v = p2.first;
                Weight w = p2.second;
                if (distance[u] == MAX)
                    continue;
                if (distance[v] > distance[u] + w) {
                    distance[v] = distance[u] + w;
                    negative[v] = true;
                }
            }
        }
    }
    for (int i = 0; i < n; ++i)
        if (negative[i])
            distance[i] = MIN;
}

int main()
{
    int N, M;
    cin >> N >> M;

    Graph g;
    for (int i = 0; i < M; ++i) {
        int a, b;
        long c;
        cin >> a >> b >> c;
        --a;
        --b;
        g[a][b] = -c;
    }

    vector<long> dists;
    vector<int> preds;
    bellmanFord(g, N, 0, dists, preds);
    if (dists[N - 1] == MIN)
        cout << "inf\n";
    else
        cout << -dists[N - 1] << '\n';

    return 0;
}


Measured memory_bytes: 512
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read_<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read_().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n: i32 = sc.read();
    let mut array: Vec<i32> = vec![];
    for _ in 0..n {
        array.push(sc.read());
    }

    let mut result: Vec<i32> = vec![];
    for el in array {
        if result.len() == 0 || result[result.len() - 1] >= el {
            result.push(el);
        } else {
            let mut left = 0;
            let mut right = result.len();
            while left < right {
                let current = (left + right) / 2;
                if result[current as usize] < el {
                    right = current;
                } else {
                    left = current + 1;
                }
            }
            result[left as usize] = el;
        }
    }

    println!("{}", result.len());
}

Measured memory_bytes: 4352
import math
a,b,C = map(int,input().split())
print(f'{(1/2)* a* b*math.sin(math.radians(C)):8f}')
print(f'{a+b+ math.sqrt(a**2+b**2-(2*a*b*math.cos(math.radians(C)))):8f}')
print(f'{b*math.sin(math.radians(C)):8f}')


Measured memory_bytes: 5724
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs

const int MAXN = 100500;

int n, k;
vector<pair<int, int>> v;
int sz[MAXN];
int types = 0;
priority_queue < pair<int, int> > q;
long long ans;
long long curAns;

int main() { 
  scanf("%d %d", &n, &k);

  for (int i = 0; i < n; i++) {
    int t, d;
    scanf("%d %d", &t, &d);
    v.push_back(make_pair(d, t));
  }

  sort(all(v));
  reverse(all(v));

  for (int i = 0; i < k; i++) {
    int curD = v[i].first, curT = v[i].second;
    ans += curD;
    if (sz[curT] == 0) {
      types++;
    }
    sz[curT]++;
    q.push(make_pair(-curD, curT));
  }
  ans += 1ll * types * types;
  curAns = ans;

  for (int i = k; i < n; i++) {
    int curD = v[i].first, curT = v[i].second;  
    if (sz[curT] == 0) {
      bool found = false;
      while (!found && !q.empty()) {
        pair<int, int> p = q.top();
        q.pop();
        if (sz[p.second] == 1) {
          continue;
        }
        sz[p.second]--;
        curAns -= (-p.first);
        found = true;
        break;
      }
      if (found) {
        sz[curT]++;
        curAns -= (1ll * types * types);
        types++;
        curAns += (1ll * types * types);
        q.push(make_pair(-curD, curT));
        curAns += curD;
      }
    } else {
      bool found = false;
      while (!found && !q.empty()) {
        pair<int, int> p = q.top();
        if (sz[p.second] == 1) {
          q.pop();
          continue;
        }
        if (-p.first < curD) {
          found = true;
          sz[p.second]--;
          curAns -= (-p.first);
          found = true;
        }
        break;
      }
      if (found) {
        sz[curT]++;
        curAns += curD;
        q.push(make_pair(-curD, curT));
      }
    }
    ans = max(ans, curAns);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2932
#include<stdio.h>
#include<math.h>

int sosu(int);

int main(){
  int i, n, a, cnt = 0;

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%d", &a);
    if(a == 2){
      cnt++;
      continue;
    }else if(a % 2 == 0) continue;
    if(sosu(a) == 1) cnt++;
  }

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

  return 0;
}

int sosu(int x){
  int i=3, sq;
  sq = sqrt(x);
  while(i <= sq){
    if(x % i == 0) return 0;
    i += 2;
  }
  return 1;
}



Measured memory_bytes: 2612
#include<iostream>
#include<string>
#include<vector>
#define R 1
#define G 2
#define B 0
using ll = long long;
using namespace std;

int main(){
	/*補集合の考えかた*/
	int n;
	string s;
	cin >> n >> s;
	ll ans=1;
	vector<int> v(3,0);
	for(char it : s) v[((int)it)%3]++;
	for(int i=0;i<3;i++)ans*=v[i];
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			int k = 2*j-i;
			if(k >=n) continue;
			if(s[i]==s[j] || s[i]==s[k] || s[j]==s[k])
				continue;
			ans--;
		}
	}
	cout <<ans;
	return 0;
}

Measured memory_bytes: 3180
using System;

class Scc
{
	static public void Main(string[] args)
	{
		string[] vals = Console.ReadLine().Split(' ');
		long N = long.Parse(vals[0]);
		long M = long.Parse(vals[1]);

		if(N*2 >= M)
		{
			Console.WriteLine(M/2);
		}
		else
		{
			Console.WriteLine(N + (M-N*2)/4);
		}
	}
}


Measured memory_bytes: 11092
#include <cstdio>
#include <vector>
#include <queue>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> P;
static const double EPS = 1e-8;
static const double PI = acos(-1.0);

inline double dot(const P& a, const P& b) { return a.real()*b.real() + a.imag()*b.imag(); }
inline double cross(const P& a, const P& b) { return a.real()*b.imag() - b.real()*a.imag(); }

int ccw(const P& a, P b, P c)
{
  b -= a;
  c -= a;
  if (cross(b, c) > EPS) {
    return +1;
  } else if (cross(b, c) < -EPS) {
    return -1;
  } else if (dot(b, c) < -EPS) {
    return +2;
  } else if (dot(b, b) + EPS < dot(c, c)) {
    return -2;
  } else {
    return 0;
  }
}

struct segment
{
  P a, b;
  segment() {}
  segment(const P& p, const P& q) : a(p), b(q) {}

  inline bool intersects(const segment& seg) const
  {
    return
      ccw(a, b, seg.a) * ccw(a, b, seg.b) <= 0
      && ccw(seg.a, seg.b, a) * ccw(seg.a, seg.b, b) <= 0;
  }

  inline double distance(const P& p) const
  {
    if (dot(b-a, p-a) < EPS) {
      return abs(p-a);
    } else if (dot(a-b, p-b) < EPS) {
      return abs(p-b);
    } else {
      return abs(cross(b-a, p-a))/abs(b-a);
    }
  }

  inline double distance(const segment& seg) const
  {
    if (intersects(seg)) {
      return 0;
    } else {
      return
        min(
            min(distance(seg.a), distance(seg.b)),
            min(seg.distance(a), seg.distance(b)));
    }
  }
};

struct star
{
  segment segs[5];
  star(double x, double y, double a, double r) {
    const P o(x, y);
    P p(0, r);
    p *= polar(1.0, a/180.0*PI);
    const P m = polar(1.0, 72.0/180.0*PI);
    P ps[5];
    for (int i = 0; i < 5; i++) {
      ps[i] = o + p;
      p *= m;
    }
    for (int i = 0, j = 0; i < 5; i++) {
      segs[i] = segment(ps[j], ps[(j+2) % 5]);
      j = (j+2) % 5;
    }
  }

  double distance(const star& s) const
  {
    double ans = 1e10;
    for (int i = 0; i < 5; i++) {
      for (int j = 0; j < 5; j++) {
        ans = min(ans, segs[i].distance(s.segs[j]));
      }
    }
    return ans;
  }
};

int main()
{
  int N, M, L;
  while (scanf("%d %d %d", &N, &M, &L) != EOF && N != 0) {
    --M; --L;
    vector<star> stars;
    for (int i = 0; i < N; i++) {
      int x, y, a, r;
      scanf("%d %d %d %d", &x, &y, &a, &r);
      stars.push_back(star(x, y, a, r));
    }

    vector<vector<double> > g(N, vector<double>(N));
    for (int i = 0; i < N; i++) {
      for (int j = i+1; j < N; j++) {
        double d = stars[i].distance(stars[j]);
        g[i][j] = g[j][i] = d;
      }
    }
    priority_queue<pair<double,int> > q;
    vector<double> dist(N, 1e10);
    dist[M] = 0;
    q.push(make_pair(0.0, M));
    while (!q.empty()) {
      const double d = -q.top().first;
      const int n = q.top().second;
      q.pop();
      if (n == L) {
        printf("%.20f\n", fabs(d));
        break;
      }
      for (int i = 0; i < N; i++) {
        if (n == i) {
          continue;
        }
        const double dd = d + g[n][i];
        if (dd < dist[i]) {
          dist[i] = dd;
          q.push(make_pair(-dd, i));
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 992
#include<stdio.h>

int main() {
   int a, b;
   int ans = 0;
   int cnt = 2;
   scanf("%d %d", &a, &b);

   for(int i = 0; i < cnt; i++) {
      if(a >= b) {
         ans += a;
         a--;
      }
      else {
         ans += b;
         b--;
      }
   }

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


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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef long long ll;
const long long MOD = 1000000000 + 7;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

ll gcd(ll a,ll b){
    return b ? gcd(b, a%b) : a; // 条件式 ? 真の場合 : 偽の場合
}

vector<pair<int,int>> p;

int main(){
    int n;
    mint dp[n];
    cin >> n;
    int zero = 0;
    map<pair<ll,ll>,pair<int,int>> mp;
    rep(i,n){
      ll x,y;
      cin >> x >> y;
      if( x == 0 && y == 0){
        zero++;
        continue;
      }
      ll g = gcd(x,y);
      x /= g;
      y /= g;
      if (y < 0) x = -x, y = -y;
      if (y == 0 && x < 0) x = -x,y = -y;
      bool rot90 = false;
      if ( x <= 0) rot90 = true;
      if (rot90) {
        ll tmp = x;
        x = y; y = -tmp;
      }
      if(rot90) mp[{x,y}].first++;
      else mp[{x,y}].second++;
      // 90度違う = マッチする組み合わせをfirstとsecondにおく。これらは同時に選べない。
    }

    mint ans = 1;
    for (auto p:mp){
      int s = p.second.first;
      int t = p.second.second;
      mint now = 1; //誰も選ばない
      now += mint(2).pow(s) - 1; // sグループを選ぶ数 
      now += mint(2).pow(t) - 1; // tグループを選ぶ数
      ans *= now;
    }
    ans -= 1;

    ans += zero;

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

Measured memory_bytes: 16352
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 
 //    String[] nyu=sc.nextLine().split(" ");

     String nyu=sc.nextLine();
//int A=Integer.parseInt(nyu[0]);
//int B=Integer.parseInt(nyu[1]+nyu[2]);
//int C=Integer.parseInt(nyu[2]);
//int D=Integer.parseInt(nyu[3]);


String[] bo={"a","i","u","e","o"};

//StringBuffer sb = new StringBuffer(nyu);
//		String dst = sb.reverse().toString();

//     String nyu2=sc.nextLine();
//int E=Integer.parseInt(nyu2);



//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(nyu){
case "H H":
System.out.println("H") ;
break;

case "D D":
System.out.println("H") ;
break;

case "H D":
System.out.println("D") ;
break;

case "D H":
System.out.println("D") ;
break;


default:
System.out.println("NO") ;

break;
}
*/

//int res=Math.min((A*B),C);

String res="consonant";
for(String tem:bo){
if(tem.equals(nyu))res="vowel";
}
//int res=0;
//for(int i=0;i<300;i++){
//if(num[i]==1)res=i;
//}

//char[] c = nyu.toCharArray();


//System.out.println(nyu+"-"+line_r_2+"-"+nyu2+"-"+line_r_1);



//if(D<1200){
//double res=Math.ceil((AB)/2);

//System.out.println("ABC");
//}else if(B<A){
//System.out.println("Alice");

//}else{
System.out.println(res);

//}




	}
}

Measured memory_bytes: 22612
#include <stdio.h>
#include <math.h>

int count = 0;

void merge(int A[],int left,int mid,int right){
  int n1 = mid - left,n2 = right - mid;
  int L[n1],R[n2];
  int i,j,k;

  for(i=0;i<=n1-1;i++)L[i] = A[left + i];
  for(i=0;i<=n2-1;i++)R[i] = A[mid + i];

  L[n1] = 10000000000;
  R[n2] = 10000000000;
  i = 0;j = 0;

  for(k=left;k<=right-1;k++){
    if(L[i]<=R[j]){
      A[k] = L[i];
      i++;
    }
    else{
      A[k] = R[j];
      j++;
    }
    count++;
  }
}

void mergeSort(int A[],int left,int right){
  if(left+1<right){
    int mid = (left + right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}

int main(){
  int n,S[10000000],i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&S[i]);

  mergeSort(S,0,n);

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

  return 0;
}



Measured memory_bytes: 5632
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x, y, z; cin >> x >> y;
    z = y / x;
    int ans = 1; while (z >>= 1) ans++;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

int main() {
  long long N;
  cin >> N;
  long long A[5];
  long long mi = 1e18;
  REP(i, 5) cin >> A[i], mi = min(mi, A[i]);
  long long ans = (N + mi - 1) / mi + 4;
  cout << ans << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{ int A[3];
  int i=3;
  while(i--)
  {cin>>A[i];
  }
  if((A[0]==A[1]&&A[0]!=A[2])||(A[0]==A[2]&&A[0]!=A[1])||(A[2]==A[1]&&A[0]!=A[2]))
    cout<<"Yes";
 else
   cout<<"No";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int x;
  cin>>x;
  int s=0;
  int t;
  REPP(i,100000){
    s += i;
    if(s>=x){
      t = i;
      break;
    }
  }
  cout<<t<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   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;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
    lint dp[3100][3100][3];
    int main(){
    lint n,s;
    cin>>n>>s;
    lint a[n];
    rep(i,n)cin>>a[i];
    dp[0][0][0]=1;
    lint mod=998244353;
    rep(i,n){
        rep(j,s+1){
            dp[i+1][j][0]+=dp[i][j][0];
            dp[i+1][j][1]+=dp[i][j][1];
            dp[i+1][j][2]+=dp[i][j][2];
            if(j-a[i]>=0){
                dp[i+1][j][1]+=dp[i][j-a[i]][1];
                dp[i+1][j][1]+=dp[i][j-a[i]][0]*(i+1);
                dp[i+1][j][2]+=dp[i][j-a[i]][0]*(i+1)*(n-i);
                 dp[i+1][j][2]%=mod;
                dp[i+1][j][2]+=dp[i][j-a[i]][1]*(n-i);
            }
            dp[i+1][j][0]%=mod;
            dp[i+1][j][1]%=mod;
            dp[i+1][j][2]%=mod;

        }
    }
    cout<<dp[n][s][2]<<endl;
    }
      

Measured memory_bytes: 221636
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)























int main() {
	ll n;
	cin >> n;
	for (ll i = 1; i < n; i++) {
		for (ll j = i + 1; j <= n; j++) {
			REP(k, 10) {
				if ((i & (1 << k)) ^ (j & (1 << k))) {
					cout << k + 1 << " \n"[j == n];
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 512
#include<stdio.h>
#define M 10001
int main(){
  int a,b,c,d,e;
  while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
    if(a*a+b*b==c*c)d++;
    if(a==b)e++;
  }
  printf("%d\n%d\n",d,e);
  return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
ll MOD = (1e9)+7;
const int dr[] = {+1, -1, +0, +0, +1, -1, +1, -1};
const int dc[] = {+0, +0, +1, -1, +1, -1, -1, +1};
const int kx[] = {+1, +2, -1, -2, +1, +2, -1, -2};
const int ky[] = {+2, +1, +2, +1, -2, -1, -2, -1};
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
inline void fastIO(){
  ios_base::sync_with_stdio(0);cin.tie(0);
}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "(" << #__VA_ARGS__ << "):", debug_out(__VA_ARGS__)
#else
#define debug(...) 47
#endif

int main(){
  fastIO();
  int n,m,a,b,ans=0;
  cin>>n>>m;
  vector<int>h(n);
  vector<vector<int>>adj(n+10);
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  for(int i=0;i<m;i++){
    cin>>a>>b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for(int i=1;i<=n;i++){
    int source=h[i-1];
    bool isGood=true;
    for(auto node:adj[i]){
      if(h[node-1]>=h[i-1])isGood=false;
    }
    if(isGood)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 8744
#pragma GCC optimize(2)
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(b/a>=c)
    cout<<c<<endl;
    else cout<<b/a<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	        
		int N = sc.nextInt();
		String S = sc.next();
		String S1[] = S.split("");
		String S2[] = S.split("");
		
		if(N%2 == 0) {
			for(int i=0;i<N/2;i++) {
				if( !(S1[i].equals(S2[i+(N/2)])) ) {
					System.out.println("No");
					break;
				}
				if(i == N/2-1) {
					System.out.println("Yes");
				}
			}
			
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21972
#include <stdio.h>
int k, n;
char s[105];
int main() {
	scanf("%d", &k);
	scanf(" %s", s);
	while (s[n] != NULL)n++;
	if (n <= k) {
		printf("%s\n", s);
		return 0;
	}
	for (int i = k; i < k + 3; i++) {
		s[i] = '.';
	}
	s[k + 3] = NULL;
	printf("%s\n", s);
}

Measured memory_bytes: 1648
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
    ll n, k;
    string str;
    cin >> n >> k >> str;
    vector<ll> ary;
#if 1
    int now = 1; //今見ている数
    int cnt = 0; //nowがいくつ並んでいるか
    for (int i = 0; i < n; i++)
    {
        if (str[i] == (char)('0' + now)) cnt++;
        else {
            ary.push_back(cnt);
            now = 1 - now; //0と1を切り替える時の計算 now ^= 1;
            cnt = 1; //新しいのをカウントし始める
        }
    }
    if (cnt != 0) ary.push_back(cnt);

    //1-0-1-0-1-0-1って感じの配列が欲しい
    //1-0-1-0みたいに0で終わってたら、適当に１つ足す
    if (ary.size() % 2 == 0) ary.push_back(0);
    if (str[0] == '0') {
        ary.push_back(0);
    }
#else
    char prev = 0;
    for (ll i = 0; (i < n); i++) {
        char curr = str[i];
        if (prev != curr) {
            prev = curr;
            ary.push_back(1);
        } else {
            ary[ary.size()-1]++;
        }
    }
    if (str[n-1] == '0') ary.push_back(0);
#endif

    vector<ll> sum(ary.size()+1, 0);
    for (ll i = 0; (i < ary.size()); ++i) {
        sum[i+1] = sum[i] + ary[i];
    }

    ll maxv = 0;
    for(ll i = 0; (i < ary.size()); i+=2) {
        ll left = i;
        ll right = min((ll)(sum.size()-1), i+k*2+1);
        maxv = max(maxv, sum[right] - sum[left]);
    }
    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 2164
#include<iostream>

using namespace std;

typedef long long int llint;

llint H;

int main() {
	cin >> H;
	llint ans = 0;
	llint now = 1;
	while (H > 0) {
		ans += now;
		H /= 2;
		now *= 2;
	}
	cout << ans << endl;
}

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

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

int find(string str, const string& word) {
  int count = 0;
  for (string::size_type pos = 0; (pos = str.find(word, pos)) != string::npos; pos += word.size()) {
    ++count;
  }
  return count;
}

int main(){
  int n;
  long long h;
  cin >> n >> h;
  vector<long long>  a(n),b(n);
  for(int i=0; i < n ; ++i) cin >> a[i] >> b[i];
  sort(a.begin(), a.end(), std::greater<int>());
  sort(b.begin(), b.end(), std::greater<int>());
  int i = 0;
  long long sum = 0;
  int count = 0;
  while(b[i] > a[0] && sum < h && i < n){
    sum += b[i];
    ++count;
    ++i;
  }
  i = 0;
  while(sum < h){
    sum += a[0];
    ++count;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 1792
/* ferris.c */
#include<stdio.h>
int main(void)
{
  int a,b;
  scanf("%d %d",&a,&b);
  if(a<=5)
    printf("0\n");
  if(a>=13)
    printf("%d\n",b);
  if(a<13&&a>5)
    printf("%d\n",b/2);
  return 0;
}



Measured memory_bytes: 128
// Problem : E - Replace Digits
// Contest : AtCoder - ACL Beginner Contest
// URL : https://atcoder.jp/contests/abl/tasks/abl_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#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 int long long
#define db double
#define mod 998244353
#define pb push_back
#define pp pair<int,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)
#define N 300005
#define ss second
#define ff first
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
int inv(int a, int b){
 return 1<a ? b - inv(b%a,a)*b/a : 1;
}
int n,q;
int st[N*4],lazy[N*4],po[N];
void build(int p, int l,int r)
{
	if(l == r)
	{
		st[p]=po[l];
		return;
	}
	int m =(l+r)/2;
	build(2*p,l,m);
	build(2*p+1,m+1,r);
	st[p]=st[2*p]+st[2*p+1];
}
void fun()
{
	int s=1;
	for(int i=0;i<N;i++)
	{
		po[i]=s;
		s*=10;
		s%=mod;
	}
}
int cal(int l,int r,int d)
{
	int a=d*po[l];
	a %= mod;
	int len = r-l+1;
	a*= (po[len]-1);
	a%= mod;
	int t = inv(9,mod);
	a*= t;
	a%= mod;
	return a;
}
void push(int p,int l,int r)
{
	if(lazy[p] == 0)
		return;
	int m = (l+r)/2;
	lazy[2*p]=lazy[p];
	lazy[2*p+1]=lazy[p];
	int d = lazy[p];
	lazy[p]=0;
	
	st[2*p] = cal(l,m,d);
	st[2*p+1] = cal(m+1,r,d);
}
int query(int p,int l,int r,int i,int j)
{
	if(i > r || j < l)
		return 0;
	push(p,l,r);
	if(i <= l and r<= j)
		return st[p];
	int m =(l+r)/2;
	return (query(2*p,l,m,i,j)+query(2*p+1,m+1,r,i,j))%mod;
}
void update(int p,int l,int r,int i,int j,int d)
{
	if(i > r || j < l)
		return;
	push(p,l,r);
	if(i <= l and r <= j)
	{
		st[p] = cal(l,r,d);
		lazy[p] = d;
		return;
	}
	int m = (l+r)/2;
	update(2*p,l,m,i,j,d);
	update(2*p+1,m+1,r,i,j,d);
	st[p]=(st[2*p]+st[2*p+1])%mod;
}
void solve()
{
	fun();
	cin >> n;
	build(1,0,n-1);
	cin >> q;
	while(q--)
	{
		int l,r,d;
		cin >> l >>r >> d;
		l = n-l;
		r = n-r;
		swap(l,r);
		int num = st[1];
		int diff = query(1,0,n-1,l,r);
		num -= diff;
		num%=mod;
		num+=mod;
		num%=mod;
		
		num += cal(l,r,d);
		num %=mod;
		cout << num <<"\n";
		update(1,0,n-1,l,r,d);
	}
}
signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 22224
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#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(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(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=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll a,b,x;
  cin >> a >> b >> x;
  if(a<=x&&x<=a+b) pr("YES");
  else pr("NO");
}

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


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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && a != c)
    cout << "Yes" << endl;
  else if (a == c && a != b)
    cout << "Yes" << endl;
  else if (b == c && b != a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int main() {
    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


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

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            ans += a[i] * a[j];
        }
    }


    cout << ans;




}

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

int main()
{
ll n , k ;
cin >> n >> k ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
sort(a.begin(),a.end());
rep(i,k)ans+=a[i];
cout << ans << endl;
return 0;
}

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

int n, m, q;
vector<int> a,b,c,d;

int max_num = 0;
void dfs(vector<int> A) {
    if (A.size() == n+1) {
        int t = 0;
        rep(i, q) {
            if (A[b[i]] - A[a[i]] == c[i]) {
                t += d[i];
            }
        }

        max_num = max(max_num, t);
        return;
    }

    A.push_back(A.back());
    while(A.back() <= m) {
        dfs(A);
        A.back()++;
    }

    
}

int main(){

    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    rep(i, q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }

    vector<int> A(1, 1);

    dfs(A);

    cout << max_num << endl;


    return 0;
} 


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

const int maxn = 105;
int w[maxn];
long long v[maxn];
const long long inf = 1e17 + 5;

int main(int argc, char const *argv[])
{
//	freopen("in.txt", "r", stdin);
	int n, W;
	scanf("%d %d", &n, &W);
	vector<long long> dp(100005, inf);
	for(int i=1; i<=n; i++){
		scanf("%d %lld", &w[i], &v[i]);
	}
	dp[0] = 0;
	for(int i=1; i<=n; i++){
		for(int j=100003-v[i]; j>=0; j--){
			dp[j+v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
		}
	}
	long long ans = 0; 
	for(int i=1; i<=100004; i++){
		if(dp[i] <= W){
			ans = i;
		}
	}
	printf("%lld", ans);
	return 0;
}

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

long long int mod=1e9+7;

int main(){
  long long int a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k%2==0){
    cout<<a-b<<endl;
  }else{
    cout<<b-a<<endl;
  }
}


Measured memory_bytes: 256
# 8_D
alp=["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"]
my_dic={'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,'m':0,'n':0
        ,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,'y':0,'z':0}
while(True):
    try:
        var=input()
    except:
        break
    for i in alp:
        s=my_dic[i]
        s+=var.lower().count(i)
        my_dic[i]=s
    
for i in alp:
    print(i+" : "+str(my_dic[i]))


Measured memory_bytes: 5564
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define d1(x) cout<<#x<<" "<<x<<endl;
#define d2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define d2i(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;

#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
#define  mat vector<vector<ll>>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void solve(){
ll n,k;
cin>>k>>n;
vll v(n);
fr(i,0,n)
cin>>v[i];
ll mx=0;
for(int i=1;i<n;i++){
    mx=max(mx,v[i]-v[i-1]);
}
mx=max(mx,v[0]+k-v[n-1]);


cout<<k-mx;;
}

int main(){
    ll t=1;
  /// cin>>t;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) \
  SORT(var);       \
  REVERSE(var)
#define OPTIMIZE_STDIO         \
  ios::sync_with_stdio(false); \
  cin.tie(0);                  \
  cout.precision(10);          \
  cout << fixed
#define endl '\n'

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
struct mint {
  ll x;
  mint() : x(0) {
  }
  mint(ll x) : x((x % MOD + MOD) % MOD) {
  }
  mint& operator+=(const mint& r) {
    if ((x += r.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint& r) {
    if ((x -= r.x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint& operator*=(const mint& r) {
    if ((x *= r.x) > MOD) {
      x %= MOD;
    }
    return *this;
  }
  mint& operator++() {
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint operator++(int) {
    mint ret = x;
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return ret;
  }
  mint& operator--() {
    if ((--x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint operator--(int) {
    mint ret = x;
    if ((--x) < 0) {
      x += MOD;
    }
    return ret;
  }
  mint operator+(const mint& r) {
    mint ret;
    return ret = x + r.x;
  }
  mint operator-(const mint& r) {
    mint ret;
    return ret = x - r.x;
  }
  mint operator*(const mint& r) {
    mint ret;
    return ret = x * r.x;
  }
  mint operator-() {
    return mint() - *this;
  }
  bool operator<(const mint& a) {
    return x < a.x;
  }
  bool operator>(const mint& a) {
    return x > a.x;
  }
  bool operator<=(const mint& a) {
    return x <= a.x;
  }
  bool operator>=(const mint& a) {
    return x >= a.x;
  }
  bool operator==(const mint& a) {
    return x == a.x;
  }
  bool operator!=(const mint& a) {
    return x != a.x;
  }
};
ostream& operator<<(ostream& os, const mint& r) {
  os << r.x;
  return os;
}
ostream& operator>>(ostream& os, const mint& r) {
  os >> r.x;
  return os;
}

int gcd(int a, int b) {
  while(true) {
    int c = b % a;
    if (c == 0) break;
    b = a;
    a = c;
  }
  return a;
}

void solve(istream& cin, ostream& cout) {
  ll a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  ll ans;
  int g = gcd(a, b);
  ans = (a * b) / g;
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


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

fn main() {
	let n: f32 = read();
	let m = (n/2.0).ceil() as u32;
	println!("{}", m);
}



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



Measured memory_bytes: 4352