akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  998244353
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------
struct edge{ll to; ll num;};
struct graph{
    ll N;
    vector<vector<edge> > G;
    vector<bool> used;
    deque<ll> path;
    bool pathf=false;
    bool ons=true;

    graph(ll n): N(n), G(N), used(N,false) {}

    void add_edge(ll s, ll t, ll num){
        G[s].emplace_back((edge){t,num});
        G[t].emplace_back((edge){s,num}); //無向ならON
    }

    void dfs(ll v=0){
        used[v]=true;
        if(ons) path.push_back(v+1);
        if(!ons and v!=0) path.push_front(v+1);
        for(auto E : G[v]){
            if(!used[E.to]){
                dfs(E.to);
                if(pathf) return;
            }
        }
        pathf=true;
    }
};
//--MAIN-----------------------------------
void Main() {
    ll N,M; cin>>N>>M;
    graph g(N);
    rep(i,M){
        ll a,b; cin>>a>>b; --a; --b;
        g.add_edge(a,b,i+1);
    }
    g.dfs();
    g.ons=false;
    g.dfs();
    cout<< g.path.size() <<"\n";
    for(auto x: g.path){
        cout<< x <<" ";
    }
    cout<<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 10112
#include <iostream>
#include <string>
#include <map>
using namespace std;
void a()
{
  int a, b, c;
  cin >> a >> b >> c;
  if (b / a >= c)
    cout << c;
  else
  {
    cout << b / a;
  }
}
void b()
{
  int a, b, k;
  cin >> a >> b >> k;
  int itr = 0;
  int ans = a;
  if (b < a)
    ans = b;
  ans++;
  while (itr != k)
  {
    ans--;
    if (a % ans == 0 && b % ans == 0)
      itr++;
  }
  cout << ans;
}
void c()
{
  string a;
  cin >> a;
  int p = 0;
  int q = 0;
  for (int i = 0; i < a.size(); i++)
  {
    if (a[i] == '0')
      p++;
    else
      q++;
  }
  int ans = 2 * p;
  if (q < p)
    ans = 2 * q;
  cout << ans;
}
int64_t find_p(int64_t *P, int64_t x)
{
  if (P[x] == x)
  {
    return x;
  }
  else
    return P[x] = find_p(P, P[x]);
}
void unite(int64_t x, int64_t y, int64_t *rank, int64_t *P, map<int64_t, int64_t> &count)
{
  x = find_p(P, x);
  y = find_p(P, y);
  if (x == y)
    return;
  if (rank[x] < rank[y])
  {
    count[y] += count[x];
    P[x] = y;
  }
  else
  {
    count[x] += count[y];
    P[y] = x;
    if (rank[x] == rank[y])
      rank[x]++;
  }
}
bool same(int64_t x, int64_t y, int64_t *P)
{
  return find_p(P, x) == find_p(P, y);
}
void d()
{
  int64_t N, M;
  cin >> N >> M;
  int64_t A[M], B[M];
  map<int64_t, int64_t> count;
  int64_t P[N], rank[N];
  for (int64_t i = 0; i < N; i++)
  {
    P[i] = i;
    rank[i] = 0;
    count[i] = 1;
  }

  for (int64_t i = 0; i < M; i++)
  {
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
  }
  int64_t pairs[M + 1];
  pairs[M] = N * (N - 1) / 2;
  for (int64_t i = M - 1; i >= 0; i--)
  {
    int64_t s, l;
    if (A[i] > B[i])
    {
      s = B[i];
      l = A[i];
    }
    else
    {
      s = A[i];
      l = B[i];
    }
    if (same(s, l, P))
      pairs[i] = pairs[i + 1];
    else
    {
      pairs[i] = pairs[i + 1] - count.at(find_p(P, s)) * count.at(find_p(P, l));
      //cout << "parent:" << find_p(P, s) << " " << find_p(P, l) << endl;
      //cout << "list:" << s << " " << l << endl;
      unite(s, l, rank, P, count);
    }
  }
  for (int i = 1; i < M + 1; i++)
    cout << pairs[i] << endl;
}
int main(void)
{
  //b();
  //a();
  //c();
  d();
}


Measured memory_bytes: 11520
<?php
$n = trim(fgets(STDIN));
$a = explode(" ", trim(fgets(STDIN)));
$b = explode(" ", trim(fgets(STDIN)));

$d = [];

foreach ($a as $k => $v){
    $d[$k] = $a[$k] - $b[$k];
}

$plus = [];
$minus = [];

foreach ($d as $i) {
    if ($i > 0) {
        $plus[] = $i;
    } elseif ($i < 0) {
        $minus[] = $i;
    }
}

if (array_sum($d) < 0) {
    echo -1 . "\n";
} elseif (count($minus) == 0) {
    echo 0 .  "\n";
} else {
    arsort($plus);

    $sum_minus = array_sum($minus);

    $s = 0;
    $cnt = 0;
    foreach ($plus as $p) {
        $cnt++;
        $s += $p;

        if ($s >= -$sum_minus) {
            break;
        }
    }

    echo count($minus) + $cnt . "\n";
}

Measured memory_bytes: 31468
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef pair<long long,long long> P;
//typedef pair<long long,P> P1;
//typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define se second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define rrep(i,x) for(long long i=x-1;i>=0;i--)
#define rrepn(i,x) for(long long i=x;i>1;i--)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
long long n,h[100005];
ll dp[100005];
#define ALL(v)  (v).begin(),(v).end()
//#define MAX(a,b) if(a>b)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))

#define DEBUG
#define pr printf
#define re return
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)


int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }

stack<long long> sta;   
queue<long long> que;
deque<long long> dque;

set <string> s_set;

int vis[200001];

//最大公約数
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
//最大公約数 複数個
int gcd(const vector<int> &v) {
	int ret = v[0];
	for (int i = 1; i < v.size(); i++)
		ret = gcd(ret, v[i]);
	return ret;
}
//最小公倍数 複数個
int lcm(const vector<int> &v) {
	int ret = v[0];
	for (int i = 1; i < v.size(); i++)
		ret = lcm(ret, v[i]);
	return ret;
}

struct Student {
  string name;
  int no, point;
};

// a < b ならtrueを返す
bool comp(const Student& a, const Student& b) {
  if (a.name != b.name)
    return a.name < b.name; // 高い順に並べたいので演算子を逆に
  if (a.point != b.point)
    return a.point > b.point; // 同様に比較演算子を反転
  return a.no < b.no;
}

std::string replaceOtherStr(std::string &replacedStr, std::string from, std::string to) {
    const unsigned int pos = replacedStr.find(from);
    const int len = from.length();
 
    if (pos == std::string::npos || from.empty()) {
        return replacedStr;
    }
 
    return replacedStr.replace(pos, len, to);
}


//	素因数分解
void countPN(int n, std::vector<int> &count)//nを素因数に分解し、countを更新
{
	int m = n;
	for(int i=2 ; i*i<=n ; ++i)
	{
		while(m%i == 0)
		{
			m /= i;
			count[i]++;
		}
		if(m==1) break;
	}
	if(m!=1) count[m]++;

}

int main(){
	ll N;
	std::cin >> N;
	ll sum;
	sum=0;
	ll cnt;
	cnt=0;
	if(N%11==0){
		pr("%lld",(N/11)*2);
	}
	else if(N%11<=6){
		pr("%lld",(N/11)*2+1);
	}
	else{
		pr("%lld",(N/11)*2+2);
	}
	re 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main()
{
    int n, k;
    cin >> n >> k;

    if(n >= k)
    {
        n = n % k;
    }

    if(n <= k/2)
    {
        cout << n << endl;
    }
    else
    {
        cout << (k-n) << endl;
    }
    return 0;
}


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

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


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

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

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

#endif

// main.cpp

int main() {
  i64 a, b;
  std::cin >> a >> b;
  std::cout << std::string(std::max(a, b), '0' + std::min(a, b)) << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    double a,b;
    cin>>a>>b;
    for (int i = 1; i <=1000; i++)
    {
        if((int)(i*0.08)==a && (int)(i*0.1)==b){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}

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

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

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

	int N; cin >> N;
	int D,ans; cin >> D >> ans;

	for (int i = 0;i < N;i++){
		int A; cin >> A;
		int now = 1;
		while(now <= D){
			ans++; now += A;
		}
	}

	cout << ans << 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 h = sc.nextInt();
        int w = sc.nextInt();
        int k = sc.nextInt();
        int[][] c = new int[h][w];
        int black = 0;
        for (int i=0;i<h;i++){
            String s = sc.next();
            for (int j=0;j<w;j++){
                if (s.charAt(j)=='.'){
                    c[i][j]=0;
                }else {
                    c[i][j]=1;
                    black++;
                }
            }
        }
        int count = 0;
        for (int i=0;i<Math.pow(2,h);i++){
            String s = Integer.toBinaryString(i);
            while (s.length()<h)s="0"+s;
            for (int j=0;j<Math.pow(2,w);j++){
                String t = Integer.toBinaryString(j);
                while (t.length()<w)t="0"+t;
                int def = black;
                for (int a=0;a<h;a++){
                    for (int b=0;b<w;b++){
                        if ((s.charAt(a)=='1'||t.charAt(b)=='1')&&c[a][b]==1)def--;
                    }
                }
                if (def==k)count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 39976
#include<cstdio>

#define i64 long long int

int n, ans;

void dfs(i64 cur, int mask) {
	if (cur>n) return;
	if(mask==7) ans++;
	
	dfs(cur*10+3, mask | 1);
	dfs(cur*10+5, mask | 2);
	dfs(cur*10+7, mask | 4);
}

int main() {
	scanf("%d", &n);
	
	ans = 0;
	dfs(0LL, 0);
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BROTN solver = new BROTN();
        solver.solve(1, in, out);
        out.close();
    }

    static class BROTN {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            StringBuilder x = new StringBuilder(in.next());
            for (int i = 0; i < x.length(); i++) x.setCharAt(i, (char) ('A' + (char) (x.charAt(i) + n - 'A') % 26));
            out.println(x.toString());
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int N;
    cin >> N;
    vi data(N);
    for (int i = 0; i < N; i++) {
        cin >> data.at(i);
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (data.at(i) % 2 == 1 && i % 2 == 0) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3540
#include <iostream>
#include <string>
using namespace std;
int main(){
  string ac="AC";
  string wa="WA";
  string tle="TLE";
  string re="RE";
  string input;
  int n;
  cin >> n;
  int array[4];
  for(int i=0;i<4;++i){
    array[i]=0;
  }
  for(int i=0;i<n;++i){
    cin >> input;
    if(input==ac){
      array[0]++;
    }
    else if(input == wa){
      array[1]++;
    }
    else if(input == tle){
      array[2]++;
    }
    else if(input == re){
      array[3]++;
    }
  }
  cout << "AC x " << array[0] << endl;
  cout << "WA x " << array[1] << endl;
  cout << "TLE x " << array[2] << endl;
  cout << "RE x " << array[3] << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define endl '\n'
#define ld long double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }
 
/*
░░░░░░░░░░░░░░░░░░░░░░░░░
░░█▀▀▄░░░░░░░░░░░▄▀▀█░░░░
░░█░░░▀▄░▄▄▄▄▄░▄▀░░░█░░░░
░░░▀▄░░░▀░░░░░▀░░░▄▀░░░░░
░░░░░▌░▄▄░░░▄▄░▐▀▀░░░░░░░
░░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█░
░░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█░
░▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█░
░█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀░
░░▀▄░░▀░░▀▀▀░░▀░░░▄█▀░░░░
░░░░█░░░░░░░░░░░▄▀▄░▀▄░░░
░░░░█░░░░░░░░░▄▀█░░█░░█░░
░░░░█░░░░░░░░░░░█▄█░░▄▀░░
░░░░█░░░░░░░░░░░████▀░░░░
░░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░
*/
 
// I want to be the very best, like no one ever was, I will battle everyday to claim my rightful place
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
// I am questioning life and universe and 
// everything else after looking at this

const ll MAXN = 204;
pair<ll,ll> a[MAXN];

bool cmp(pair<ll,ll> a,pair<ll,ll> b){
    return atan2(a.second,a.first) < atan2(b.second,b.first);
}

void solve(){
    ll n; cin>>n;

    FOR(i,1,n) cin>>a[i].first>>a[i].second;

    sort(a+1,a+n+1,cmp);

    FOR(i,n+1,2*n) a[i] = a[i-n];

    ll ans = 0;

    FOR(i,1,n){
        ll x = 0,y = 0;
        FOR(j,i,i+n-1){
            x = x + a[j].first,y = y + a[j].second;
            ans = max(ans,x*x + y*y);
        }
    }

    ld anss = sqrtl(ans+.0);

    cout<<fixed<<setprecision(10)<<anss<<endl;
} 
 
signed main(){
 
   FastRead;    
 
 
    ll t;
    t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    int m,k; cin >> m >> k;
    if(m == 0){
        if(k == 0) cout << 0 << " " << 0 << endl;
        else cout << "-1" << endl;
        return 0;
    }
    if(m == 1){
        if(k == 0) cout << 0 << " " << 0 << " " << 1 << " " << 1 << endl;
        else cout << "-1" << endl;
        return 0;
    }
    if(k >= (1 << m)){
        cout << "-1" << endl;
        return 0;
    }
    deque<int> d;
    if(k != 0){
        d.push_back(0);
        d.push_back(k);
        FOR(i, 1, (1<<m)){
            if(i == k) continue;
            d.push_back(i);
            d.push_front(i);
        }
        d.push_front(0);
        d.push_back(k);
    }else{
        rep(i, (1<<m)){
            d.push_back(i);
            d.push_back(i);
        }
    }
    int s = d.size();
    rep(i, s) printf("%d%c", d[i], i == s-1 ? '\n' : ' ');
}

Measured memory_bytes: 2944
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

a = I()

print(a+a**2+a**3)

Measured memory_bytes: 65368
#include <stdio.h>
#include <math.h>
#define rep(i,a,n) for(int i=a;i<n;i++)

int main(){
	int r,c,d[110][110]={0},sum=0;
	scanf("%d %d",&r,&c);
	rep(i,0,r){
		rep(j,0,c){
			scanf("%d",&d[i][j]);
			sum+=d[i][j];
			d[r][j]+=d[i][j];
			d[i][c]+=d[i][j];
		}
	}
	d[r][c]=sum;
	rep(i,0,r+1){
		rep(j,0,c+1){
			printf("%d",d[i][j]);
			if(j!=c) printf(" ");
		}
		printf("\n");
	}
	return 0;
}

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

using namespace std;

int a, b, c;
int k;

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	
	cin >> a >> b >> c >> k;
	
	int cnt = 0;
	while (b <= a) 
	{
		b *= 2;
		cnt ++;
	}
	while (c <= b)
	{
		c *= 2;
		cnt ++;
	}
	
	cnt <= k ? cout << "Yes\n" : cout << "No\n";
	
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
typedef pair<ll,ll> pll;
ll N,K;
pll sushi[100005];
ll ans=0,sum=0,r=0;
map<int,ll> neta;
int main(void)
{
  set<int> various;
  cin >> N >> K;
  for (int i=1; i <=N; ++i)
   {
     ll t,d;
     cin >> t >> d;
     sushi[i]=pll(d,t);;
   }
  sort(sushi+1,sushi+N+1);
  
  for(int i=N;i>=1;i--)
    {
      if(i>=N-K+1)
	{
	  neta[sushi[i].second]++;
	  sum+=sushi[i].first;
	  if(i==N-K+1)
	    {
	      ll s=neta.size();
	      ans=sum+s*s;
	      r=N-K+1;
	    }
	}
      else
	{
	  if(!neta.count(sushi[i].second))
	    {
	      neta[sushi[i].second]++;
	      while(r<=N && neta[sushi[r].second]==1)r++;
	      if(r==N+1) break;
	      sum+=sushi[i].first-sushi[r].first;
	      neta[sushi[r].second]--;r++;
	      ll s=neta.size();
	      ans=max(ans,sum+s*s);
	    }
	}
    }
  cout << ans << endl;
 return 0;
}
     


Measured memory_bytes: 5760
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
 
  int x; cin >> x;
  
  vector<long long> vec(5,0);
  for(int i=0; i<x; i++){
    string s; cin >> s;
    if (s.at(0) == 'M'){
      vec.at(0)++;
    } else if (s.at(0) == 'A'){
      vec.at(1)++;
    } else if (s.at(0) == 'R'){
      vec.at(2)++;
    } else if (s.at(0) == 'C'){
      vec.at(3)++;
    } else if (s.at(0) == 'H'){
      vec.at(4)++;
    }
  }

  long long ans = 0;
  for(int i=0; i<3; i++){
    for(int j=i+1; j<4; j++){
      for(int k=j+1; k<5; k++){
        ans += vec.at(i)*vec.at(j)*vec.at(k);
      }
    }
  }
  
  printf ("%lld\n",ans);
 
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
  
int main(void){
    int i,j;
    char ch;
    while(1){
        scanf("%c",&ch);
        if(ch == '\n'){
            printf("\n");
            break;
        }
        else if(islower(ch)){
            printf("%c",toupper(ch));
        }
        else if(isupper(ch)){
            printf("%c",tolower(ch));
        }
        else{
            printf("%c",ch);
    }
}
    return(0);
}

Measured memory_bytes: 524
#include <stdio.h>

typedef struct {
	int zikoku;
	char name[52];
} station_t;

int main(void) {
	int N,T;
	station_t stations[10][2];
	int i;
	int count;
	scanf("%d%d",&N,&T);
	for(i=0;i<N;i++) {
		int t1,t2;
		scanf("%d:%d%s",&t1,&t2,stations[i][0].name);
		stations[i][0].zikoku=t1*60+t2;
		scanf("%d:%d%s",&t1,&t2,stations[i][1].name);
		stations[i][1].zikoku=t1*60+t2;
	}
	count=0;
	for(i=1;i<N;i++) {
		if(stations[i][0].zikoku-stations[i-1][1].zikoku>=T)count++;
	}
	printf("%d\n",count);
	for(i=1;i<N;i++) {
		int nowtime=stations[i][0].zikoku-stations[i-1][1].zikoku;
		if(nowtime>=T) {
			printf("%s %d\n",stations[i][0].name,nowtime);
		}
	}
	return 0;
}

Measured memory_bytes: 604
def main():
    from itertools import groupby as group
    s = input()
    res = [0 for _ in range(len(s))]

    l, r = 0, 0
    for k, g in group(s):
        m = len(list(g))
        r = l + m - 1
        x = m // 2
        if k == 'R':
            if m % 2 == 0:
                res[r] += x
                res[r + 1] += x
            else:
                res[r] += x + 1
                res[r + 1] += x
        if k == 'L':
            if m % 2 == 0:
                res[l] += x
                res[l - 1] += x
            else:
                res[l] += x + 1
                res[l - 1] += x

        l = r + 1

    ans = ' '.join(map(str, res))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10604
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template <std::uint_fast64_t Modulus> class modint {
    using u64 = std::uint_fast64_t;

  public:
    u64 a;
    constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
    constexpr u64 &value() noexcept { return a; }
    constexpr const u64 &value() const noexcept { return a; }
    constexpr modint operator+(const modint rhs) const noexcept {
        return modint(*this) += rhs;
    }
    constexpr modint operator-(const modint rhs) const noexcept {
        return modint(*this) -= rhs;
    }
    constexpr modint operator*(const modint rhs) const noexcept {
        return modint(*this) *= rhs;
    }
    constexpr modint operator/(const modint rhs) const noexcept {
        return modint(*this) /= rhs;
    }
    constexpr modint operator^(const u64 rhs) const noexcept {
        return modint(*this) ^= rhs;
    }
    constexpr modint &operator+=(const modint rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) {
            a -= Modulus;
        }
        return *this;
    }
    constexpr modint &operator-=(const modint rhs) noexcept {
        if (a < rhs.a) {
            a += Modulus;
        }
        a -= rhs.a;
        return *this;
    }
    constexpr modint &operator*=(const modint rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }
    constexpr modint &operator/=(modint rhs) noexcept {
        u64 exp = Modulus - 2;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
    constexpr modint &operator^=(u64 exp) {
        modint rhs = modint(*this);
        a = 1;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
};
using mint = modint<MOD>;
vector<mint> f, fi;
void comb(int n) {
    f.resize(n + 1);
    fi.resize(n + 1);
    f[0] = 1;
    for (ll i = 1; i <= n; i++) {
        f[i] = f[i - 1] * mint(i);
    }
    fi[n] = mint(1) / f[n];
    for (ll i = n - 1; i >= 0; i--) {
        fi[i] = fi[i + 1] * mint(i + 1LL);
    }
}
mint ncr(ll n, ll r) {
    if (n < r) {
        return mint(0);
    }
    if (r == 0) {
        return mint(1);
    }
    return f[n] * fi[n - r] * fi[r];
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x, y;
    cin >> x >> y;
    comb(2000010);
    mint res = 0;
    for (ll a = 0; a <= x; a++) {
        ll b = y - 2 * a;
        if (b < 0 || a + 2 * b != x) {
            continue;
        }
        res += ncr(a + b, a);
    }
    cout << res.a << endl;
}

Measured memory_bytes: 31488
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

class UnionFind{
    public:
        UnionFind(int N) : parent(N, -1) {}
        bool unite(int x, int y){
            x = find(x);
            y = find(y);
            if (x == y){return false;}
            if (parent[x] > parent[y]){swap(x, y);}
            parent[x] += parent[y];
            parent[y] = x;
        }
        int find(int x) {
            if (parent[x] < 0){return x;}
            return parent[x] = find(parent[x]);
        }
        int size(int x) {
            return -parent[find(x)];
        }
        private:
            vector<int> parent;
};

// abc 120 d verify
int main(void) {
    ll n,m;
    cin>>n>>m;
    int a[m],b[m];;
    ll res[m];
    rep(i,m){
        cin>>a[i]>>b[i];
        a[i]--;
        b[i]--;
    }
    ll now=n*(n-1)/2;
    UnionFind uf(n);
    for(int i=m-1;i>=0;i--){
        res[i]=now;
        if(uf.find(a[i])!=uf.find(b[i])){
            now -=ll(uf.size(a[i]))*uf.size(b[i]);
            uf.unite(a[i],b[i]);
        }
    }
    rep(i,m){
        cout << res[i] << endl;
    }
    return 0;
}


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

int n;
long long ans;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=9;++i)
		for(int j=1;j<=9;++j) {
			int cnt1=0,cnt2=0;
			for(int k=1;k<=n;++k) {
				int r=k;
				while(r/10) r/=10;
				if(k%10==i&&r==j) cnt1++;
			}
			for(int k=1;k<=n;++k) {
				int r=k;
				while(r/10) r/=10;
				if(k%10==j&&r==i) cnt2++;
			}
			ans+=1ll*cnt1*cnt2;
		}
	printf("%lld",ans);
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main(){
    string s;
    cin >> s;
    int n = s.size();
    if(s[0] != 'A') cout << "WA\n";
    else{
        int cnt = 0;
        for(int i=2;i <= n-2;++i){
            if(s[i] == 'C'){
                 ++cnt;
            }
        }
        int x = cnt;
        if(cnt != 1) cout << "WA\n";
        else{
            cnt = 0;
            rep(i,n){
                if(!(s[i] >= 'a' && s[i] <= 'z')) ++cnt;
            }
            if(cnt - 2 != 0) cout << "WA\n";
            else cout << "AC\n";
        }
    }   


    return 0;   
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <deque>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <climits>
#include <numeric>
#include <bitset>
#include <random>
#include <tuple>
#include <initializer_list>
#include <fstream>
#include <cctype>
#include <string>
#include <cfloat>
#include <array>
#include <fstream>

bool is_integer(const std::vector<int>& a, const std::vector<int>& b) {
	int sum{ 0 };
	for (auto i = 0; i < a.size(); ++i) {
		sum += (a[i] - b[i]) * (a[i] - b[i]);
	}
	int sqrt = std::sqrt(sum);
	return sqrt * sqrt == sum;
}
int main() {
	int n, d; std::cin >> n >> d;
	std::vector<std::vector<int>> points(n, std::vector<int>(d));
	for (auto& p : points) for (auto& x : p) std::cin >> x;
	int count{ 0 };
	for (auto i = 0; i < n; ++i) {
		for (auto j = 0; j < i; ++j) {
			if (is_integer(points[i], points[j])) ++count;
		}
	}
	std::cout << count << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 1000000
#define mod 1000000007
using namespace std;

inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
inline void Add(int &x,int y)
{
	x+=y; if(x>=mod) x-=mod; 
	if(x<0) x+=mod;
}
inline int qpow(int bas,int pw)
{
	int ret=1; for(;pw;pw>>=1,bas=1ll*bas*bas%mod)
		if(pw&1) ret=1ll*ret*bas%mod; return ret;
}
int fac[N+10],inv[N+10],n,Ans,per,cur;
inline int C(int n,int m)
{
	return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main()
{
	fac[0]=1; for(int i=1;i<=N;i++)
		fac[i]=1ll*fac[i-1]*i%mod;
	inv[N]=qpow(fac[N],mod-2);
	for(int i=N-1;i>=0;i--)
		inv[i]=1ll*inv[i+1]*(i+1)%mod;
	cin >> n; for(int i=(n+1)/2;i<n;i++)
	{
		per=cur;
		cur=1ll*C(i-1,n-i-1)*fac[i]%mod*fac[n-i-1]%mod;
		Add(Ans,1ll*(cur-per)*i%mod);
	}
	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<long long>n(3);
  cin >> n[0] >> n[1] >> n[2];
  sort(n.begin(),n.end());
  cout << (n[0] * n[1] *((n[2] + 1) / 2)) - (n[0] * n[1] * (n[2] / 2)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int M = 1000000007;

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    int h = H + W - 1;
    int w = H + W;
    vector<vector<int>> s(h, vector<int>(w, 0));
    for (int i = 0; i < H; ++i) {
        cin >> S[i];
        for (int j = 0; j < W; ++j) {
            if (S[i][j] == '#') {
                s[i + j][i - j + W] = 1;
            }
        }
    }
    vector<vector<int>> imsw(h, vector<int>(w + 1, 0));
    vector<vector<int>> imsh(h + 1, vector<int>(w, 0));
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            imsw[i][j + 1] = imsw[i][j] + s[i][j];
        }
    }
    for (int j = 0; j < w; ++j) {
        for (int i = 0; i < h; ++i) {
            imsh[i + 1][j] = imsh[i][j] + s[i][j];
        }
    }
    long long ans = 0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (!s[i][j]) continue;
            for (int ti = i + 1; ti < h; ++ti) {
                if (s[ti][j]) {
                    int d = ti - i;
                    if (j >= d)
                        ans += imsh[ti + 1][j - d] - imsh[i][j - d];
                    if (j + d < w)
                        ans += imsh[ti + 1][j + d] - imsh[i][j + d];
                }
            }
            for (int tj = j + 1; tj < w; ++tj) {
                if (s[i][tj]) {
                    int d = tj - j;
                    if (i >= d)
                        ans += imsw[i - d][tj + 1] - imsw[i - d][j];
                    if (i + d < h)
                        ans += imsw[i + d][tj + 1] - imsw[i + d][j];
                }
            }
        }
    }
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (!s[i][j]) continue;
            for (int k = 1; k < w; ++k) {
                int a = 0, b = 0;
                if (i >= k && s[i - k][j])
                    ++a;
                if (i + k < h && s[i + k][j])
                    ++a;
                if (j >= k && s[i][j - k])
                    ++b;
                if (j + k < w && s[i][j + k])
                    ++b;

                ans -= a * b;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6656
N, D = map(int, input().split())
X = []
Y = []

for n in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)

ans = 0
distance = 0
import math

for n in range(N):
    distance = math.sqrt(X[n]**2 + Y[n]**2)
    if distance <= D:
        ans += 1

print(ans)

Measured memory_bytes: 24916
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
int main()
{
	int a,b;
	cin>>a>>b;
	for(double i=1;i<=10000;i++)
	{
		if((int)(double)((double)(i*1.000000)*(double)(0.080000))==a&&(int)(double)((double)(i*1.000000)*(double)(0.100000))==b)
		{
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	return 0;
}



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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


void Main()
{
    int n,m;cin>>n>>m;

    VL a(m),b(m);
    VVL c(m);
    REP(i,m){
        cin>>a[i]>>b[i];
        c[i].resize(b[i]);
        REP(j,b[i]){
            cin>>c[i][j];
            c[i][j]--;
        }
    }

    VVL dp(m);
    REP(i,m){
        dp[i].resize(1<<n,INF_LL);
    }

    dp[0][0] = 0;
    LL tmpbit = 0;
    for(auto x : c[0]){
        tmpbit += (1<<x);
    }
    dp[0][tmpbit] = a[0];

    FOR(i,1,m){
        REP(bit,(1<<n)){
            dp[i][bit] = min(dp[i][bit], dp[i-1][bit]);
            LL newbit = bit;
            for(auto x : c[i]){
                newbit |= (1<<x);
            }
            dp[i][newbit] = min(dp[i][newbit] , dp[i-1][bit]+a[i]);
        }
    }

    if(dp[m-1][(1<<n)-1] == INF_LL){
        cout<<-1<<endl;
    }
    else{
        cout<<dp[m-1][(1<<n)-1]<<endl;
    }

	return;
}

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

Measured memory_bytes: 35384
cnt = [0 for i in range(26)]
while True:
      try:
            s = input()
      except:
            break
      for i in range(len(s)):
            m = ord(s[i]) - ord('A')
            if m >= 0 and m < 26:
                  cnt[m]+=1
            m = ord(s[i])-ord('a')
            if m >= 0 and m < 26:
                  cnt[m] += 1
for i in range(26):
      print(chr(i+ord('a')), ":", cnt[i])


Measured memory_bytes: 5564
using System;
class p
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    string[] input = Console.ReadLine().Split(' ');
    int[] arr = new int[N];
    for (int i = 0; i < N; i++) {
      arr[i] = int.Parse(input[i]);
    }
    Array.Sort(arr);
    Console.WriteLine(Math.Abs(arr[N-1] - arr[0]));
  }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
   long long h,w;
   long long ans=0;
    cin >> h >> w;
   if (h==1 || w==1) ans= 1;
   else  ans= (h*w+1)/2  ;
  cout<<ans<<endl ;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////
ll n;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n;
    print((n/2)+(n%2));
    return 0;
}

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

constexpr int MAXN = 5e5 + 5;
constexpr int MAXA = 5e5 + 6;
constexpr int LOG = 30;
using namespace std;

inline int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (!isdigit(ch)) f = (ch == '-') ? -1 : 1, ch = getchar();
    while (isdigit(ch)) x = (x << 3) + (x << 1) + ch - 48, ch = getchar();
    return x * f;
}

struct Node {
    Node *lson, *rson;
    int cnt;
} Tree[MAXN * LOG], *root[MAXN];
int tot, n, m, cnt, arr[MAXN], pre[MAXA], last[MAXN];
inline Node *newNode(Node *&root) { return root = &Tree[tot++]; }
inline void build(int L, int R, Node *root) {
    if (L == R) return;
    int mid = (L + R) >> 1;
    build(L, mid, newNode(root->lson)), build(mid + 1, R, newNode(root->rson));
}

inline void modify(Node *pre, Node *cur, int L, int R, int pos) {
    cur->cnt = pre->cnt;
    if (L == R) {
        cur->cnt++;
        return;
    }
    int mid = (L + R) >> 1;
    if (pos <= mid)
        cur->rson = pre->rson,
        modify(pre->lson, newNode(cur->lson), L, mid, pos);
    else
        cur->lson = pre->lson,
        modify(pre->rson, newNode(cur->rson), mid + 1, R, pos);
    cur->cnt = cur->lson->cnt + cur->rson->cnt;
}

inline int query2(Node *pre, Node *cur, int L, int R, int qL, int qR) {
    if (qL == L && R == qR) return cur->cnt - pre->cnt;
    int mid = (L + R) >> 1;
    if (qR <= mid)
        return query2(pre->lson, cur->lson, L, mid, qL, qR);
    else if (qL > mid)
        return query2(pre->rson, cur->rson, mid + 1, R, qL, qR);
    else
        return query2(pre->lson, cur->lson, L, mid, qL, mid) +
               query2(pre->rson, cur->rson, mid + 1, R, mid + 1, qR);
}

int main() {
    n = read(), m = read();
    build(0, n, newNode(root[0]));
    for (int i = 1; i <= n; i++) {
        arr[i] = read(), last[i] = pre[arr[i]], pre[arr[i]] = i;
        modify(root[i - 1], newNode(root[i]), 0, n, last[i]);
    }
    while (m--) {
        int l = read(), r = read();
        printf("%d\n", query2(root[l - 1], root[r], 0, n, 0, l - 1));
    }
    return 0;
}

Measured memory_bytes: 271896
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author TM
 */


#include <bits/stdc++.h>

using namespace std;

class BSs {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        string s;
        cin >> s;
        int len_s = s.size();
        string ss;
        while (1) {
            ss = s.substr(0, len_s - 1);
            len_s -= 1;
            if (len_s % 2 != 0) continue;
            string s_back = s.substr(0, len_s / 2);
            string s_forward = s.substr(len_s / 2, len_s / 2);
            if (s_back == s_forward) break;
        }
        cout << ss.size() << endl;
    }
};


int main() {
	BSs solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;  
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const double eps = 1e-14;
const double PI = M_PI;  
#define DEB cout<<"!"<<endl
#define SHOW(a,b) cout<<(a)<<" "<<(b)<<endl  
#define DIV 1000000007

int main(){
	ll x; cin >> x;
	int i = 0;
	for(int i = 1; i < DIV; i++)
		if(i*(i+1)/2 >= x){
			cout << i << endl;
			break;
		}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int S;
    scanf("%d", &S);
    int h = S / 3600;
    int m = ( S - 3600 * h ) / 60;
    int s = ( S - 3600 * h) % 60;
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}


Measured memory_bytes: 2084
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	ll n, a, b;
	cin >> n >> a >> b;
	ll ans = 0;
	ans += (n / (a + b)) * a;
	ll c = n % (a + b);
	if (c <= a) ans += c;
	else ans += a;
	cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  
 if((N % 1 == 0 && N / 1 < 10) || (N % 2 == 0 && N / 2 < 10) || (N % 3 == 0 && N / 3 < 10) || (N % 4 == 0 && N / 4 < 10) || (N % 5 == 0 && N / 5 < 10) || (N % 6 == 0 && N / 6 < 10) || (N % 7 == 0 && N / 7 < 10) || (N % 8 == 0 && N / 8 < 10) || (N % 9 == 0 && N / 9 < 10)){
    cout << "Yes" << endl;
 }
  
  else{
    cout << "No" << endl;
  }
  

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
long long a[100];
int main()
{
    int n;
    cin>>n;
    a[0]=2;
    a[1]=1;
    for(int i=2;i<=n;i++)
        a[i]=a[i-1]+a[i-2];
    cout<<a[n]<<endl;
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  int a=s.size(), z=0;
  for(int i=0; i<s.size(); i++) {
    if(a>i && s[i]=='A') a=i;
    if(z<i && s[i]=='Z') z=i;
  }
  cout << z-a+1 << endl;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];

  int prev = A[0], ans = 1;
  int change = 0;
  for (int i = 1; i < N; i++) {
    if (change == 0 && A[i] > prev) change = 1;
    else if (change == 0 && A[i] < prev) change = 2;

    if ((change == 1 && A[i] < prev) || (change == 2 && A[i] > prev)) ans++, change = 0;

    prev = A[i];
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640