akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define INF 1LL<<60

long long kaizyo(int x){
    if(x==0){
        return 1;
    }else if(x==1){
        return 1;
    }
    return kaizyo(x-1)*x;
}

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

    int ans=0;
    if(N==0){
            ans+=M*(M-1)/2;
    }else if(M==0){
            ans+=N*(N-1)/2;
    }else{
    ans+=N*(N-1)/2;
    ans+=M*(M-1)/2;}

    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class AtCoder {
  static void Main() {
    var inputs = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToList();
    var K = inputs[0];
    var X = inputs[1];
    
    if(500 * K >= X) {
      Console.WriteLine("Yes");
    } else {
      Console.WriteLine("No");
    }      
  }
}

Measured memory_bytes: 11220
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cctype>

#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;

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

typedef pair<int ,int> P;

class Coordinates
{
    public:
        int x;
        int y;

        //Coordinates(int a, int b) { x=a; y=b; }
        Coordinates operator+(Coordinates p)
        {
            Coordinates tmp;
            tmp.x = x + p.x;
            tmp.y = y + p.y;
            return tmp;
        }
        Coordinates(){ x = 0; y = 0;};
        //Coordinates(int a, int b);
        Coordinates(int a, int b) { x = a; y = b;}

        friend bool operator==(const Coordinates a, const Coordinates b)
        {
            return (a.x == b.x && a.y == b.y);
        }
        friend bool operator<(const Coordinates a, const Coordinates b)
        {
            //同じときはfalseの仕様
            int da = a.x*a.x + a.y*a.y;
            int db = b.x*b.x + b.y*b.y;
            if ( da < db ) { return true; }
            else if ( da == db ) 
            {
                if ( a.x < b.x ) { return true; }
                else             { return false; }
            }
            else { return false; }
        }
};

typedef Coordinates Coo;


int main()
{
    int n;
    cin >> n;
    //各caveに対して
    rep( i, n)
    {
        Coo sum;
        Coo tmp;
        Coo max = Coo(0,0);
        //各移動情報に関して
        while ( cin >> tmp.x >> tmp.y )
        {
            if ( tmp.x == 0 && tmp.y == 0) { break; }
            sum = sum + tmp;
            if( max < sum ) { max = sum; }
        }
        cout << max.x << " " << max.y << endl;
    }
}

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

#define SZ(a) (int)a.size()
#define PB push_back
//#define cerr if(false)cerr
#define print(x) cerr<<"\n" << (#x) << " is " << (x) << endl;

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

typedef vector<int> vi;
typedef vector<ll> vll;

const int MAXN = 1000007;
const int INF = 1000303;
const ll mod = 1e9+7;

ll power(ll a, ll b){
	ll tmp = 1LL;
	while(b){
		if(b & 1){tmp = (tmp * a); tmp %= mod;}
		a = (a * a) % mod;
		b /= 2;
	}
	return tmp;
}

ll answer(ll n, ll a){
	ll ans = 1LL;
	for(int i=0; i<a; i++){
		ans = (ans * (n-i))%mod;
		ans %= mod;
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n, a, b;
	int k = 200005;
	ll inv[k+1];
	inv[0] = 1, inv[1] = 1;
	for(int i=2; i<=k; i++){
		inv[i] = (mod - ((mod/i) * inv[mod%i]) % mod) % mod;
	}
	ll inv_fact[k+1];
	inv_fact[1] = 1;
	for(int i=2; i<=k; i++){
		inv_fact[i] = (inv_fact[i-1]*inv[i])%mod;
	}
	cin >> n >> a >> b;
	ll ans = (power(2, n)-1LL)%mod;
	//cout << ans << endl;
	//cout << answer(n, a) << endl;
	//cout << answer(n, b) << endl;
	//cout << inv[b] << endl;
	ans = (mod + ans - (answer(n, a)*inv_fact[a])%mod)%mod;
	ans = (mod + ans - (answer(n, b)*inv_fact[b])%mod)%mod;
	cout << ans << endl;
}


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

char field[102][102];
char now;

void DFS(int xx,int yy)
{
	field[yy][xx] = '.';
	if(now==field[yy-1][xx])
		DFS(xx,yy-1);
	if(now==field[yy+1][xx])
		DFS(xx,yy+1);
	if(now==field[yy][xx-1])
		DFS(xx-1,yy);
	if(now==field[yy][xx+1])
		DFS(xx+1,yy);
	
}
int main()
{
	int x,y;
	while(cin >> y >> x){
		if(!x&&!y)
			break;
		memset(field,'.',sizeof(field));
		for(int i=1;i<=y;i++){
			for(int j=1;j<=x;j++){
				cin >> field[i][j];
			}
		}
		int count = 0;
		for(int i=1;i<=y;i++){
			for(int j=1;j<=x;j++){
				if(field[i][j]!='.'){
					count++;
					now = field[i][j];
					DFS(j,i);
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <deque>
#include <cstdio>
using namespace std;
#define ll long long
int main(){
	ll N;
	scanf("%lld", &N);
	ll a[N], ps = 0, ns = 0;
	deque<ll> p, n;
	for (ll i = 0; i < N; i++){
		scanf("%lld", &a[i]);
		if (a[i] > 0){
			p.emplace_back(a[i]);
			ps += a[i];
		}else if (a[i] <= 0){
			n.emplace_back(a[i]);
			ns += a[i];
		}
	}
	if (p.empty()){
		ll ma = -2147483648, pos;
		for (ll i = 0; i < n.size(); i++){
			if (n[i] > ma){
				ma = n[i];
				pos = i;
			}
		}
		p.emplace_back(ma);
		n.erase(n.begin() + pos);
		ps += ma;
		ns -= ma;
	}
	if (n.empty()){
		ll mi = 2147483647, pos;
		for (ll i = 0; i < p.size(); i++){
			if (p[i] < mi){
				mi = p[i];
				pos = i;
			}
		}
		n.emplace_back(mi);
		p.erase(p.begin() + pos);
		ns += mi;
		ps -= mi;
	}
	printf("%lld\n", ps - ns);
	while (true){
		if (p.size() == 1 && n.size() == 1){
			printf("%lld %lld\n", p[0], n[0]);
			return 0;
		}
		if (n.size() == 1){
			printf("%lld %lld\n", n[0], p[0]);
			n.emplace_back(n[0] - p[0]);
			p.erase(p.begin());
			n.erase(n.begin());
		}else{
			printf("%lld %lld\n", p[0], n[0]);
			p.emplace_back(p[0] - n[0]);
			p.erase(p.begin());
			n.erase(n.begin());
		}
	}
}

Measured memory_bytes: 3456
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector < long double > a(n);
	long double ans=0;

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

	for(int i=0; i<n; i++) {
		ans += (1/a[i]);
	}
	ans = 1/ans;
	// cout << ans << endl;
	printf("%.14Lf\n", ans);

	return 0;
}

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

int main(){
    char ch[1000]="A";
    int num,i,a;
    while(true){
        scanf("%s",&ch);
        if(ch[0]=='0')break;
        i=0;
        num=0;
        while(true){
            if(ch[i]=='\0')break;
            a = ch[i]-'0';
            num += a;
            a=0;
            i+=1;
        }
        cout<<num<<endl;
    }
    return 0;
}


Measured memory_bytes: 3132
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>

using namespace std;

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

  if (N % (2 * D + 1) == 0){
    cout << N / (2 * D + 1) << endl;
  }else{
    cout << N / (2 * D + 1) + 1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
import sys
from collections import Counter

n = int(input())
a_list = [int(input()) for _ in range(n)]
past_set = set()
next_hop = 0
cnt = 0

while True:
    if next_hop in past_set:
        print(-1)
        sys.exit()
    else:
        past_set.add(next_hop)
    if next_hop == 1:
        print(cnt)
        sys.exit()
    else:
        next_hop = a_list[next_hop]-1
        cnt += 1


Measured memory_bytes: 16236
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

vector<string>sts(3);
bool check(char c) {
	for (int y = 0; y < 3; ++y) {
		bool ok = true;
		for (int x = 0; x < 3; ++x) {
			if (sts[y][x] != c)ok = false;
		}
		if (ok)return true;
	}
	for (int x = 0; x < 3; ++x) {
		bool ok = true;
		for (int y = 0; y < 3; ++y) {
			if (sts[y][x] != c)ok = false;
		}
		if (ok)return true;
	}
	{
		bool ok = true;
		for (int i = 0; i < 3; ++i) {
			if (sts[i][i] != c)ok = false;
		}
		if (ok)return true;
	}
	{
		bool ok = true;
		for (int i = 0; i < 3; ++i) {
			if (sts[i][2-i] != c)ok = false;
		}
		if (ok)return true;
	}
	return false;
	
}

int main() {
	while (cin>>sts[0]) {
		if (sts[0] == "0")break;
		for (int i = 1; i < 3; ++i) {
			cin >> sts[i];
		}
		if (check('b'))cout << "b" << endl;
		else if (check('w'))cout << "w" << endl;
		else cout << "NA" << endl;
		
	}
	return 0;
}

Measured memory_bytes: 3092
#![allow(unused_imports)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::{min, max};
use std::collections::{HashMap, HashSet, VecDeque, BinaryHeap};

fn main() {
    input!{
        n: usize,
        s: chars
    }
    let m = s.len();
    let d = 1000000007;
    let mut st: Vec<usize> = vec![0; n + m + 1];
    st[0] = 1;
    for i in 1..n + m + 1 {
        st[i] = st[i - 1] * i % d;
    }
    let sti: Vec<usize> = st.iter().map(|&x| inv_m(x, d)).collect();
    let mut ans = 0;
    for k in 0..n + 1 {
        ans = (ans + st[m + k - 1] * sti[k] % d * pow_m(25, k, d) % d * pow_m(26, n - k, d) % d) % d;
    }
    ans = ans * sti[m - 1] % d;
    println!("{}", ans);
}

fn pow_m(n: usize, mut p: usize, d: usize) -> usize {
    let mut r = n;
    let mut ret = 1;
    while p > 0 {
        if p % 2 == 0 {
            r = r * r % d;
            p /= 2;
        } else {
            ret = ret * r % d;
            p -= 1;
        }
    }
    ret
}

fn inv_m(n: usize, d: usize) -> usize {
    pow_m(n, d - 2, d)
}


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

#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;
const int INF = 2e16;
const int MOD = 1e9 + 7;
const int MB = 20;
const int K = 500;
const int maxN = 50;

void solve() {
	int h, n;
	cin >> h >> n;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}
	vector<int> dp(h + 1, INF);
	dp[h] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = h - 1; j >= 0; j--) {
			if (j + a[i].first <= h) dp[j] = min(dp[j], dp[j + a[i].first] + a[i].second);
		}
	}

	int ans = dp[0];
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= h; j++) {
			if (j - a[i].first <= 0) ans = min(ans, dp[j] + a[i].second);
		}
	}
	cout << ans;
}

signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define xrep(i,a,b) for(int i=int(a);i<int(b);++i)
using ll = long long;


int main() {
    int N;
    cin >> N;
    xrep(i, 1, 10) {
        xrep(j, 1, 10) {
            if(N==i*j) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 3604
import sys
input = sys.stdin.readline

INF = float('inf')

N = int(input().strip())
data = [list(map(int, input().split())) for _ in range(N)]
cost_b = []
cost_D = []
for b in range(1<<N):
  towns = []
  cost = INF
  for i in range(N):
    if (b>>i)&1:
      towns.append(data[i])
  for i in range(len(towns)):
    X = towns[i][0]
    cost = min(cost,sum(abs(towns[j][0]-X)*towns[j][2] for j in range(len(towns))))
  for i in range(len(towns)):
    Y = towns[i][1]
    cost = min(cost,sum(abs(towns[j][1]-Y)*towns[j][2] for j in range(len(towns))))
  if len(towns) == 0:
    cost = 0
  cost_b.append(cost)
  cost_D.append(sum(min(abs(towns[j][0]),abs(towns[j][1]))*towns[j][2] for j in range(len(towns))))

dp = [[INF]*(N+1) for i in range(1<<N)]

for i in range(1<<N):
  dp[i][0] = cost_D[i]
count = 0
for k in range(1,N+1):
  for i in reversed(range(1<<N)):
    x = i
    while x>=0:
      x &= i
      new = dp[i-x][k-1]+cost_b[x]
      if dp[i][k] > new:
        dp[i][k] = new
      if new == 0:
        break
      x -= 1
for i in range(N+1):
  print(dp[-1][i])

Measured memory_bytes: 110516
#include <bits/stdc++.h>
#ifdef DEBUG
#include "_debug.cpp"
#include "callable.hpp/callable.hpp"
#endif
#define endl '\n'
using namespace std;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b;
    cin >> a >> b;
    for(int i = 1, j = 2; j <= 999; i++, j++) {
        int aa = i * (i + 1) / 2;
        int bb = j * (j + 1) / 2;
        if(aa - a == bb - b and aa - a >= 1) {
            cout << aa - a << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN,"%d %d",$N,$K);
$S=strval(trim(fgets(STDIN)));
$length = strlen($S);
$array1 = [];
$array0 = [];

while(substr($S,0,1) !== false){
  if(substr($S,0,1) === "1"){
    if(strpos($S,"0") === false){
      $array1[] = strlen($S);
      $array0[] = 0;
      break;
    }else{
      $S = substr($S,strpos($S,"0"),strlen($S)-1);
      $array1[] = $length-strlen($S);
      $length = strlen($S);
    }
  }else{
    $array1[] = 0;
  }
  if(substr($S,0,1) === "0"){
    if(strpos($S,"1") === false){
      $array0[] = strlen($S);
      break;
    }else{
      $S = substr($S,strpos($S,"1"),strlen($S)-1);
      $array0[] = $length-strlen($S);
      $length = strlen($S);
    }  
  }else{
    $array0[] = 0;
  }
}

$size = count($array1);
if($K>=$size){
  $max = array_sum($array1)+array_sum($array0);
}else{
  $value = 0;
  $max = $array1[0]+$array0[0];
  for($i=0;$i<$size-$K+1;$i++){
    if($i===$size-$K && $i===0){
      for($j=0;$j<$K;$j++){
        $value += $array1[$i+$j];
      }
    }elseif($i===0){
      for($j=0;$j<$K+1;$j++){
        $value += $array1[$i+$j];
      }
    }elseif($i===$size-$K){
      //何もしない
    }else{
      $value += $array1[($K-1)+$i+1];
    }
    if($i===0){
      for($j=0;$j<$K;$j++){
        $value += $array0[$i+$j];
      }
    }else{
      $value += $array0[($K-1)+$i];
    }
    if($value > $max){
      $max = $value;
    }
    $value -= $array1[$i];
    $value -= $array0[$i];
  }
}
echo $max;


Measured memory_bytes: 18956
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> H(N);
    REP(i, N) {
        cin >> H[i];
    }
    int ma = 0, res = 0;
    REP(i, N) {
        if (H[i] >= ma) {
            res++;
            ma = H[i];
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
S = list(input())
K = int(input())

for i in range(len(S)):
    if S[i] == 'a':
        continue

    d = ord('z') - ord(S[i]) + 1
    if K >= d:
        S[i] = 'a'
        K -= d
    # print(K, d)

if K > 0:
    j = ord(S[-1]) + K % 26
    S[-1] = chr(j)

print(''.join(S))

Measured memory_bytes: 49520
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <cstdio>
//#include <iomanip>//"cout<<fixed<<setprecision(n)<<sth<<endl;"
//#include <string>//"reverse(s's it,s's it)"
//#include <functional>//"greater<T>" "sort(a,a+n,greater<int>());""
//#include <cmath>//"abs" "sqrt"
//#include <numeric>//"accumulate(inputit,inputit,init,(optional) object)"
//#include <algorithm>//"lower_bound(it,it,v)" "next_permutation(a,a+n)"
//"reverse(v's it,v's it)"(v: vector)
using namespace std;
#define pb push_back//also for STRING
#define fi first
#define sc second
#define mp make_pair
#define is insert
#define ps push//TMP//stack,(priority) queue,
#define fr front//TMP//queue//for priority, use top().
typedef pair<int,int> pii;
//Add other types in the same way.

#define MAX_N 500000
vector<pii> v[MAX_N];
int dp[MAX_N+1];

int main(){
	int n;
//	cout<<"start"<<endl;
	string s;
//	cout<<"defining s"<<endl;
	cin>>n>>s;
//	cout<<"getting s: fin"<<endl;
//	cout<<"making vector<pii>"<<endl;
	for(string::size_type pos=s.find("101");pos!=string::npos;){
//		cout<<pos<<endl;
		int i=pos+2;
		for(;i<n&&s[i]=='1';++i){}
		v[i-1].pb(mp(pos,i-pos-2));
		if(i-2>pos+1) v[i-2].pb(mp(pos,i-pos-3));
		pos=s.find("101",pos+1);
	}
//	cout<<"making v: going"<<endl;
	for(string::size_type pos=s.find("101");pos!=string::npos;){
		int i=pos;
		for(;i>=0&&s[i]=='1';--i){}
		v[pos+2].pb(mp(i+1,pos-i));
		if(i+2<pos+1) v[pos+2].pb(mp(i+2,pos-i-1));
		pos=s.find("101",pos+1);
	}
//	cout<<"making v: fin"<<endl;
//	for(int j=0;j<n;++j) for(int i=0;i<v[j].size();++i){
//		cout<<v[j][i].fi<<" "<<j<<" "<<v[j][i].sc<<endl;
//	}
	fill(dp,dp+s.size(),0);
	for(int i=1;i<s.size();++i){
		dp[i]=dp[i-1];
		for(int j=0;j<v[i].size();++j){
			dp[i]=max(dp[i],dp[v[i][j].fi-1]+v[i][j].sc);
		}
//		cout<<"dp["<<i<<"]: fin"<<endl;
	}
//	for(int i=0;i<n;++i) cout<<" "<<dp[i];
//		cout<<endl;
	cout<<dp[s.size()-1]<<endl;
}

Measured memory_bytes: 19844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define _GLIBCXX_DEBUG

signed main() {
  int N, M; cin >> N >> M;
  if(M>=N) cout << "unsafe" << endl;
  else cout << "safe" << endl;

}


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

int main() {
  ll n, x, y;
  cin >> n >> x >> y;
  x--;
  y--;

  map<ll, ll> cnt;
  for (ll i = 0; i < n - 1; i++) {
    for (ll j = i + 1; j < n; j++) {
      ll d;
      if ((i <= x && j <= x) || (y <= i && y <= j)) {
        d = j - i;
      }
      else if (i <= x && y <= j) {
        d = j - i - (y - x) + 1;
      }
      else if (x < i && j < y) {
        d = min(j - i, i - x + 1 + y - j);
      }
      else if (i <= x && j < y) {
        d = min(j - i, x - i + 1 + y - j);
      }
      else if (x < i && y <= j) {
        d = min(j - i, i - x + 1 + (j - y));
      }
      else {
        cout << "error" << endl;
      }
      cnt[d]++;
    }
  }
  for (ll k = 1; k < n; k++) {
    cout << cnt[k] << endl;
  }
}


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

public class Hello
{
    static void Main()
    {
        int house_num = int.Parse(Console.ReadLine());

        string[] s_data = Console.ReadLine().Split(' ');
        int[] house_data = new int[s_data.Length];
        for (int i = 0; i < s_data.Length; i++) house_data[i] = int.Parse(s_data[i]);

        var house_position = new List<int>(house_data);
        int max = house_position.Max(); int min = house_position.Min();
        Console.WriteLine(max - min);
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	lint A,B;

	cin >> A >> B;

	if((A+B)%2==1)
		cout << "IMPOSSIBLE";
	else
		cout << (A+B)/2;
	cout << endl;
	return 0;
}



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

using namespace std;

int main(){
        int N;
        vector <int> a;
        cin>>N;
        int cnt4=0, cnt2=0;
        for(int i=0;i<N;i++){
                int aa;
                cin>>aa;
                a.push_back(aa);
                if(aa%4==0){
                        cnt4++;
                }
                else if(aa%2==0){
                        cnt2++;
                }
        }
        //cout<<N/2<<endl;
        //cout<<cnt2/2+cnt4<<endl;
        if(N/2<=(cnt2/2+cnt4)){
                cout<<"Yes"<<endl;
        }
        else{
                cout<<"No"<<endl;
        }
        return 0;
}


Measured memory_bytes: 892
#include <iostream> 
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define ll long long
#define pb push_back

int main(int argc, char** argv) {
	double n;
	cin>>n;
	printf("%.10lf",n*n*n/27.0);
	
	
	return 0;
}

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

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main() {
    int N;
    cin >> N;
    int M;
    cin >> M;
    map<int, bool> broken;
    for(int i = 1; i <= N; i++){
        broken[i] = false;
    }
    for(int i = 0; i < M; i++){
        int A;
        cin >> A;
        broken[A] = true;
    }
    vector<ull> count(N + 1);
    if(!(broken[1])) count[1] = 1;
    else count[1] = 0;

    if(!(broken[2])) count[2] = count[1] + 1;
    else count[2] = 0;

    for(int i = 3; i <= N; i++){
        if(broken[i]) count[i] = 0;
        else{
            count[i] = count[i - 1] + count[i - 2];
            count[i] %= 1000000007;
        }
    }
    cout << count[N] << endl;
}

Measured memory_bytes: 5760
#include <stdio.h>

int main(void){
	int i,d[10],v1,v2,sum;
	double l;
	
	while(scanf("%d",&d[0])!=EOF){
		sum=d[0];
		for(i=1;i<10;i++){
			scanf(",%d",&d[i]);
			sum+=d[i];
		}
		scanf(",%d,%d",&v1,&v2);
		
		l=sum*v1/(v1+v2);
		for(i=0;l>0.0;i++){
			l-=d[i];
		}
		printf("%d\n",i);
	}
	
	return 0;
}

Measured memory_bytes: 596
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static class Task {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int preMaxA = in.nextInt();
            int preMaxB = in.nextInt();
            int preMaxC = in.nextInt();
            for (int i = 1; i < n; i++) {
                int a = in.nextInt();
                int b = in.nextInt();
                int c = in.nextInt();
                int curMaxA = Math.max(preMaxB, preMaxC) + a;
                int curMaxB = Math.max(preMaxA, preMaxC) + b;
                int curMaxC = Math.max(preMaxA, preMaxB) + c;
                preMaxA = curMaxA;
                preMaxB = curMaxB;
                preMaxC = curMaxC;
            }

            out.println(Math.max(preMaxA, Math.max(preMaxB, preMaxC)));
        }
    }

    private static void sort(double[] arr) {
        Double[] objArr = Arrays.stream(arr).boxed().toArray(Double[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(int[] arr) {
        Integer[] objArr = Arrays.stream(arr).boxed().toArray(Integer[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(long[] arr) {
        Long[] objArr = Arrays.stream(arr).boxed().toArray(Long[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task task = new Task();
        task.solve(1, in, out);
        out.close();
    }

    public static void main(String[] args) {
        new Thread(null, () -> solve(), "1", 1 << 26).start();
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

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

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

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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

    }

}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; i++){
  cin >> A.at(i);
  }
  sort(A.begin(),A.end());
  int ans = 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(A.at(i) + A.at(j) > A.at(k)){
  ans +=1;
  }
  }
  }
  }
  cout << ans;
}

Measured memory_bytes: 256
I, O, T, J, L, S, Z = map(int, input().split())
A = (I//2)*2+(J//2)*2+(L//2)*2
if I > 0 and J > 0 and L > 0:
    B = ((I-1)//2)*2+((J-1)//2)*2+((L-1)//2)*2+3
else:
    B = 0
print(max(A, B)+O)


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

int main()
{
    int n;
    cin >> n;
    long l[n];
    for (int i = 0; i < n; i++)
    {
        cin >> l[i];
    }
    int ans=0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < i; j++)
        {
            for (int k = 0; k < j; k++)
            {
                if (l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j])
                {
                    if (l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i])
                    {
                        ans++;
                    }
                    
                }
                
            }
            
        }
        
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;

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


int main(){
    ll r, d, x;
    cin >> r >> d >> x;
    for(int i = 1; i <= 10; i++){
        x = r * x - d;
        cout << x << endl;
    }



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int mod = 1e9 + 7;

int n, m;
vector<pi> v[305];
int dp[305][305][305];

int* get_mem(int a, int b, int c, int d){
	vector<int> v = {b, c, d};
	sort(v.begin(), v.end());
	b = v[0], c = v[1], d = v[2];
	return &dp[a][b][c];
}

int f(int pos, int lr, int lg, int lb){
	int *k = get_mem(pos, lr, lg, lb);
	if(*k != -1) return *k;
	vector<int> w = {lr, lg, lb};
	sort(w.begin(), w.end());
	for(auto &i : v[pos]){
		if(i.first <= w[0]){
			if(i.second != 3) return *k = 0;
		}
		else if(i.first <= w[1]){
			if(i.second != 2) return *k = 0;
		}
		else if(i.first <= w[2]){
			if(i.second != 1) return *k = 0;
		}
	}
	if(pos == n) return *k = 1;
	int ret = (f(pos + 1, pos + 1, lg, lb) + f(pos + 1, lr, pos + 1, lb)) % mod + f(pos + 1, lr, lg, pos + 1);
	return *k = ret % mod;
}

int main(){
	cin >> n >> m;
	for(int i=0; i<m; i++){
		int s, e, x;
		cin >> s >> e >> x;
		v[e].push_back(pi(s, x));
	}
	memset(dp, -1, sizeof(dp));
	cout << f(0, 0, 0, 0) << endl;
}


Measured memory_bytes: 111104
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        
        
        
        Scanner sc = new Scanner(System.in);
		String S= sc.next();
		
		
		String begin;
		String end;
		String answer;
		
		for(int i=0;i<S.length();i++){
		    
		    for(int j=0;j<S.length();j++){
		        
		        begin= S.substring(0,i);
		        end = S.substring(j,S.length());
		        answer =begin+end;
		        
		        
		        if(answer.equals("keyence")){
		            System.out.println("YES");
		            return;
		            
		        }else if(begin.equals("keyence")){
		            System.out.println("YES");
		            return;
		            
		        }else if(end.equals("keyence")){
		            System.out.println("YES");
		            return;
		            
		        }
		    }
		    
		    
		}
		System.out.println("NO");
		
		
	}
}


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

vector<vector<pair<int, int>>> g;
vector<int> ans;

void dfs(int pre, int crt, int d)
{
  for (auto i : g[crt])
  {
    if (i.first == pre)
      continue;
    ans[i.first] = d ^ i.second;
    dfs(crt, i.first, d ^ i.second);
  }
}

int main()
{
  int n;
  cin >> n;
  g.resize(n);
  rep(i, n - 1)
  {
    int  u, v, w;
    cin >> u >> v >> w;
    if (w % 2 == 0)
      w = 0;
    else
      w = 1;
    u--;
    v--;
    g[u].emplace_back(v, w);
    g[v].emplace_back(u, w);
  }
  ans.resize(n);
  ans[0] = 0;
  dfs(-1, 0, 0);
  rep(i, n)
    printf("%d\n", ans[i]);
}

Measured memory_bytes: 8192
import numpy as np
import itertools

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

if N%2==0:
    left = np.cumsum([0]+A[::2])
    right = np.cumsum([0]+A[::-2])[::-1]
    ans = max(left+right)
else:
    left = np.cumsum([0] + A[:-1:2])
    mid_left = np.cumsum([0]+A[-2::-2])[::-1]
    mid_right = np.cumsum([0]+A[1::2])
    right = np.cumsum([0] + A[:1:-2])[::-1]

    left_sum = left+mid_left
    left_max = np.zeros(N//2+1, dtype=int)
    left_max[0] = left_sum[0]
    for i in range(1, N//2+1):
        left_max[i] = max(left_max[i-1], left_sum[i])
    left_max -= mid_left

    right_sum = right + mid_right
    right_max = np.zeros(N//2 + 1, dtype=int)
    right_max[-1] = right_sum[-1]
    for i in range(N//2-1, -1, -1):
        right_max[i] = max(right_max[i + 1], right_sum[i])
    right_max -= mid_right

    ans = max(left_max+right_max)


print(ans)


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    string o,e;
    cin>>o>>e;
    
    for(int i = 0; i < e.size(); i++)
    {
        cout<<o[i]<<e[i];
    }
    if(o.size()>e.size())
    {
        cout<<o[o.size()-1];
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX = 20;
int N, M, C;
int B[MAX];
int A[MAX];
int main() {
  cin >> N >> M >> C;
  for (int i =0 ; i < M; i++)
    cin >> B[i];
  int ct = 0;
  int tmp = 0;
  for (int j = 0; j < N; j++) {
    for (int i = 0; i < M; i++) {
      cin >> A[i];
      tmp += A[i] * B[i];
    }

    if (tmp + C > 0) {
      ct++;
    }
    tmp = 0;
  }
  cout << ct << endl;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N   200005
#define MAX 300005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n"
 
const int inf = (int)1e18 + 10;

vector < double >  v;
signed main(){
  fast;
  

  int n ;
  double x;
  cin >> n;
  for(int i = 0 ; i < n ; i++){
        cin >> x;
       v.pb(x);
  }
  sort(v.begin() , v.end());
  double ans = v[0];
  for(int i = 1 ; i < n ; i++){
      ans = (ans + v[i]) / 2;
  }
  cout <<fixed << setprecision(9)<< ans << endl;




 
}

Measured memory_bytes: 256
<?php

//$_input = explode(
//    "\n",
//    'dreamerasererasedream
//'
//);

function getNext() {
    return trim(
        isset($GLOBALS['_input'])
            ? array_shift($GLOBALS['_input'])
            : fgets(STDIN)
    );
}

function buildable($s, $arr) {
    while (true) {
        foreach ($arr as $value) {
            if (strpos($s, $value) === 0) {
                $s = substr($s, strlen($value));

                if ($s === '') {
                    return true;
                }

                continue 2;
            }
        }

        return false;
    }
}

printf("%s\n", buildable(strrev(getNext()), array_map(function ($s) { return strrev($s); }, ['dream', 'dreamer', 'erase', 'eraser'])) ? 'YES' : 'NO');



Measured memory_bytes: 4604
import java.util.*;
import java.lang.Math;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] h = new int[n];
		int[] dp = new int[n];
		for(int i=0;i<n;i++){
			h[i] =sc.nextInt();
		}
		
		dp[0]=0;
		dp[1]=Math.abs(h[0]-h[1]);
		for(int i=2;i<n;i++){
			if(dp[i-1]+Math.abs(h[i-1]-h[i]) > dp[i-2]+Math.abs(h[i-2]-h[i]))
			dp[i]=dp[i-2]+Math.abs(h[i-2]-h[i]);
			else
			dp[i]=dp[i-1]+Math.abs(h[i-1]-h[i]);
		}
		
		System.out.print(dp[n-1]);
	}
}

Measured memory_bytes: 60064
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int acCount = 0;
        int waCount = 0;
        int tleCount = 0;
        int reCount = 0;

        for (int i = 0; i < n; i++) {
            String s = sc.next();
            if (s.equals("AC")) {
                acCount++;
            } else if (s.equals("WA")) {
                waCount++;
            } else if (s.equals("TLE")) {
                tleCount++;
            } else if (s.equals("RE")) {
                reCount++;
            }
        }

        System.out.println("AC x " + acCount);
        System.out.println("WA x " + waCount);
        System.out.println("TLE x " + tleCount);
        System.out.println("RE x " + reCount);
    }
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

char a[1003][1003];

typedef int64_t ll;
const int mod = 1000000007;
i64 dp[1003][1003];

void rec(u64 h, u64 w) {
  if (dp[h][w] != -1)
    return;

  if (a[h + 1][w] == '#') {
    dp[h + 1][w] = 0;
  } else if (dp[h + 1][w] == -1) {
    rec(h + 1, w);
  }

  if (a[h][w + 1] == '#') {
    dp[h][w + 1] = 0;
  } else if (dp[h][w + 1] == -1) {
    rec(h, w + 1);
  }

  dp[h][w] = (dp[h][w + 1] + dp[h + 1][w]) % mod;
}

int main() {
  i32 h, w;
  cin >> h >> w;

  rep(i, h) {
    rep(j, w) { cin >> a[i][j]; }
  }

  rep(i, h + 1) {
    rep(j, w + 1) { dp[i][j] = -1; }
  }

  rep(i, h) {
    a[i][w] = '#';
    dp[i][w] = 0;
  }
  rep(j, w) {
    a[h][j] = '#';
    dp[h][j] = 0;
  }

  dp[h - 1][w - 1] = 1;
  rec(0, 0);

  cout << dp[0][0];
  // rep(i, h + 1) {
  //   rep(j, w + 1) { cout << dp[i][j]; }
  //   cout << endl;
  // }

  return 0;
}


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

using namespace std;

#define INF ((1<<30)-1)  //int32_t
#define MOD 1000000007
#define MOD2 

#define all(a)  (a).begin(),(a).end()

#define mkp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main(){

    bool flag=false;

    ll ans=0,sum=0;
    
    int n,k;
    cin >>n>>k;

    if(k > (n+1)/2)flag=false;
    else flag=true;

    //cout <<fixed<<setprecision(16)<< << endl;
    //cout << ans << endl;

    if(flag)cout << "YES" <<endl;
    else cout << "NO" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
s = input()
f1 = s[0] == "A"
f2 = s[2:-1].count("C") == 1
index = s[2:-1].find("C") + 2
f3 = (s[1:index]+s[index+1:]).lower() == (s[1:index]+s[index+1:])
print("AC" if f1 and f2 and f3 else "WA")

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

int main()
{
    int N;
    cin >> N;
    int ans = 1;
    vector<int> P(N);
    for (int i = 0; i < N; i++)
    {
        cin >> P.at(i);
    }

    int min = P.at(0);
    for (int i = 1; i < N; i++)
    {
        if (min >= P.at(i))
        {
            ans ++;
            min = P.at(i);
        }

        else
        {
            continue;
        }
        
        
    }

    cout << ans;
    
    
}

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

int main(){
	int N;
	cin >> N;
	if(N == 1){
		cout << "Yes" << endl;
		return 0;
	}
	ll H[N];
	for(int i(0);i<N;++i){
		cin >> H[i];
	}
	for(int i(0);i<N-1;++i){
		if(H[N-2-i]-H[N-1-i] == 1){
			H[N-2-i]--;
		}else if(H[N-2-i]-H[N-1-i] > 1){
			cout << "No" << endl;
			return 0;
		}
	}
	for(int i(1);i<N;++i){
		if(H[i-1] - H[i] > 0){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

using namespace std;

int n,mon;

int main()
{
	scanf("%d %d",&n,&mon);
	mon /= 1000;//10 5 1
	for(int i = 0;i <= mon / 10; i++){//10
		for(int j = 0;j <= mon / 5; j++){//5
			if((mon - (i * 10 + j * 5)) >= 0 && (mon - (i * 10 + j * 5)) + i + j == n) {
				printf("%d %d %d\n",i,j,mon - (i * 10 + j * 5));
				return 0;
			}
		}
	}
	printf("-1 -1 -1\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);

  int x, y, z;
  cin >> x >> y >> z;
  int ans = (x - z) / (y + z);
  cout << ans << endl;
    return 0;
}


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

int A[100010];
int B[100010];
int C[100010];
int D[100010];
int main(){
    int n; scanf("%d",&n);
    for(int i=1;i<=n;i++) {
        scanf("%d",&A[i]);
    }
    int g = A[1];
    B[1]=A[1];
    for(int i=2;i<=n;i++) {
        g=__gcd(g,A[i]);
//        cout<<g<<endl;
        B[i]=g;
    }
    g = A[n];
    C[n]=A[n];
    for(int i=n-1;i>=1;i--) {
        g = __gcd(g,A[i]);
        C[i]=g;
    }
    B[0]=0; C[n+1]=0;
    int ans = 0;

//    for(int i=1;i<=n;i++) {
//        cout<<B[i]<<" ";
//    }cout<<endl;
//    for(int i=1;i<=n;i++) {
//        cout<<C[i]<<" ";
//    }cout<<endl;


    for(int i=1;i<=n;i++) {
        D[i]=__gcd(B[i-1],C[i+1]);
        ans = max(ans,D[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        if (A <= 8 && B <= 8) {
            System.out.println("Yay!");
        } else {
            System.out.println(":(");
        }
    }

    private class MyScanner {
        String[] s;int i;BufferedReader br;String reg = " ";
        MyScanner () { s = new String[0];i = 0;br = new BufferedReader(new InputStreamReader(System.in)); }
        public String next() {
            try {
                if (i < s.length) return s[i++]; String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0); i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}


Measured memory_bytes: 21460
#include<cstdio>

int main(void) {
    while(true) {
        int n,res=0;
        scanf("%d", &n);
        if(!n) break;
        
//      N = n(a+a+(n-1))/2
//      a = (2*N/n-n+1)/2
        for(int m=2; m<1000; m++) {
            if(!(2*n % m))
                if(!((2*n/m-m+1)%2))
                    if(2*n/m-m+1 > 0)
                        res++;
        }
        printf("%d\n",res);
    }
    return 0;
}

Measured memory_bytes: 1028
import std.stdio, std.string, std.array, std.conv, std.algorithm, std.typecons, std.range, std.container, std.math, std.algorithm.searching, std.functional,std.mathspecial;

void main(){
    auto na=readln.chomp.split.map!(to!int).array;
    auto xs=readln.chomp.split.map!(to!int);
    auto diffs=xs.map!(x=>x-na[1]);
    auto negaes=diffs.filter!"a<0".array;
    auto zeroes=diffs.filter!"a==0".count;
    auto posies=diffs.filter!"a>0".array;
    
    long[int] negaSet;
    negaSet[0]=1;
    long[int] posiSet;
    posiSet[0]=1;

    foreach(n;negaes){
        foreach(k,ns;negaSet.dup){
            negaSet[k-n]+=ns;
        }
    }
    foreach(n;posies){
        foreach(k,ns;posiSet.dup){
            posiSet[k+n]+=ns;
        }
    }

    long res=0;
    foreach(k,n;negaSet){
        auto p=k in posiSet;
        if(p!=null)res+=n*(*p);
    }
    writeln(res*(2L^^(zeroes))-1);
}


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

int main() {
    char c[6]; REP(i,6) cin >> c[i];
    if(c[0] == c[5] && c[1] == c[4] && c[2] == c[3])
    cout << "YES" << endl;
    else cout << "NO" << endl;


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n,ans=0;
    scanf("%d",&n);
    int v[n],c[n];
    for(int i=0;i<n;i++) scanf("%d",&v[i]);
    for(int i=0;i<n;i++){
        scanf("%d",&c[i]);
        if(v[i] - c[i] >0){
            ans += v[i] - c[i];
        }
    }
    printf("%d",ans);
    
}


Measured memory_bytes: 128
from collections import deque
n = map(int, raw_input().split())
n = n[0]

d = map(int, raw_input().split())
e = range(0,10)
for dd in d:
    e.remove(dd)

sn = str(n)
indexes = deque()
bg = False
for cn in sn:
    dn = int(cn)
    i = 0
    if bg:
        indexes.append(0)
        continue
    while i < len(e) and dn > e[i]:
        i+=1
    if i != len(e):
        indexes.append(i)
        if dn < e[i]:
            bg = True

    else: # carry up
        j = -1
        while -j < len(indexes):
            if indexes[j] + 1 < len(e): # able to up
                indexes[j] += 1
                break
            else:
                indexes[j] = 0
            j -= 1
        # print j,indexes
        if -j >= len(indexes) : # one more digit
            indexes.clear()
            if e[0] != 0:
                indexes.append(0)
            else:
                indexes.append(1)
            for l in xrange(len(sn)):
                indexes.append(0)
            break

        indexes.append(0)
ans = ""
while len(indexes) != 0:
    i = indexes.popleft()
    ans += str(e[i])
    # print ans
print ans

Measured memory_bytes: 2936
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    int b = a[0];
    double ans = 0.0;
    double bo = 0;

    rep1(i,1,n){
        b = (b*a[i])/__gcd(b,a[i]);
    }

    rep(i,n){
        bo += b/a[i];
    }

    ans = b/bo;
    cout << std::fixed << std::setprecision(14) << ans << endl;
    return 0;


}

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


int bubbleSort(int A[],int N){
 int sw=0;
 bool flag=1;
 for(int i=0;flag;i++){
  flag=0;
  for(int j=N-1;j>=i+1;j--){
   if(A[j]<A[j-1]){
   swap(A[j],A[j-1]);
   flag=1;
   sw++;
   }
  }
 }
 return sw;
 }
 
 int main(){
 int A[100],N,sw;
 cin >>N;
 for(int i=0;i<N;i++) cin>>A[i];
 
 sw=bubbleSort(A,N);
 
 for(int i=0;i<N;i++){
  if(i)cout<<" ";
  cout<<A[i];
 }
 cout<<endl;
 cout<<sw<<endl;
 
 return 0;
}

Measured memory_bytes: 3092