akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys


def solve(H: int, W: int):
    ans = 0
    if H == 1 or W == 1:
        print(1)
        return
    elif H % 2 == 0:
        ans = (H / 2) * W
    else:
        if W % 2 == 0:
            ans = (H // 2 + 1) * W - (W // 2)
        else:
            ans = (H // 2 + 1) * W - (W // 2)
    print(int(ans))

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    solve(H, W)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int gi(){
    char ch=getchar(); int x=0,q=0;
    while(ch<'0'||ch>'9') q=ch=='-'?1:q,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return q?-x:x;
}
const int N=401,M=1e5+50;
bitset<N>f[N];
int a[M],b[M],vis[N];
int main(){
    int n=gi(),m=gi(),x,y;
    for (int i=1; i<=m; ++i)
	a[i]=gi(),b[i]=gi();
    for (int i=1; i<=n; ++i)
	f[i].set(i);
    for (int i=m; i>=1; --i){
	x=a[i],y=b[i];
	for (int t=1; t<=n; ++t)
	    if (f[t][x]||f[t][y]){
		if (f[t][y]) swap(x,y);
		if (f[t][y]) vis[t]=1;
		else f[t].set(y);
	    }
    }
    int ans=0;
    for (int i=1; i<=n; ++i)
	if (!vis[i])
	    for (int j=i+1; j<=n; ++j)
		if (!vis[j]&&(f[i]&f[j]).count()==0)
		    ++ans;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
 
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll a,b,c,d,e,ans;
ll x[100005],y[100005],z[100005];
ll p[100005],cost[100005];
char s[100005],t[100005];

int main(){
	cin>>s;
	n=strlen(s);
	for(i=0;i<n;i++){
		if(s[i]=='x')continue;
		t[k]=s[i];
		k++;
	}
	m=strlen(t);
	bool flag=false;
	for(i=0;i<m;i++){
		if(t[i]!=t[m-1-i])flag=true;
	}
	if(flag){
		p(-1);
	}else{
		ll start=0,end=n-1;
		ll ssnum,eenum;
		while(start<=end){
			ssnum=0;
			eenum=0;
			while(s[start]=='x'){
				start++;
				ssnum++;
			}
			while(s[end]=='x'){
				end--;
				eenum++;
			}
			ans += abs(ssnum-eenum);
			start++;
			end--;
		}
		p(ans);
	}
	return 0;
			

}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main()
{
    string s;
    cin >> s;
    if(s == "AAA" || s == "BBB")
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

using namespace std;

int main()
{
	int n, x, y, z;

	scanf("%d", &n );

	for ( int i = 0; i < n; i++ )
	{
		scanf("%d %d %d", &x, &y, &z );

		if ( pow( x, 2 ) + pow( y, 2 ) == pow( z, 2 ) || pow( x, 2 ) + pow( z, 2 ) == pow( y, 2 ) || pow( y, 2 ) + pow( z, 2 ) == pow( x, 2 ) )
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}

	return 0;
}

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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!

//

ll dist(ll i, ll j, ll N, ll X, ll Y){
  // assume i<j
  if(j<=X) return j-i;
  if(Y<=i) return j-i;
  if(i<=X){
    if(j<=Y){
      return min(j-i, (X-i)+1LL+(Y-j));
    } else {
      return (X-i) + 1LL + (j-Y);
    }
  }
  if(X<i){
    if(j<=Y){
      return min(j-i, (i-X)+1LL+(Y-j));
    } else {
      return min(j-i, (i-X)+1LL+(j-Y));
    }
  }
  return -1;
}

void solve(long long N, long long X, long long Y) {
  unordered_map<ll, ll> hist; X--; Y--;
  rep(i,N){
    rep(j,i+1,N){
      ll d = dist(i,j,N,X,Y);
      hist[d]++;
    }
  }
  rep(k,1,N){
    cout << hist[k] << endl;
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long N;
  std::cin >> N;
  long long X;
  std::cin >> X;
  long long Y;
  std::cin >> Y;
  solve(N, X, Y);
  return 0;
}


Measured memory_bytes: 3696
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// to container
template <class C>
void input(C &c)
{
    for_each(c.begin(), c.end(), [](auto &i) { cin >> i; });
}

// to number, string
template <class T>
T input()
{
    T data;
    cin >> data;
    return data;
}

int main()
{
    ll N = input<ll>(), K = input<ll>(), Q = input<ll>();
    vector<ll> A(N + 1, 0);

    for (ll i = 0; i < Q; i++)
    {
        ll a = input<ll>();
        A[a] += 1;
    }

    for (ll i = 1; i < N + 1; i++)
    {
        ll diff = Q - A[i];
        if (K - diff <= 0)
        {
            cout << "No" << endl;
        }
        else
        {
            cout << "Yes" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1408
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	int l,a,b,c,d;
	scanf("%d",&l);
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	printf("%d\n",l-max(a/c+(a%c!=0?1:0),b/d+(b%d!=0?1:0)));
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <climits>

using namespace std;

typedef long long ll;

int main() {
    ll N;    cin >> N;
    ll *a = new ll[N];
    for (ll i = 0; i < N; i++)
        cin >> a[i];

    ll ans = 0;
    ll x = 1;
    ll *y = new ll[N+1];
    for (ll i = 0; i < N; i++) {
        if (a[i] == x) {
            y[x] = 1;
            x++;
        }
    }

    if (y[1] == 0) {
        cout << -1 << endl;
    }
    else {
        for (ll i = 1; i <= N; i++) {
            if (y[i] > 0)
                ans += 1;
        }
        cout << N - ans << endl;
    }

    return 0;

}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long int lld;
const int MAX=30000;
vector<int> adj,fin;
int sum,n;
int main(){
    scanf("%d",&n);
    if(n==3){
        printf("2 5 63\n");
        return 0;
    }
    if(n==4){
        printf("2 5 20 63\n");
        return 0;
    }
    int i;
    for(i=2;i<=MAX;i++) if(i%2==0||i%3==0||i%5==0) adj.push_back(i);
    for(i=0;i<n-2;i++) fin.push_back(adj[i]),sum+=adj[i];
    for(i=n;i<adj.size();i++){
        if((sum+adj[i])%2==0||(sum+adj[i])%3==0||(sum+adj[i])%5==0) {
            fin.push_back(adj[i]),sum+=adj[i];
            break;
        }
    }
    for(i++;i<adj.size();i++){
        if((sum+adj[i])%30==0) {
            fin.push_back(adj[i]),sum+=adj[i];
            break;
        }
    }
    for(int i=0;i<n;i++) printf("%d ",fin[i]);
    //printf("\n%d %d",fin.size(),sum);
    printf("\n");
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 12 00:21:05 2020

@author: liang
"""

N = int(input())
A = [int(x) for x in input().split()]

A.sort()
A += [-1]
dp = [0] + [True]*10**6
def Solve():
    if A[0] == 1:
        if len(A) >= 2 and A[1] == 1:
            return 0
        else:
            return 1
    k = 0
    for i in range(1,10**6+1):
        if i == A[k]:
            #print("A",i)
            #kの処理
            tmp = A[k]
            cnt = 0
            while k <= N-1 and A[k] == tmp:
                #print("B",k,tmp)
                cnt += 1
                if cnt == 2:
                    dp[tmp] = False
                k += 1
            #倍数の消去
            for j in range(2*i,10**6+1,i):
                #print("C")
                dp[j] = False
    ans = 0
    for a in A[:-1]:
        if dp[a]:
            ans += 1
    return ans

ans = Solve()
print(ans)

Measured memory_bytes: 37252
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
#define PI 3.14159265358979
//#define rep(i,init,n) for(ll i=init;i<=n;++i)
using P = pair<string , int>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

long double pi = 3.14159265359;

int main(){
    long double a ,b,h,m;
    cin >> a >> b >> h >> m;
    long double a_posi,b_posi, dis_pi, ans;
    b_posi = m * 2*pi/60;
    a_posi = h * 2*pi/12 + m * 2*pi/720;
    if(a_posi >= b_posi) dis_pi = a_posi-b_posi;
    else dis_pi = b_posi -a_posi;
//    dis_pi = min(a_posi-b_posi, b_posi-a_posi)  ;
    ans = a*a + b*b - 2*a*b*cos(dis_pi);
    ans = sqrtl(ans);
    cout << std::fixed << std::setprecision(15) << ans << endl;


    return 0;
}

Measured memory_bytes: 4164
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {
var inputArray = retreiveStringArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			var S = inputArray[0];

			//答えの出力
			var ans = S.Substring(0,3);
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}


Measured memory_bytes: 25884
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder2020Ned
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
           
            int[] immi = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            int bad = 0;
            foreach (int item in immi)
            {
                if (item % 2 == 0)
                {
                    if(item % 3 != 0)
                    {
                        if(item % 5 != 0)
                        {
                            bad++;
                        }
                    }
                }                                  
            }
            if(bad >= 1)
            {
                Console.Write("DENIED");
            }
            else
            {
                Console.Write("APPROVED");
            }
            Console.Read();
        }
    }
}


Measured memory_bytes: 13396
#include<stdio.h>

int main(void){
	int m,f,r,i;
	char a[i];
	while(50){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1&&f==-1&&r==-1){
		break;	
		}else if(m==-1||f==-1){
			printf("F\n");
		}else if(m+f>=80){
			printf("A\n");
		}else if(m+f>=65&&m+f<80){
			printf("B\n");
		}else if(m+f>=50&&m+f<65){
			printf("C\n");
		}else if(m+f>=30&&m+f<50&&r>=50){
			printf("C\n");
		}else if(m+f>=30&&m+f<50){
			printf("D\n");
		}else if(m+f<30){
			printf("F\n");
		}
		
	}
	return 0;
}


Measured memory_bytes: 2572
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i64,
        k: i64,
        x: i64,
        y: i64,
    }
    let kk = std::cmp::min(n,k);
    println!("{}", kk * x + (n-kk) * y);
}


Measured memory_bytes: 4352
#include <iostream>
#include<string>
#include<vector>
#include <algorithm>
using namespace std;
int main()
{
	int N;
	cin >> N;
	string S;
	char R[2] = "R", G[2] = "G", B[2] = "B";
	cin >> S;
	
	vector<int>r, g, b;
	for (int i = 0; i < N; i++) {
		if (S[i] == R[0]) {
			r.push_back(i);
		}
		else if (S[i] == G[0]) {
			g.push_back(i);
		}
		else if(S[i]==B[0]){
			b.push_back(i);
		}
	}
	int mi, ma, half;
	int count = 0;
	uint64_t total = r.size()*g.size()*b.size();
	for (uint64_t a = 0; a < r.size(); a++) {
		for (uint64_t i = 0; i <b.size() ; i++) {
			mi=min(r[a],b[i])-abs(r[a] - b[i]);
			ma=max(r[a], b[i])+ abs(r[a] - b[i]);
			std::vector<int>::iterator itr;
			itr = find(g.begin(), g.end(), mi);
			if (itr != g.end()) {
				count++;
			}
			itr = find(g.begin(), g.end(), ma);
			if (itr != g.end()) {
				count++;
			}
			if ((r[a] + b[i]) % 2 == 0) {
				half = (r[a] + b[i]) / 2;
				itr = find(g.begin(), g.end(), half);
				if (itr != g.end()) {
					count++;
				}
			}
		}
	}

	cout << total-count;


}



Measured memory_bytes: 3644
#include <iostream>
using namespace std;
typedef long long ll;

const ll inf = 1LL << 60;

int n,k;
ll h[110000];
ll dp[110000];

int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> h[i];

    for(int i = 0; i < 110000; i++) dp[i] = inf;

    dp[0] = 0;
    for(int i = 0; i < n; i++){
        for(int j = 1; j <= k; j++){
            dp[i + j] = min(dp[i + j],dp[i] + abs(h[i + j] - h[i]));
        }
    }
    
    cout << dp[n-1] << endl;

    return 0;
}


Measured memory_bytes: 1920
#include <iostream>

using namespace std;

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


Measured memory_bytes: 3108
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
#define N 500500
using namespace std;

int n, p[N], a[N], mi[N];

bool check(int u) {
    if (1 < u && u < n && p[u - 1] > p[u] && p[u] > p[u + 1])
        return swap(p[u - 1], p[u + 1]), true;
    else return false;
}

int stk[N], top;

int main() {
#ifdef isLOCAL
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> n;
    for (int i = 1; i <= n; ++i)
        scanf("%d", p + i);

    p[n + 1] = n + 1, p[0] = 0;
    for (int i = 1; i <= n; ++i) {
        if (p[i - 1] != i - 1 && p[i] != i && p[i + 1] != i + 1)
            return puts("No"), 0;
        a[i] = i == p[i];
    }

    
    for (int i = 1, j; i <= n; i = j + 1) {
        for (j = i; j < n && a[j] != a[j + 1]; ++j);
        top = 0;
        for (int k = i; k <= j; ++k) {
            if (p[k] < i || j < p[k]) return puts("No"), 0;
            if (!a[k]) stk[++top] = p[k];
        }
        mi[top] = stk[top];
        for (int k = top - 1; k >= 1; --k)
            mi[k] = min(mi[k + 1], stk[k]);
        int mx = stk[1];
        for (int k = 2; k < top; ++k) {
            mx = max(mx, stk[k]);
            if (mi[k] < stk[k] && stk[k] < mx)
                return puts("No"), 0;
        }
    }

    return puts("Yes"), 0;

    queue<int> q;
    for (int i = 2; i < n; ++i)
        if (check(i)) q.push(i);

    while (!q.empty()) {
        int u = q.front(); q.pop();
        if (check(u - 2)) q.push(u - 2);
        if (check(u + 2)) q.push(u + 2);
    }

    for (int i = 1; i <= n; ++i)
        if (p[i] != i) return puts("No"), 0;
    puts("Yes");

    return 0;
}


Measured memory_bytes: 5888
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c> {i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
	~debug() { cerr << endl; }
	eni( != ) cerr << boolalpha << i; ris;
}
eni( == ) ris << range(begin(i), end(i));
}
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void solve() {
	int n;
	cin >> n;
	vector<int> v(n);
	map<int, int> mp;
	for (int i = 0; i < n; ++i) {
		cin >> v[i];
		mp[v[i]]++;
	}
	int cnt = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			for (int k = j + 1; k < n; ++k) {
				if (v[i] + v[j] > v[k] && v[j] + v[k] > v[i] && v[i] + v[k] > v[j] && v[i] != v[j] && v[i] != v[k] && v[k] != v[j]) {
					cnt++;
				}
			}
		}
	}
	cout << cnt;
}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}

	return 0;
}


Measured memory_bytes: 3644
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var s = cin.Read;
            WriteLine(s.Count(x => x == '1'));
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


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

int main(){
    string S;
    vector<int> v(26, 0);
    cin >> S;
    for (int i = 0; i < S.size(); ++i){
        int a = S[i] - 'a';
        v[a] += 1;
    }
    bool d = true;
    for (int i = 0; i < 26; ++i){
        if (v[i] > 1){
            cout << "no" << endl;
            d = false;
            break;
        }
    }
    if (d) cout << "yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn = 1e5+5;
int id[maxn],x[maxn],y[maxn];
int main(){
	int n;
	scanf("%d",&n);
	for(int i = 1;i<=n;i++){
		scanf("%d%d%d",&id[i],&x[i],&y[i]);
	}
	int dis = 0;
	id[0] = 0;
	x[0] = 0;
	y[0] = 0;
	int xx,yy,tmp;
	for(int i = 1;i<=n;i++){
		dis = id[i]-id[i-1];
		xx = abs(x[i]-x[i-1]);
		yy = abs(y[i]-y[i-1]);
		tmp = xx+yy;
		if((dis-tmp)%2!=0||(dis<tmp)){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 1408
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using mp_int = mp::cpp_int;

const mp_int MAX = (mp_int)1e18;

mp_int A[100000];

int main() {
	mp_int ans = 1;

	int N;
	cin >> N;

	for (int i=0; i<N; i++) {
		cin >> A[i];
		if (A[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}

	for (int i=0; i<N; i++) {
		ans *= A[i];
		if (ans > MAX) {
			ans = -1;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6832
#include <iostream>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
#include <ctype.h>

#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
//#define hell        1000000007
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.000000001
#define all(a)      (a).begin(),(a).end()
const long long INF = (long long) 1e7+1;
const long long mod = (long long) 998244353;
const long long hell = (long long) 1000000007;

using namespace std;
#include <stdio.h>

ll power(ll x,ll y)
{
  ll res=1;
  while(y>0){
    if(y%2) res=(x%hell*res%hell)%hell;
    x=(x%hell*x%hell)%hell;
    y=y/2;
  }
  return res;
}

ll modinv(ll x){
  return power(x,hell-2);
}

void solve();


void fastIO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
   fastIO();
    solve();
}
//void sieve();
ll pw(ll k,ll x);
ll gcd(ll x,ll y);

/*
  For freq or prime factors

for(auto pri:prime){
  while(k%pri==0){
    pcnt[pri]++;
    k/=pri;
  }
}*/

void solve(){
  int test;
  //cin>>test;
  test=1;
  
  while(test--){
      int h,a;
      cin>>h>>a;
      cout<<(h+a-1)/a;
  }    
}    

    




///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

ll gcd(ll a,ll b)
{
    while( b != 0)
	{
		ll  t = b;
		b= a %t;
		a = t;
	}
	return a;
}


ll pw(ll k,ll x){
  if(x==0)
  return 1;
  if(x&1)
  return ((pw(k,x-1))*k);
  else
  return ((pw(k,x/2))*(pw(k,x/2)));
}


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

int a,b,c;

int main()
{
    cin>>a>>b>>c;
   	
   	if( (a==b and a!=c) || (b==c and b!=a) || (a==c and a!=b))
   		cout<<"Yes";
   	else
   		cout<<"No";

}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>

#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
//cout << fixed << setprecision(10) << ans << endl;
//int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main(){
    int a;
    double b;
    cin >> a >> b;
    b *= 100 + eps;
    int c = b;
    int d = (a * c);
    int f = d/100;
    cout << f << endl;
    return 0;
}


Measured memory_bytes: 3712
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int n, ans = 0, cnt = 1, one = 0;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a.at(i);
        if(a.at(i) == 1) one++;
    }
    if(one == 0) ans = -1;
    else{
        for(int i = 0; i < n; ++i){
            if(a.at(i) == cnt) cnt++;
            else ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4008
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(auto i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MOD = 1000000007;

int exp_mod(long long a, long long b, int m) {
	long long res = 1;
	while (b > 0) {
		if (b&1)
			res = (res * a)%m;
		a = (a * a)%m;
		b >>= 1;
	}
	return (int)res;
}

int fact_mod(int n, int m) {
	long long res = 1;
	for (int i=n; i>0; --i)
		res = (res * i)%m;
	return (int)res;
}

int comb_mod(int n, int r) {
	long long res = 1;
	for (int i=0; i<r; ++i)
		res = (res * (n - i) )%MOD;
	return ( res * exp_mod(fact_mod(r, MOD), MOD-2, MOD) ) % MOD;
}

struct Pony
{
    string name;
    int score, n;

    Pony(string name_, int score_, int n_)
    {
        name = name_;
        score = score_;
        n = n_;
    }

    bool operator<(const Pony &another) const
    {
        return name < another.name || ((name == another.name) && score > another.score);
    };
};

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

  int n, m;

  cin >> n >> m;

  vector<long> v(n);
  
  rep(i, n) {
    cin >> v[i];
  }

  long mx = -INF*1000;

  rep(i, m) {
    long now = -INF*1000;
    int jmax = min(n, m-i);
    rep(j, jmax+1) {
      vector<long> vv;
      long nn = 0;
      rep(k, j) {
        vv.push_back(v[k]);
        nn+=v[k];
      }
      rep(k, jmax-j) {
        vv.push_back(v[n-k-1]);
        nn+=v[n-k-1];
      }
      sortv(vv);
      int vs = vv.size();
      rep(k, min(i, vs)) {
        if (vv[k] >= 0) break;
        nn-=vv[k];
      }
      now = max(now, nn);
    }
    mx = max(now, mx);
  }

  cout << mx << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
/**
 Answer #4
 **/

using namespace std;

long long X, Y, Z;
long long K;
long long A[1000], B[1000], C[1000];



bool solve (long long P){
    int cnt = 0;
    for(int i = 0; i < X; ++i){
        for(int j = 0; j  < Y; ++j){
            for(int k = 0; k  < Z; ++k){
            if(A[i] + B[j] + C[k] < P) break;
            ++cnt;
            if(cnt >= K) return true;
            }
        }
    }
    return false;
}

std::vector<long long> getCandidate(long long P){
    std::vector<long long> vRet;

    for(int i = 0; i < X; ++i){
        for(int j = 0; j  < Y; ++j){
            for(int k = 0; k  < Z; ++k){
            if(A[i] + B[j] + C[k] < P) break;
            vRet.push_back(A[i]+B[j]+C[k]);
            }
        }
    }
    return vRet;
}





int main()
{

    //    cout << " a" << endl;
    
    cin >> X >> Y >> Z >> K;
    for (int i = 0; i < X; ++i)
    {
        cin >> A[i];
    }
    sort(A, A + X, greater<long long>());

    for (int i = 0; i < Y; ++i)
    {
        cin >> B[i];
    }
    sort(B, B + Y, greater<long long>());

    for (int i = 0; i < Z; ++i)
    {
        cin >> C[i];
    }
    sort(C, C+ Z, greater<long long>());

    long long maxValue = A[0] + B[0] + C[0];
    long long border = 0;
    int rep = 0;
    long long step;
    long long iMin = 0;
    long long iMax = maxValue;
    while(1){
    //    cout << "  " << iMin << " " << iMax << endl;
        step = (iMax - iMin)/2;
        if(step < 1) break;
        if(solve(iMin+step)){
            iMin += step;
        }
        else{
            iMax -= step;
        } 
    }
    border = iMin;
    vector<long long> vec = getCandidate(border);
    sort(vec.begin(), vec.end(), greater<long long>());
    for(int i = 0; i < K; ++i){
        cout << vec[i] <<endl;
    }    
    return 0;
}

Measured memory_bytes: 263768
A, B, C, D = map(int, input().split())

if B <= C:
    print(0)

elif D <= A:
    print(0)

elif C <= A:
    if D <= B:
        print(D-A)
    else:
        print(B-A)

elif C > A:
    if  B >= D:
        print(D-C)
    else:
        print(B-C)

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

 int main(){
 	int a,b;
 	cin >> a >> b;
 	if(a*b%2==1){
 		cout << "Odd" << endl;
 	}
 	else{
 		cout << "Even" << endl;
 	}
 	
 	 }

Measured memory_bytes: 256
s = list(input())
start = 0
end = 0
len_s = len(s)
for i in range(len_s):
  if s[i] == "A":
    start = i
    break
    
for i in reversed(range(len_s)):
  if s[i] == "Z":
    end = i
    break
print(end - start + 1)

Measured memory_bytes: 10444
N,*A = `dd`.split.map &:to_i
ns = {}
A.each{ |a| ns[a] = (ns[a] || 0) + 1 }
puts case ns.size
when 1; (ns[0] || 0) > 0
when 2
  x,y = ns.keys.sort_by{ |a| ns[a] }
  ns[x]*2 == ns[y] && (x ^ y) == y
when 3
  x,y,z = ns.keys
  ns[x] == ns[y] && ns[y] == ns[z] && (x ^ y) == z
else false
end ? "Yes" : "No"


Measured memory_bytes: 12680
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

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

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> Point;

const double EPS = 1e-8;
const double PI = atan(1.0) * 4.0;

struct Data
{
	double arg;
	bool in;
	Data(double arg, bool in) : arg(arg), in(in) {}
	bool operator< (const Data& d)const
	{
		return fabs(arg - d.arg) < EPS ? in && !d.in : arg < d.arg;
	}
};

int main()
{
	int n;
	while(scanf("%d", &n), n){
		vector<Point> p(n);
		rep(i, n){
			scanf("%lf,%lf", &p[i].real(), &p[i].imag());
		}

		int ans = 0;
		rep(i, n){
			int sim = 1;
			vector<Data> args;
			rep(j, n){
				if(i == j)
					continue;
				Point vec = p[j] - p[i];
				double r = abs(vec);

				if(r > 2.0)
					continue;
				else if(r < EPS){
					++sim;
				}else{
					double theta = atan2(vec.imag(), vec.real());
					double phi = acos(r/2.0);

					double a = theta - phi;
					if(a < -PI) a += 2.0 * PI;
					double b = theta + phi;
					if(b > PI) b -= 2.0 * PI;
					args.push_back(Data(a, true));
					args.push_back(Data(b, false));

					if(b < a)
						++sim;
				}
			}
			sort(args.begin(), args.end());
			int best = sim;
			//printf("%d --\n", i+1);
			rep(i, args.size()){
			//	printf("sim = %d\n", sim);
				if(args[i].in)
					++sim;
				else
					--sim;
				best = max(best, sim);
			}
			//printf("sim = %d\n", sim);
			ans = max(best, ans);
		}

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

Measured memory_bytes: 0
#include<stdio.h>
// typedef long long int ll;
//先生によると二項定理を使うらしい
int MIN(int a, int b){return a>b?b:a;}

int main(void){
    int n;
    scanf("%d", &n);
    int a[n];
    for(int i=0; i<n; i++){
        scanf("%d", &a[i]);
    }
    
    int sum = 0;
    int min = 1000000000;

    for(int i=0; i<n; i++){
        int tmp = a[i];
        int cnt = 0;
        int flag = 1;
        while((tmp > 0) && flag){
            if(tmp%2 == 0){
                cnt++;
            }else{
                flag = 0;
            }
            tmp /= 2;
        }
        sum += cnt;
        min = MIN(min, cnt);
    }
    //全ての整数を3倍できないことを、全ての数を2で割れないことと謎に結びつけてた？
    //で、2で割る回数を最大化したいので、2で割れる回数が一番小さいa_iのその回数を
    //全体から引いてたみたいやが・・・
    //自分でもよくわからない
    // printf("%d\n", sum-min);
    printf("%d\n", sum);
    return 0;
}

Measured memory_bytes: 256
//マヤの大予言

#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<algorithm>
#include<deque>

using namespace std;
#define LL long long

//文字列分割
vector<string>Split(string s, char c) {
	vector<string> v;
	auto pbegin = s.begin();
	while (pbegin != s.end()) {
		auto pend = pbegin;
		while (pend != s.end() && *pend != c) 
			pend++;
		v.push_back(string(pbegin, pend));
		if (pend != s.end())
			pend++;
		pbegin = pend;
	}
	return v;
}
//

LL Md[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
LL wd = 20, td = 360, kad = 7200, bd = 144000, cd = 1872000;
LL y400d = 146097, y100d = 36524, y4d = 1461, y1d = 365;

LL adtoll(LL y, LL m, LL d) {//西暦から日数
	LL tmp = 0, Y = y;
	//年
	Y--;
	tmp += Y / 400 * y400d; Y %= 400;
	tmp += Y / 100 * y100d;  Y %= 100;
	tmp += Y / 4 * y4d; Y %= 4;
	tmp += Y * y1d;
	//月
	if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)
		 Md[2] = 29;//閏年
	else Md[2] = 28;
	for (int i = 0; i < m; i++) 
		tmp += Md[i];
	//日
	tmp += d;
	return tmp;
}

string lltoad(LL days) {//日数から西暦
	string s;
	LL y = 0, m = 0, d = 0;
	LL Y = y;
	//年
	y += days / y400d * 400; days %= y400d;
	y += days / y100d * 100; days %= y100d;
	y += days / y4d * 4; days %= y4d;
	if (days / y1d == 4) {
		y += days / y1d; m = 12; d = 30;
	}
	else {
		y += days / y1d; days %= y1d;
		if (days == 0) {//年末
			m = 12; d = 31;
		}
		else {
			y++;

			//月
			if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)
				Md[2] = 29;//閏年
			else Md[2] = 28;
			LL i = 1;
			while (true) {
				if (days <= Md[i]) {
					m = i; break;
				}
				else {
					days -= Md[i]; i++;
				}
			}
			//日
			d = days;
		}
	}

	s = to_string(y) + "." + to_string(m) + "." + to_string(d);

	return s;
}

LL mayatoll(LL b, LL ka, LL t, LL w, LL ki) {//マヤから日数
	LL tmp = 0;
	tmp += b * bd;
	tmp += ka * kad;
	tmp += t * td;
	tmp += w * wd;
	tmp += ki;
	return tmp;
}


string lltomaya(LL days) {//日数からマヤ
	days %= cd;
	string s;
	LL b, ka, t, w, ki;
	b = days / bd; days %= bd;
	ka = days / kad; days %= kad;
	t = days / td; days %= td;
	w = days / wd; days %= wd;
	ki = days;

	s = to_string(b) + "." + to_string(ka) 
		+ "." + to_string(t) + "." + to_string(w) + "." + to_string(ki);

	return s;
}


int main() {
	while (true) {
		string s;
		cin >> s;
		if (s == "#")break;

		int type;//1:ad 0:maya
		LL y, m, d;//西暦
		LL b, ka, t, w, ki;//マヤ暦

		vector<string> data = Split(s, '.');
		if (data.size() == 3) {
			y = stoi(data[0]);
			m = stoi(data[1]);
			d = stoi(data[2]);
			type = 1;
		}
		else {
			b = stoi(data[0]);
			ka = stoi(data[1]);
			t = stoi(data[2]);
			w = stoi(data[3]);
			ki = stoi(data[4]);
			type = 0;
		}

		string output;
		LL day = 0;
		LL we = 734858;
		if (type) {//ad
			day = adtoll(y, m, d) - we;
			output = lltomaya(day);
		} 
		else{//maya
			day = ki + w * 20 + t * 360 + ka * 7200 + b * 144000 + we;
			output = lltoad(day);
		}
		//
		//cout << " ";
		//
		cout << output << endl;
	}

	return 0;
}


Measured memory_bytes: 3300
#include<iostream>
#include<algorithm>
using namespace std;
int d[100005];
int main()
{	//ios::sync_with_stdio(false);
	int i,j,n;
	cin>>n;
	for(i=1;i<=n;i++)
		cin>>d[i];
	sort(d+1,d+n+1);
	printf("%d", d[(n >> 1) + 1] - d[n >> 1]);

}

Measured memory_bytes: 640
#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 n;
  R n;
  ll a[n];
  rep(i,n) R a[i];
  ll ans=MAXL,s1=0,s2=0;
  rep(i,n) s2+=a[i];
  rep(i,n) {
    s1+=a[i];
    s2-=a[i];
    ans=min(ans,abs(s1-s2));
  }
  pr(ans);
}

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


Measured memory_bytes: 256
import itertools
import copy
h, w, k = (int(x) for x in input().split())
count=0
c =[[]for i in range(h)]
for i in range(h):
	c[i]=input()
	
for i in range(h):
	for j in range(w):
		if c[i][j]=="#":
			count+=1
ans = 0
need = count-k

for i in itertools.product([0,1], repeat=h):
	need1 = need
	c_2 = copy.copy(c)
	for j in range(h):
		if i[j]==1:
			for k in range(w):
				if c_2[j][k]=="#":
					need1-=1
			list = ["."]*w
			c_2[j]="".join(list)
					
					
	for j in itertools.product([0,1], repeat=w):
		need2=need1
		for k in range(w):
			if j[k]==1:
				for l in range(h):
					if c_2[l][k]=="#":
						need2-=1
		if need2==0:
			ans+=1
print(ans)



Measured memory_bytes: 69400
#include <cstdio>
#include <cstring>
using namespace std;
char s[10005],ans[10005];
int top=0;
int main(){
    scanf("%s",s);
    for(int i=0;i<strlen(s);i++)
        if(s[i]!='B'){
            top++;
            ans[top]=s[i];
        } else if(top>0) top--;
    for(int i=1;i<=top;i++)
        printf("%c",ans[i]);
    return 0;
}

Measured memory_bytes: 128
/*
 * iraira.cpp
 *
 *  Created on: 2018/05/02
 *      Author: J01003
 */
/*
 * taete.cpp
 *
 *  Created on: 2018/04/26
 *      Author: J01003
 */
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
    int a,b;
    string op;
    while (1){
    cin>>a>>op>>b;
    if(op == "+"){
    	cout<<a+b<<endl;
    }else if(op == "-"){
    	cout<<a-b<<endl;
    }else if(op =="*"){
    	cout<<a*b<<endl;
    }else if(op =="/"){
    	cout<<a/b<<endl;
    }if(op =="?"){
    	return 0;}
    }
	return 0;
}




Measured memory_bytes: 3140
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.*;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main
{
	public static void main (String[] arg)throws IOException
	{
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		int[] a= new int[31];
		int[] b= new int[31];	
		int num = Integer.parseInt(input.readLine());
		int num2 = Integer.parseInt(input.readLine());
		for(int i=0;i<=30;i++){
           a[i]=i;
		}
		
		String[] change;
		for(int j=1;j<=num2;j++){
		change=input.readLine().split(",");
		int x1 = Integer.parseInt(change[0]);
        int y1 = Integer.parseInt(change[1]);
		int buffer;
		buffer=a[x1];
		a[x1]=a[y1];
		a[y1]=buffer;
		}
		for(int k=1;k<=num;k++){
			System.out.println(a[k]);
		}
	}
}

Measured memory_bytes: 17064
import java.util.*;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        int[][] arg = new int[m][2];
        for (int i = 0; i < m; i++) {
            arg[i][0] = sc.nextInt();
            arg[i][1] = sc.nextInt();
        }

        Arrays.sort(arg, (o1,o2) -> o1[1] - o2[1]);

        int [] ans = new int[m];
        int cnt = 0;
        for (int i = 0; i < m; i++) {
            int[] t = arg[i];
            boolean f = true;
            for (int j = 0; j < ans.length; j++) {
                if (ans[j] >= t[0]) {
                    f = false;
                    break;
                }
            }
            if (f) {
                ans[cnt] = t[1] - 1;
                cnt++;
            }
        }

        System.out.println(cnt);
    }
}

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

string convert(int n) {
    string s;
    while (n >= 4) {
        int p = n % 4;
        s.push_back(p+'0');
        n /= 4;
    }
    s.push_back(n+'0');
    reverse(s.begin(), s.end());
    return s;
}

int main() {
    int n;
    while (cin >> n) {
        if (n == -1) break;
        cout << convert(n) << endl;
    }
    return 0;
}

Measured memory_bytes: 0
from sys import stdin
data = stdin.read().splitlines()

n = int(list(data[0].split())[0])
a = int(list(data[0].split())[1])
b = int(list(data[0].split())[2])

i = 0
count = 0
while i <= n:
    s = sum(list(map(int, str(i))))
    if a <= s and s <= b:
        count = count + i
    i += 1
print(count)

Measured memory_bytes: 9120
// g++ -std=c++14

//Difficulty according to solve count during contest:
//A B C D H F E I G K L M N P S O Q R J U Z Y X T V W

#include<bits/stdc++.h>

typedef long long ll;
typedef long double lld;
using namespace std;

#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define endl "\n"
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(c) (c.begin(),c.end())
#define LET(x, a)  __typeof(a) x(a)
#define foreach(it, v) for(LET(it, v.begin()); it != v.end(); it++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define inf 1000000000000000001

#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}

template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
ll l=v.size();for(ll i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

#define int ll
vector<int> curr, prev1;
int32_t main(){ _
  int n, w, sum = 0;
  cin >> n >> w;
  vector<int> weight(n), value(n);
  for(int i = 0; i < n; i++){
    cin >> weight[i] >> value[i];
    sum += value[i];
  }
  curr.resize(sum + 1, 1e9 + 5);
  prev1.resize(sum + 1, 1e9 + 5);
  prev1[value[0]] = weight[0];
  prev1[0] = 0;
  for(int i = 1; i < n; i++){
    curr[value[i]] = weight[i];
    for(int j = 0; j <= sum; j++){
      if(prev1[j] + weight[i] <= w)
        curr[j+ value[i]] = min(curr[j + value[i]], prev1[j] + weight[i]);
      curr[j] = min(curr[j], prev1[j]);
    }
    swap(curr, prev1);
    curr.clear();
    curr.resize(sum + 1, 1e9 + 5);
  }
  int ans = 0;
  for(int i = sum; i >= 0; i--){
    if(prev1[i] <= w){
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4756
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n=0;
   cin>>n;
   int a[n];
   for(int i=0;i<n;i++)
    cin>>a[i];
   int b[n];
   sort(a,a+n);
   int k[n];
       b[0]=a[n/2];
       k[0]=a[n/2];
       int c=0;
       int i=0,j=n-1;
       while(c<n-1){
           c++;
           if(c%2!=0)
           b[c]=a[i++];
           else
           b[c]=a[j--];
          // cout<<"i="<<i<<endl;
           //cout<<"j="<<j<<endl;
           }
    i=0;j=n-1;c=0;
           while(c<n-1){
           c++;
           if(c%2==0)
           k[c]=a[i++];
           else
           k[c]=a[j--];
           }

       //for(int i=0;i<n;i++)
      //  cout<<b[i]<<" ";
       long long int sum1=0,sum2=0;
       for(int i=0;i<n-1;i++)
        sum1=sum1+abs(b[i]-b[i+1]);
        for(int i=0;i<n-1;i++)
        sum2=sum2+abs(k[i]-k[i+1]);
        cout<<max(sum1,sum2)<<endl;
}


Measured memory_bytes: 1408