akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int x[50],y[50];
int xx[50],yy[50];

signed main(){
	int K,n;cin>>n>>K;
	vector<int>X,Y;
	rep(i,n){
		cin>>x[i]>>y[i];
		X.push_back(x[i]);
		Y.push_back(y[i]);
	}
	sort(X.begin(),X.end());
	X.erase(unique(X.begin(),X.end()),X.end());
	sort(Y.begin(),Y.end());
	Y.erase(unique(Y.begin(),Y.end()),Y.end());
	rep(i,n){
		xx[i]=lower_bound(X.begin(),X.end(),x[i])-X.begin();
		yy[i]=lower_bound(Y.begin(),Y.end(),y[i])-Y.begin();
	}
	ll Min=LLONG_MAX;
	rep(i,X.size())for(int j=i;j<X.size();j++){
		rep(k,Y.size())for(int t=k;t<Y.size();t++){
			int cnt=0;
			rep(l,n){
				if(X[i]<=x[l]&&x[l]<=X[j]&&Y[k]<=y[l]&&y[l]<=Y[t]){
					cnt++;
				}
			}
			if(cnt>=K){
				Min=min(Min,(ll)(X[j]-X[i])*(ll)(Y[t]-Y[k]));
			}
		}
	}
	cout<<Min<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1000000007LL;
ll S[100000];
int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < N; i++) cin >> S[i], S[i] %= M;
	for (int i = 1; i < N; i++) (S[i] += S[i - 1]) %= M;
	ll ans = 0;
	map<int, int> cnt;
	cnt[S[0]]++;
	if (S[0] == 0) ans++;
	for (int i = 1; i < N; i++) {
		ans += cnt[S[i]];
		if (S[i] == 0) ans++;
		cnt[S[i]]++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    long X, t; cin >> X >> t;
    if (X-t < 0) cout << 0 << endl;
    else cout << X-t << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int n,k,i,j,x,f,d[10]={0};
  scanf("%d %d",&n,&k);
  while(k--){
    scanf("%d",&x);
    d[x]=1;
  }
  for(i=n;;i++){
    x=i;
    f=0;
    while(x){
      if(d[x%10]){
	f=1;
	break;
      }
      x/=10;
    }
    if(f)
      continue;
    else
      break;
  }
  printf("%d\n",i);
  return 0;
}


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

A = list(map(int, input().split()))

B = []
t = 0
for i in A:
    if i < 0:
        t += 1
        B.append(abs(i))
    else:
        B.append(i)
    
if t % 2 == 0:
    print(sum(B))
else:
    print(sum(B) - 2 * min(B))

Measured memory_bytes: 65184
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x) - 1 * 100);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>

using namespace std;
int n;
int main(void) {
	cin >> n;
	int odd = 0, two = 0, four = 0, tm;
	rep(i, n) {
		cin >> tm;
		if (tm % 2) {
			odd++;
		}

		else if (tm % 4 == 0) {
			four++;
		}
		else if (tm % 2 == 0) {
			two++;
		}
	}
	if (two == 0) {
		if (odd <= four + 1) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		if (odd + 1 <= four + 1) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<ll>A(N);
    int flagN = -1; // -1なら全部0以上, 0以上なら A[i] < 0
    int flagP = -1; // -1なら全部0以下, 0以上なら A[i] > 0
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        if(A[i] < 0) flagN = i;
        if(A[i] > 0) flagP = i;
    }

    ll M = 0;
    if(flagN == -1){
        int x = 0; // A[x] は絶対値最小
        M = A[0];
        for (int i = 1; i < N; ++i) {
            if(A[x] > A[i]) x = i;
            M += A[i];
        }
        M = M - (2 * A[x]);
        cout << M << endl;
        if(x == 0){
            for (int i = 2; i < N; ++i) {
                cout << A[0] << " " << A[i] << endl;
                A[0] -= A[i];
            }
            cout << A[1] << " " << A[0] << endl;
        }else{
            for (int i = 1; i < N; ++i) {
                if(i != x){
                    cout << A[x] << " " << A[i] << endl;
                    A[x] -= A[i];
                }
            }
            cout << A[0] << " " << A[x] << endl;
        }
    }else if(flagP == -1){
        int x = 0; // A[x] は絶対値最小
        M -= A[0];
        for (int i = 1; i < N; ++i) {
            if(A[x] < A[i]) x = i;
            M -= A[i];
        }
        M = M + (2 * A[x]);
        cout << M << endl;

        for (int i = 0; i < N; ++i) {
            if(i != x){
                cout << A[x] << " " << A[i] << endl;
                A[x] -= A[i];
            }
        }
    }else{
        // 正も負もある場合
        for (int i = 0; i < N; ++i) {
            M += abs(A[i]);
        }
        cout << M << endl;

        for (int i = 0; i < N; ++i) {
            if(A[i] >= 0 && i != flagP){
                cout << A[flagN] << " " << A[i] << endl;
                A[flagN] -= A[i];
            }
        }
        for (int i = 0; i < N; ++i) {
            if(A[i] < 0){
                cout << A[flagP] << " " << A[i] << endl;
                A[flagP] -= A[i];
            }
        }
    }
    return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int X;
  cin >> X;
  cout << 10 - (X/200) << endl;
  return 0;
}

Measured memory_bytes: 3628
W, H = map(int, input().split())
p = [int(input()) for _ in range(W)]
q = [int(input()) for _ in range(H)]

pq = [(p[i], 0, i) for i in range(W)] + [(q[i], 1, i) for i in range(H)]
pq.sort()

ret = 0
x, y = W + 1, H + 1
for cost, type, i in pq :
    if type == 0 :
        x -= 1
        ret += p[i] * y
    else :
        y -= 1
        ret += q[i] * x
        
print(ret)

Measured memory_bytes: 88536
#include <stdio.h>

int main(void)
{
    int n, x, fx=0;

    scanf("%d", &n);
    x = n;

    while (n) {
        fx += n%10;
        n /= 10;
    }

    if (x%fx==0)    printf("Yes\n");
    else            printf("No\n");

    return 0;
}

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

int n, q, a[200009], c[200009], d[200009], sum;

int main() {
	cin >> n >> q;
	for (int i = 1; i <= n; i++) { cin >> a[i]; c[a[i]]++; }
	for (int i = 1; i <= n; i++) { for (int j = i; j > i - c[i]; j--) { d[j]++; if (j == 1) break; } }
	for (int i = 1; i <= n; i++) { if (d[i] == 0) sum++; }
	for (int i = 1; i <= q; i++) {
		int r1, r2; cin >> r1 >> r2;
		int m1 = a[r1], m2 = r2;
		c[m1]--; if (m1 - c[m1] >= 1) { d[m1 - c[m1]]--; if (d[m1 - c[m1]] == 0) sum++; }
		if (m2 - c[m2] >= 1) { d[m2 - c[m2]]++; if (d[m2 - c[m2]] == 1) sum--; }c[m2]++;
		a[r1] = r2;
		cout << sum << endl;
	}
	return 0;
}

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

int main() {
    while(1){
        string str;
        cin>>str;
        int m;
        cin>>m;
        if(str=="-") break;
        else {
            for(int i=0;i<m;i++){
                int h;cin>>h;
                int size=str.size();
                string str_cpy=str.substr(0,h);
                str.erase(0,h);
                str.insert(size-h,str_cpy);
            }
        }
        cout<<str<<endl;
    }


}


Measured memory_bytes: 3220
from collections import Counter
n = int(input())
a = []
while n % 2 == 0:
    a.append(2)
    n //= 2
f = 3
while f * f <= n:
    if n % f == 0:
        a.append(f)
        n //= f
    else:
        f += 2
if n != 1:
    a.append(n)

c = Counter(a)
ans = 0
loop = True
for i in c.values():
    x = 1
    while loop == True:
        if x * (x + 1) // 2 <= i < (x + 1) * (x + 2) // 2:
            break
        x += 1
    ans += x
print(ans)

Measured memory_bytes: 9468
#include<bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define rep(i,l,r) for(int i = l;i < r;i++)
#define per(i,l,r) for(int i = r - 1;i >= l;i--)
#define de(x) cout<<#x<<" = "<<x<<endl
#define dd(x) cout<<#x<<" = "<<x<<','
typedef long long ll;
int main()
{
	int a,b;
	char s[20];
	cin>>a>>b;
	cin>>s;
	if(strlen(s) != a + b + 1) return 0 * printf("No\n");
	rep(i,0,a + b + 1){
		if(i != a){
			if(s[i] <'0' || s[i] > '9') return 0 * printf("No\n");
		}else{
			if(s[i] != '-')return 0 * printf("No\n");
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
# B - Distance

n,d = list(map(int, input().split()))

p = []
for i in range(n):
    p.append(list(map(int, input().split())))
    
c = 0
for pi in p:
    if pi[0]**2 + pi[1]**2 <= d**2:
        c+=1
    
print(c)

Measured memory_bytes: 45460
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

fn distance(p0: (i32, i32), p1: (i32, i32)) -> f64 {
    let x0 = p0.0 as f64;
    let y0 = p0.1 as f64;
    let x1 = p1.0 as f64;
    let y1 = p1.1 as f64;

    return ((x1 - x0).powi(2) + (y1 - y0).powi(2)).sqrt();
}

struct State {
    nth_arr: Vec<Option<usize>>,
    visited_towns: usize,
}

fn fact(x: i32) -> i32 {
    if x == 0 {
        return 1;
    }

    return x * fact(x - 1);
}

fn main() {
    input! {
        N: usize,
        XYs: [(i32, i32); N],
    }

    let mut ans: f64 = 0.0;
    let mut states: Vec<State> = Vec::new();
    for i in 0..N {
        // その町を訪問する順番
        let mut arr: Vec<Option<usize>> = vec![None; N];

        // i番目の町が最初
        arr[i] = Some(0);
        let state = State {
            nth_arr: arr,
            visited_towns: 1,
        };
        states.push(state);
    }

    let factn: f64 = fact(N as i32) as f64;
    let mut cnt: i32 = 0;
    while !states.is_empty() {
        let state: State = states.pop().unwrap();
        if state.visited_towns == N {
            cnt += 1;

            let mut d_sum: f64 = 0.0;
            let mut order: Vec<usize> = vec![0; N];
            for (town_ind, &order_op) in state.nth_arr.iter().enumerate() {
                let ord: usize = order_op.unwrap();
                order[ord] = town_ind;
            }

            for i in 1..N {
                let prev_town = order[i - 1];
                let current_town = order[i];
                let d = distance(XYs[prev_town], XYs[current_town]);
                d_sum += d / factn;
            }
            ans += d_sum;
        } else {
            for i in 0..N {
                if state.nth_arr[i].is_none() {
                    let mut new_arr = Vec::new();
                    new_arr.extend_from_slice(&state.nth_arr);
                    new_arr[i] = Some(state.visited_towns);
                    let new_state = State {
                        nth_arr: new_arr,
                        visited_towns: state.visited_towns + 1,
                    };
                    states.push(new_state);
                }
            }
        }
    }

    dbg!(cnt);
    println!("{}", ans);
}


Measured memory_bytes: 2180
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

typedef long long ll;

const int N=2e5+1e3+7;

const double pi=acos(-1);

struct node{
	ll x,y;
}p[N];

ll n,a[N],g[N],sx,sy,tx,ty,cnt,f[N],tot;

ll sxx,txx,syy,tyy;

double ans;

bool cmp(node a,node b)
{
	return a.x<b.x;
}

int main()
{
	cin>>sx>>sy>>tx>>ty;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>p[i].x>>p[i].y;
		if(sx>tx)
			p[i].x=-p[i].x;
		if(sy>ty)
			p[i].y=-p[i].y;
	}
	if(sx>tx)
		sx=-sx,tx=-tx;
	if(sy>ty)
		sy=-sy,ty=-ty;
	sort(p+1,p+n+1,cmp);
	sxx=min(sx,tx);
	txx=max(sx,tx);
	syy=min(sy,ty);
	tyy=max(sy,ty);
	for(int i=1;i<=n;i++)
		if(p[i].x>=sxx&&p[i].x<=txx&&p[i].y>=syy&&p[i].y<=tyy)
			a[++cnt]=p[i].y;
	for(int i=1;i<=cnt;i++)
		g[i]=1e20;
	for(int i=1;i<=cnt;i++)
	{
		ll k=lower_bound(g+1,g+cnt+1,a[i])-g;
		g[k]=a[i];
		tot=max(tot,k);
	}
	ans=abs(ty-sy)+abs(tx-sx);
	ans*=100;
	if(tot==min(abs(sx-tx)+1,abs(sy-ty)+1))
		ans+=5*pi;
	ans-=(double)tot*20;
	ans+=(double)tot*pi/2*10;
	printf("%.20lf",ans);
}

Measured memory_bytes: 6528
#include <iostream>
#include <string.h>
#include <string>
using namespace std;

struct process{
    string name;
    int time;
};

struct processQueue{
    static const int queue_max = 1000000;
    process queue[queue_max];
    int top;
    int index;
    processQueue():top(0), index(0){};
    bool is_empty(){
        return top == index;
    }
    void push_back(process in){
        queue[index] = in;
        index ++;
        if(index >= queue_max)
            index = 0;
    }
    process pop_front(){
        process ret = queue[top];
        top ++;
        if(top >= queue_max)
            top = 0;
        return ret;
    }
    void printQueue(){
        for(int i=0; i<index; i++){
            cout << i << ":" << queue[i].name << ", "<< queue[i].time << endl;
        }
    }
};

int main(){
    int n, q;
    cin >> n >> q;
    processQueue que;
    for(int i=0; i<n; i++){
        process temp;
        cin >> temp.name;
        cin >> temp.time;
        que.push_back(temp);
    }
    int count = 0;
    while(!que.is_empty()){
        process temp = que.pop_front();
        if(temp.time - q > 0){
            temp.time -= q;
            que.push_back(temp);
            count += q;
        }else{
            count += temp.time;
            cout << temp.name << " " << count << endl;
        }
    }
}


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

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

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

ll diff(ll x, ll y){
    return (x>y) ? (x-y):(y-x);
}
int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N, X, Y;
    cin >> N >> X >> Y;

    X--;
    Y--;
    vector<ll> counts(N, 0);
    for(ll i = 0 ; i < N; i++ ){
        for(ll j = i; j < N; j++){
            ll len = min((j-i), diff(Y,j)+diff(X,i)+1);
            counts[len]++;
        }
    }
    for(int i = 1; i < N; i++){
        cout << counts[i] << endl;
    }
}


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

int main() {
  int N;
  cin >> N;
  
  int i=0, sum=0;
  while(i<N) {
    int ln, rn;  
    cin >> ln >> rn;
    sum += rn - ln + 1;
    i++;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
const long long inf = 1LL << 61;
const int max_size = 262144;
int N, Q, A, B, x[200009]; long long seg[2][524296];
void release(int tp, int pos, long long val) {
	pos += max_size;
	seg[tp][pos] = min(seg[tp][pos], val);
	while (pos > 1) {
		pos >>= 1;
		seg[tp][pos] = min(seg[tp][pos * 2], seg[tp][pos * 2 + 1]);
	}
}
long long min_query(int tp, int a, int b, int k = 1, int l = 0, int r = max_size) {
	if (a <= l && r <= b) return seg[tp][k];
	if (r <= a || b <= l) return inf;
	long long lc = min_query(tp, a, b, k * 2, l, (l + r) >> 1);
	long long rc = min_query(tp, a, b, k * 2 + 1, (l + r) >> 1, r);
	return min(lc, rc);
}
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin >> N >> Q >> A >> B; A--, B--;
	for (int i = 1; i <= Q; i++) cin >> x[i], x[i]--;
	long long ret = inf;
	for (int tp = 0; tp < 2; tp++) {
		fill(seg[0], seg[0] + max_size * 2, inf);
		fill(seg[1], seg[1] + max_size * 2, inf);
		release(0, A, -A);
		release(1, A, A);
		x[0] = B;
		long long ans = inf;
		for (int i = 1; i <= Q; i++) {
			long long lc = min_query(0, 0, x[i]) + x[i];
			long long rc = min_query(1, x[i], N) - x[i];
			long long res = min(lc, rc) - abs(x[i] - x[i - 1]);
			release(0, x[i - 1], res - x[i - 1]);
			release(1, x[i - 1], res + x[i - 1]);
		}
		for (int i = 0; i < N; i++) ans = min(ans, min_query(0, i, i + 1) + i);
		for (int i = 1; i <= Q; i++) ans += abs(x[i] - x[i - 1]);
		ret = min(ret, ans);
		swap(A, B);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 9216
class Main{
  public static void main(String[]z){
    Scanner x=new Scanner(System.in);
    int i=0;
    while(x.hasNext()){
      String s=x.nextLine();
      if(s.equals(new StringBuffer(s).reverse().toString()))i++;
    }
    System.out.println(i);
  }
}

Measured memory_bytes: 12000
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
#else
	#define DBG(X)
#endif

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::pair;
using std::swap;
using std::sort;
using std::lower_bound;
using std::unique;
using std::abs;

using int64 = long long int;
using pii   = pair<int, int>;
using pii64 = pair<int64, int64>;

const int NIL = -1;
const int INF = (int)2e9;
const int64 INF64 = (int64)2e18;

void init_IO() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
}

template<typename T>
std::ostream& operator<<(std::ostream& os, const vector<T>& vec) {
	os << '[';
	int fst = 1;

	for(auto& elem: vec) {
		if(fst == 0) {
			os << ' ';
		}

		os << elem;
		fst = 0;
	}

	os << ']';
	return os;
}

void solve() {
	int64 h, w, x, y;
	cin >> w >> h >> x >> y;

	int64 area = h * w;

	cout << area / 2;

	if(area & 1) {
		cout << ".5 ";
	} else {
		cout << ' ';
	}

	cout << (2 * x == w && 2 * y == h) << '\n';
}

int main() {
	init_IO();
	solve();

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define REP(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define TF(flag) (flag)?1:0
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

int main(void){
  int N; cin>>N;
  cout<<N*800-N/15*200;
}














Measured memory_bytes: 256
n = int(input())
w = list(map(int, input().split()))
diffs = 100000
for t in range(n):
    s1 = 0
    s2 = 0
    for i in range(t):
        s1 += w[i]
    for j in range(n - t):
        s2 += w[j + t]
    tmp = abs(s1 - s2)
    if tmp < diffs:
        diffs = tmp
print(diffs)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define forr(i,n) for(int i=int(n-1);i>=0;i--)
#define fora(i,a,b) for(int i=int(a);i<=int(b);i++)
#define forb(i,a,b) for(int i=int(a);i>=int(b);i--)
#define mod 1000000007
using namespace std;
using ll=long long int;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vii;
typedef pair<ll ,ll> pii;


void solve()
{
	ll n;
	cin>>n;
	ll arr[n];
	forn(i,n)
	{
		cin>>arr[i];
	}
	ll cur=arr[0];
	ll ans=0;
	fora(i,1,n-1)
	{
		if(arr[i]<cur)ans+=cur-arr[i];
		else cur=arr[i];
	}
	cout<<ans<<endl;
	
}
int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
	solve();
    return 0;
}



Measured memory_bytes: 5144
import numpy as np

h, w  = map(int,input().split())
sn = [[0]*w for i in range(h)]
 
for i in range(h):
    s = input()
    for j in range(w):
        if s[j] == '.':
            sn[i][j] = 1
sn = np.array(sn)
score = np.zeros_like(sn)
total = np.zeros_like(sn)

score[0] += sn[0]
for i in range(1, h):
    score[i] = (score[i-1] + sn[i]) * sn[i]
total += score

score[h-1] = sn[h-1]
for i in range(h-2, -1, -1):
    score[i] = (score[i+1] + sn[i]) * sn[i]
total += score

score[:,0] = sn[:,0]
for i in range(1, w):
    score[:,i] = (score[:,i-1] + sn[:,i]) * sn[:,i]
total += score

score[:,w-1] = sn[:,w-1]
for i in range(w-2, -1, -1):
    score[:,i] = (score[:,i+1] + sn[:,i]) * sn[:,i]
total += score
    
print(total.max()-3)

Measured memory_bytes: 140660
package main

import (
	"fmt"
)

// main is ...
func main() {
	var s string
	fmt.Scan(&s)

	sLen := len(s) / 2
	var s1, s2 string

	for idx, r := range s {
		if len(s)%2 != 0 && idx == sLen {
			continue
		}
		if idx >= sLen {
			s2 += string(r)
			continue
		}
		s1 += string(r)
	}
	var sTmp string
	for i := sLen - 1; i >= 0; i-- {
		sTmp += string(s2[i])
	}
	s2 = sTmp
	// fmt.Println("s1 : ", s1)
	// fmt.Println("s2 : ", s2)
	if s1 == s2 {
		fmt.Print(0)
		return
	}

	count := 0
	for i := 0; i < sLen; i++ {

		// fmt.Println("s1 : ", s1[i])
		// fmt.Println("s2 : ", s2[sLen-1-i])
		// if s1[i] != s2[sLen-1-i] {
		// fmt.Println("s2 : ", s2[i])
		if s1[i] != s2[i] {
			count++
		}
	}
	fmt.Print(count)
}



Measured memory_bytes: 512
S = input()
N = len(S)
f = True
if S[0] != 'A':
    f = False
if S[2:N-1].count('C') != 1:
    f = False
for s in S:
    if s != 'A' and s != 'C' and s.isupper():
        f = False
print('AC' if f else 'WA')

Measured memory_bytes: 9116
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int bitcnt(int s, int n) {
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (s & (1 << i)) {
            cnt++;
        }
    }
    return cnt;
}

int main() {
    int n; cin >> n;
    vector<vector<int> > a(n, vector<int>(n));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a.at(i).at(j);
        }
    }
    vector<int> dp((1 << n), 0);
    dp.at(0) = 1;
    for (int i = 1; i < (1 << n); i++) {
        int cnt = bitcnt(i, 22);
        for (int j = 0; j < n; j++) {
            if ((i & (1 << j)) && (a.at(cnt-1).at(j))) {
                dp.at(i) += dp.at(i ^ (1 << j));
                dp.at(i) %= MOD;
            }
        }
    }
    cout << dp.at((1 << n) - 1) << endl;
}

Measured memory_bytes: 8448
n = int(input())
a = sorted([int(i) for i in input().split()])
ans = 1
dic = {}
for i in range(10**5):
    dic[i] = 0
for i in a:
    dic[i] += 1
for i in range(1,10**5-1):
    ans = max(ans, dic[i-1] + dic[i] + dic[i+1])
print(ans)

Measured memory_bytes: 20688
import sys
from bisect import bisect_left

input = sys.stdin.readline


def solve(N, L):
    L.sort()
    ans = 0
    for a in range(N - 2):
        for b in range(a + 1, N - 1):
            c = bisect_left(L, L[a] + L[b]) - 1
            ans += c - b
    return ans


def main():
    N = int(input())
    L = list(map(int, input().split()))

    ans = solve(N, L)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9352
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18

using namespace std;

int main(void){
  double l;
  cin >> l;

  double ans = l * l * l / 27;
  printf("%.10lf\n", ans);

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define LL long long
using namespace std;
const int maxn = 3e3 + 5;
const int mod = 1e9 + 7;
int f[maxn][maxn], n, a[maxn], p2c[maxn][maxn], q;
int l[maxn], r[maxn], tmp[maxn], ptmp[maxn];
int pow2[maxn], ans, tmpl, tmpr;
inline int mul(const int &a, const int &b) {
	return 1ll * a * b % mod;
}
inline void Add(int &a, const int &b) {
	a = a + b >= mod ? a + b - mod : a + b;
}
inline int Minus(const int &a, const int &b) {
	return a - b < 0 ? a - b + mod : a - b;
}
int main() {
	scanf("%d%d", &n, &q), pow2[0] = 1;
	for(register int i = 1; i <= q; ++i)
		pow2[i] = pow2[i - 1] * 2 % mod;
	for(register int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	for(register int i = 1; i <= q; ++i) {
		scanf("%d%d", &l[i], &r[i]);
		if(l[i] > r[i]) swap(l[i], r[i]);
	}
	for(register int i = 1; i <= n; ++i)
		for(register int j = i + 1; j <= n; ++j)
			f[i][j] = 1;
	reverse(l + 1, l + q + 1);
	reverse(r + 1, r + q + 1);
	for(register int i = 1; i <= q; ++i) {
		for(register int j = 1; j <= n; ++j)
			tmp[j] = f[j][r[i]], ptmp[j] = p2c[j][r[i]];
		for(register int j = 1; j <= n; ++j) {
			if(j == l[i] || j == r[i]) continue;
			f[j][r[i]] = mul(f[j][r[i]], pow2[i + p2c[j][r[i]] - 1]);
			f[j][l[i]] = mul(f[j][l[i]], pow2[i + p2c[j][l[i]] - 1]);
			tmpl = f[j][l[i]], tmpr = f[j][r[i]];
			Add(f[j][r[i]], tmpl);
			Add(f[j][l[i]], tmpr);
			f[r[i]][j] = Minus(pow2[i], f[j][r[i]]);
			f[l[i]][j] = Minus(pow2[i], f[j][l[i]]);
			p2c[j][l[i]] = p2c[j][r[i]] = -i;
			p2c[l[i]][j] = p2c[r[i]][j] = -i;
		}
		p2c[l[i]][r[i]] = -i;
		f[l[i]][r[i]] = pow2[i - 1];
		p2c[r[i]][l[i]] = -i;
		f[r[i]][l[i]] = pow2[i - 1];
		/*for(register int j = 1; j <= n; ++j) {
			for(register int k = 1; k <= n; ++k) {
				//f[i][j] = mul(f[i][j], pow2[q + p2c[i][j]]);
				printf("%d ", mul(f[j][k], pow2[i + p2c[j][k]]));
			}
			putchar('\n');
		}*/
	}
	for(register int i = 1; i <= n; ++i) {
		for(register int j = i + 1; j <= n; ++j) {
			f[i][j] = mul(f[i][j], pow2[q + p2c[i][j]]);
			if(a[i] > a[j]) Add(ans, f[i][j]);
			else if(a[i] < a[j]) Add(ans, Minus(pow2[q], f[i][j]));
		}
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 70784
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

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

int main(){
    int n;
    cin >> n;
    bool flag = 1;
    rep(i,n){
        int a;
        cin >> a;
        if(a%2==0){
            if(a%3==0||a%5==0){
            }else{
                flag = 0;
            }
        }
    }
    if(flag){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//https://onlinejudge.u-aizu.ac.jp/problems/1616

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, m;

    while (cin >> n >> m, n | m) {
        vector<int> a(n);
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
        }

        sort(a.begin(), a.end());

        int ans = 0;
        for (int i = 0; i < n and a[i] < m; ++i) {
            for (int j = i + 1; j < n and a[i] + a[j] <= m; ++j) {
                ans = max(ans, a[i] + a[j]);
            }
        }

        if (ans == 0) {
            cout << "NONE" << endl;
        } else {
            cout << ans << endl;
        }
    }
    return 0;
}

/*
 * 愚直に全検索
 * 
 */


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
 
int main()
{
  int x, y;
  cin >> x >> y;
  
  if (y % 2 || -1*x + y/2 < 0 || 2*x - y/2 < 0)
  {
    cout << "No";
    return 0;
  }
  
  cout << "Yes";
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int A;
  int B;
  int C;
  int X;
  int Y;
  cin >> A >> B >> C >> X >> Y;
  
  int AB = min(X, Y);
  X -= AB;
  Y -= AB;
  int sum = 0;
  if(A + B < C * 2){
    sum += AB * (A + B);
  }else{
    sum += AB * (C * 2);
  }
  if(A < C*2){
    sum += X * A;
  }else{
    sum += X * (C * 2);
  }
  if(B < C*2){
    sum += Y * B;
  }else{
    sum += Y * (C * 2);
  }
  cout << sum;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		//????????£????????????????????°?????????????????£?¨?
		Scanner sc = new Scanner(System.in);
		//??°?????????
		while(true){
			//???????????°???
			int intA = sc.nextInt();
			//??????
			String strOp = sc.next();
			//???????????°???
			int intB = sc.nextInt();
			//?????¶strOp????????????????¨????
			if("+".equals (strOp)){
				System.out.println(intA + intB);
			}else if("-".equals (strOp)){
				System.out.println(intA - intB);
			}else if("*".equals (strOp)){
				System.out.println(intA * intB);
			}else if("/".equals (strOp)){
				System.out.println(intA / intB);
			}else if("?".equals(strOp)){
				break;
			}
		}
	}
}

Measured memory_bytes: 26088
def check(a):
    for x in a:
        if x%2 == 0:
            if x%3 == 0 or x%5 == 0:
                pass
            else:
                return False
    return True

n = int(input())
a = list(map(int, input().split()))

if check(a):
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
#define pb push_back
using namespace std;
int32_t main()
{
        int n,i,j;
        cin>>n;
        int h[n][3],dp[n][3]={0};
        for(i=0;i<n;i++)
        {
            for(j=0;j<3;j++)
                cin>>h[i][j];
        }
        dp[0][0]=h[0][0];
        dp[0][1]=h[0][1];
        dp[0][2]=h[0][2];
        for(i=1;i<n;i++)
        {
            for(j=0;j<3;j++)
            {
                dp[i][j]=-1;
                dp[i][j]=max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+h[i][j];
            }
        }
        cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<"\n";
    return 0;
}


Measured memory_bytes: 8196
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define For(i, a, b) for (int i = int(a); i < int(b); i++)
#define Dor(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define Foz(i, a) For(i, 0, a)
#define Doz(i, a) Dor(i, 0, a)
#define Trav(e, v) for (auto& e : v)
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<ii>;
template <typename T> bool ckmin (T& a, T b) { return (b < a) ? a = b, 1 : 0; }
template <typename T> bool ckmax (T& a, T b) { return (b > a) ? a = b, 1 : 0; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (string& e) { return "\"" + e + "\""; }
string to_string (char e) { return "\'" + string(1, e) + "\'"; }
string to_string (bool e) { return e ? "true" : "false"; }
template <typename T> string to_string (T e) {
	string s = "[ ";
	for (auto& x : e) s += to_string(x) + " ";
	return s + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e) {
	return "(" + to_string(e.first) + ", " + to_string(e.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
const int N = 110;
int n, a[N];

bool can() {
	Foz(i, n) if (a[i] % 2 == 0) {
		if (a[i] % 3 != 0 && a[i] % 5 != 0) return false;
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	cin >> n;
	Foz(i, n) cin >> a[i];
	cout << (can() ? "APPROVED" : "DENIED") << '\n';
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N,math,count = 0;
	cin >> N;
	math = N;
	
	for (int i=0;i<8;i++){
		count += math %10;
		math = math / 10;
	}
	
	if ( N % count == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
using namespace std;
typedef long long LL;
const int INF=0x3f3f3f3f;
const int MAXN=1e5+5;
int a[MAXN];
int g[105][105];

int main()
{
    int h,w;
    while(scanf("%d%d",&h,&w)!=EOF)
    {
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;++i)
            scanf("%d",&a[i]);
        int cnt=1;
        for(int i=1;i<=h;++i)
        {
            if(i&1)
            {
                for(int j=1;j<=w;++j)
                {
                   if(a[cnt]>0) {g[i][j]=cnt;--a[cnt];}
                   else if(a[cnt]==0) {++cnt;g[i][j]=cnt;--a[cnt];}
                }
            }else
            {
                for(int j=w;j>=1;--j)
                {
                    if(a[cnt]>0) {g[i][j]=cnt;--a[cnt];}
                    else if(a[cnt]==0) {++cnt;g[i][j]=cnt;--a[cnt];}
                }
            }
        }
        for(int i=1;i<=h;++i)
        {
            for(int j=1;j<=w;++j)
            {
                if(j!=w) printf("%d ",g[i][j]);
                else printf("%d\n",g[i][j]);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include<iostream>

using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
string A, B;
int M;
int memo[502][2][4][10][500];
//pos, less, hoge, pre, modM
string S;
const int up=2, down=3;
const int mod=1e4;



int rec(int i, int j, int k, int l, int m){

    if(memo[i][j][k][l][m]!=-1) return memo[i][j][k][l][m];

    if(i==S.size()){
        return memo[i][j][k][l][m]=((k!=0)&&(m==0));

    }
    int ret=0;
    int ue=(j? 9: S[i]-'0');
    rep(d, ue+1){
        int diff=d-l;
        int nj=(j||d<ue);
        int nk;
        int nm=(10*m+d)%M;
        if(k==0){
            nk=(d!=0);
        }else if(k==1){
            if(diff==0) continue;
            nk=(diff>0? up: down);
        }else if(k==up&&diff<0){
            nk=down;
        }else if(k==down&&diff>0){
            nk=up;
        }else{
            continue;
        }
        (ret+=rec(i+1, nj, nk, d, nm))%=mod;
    }

    return memo[i][j][k][l][m]=(ret%mod);
}


int calc(string N){

    fill((int*)memo, (int*)memo+502*2*4*10*500, -1);
    S=N;
    return rec(0, 0, 0, 0, 0);
}

void minus1(){

    int len=A.size();
    for(int i=0; i<len; i++){
        char ch=A[len-1-i];
        if(ch=='0'){
            A[len-1-i]='9';
        }else{
            A[len-1-i]=ch-1;
            break;
        }
    }
    if(A[0]=='0'&&A.size()>1) A=A.substr(1);
}

int main(){

    cin>> A>> B>> M;

    minus1();
    cout<< (calc(B)-calc(A)+mod)%mod<< endl;

    return 0;
}

Measured memory_bytes: 81652
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

typedef pair<int,int> P;
int visit[100000+1];

int main(void){
    int K;
    cin>>K;
    priority_queue<P, vector<P>, greater<P> > que;
    que.push(mp(1,1));
    while(!que.empty()){
        P p = que.top();
        que.pop();
        if(!visit[p.second]){
            visit[p.second] = p.first;
            que.push(mp(p.first,(p.second*10)%K));
            que.push(mp(p.first+1,(p.second+1)%K));
        }
    }
    cout<<visit[0]<<endl;
     return 0;
}

Measured memory_bytes: 1784
#include <stdio.h>

long long int gcd(long long int n1, long long int n2)
{
    if(n2 != 0)
        return gcd(n2, n1 % n2);
    else
        return n1;
}

int main()
{
    long long int n1, n2;
    scanf("%lld%lld", &n1, &n2);
    printf("%lld\n", (n1*n2)/gcd(n1, n2));
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n, m;
int s, c;
int num[4];
bool mark[4];
int main() {
	cin >> n >> m;
	if (m == 0) {
		if (n == 1) puts("0");
		else {
			cout << 1;
			for (int i = 2; i <= n; i++) cout << 0;
		}
		return 0;
	}
	for (int i = 1; i <= m; i++) {
		cin >> s >> c;
		if (s == 1 && c == 0 && n != 1) {
			puts("-1");
			return 0;
		}
		if (mark[s]) {
			if (num[s] != c) {
				puts("-1");
				return 0;
			}
		} else {
			num[s] = c;
			mark[s] = 1;
		}
	}
	if (!mark[1]) num[1] = 1;
	for (int i = 1; i <= n; i++) cout << num[i];
	return 0;
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n,count=0,str;
  bool flag=true;
  string s;
  cin>>n>>s;
  vector<string> v;
  for(long long int i=0;i<s.size();i++){
    
    if(flag){
      str=i;
      flag=false;
    }
    
    if(s[i]==s[i+1]){
      count++;
    }else{
      flag=1;
      v.push_back(s.substr(str,count+1));
      count=0;
      flag=true;
    }
    
    
  }
  cout<<v.size()<<endl;
   
}
///////////////////////////

Measured memory_bytes: 5876
using System;

namespace ABC107_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] array = Console.ReadLine().Split(' ');
            int a = int.Parse(array[0]);
            int b = int.Parse(array[1]);
            int s;
            s = a - b + 1;
            Console.WriteLine(s);
        }
    }
}


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main()
{
	int n,m;
	while(cin>>n>>m,(n!=0&&m!=0)){
		vector<int> t(n),h(m);
		rep(i,n)cin>>t[i];
		rep(i,m)cin>>h[i];
		sort(all(t));
		sort(all(h));

		// int res=abs(accumulate(all(t),0)-accumulate(all(h),0));
		int t_sum=accumulate(all(t),0);
		int h_sum=accumulate(all(h),0);
		int taro=-1,hanako=-1;
		int sum=INF;
		rep(i,n){
			rep(j,m){
				if(t_sum-t[i]+h[j]==h_sum-h[j]+t[i]){
					if(sum>t[i]+h[j]){
						taro=t[i];
						hanako=h[j];
						sum=taro+hanako;
					}
				}
			}
		}
		if(taro<0)cout<<-1<<endl;
		else cout<<taro<<" "<<hanako<<endl;
	}
	return 0;
}


Measured memory_bytes: 3144
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main{
    public static void main(String[] a) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String strArray[];
		String str;
		while (line != null) {
			strArray = line.split(" ");
			str = String.valueOf(Integer.valueOf(strArray[0]) + Integer.valueOf(strArray[1]));
			char[] charArray = str.toCharArray();
			System.out.println(charArray.length);
			line = br.readLine();
		}
    }
}

Measured memory_bytes: 24152
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  string s, t;
  cin >> s >> t;
  bool can = false;
  rep(_,sz(s)) {
    if (s == t) can = true;
    char tmp = s[sz(s)-1];
    s.pop_back();
    s = tmp + s;
  }
  if (can) yn;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

int main()
{
    ll n;

    ll ans=0;
    cin>>n;
    vector<string> s(n);
    rep(i,n)
    {
        string ts;
        cin>>ts;
        sort(ts.begin(),ts.end());
        s[i]=ts;

    }
    map<string,ll> m;
    rep(i,n)
    {
        m[s[i]]+=1;
    }
    for(auto itr=m.begin();itr!=m.end();itr++)
    {
        ans+=(itr->second)*(itr->second-1)/2;
    }
    cout<<ans;
    
}

Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char s[305];
int n,m,k,a[305],b[305];
ll d[305][305][305],ans,mod = 998244353;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> s+1 >> k;
    m = strlen(s+1);
    n = 1;
    for(int i = 1;i <= m;i++) {
        if(s[i] == '0') n++;
        else a[n]++;
    }
    n++;
    for(int i = n-1;i >= 0;i--) {
        b[i] = b[i+1]+a[i];
    }

    k = min(b[1],k);
    d[0][0][0] = 1;
    for(int i = 1;i <= n;++i) {
        for(int c = 0;c <= a[i];c++) {
            for(int j = c;j <= k;j++) {
                for(int l = j;l <= k;l++) {
                    d[i][l][j-c] = (d[i][l][j-c]+d[i-1][l][j])%mod;
                }
            }
        }
        for(int c = 1;c <= k;++c) {
            for(int j = k-c;j >= 0;j--) {
                for(int l = 0;l <= j;l++) {
                    d[i][j+c][l+c] = (d[i][j+c][l+c]+d[i-1][j][l])%mod;
                }
            }
        }
    }
    for(int i = 0;i <= k;i++) ans += d[n][i][0];
    cout << ans%mod;
}

Measured memory_bytes: 58280
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>

#define MOD 1000000007
#define pi 3.14159265358979

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
	ll x, k, d;
	cin >> x >> k >> d;
	if (x > 0)
	{
		ll l = x / d;
		if (l > k)
		{
			x -= k * d;
			cout << abs(x);
			return 0;
		}
		k -= l;
		x -= l * d;

		if (k == 0)
		{
			cout << abs(x);
			return 0;
		}

		if (k % 2 == 0)
			cout << abs(x);
		else
			cout << abs(x - d);
	}
	else
	{
		ll l = -x / d;
		if (l > k)
		{
			x += k * d;
			cout << abs(x);
			return 0;
		}
		k -= l;
		x += l * d;

		if (k == 0)
		{
			cout << abs(x);
			return 0;
		}

		if (k % 2 == 0)
			cout << abs(x);
		else
			cout << abs(x + d);
	}
	return 0;
}


Measured memory_bytes: 3228
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[][][] residents = new int[4][3][10];
		int n, b, f, r, v;
		n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			b = sc.nextInt() - 1;
			f = sc.nextInt() - 1;
			r = sc.nextInt() - 1;
			v = sc.nextInt();
			residents[b][f][r] += v;
		}
		for (int i = 0; i < residents.length; i++) {
			for (int j = 0; j < residents[i].length; j++) {
				for (int k = 0; k < residents[i][j].length; k++) {
					System.out.print(" " + residents[i][j][k]);
				}
				System.out.println();
			}
			if (i != residents.length - 1) {
				System.out.println("####################");
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 29320
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

int n;
int p[200];
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i) {
        cin >> p[i];
	}
	vector<int> ans;
	for (int i = 1; i < n; ++i) {
        for (int j = 1; j < n; ++j) {
            ans.push_back(1);
            if (p[j - 1] > p[j]) {
                ans.push_back(n - 1);
                swap(p[j - 1], p[j]);
            }
        }
        ans.push_back(1);
	}
	printf("%d\n", (int)ans.size());
	for (int i : ans) {
        printf("%d\n", i);
	}
	return 0;
}


Measured memory_bytes: 764