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

int N, M;

int main() 
{
    cin >> N;
    map<string, int> m;
    for (int i = 0; i < N; i++) 
    {
        string t; cin >> t;
        if (m.find(t) == m.end()) m.insert(pair<string, int>(t, 1));
        else m[t]++;
    }
    
    cin >> M;
    for (int i = 0; i < M; i++)
    {
        string t; cin >> t;
        if (m.find(t) != m.end()) m[t]--;
    }

    int max_v = 0;
    for (auto i = m.begin(); i != m.end(); i++) 
    {
        if (i->second > max_v) max_v = i->second;
    }
    cout << max_v << endl;
}

Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())

diff_x = x2 - x1
diff_y = y2 - y1

x3 = x2 - diff_y
y3 = y2 + diff_x
x4 = x3 - diff_x
y4 = y3 - diff_y


print("{} {} {} {}".format(x3,y3,x4,y4))


Measured memory_bytes: 2940
#import math
import collections
#n,k = map(int, input().split( ))
n = int(input())
A = list(map(int, input().split( )))
c = collections.Counter(A)
s = 0
for a in c:
  if c[a] >= 2:
    s += c[a]*(c[a]-1)//2
#print(s)  
for a in A:
  if c[a] == 1:
    print(s)
  else:
    print(s - c[a] + 1) 

Measured memory_bytes: 34196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;

int main() {
  int n; cin >> n;
  vector<int> f(10001, 0);
  for (int i = 1; i <= 10000; ++i) {
    for (int j = 1; j <= 10000; ++j) {
      for (int k = 1; k <= 10000; ++k) {
        int cal = i*i + j*j + k*k + i*j + j*k + k*i;
        if (cal <= 10000) {
            f[cal]++;
        } else {
            break;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) cout << f[i] << endl;
}


Measured memory_bytes: 3612
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"math"
	"os"
	"sort"
)

type sushi struct {
	t, d  int
	isMax bool
	index int
}

type sushis []*sushi

func (r sushis) Len() int {
	return len(r)
}
func (r sushis) Swap(i, j int) {
	r[i], r[j] = r[j], r[i]
}

func (r sushis) Less(i, j int) bool {
	return r[i].d > r[j].d
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var N, K int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d %d", &N, &K)

	var ss sushis
	ss = make([]*sushi, N)
	for i := 0; i < N; i++ {
		s := &sushi{}
		scanner.Scan()
		fmt.Sscanf(scanner.Text(), "%d %d", &s.t, &s.d)
		ss[i] = s
	}
	sort.Sort(ss)

	typeMap := make(map[int]struct{})
	for _, s := range ss {
		if _, e := typeMap[s.t]; e {
			continue
		}
		s.isMax = true
		typeMap[s.t] = struct{}{}
	}

	candidate := make([]*sushi, K)
	remaining := make(PriorityQueue, 0)
	heap.Init(&remaining)

	id := 0
	for i, s := range ss {
		if i < K {
			candidate[i] = s
		} else {
			if s.isMax {
				s.index = id
				heap.Push(&remaining, s)
				id++
			}
		}
	}

	dpoint, v := score(candidate)
	ans := dpoint + v*v
	index := K
	for index > 0 && remaining.Len() > 0 {
		index--
		if candidate[index].isMax == true {
			continue
		}
		v++
		s := heap.Pop(&remaining).(*sushi)
		dpoint = dpoint + s.d - candidate[index].d
		ans = max(ans, dpoint+v*v)
	}
	fmt.Println(ans)
}

func score(candidate []*sushi) (int, int) {
	dpoint := 0
	mp := make(map[int]struct{})
	for _, c := range candidate {
		dpoint = dpoint + c.d
		mp[c.t] = struct{}{}
	}
	return dpoint, len(mp)
}

func max(ns ...int) int {
	ret := math.MinInt64
	for _, n := range ns {
		if n > ret {
			ret = n
		}
	}
	return ret
}

// A PriorityQueue implements heap.Interface and holds Items.
type PriorityQueue []*sushi

func (remaining PriorityQueue) Len() int {
	return len(remaining)
}

func (remaining PriorityQueue) Less(i, j int) bool {
	return remaining[i].d > remaining[j].d
}

func (remaining PriorityQueue) Swap(i, j int) {
	remaining[i], remaining[j] = remaining[j], remaining[i]
	remaining[i].index = i
	remaining[j].index = j
}

func (remaining *PriorityQueue) Push(x interface{}) {
	n := len(*remaining)
	item := x.(*sushi)
	item.index = n
	*remaining = append(*remaining, item)
}

func (remaining *PriorityQueue) Pop() interface{} {
	old := *remaining
	n := len(old)
	item := old[n-1]
	item.index = -1 // for safety
	*remaining = old[0 : n-1]
	return item
}

// update modifies the priority and value of an sushi in the queue.
func (remaining *PriorityQueue) update(item *sushi, value string, priority int) {
	// not use
}


Measured memory_bytes: 12544
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//数値計算 個数以外はdouble
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//過半数：N/2.0で判定
//優先度付きキュー
//priority_queue<
//ll,
//vector<ll>
//> q;
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
#define PI 3.14159265358979323846264338327950L
using namespace std;


//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

ll RS(ll N, ll P, ll M) {
	if (P == 0) return 1;
	if (P % 2 == 0) {
		ll t = RS(N, P / 2, M);
		return t * t % M;
	}
	return N * RS(N, P - 1, M);
}

int main() {
	char b; cin >> b;
	if (b == 'A') cout << 'T' << endl;
	else if (b == 'T') cout << 'A' << endl;
	else if (b == 'G') cout << 'C' << endl;
	else if (b == 'C') cout << 'G' << endl;
}

Measured memory_bytes: 8064
#include <iostream>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <ctype.h>

const int INF =100000000;

using namespace std;

int main(){

  while(1){

    int n ;

    cin >> n;

    if(n == 0){
      break;
    }else{
      int ans[11] = {0};
      for(int i = 0;i < n;i++){
	int a;
	cin >>a;
	ans[a]++;
      }
      for(int i = 0;i <10;i++){
	if(ans[i] == 0){
	  cout << "-" <<endl;
	}else{
	  for(int j = 0;j < ans[i];j++){
	  cout << "*" ;
	  }
	  cout << endl;
	}
      }
    }
  }
}


Measured memory_bytes: 1152
import math

A, B, H, M = map(int, input().split())

sh = 2 * math.pi * ((H + M/60) / 12)
sm = 2 * math.pi * (M / 60)

d2 = (A  * math.sin(sh) - B * math.sin(sm))**2
d2 += (A * math.cos(sh) - B * math.cos(sm))**2

ans = (d2)**0.5
print(ans)

Measured memory_bytes: 9516
#include<stdio.h>

#define MAX 2000000

void maxHeapify(int);

int n,arr[MAX+1];

int main(){

  int i;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&arr[i]);
  }

  for(i=n/2;i>=1;i--){
    maxHeapify(i);
  }

  for(i=1;i<=n;i++){
    printf(" %d",arr[i]);
  }
  printf("\n");

  return 0;
}

void maxHeapify(int i){

  int l,r,L,tmp;

  l=2*i;
  r=2*i+1;

  if(l<=n&&arr[l]>arr[i]){
    L = l;
  }
  else L = i;

  if(r<=n&&arr[r]>arr[L]){
    L=r;
  }

  if(L!=i){
    tmp = arr[i];
    arr[i] = arr[L];
    arr[L] = tmp;
    maxHeapify(L);
  }
}

Measured memory_bytes: 2552
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  int N; std::cin >> N;
  double m = (N+1)/2; m /= N;
  std::cout << std::setprecision(10) << std::fixed;
  fin(m);
  return 0;
}


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

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


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

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

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

#endif

// main.cpp

int main() {
  std::string S;
  std::cin >> S;
  for (auto it1 = S.begin(), it2 = ++S.begin(); it2 != S.end(); ++it1, ++it2) {
    if (*it1 == 'A' && *it2 == 'C') {
      std::cout << "Yes" << std::endl;
      return 0;
    }
  }
  std::cout << "No" << std::endl;
  return 0;
}

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

#define INF 1e9
#define PI 3.141592653589793238
#define N 1000000010
#define mod 1000000007
#define REP(inc, bgn, end) for(int inc=bgn; inc<end; inc++)
typedef long long ll;

int main() {
    int n;cin>>n;
    vector<int> p(n), q(n), ary(n);
    REP(i,0,n) cin>>p[i];
    REP(i,0,n) cin>>q[i];

    REP(i,0,n) ary[i] = i+1;

    map<vector<int>, int>mp;
    do{
        mp[ary] = mp.size();
    }while(next_permutation(ary.begin(), ary.end()));

    int ans = abs(mp[p]-mp[q]);
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 8652
n = "0" + input()
n = list(map(int, list(n)))
n.reverse()

pay = 0
turi = 0

pls = 0
for i in range(len(n)):
  val = n[i] + pls
  pls = 0
  if val < 5:
    pay += val
  elif val == 5:
    pay += val
    if n[i + 1] >= 5:
      pls = 1
  else:
    turi += 10 - val
    pls = 1

ans = pay + turi
print(ans)

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

//week_1_F

void week_1_F()
{
    int n, k;
    char *s;
    cin >> n >> k;
    s = new char[n];
    for (int i = 0; i < n; i ++)
        cin >> s[i];
    int count = 0;
    for (int i = 0; i < n-1; i++)
        if(s[i+1] == s[i])
            count ++;
    count = (count + k*2 ) > (n-1) ? n-1 : (count + k*2 );
    cout<< count;
    return ;
}

int main()
{
    week_1_F();
    return 0;
}

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

def check():
    l = (C*(N-1)-(B-A))/(D+C)
    r = (D*(N-1)-(B-A))/(D+C)
    if l<=N and r>=0 and int(r)>=l:
        return 'YES'
    return 'NO'
print(check())

Measured memory_bytes: 3064
// Code for C - One Quadrillion and One Dalmatians
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main() {
  string s[] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q","r","s","t","u","v","w","x","y", "z"};
  ll N;
  cin >> N;

  vector<int> a;

  while(N > 0) {
    int x = N % 26;
    if (x == 0) {
      a.push_back(26);
      N -= 1;
    } else {
      a.push_back(x);
    }
    N /= 26;
  }

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

  for (vector<int>::iterator itr = a.begin(); itr != a.end(); itr++) {
    cout << s[*itr - 1];
  }

  return 0;
}


Measured memory_bytes: 3572
#coding:utf-8
import collections

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

def count_inversion(sequence):
    count = 0
    for i in range(1,len(sequence),1):
        for j in range(i,len(sequence),1):
            if sequence[i-1] > sequence[j]:
                count += 1
    return count

inner_count = count_inversion(A)

A = sorted(A)

duplicate = {k:1 for k,v in enumerate(A)}

A_index = 0
duplicate_index = 0

while A_index < len(A)- 1:
    if A[A_index+1] == A[A_index]:
        duplicate[A_index + 1] -= 1
        duplicate[duplicate_index] += 1
    else:
        duplicate_index = A_index + 1
    A_index += 1
        
count = 0
for k, v in duplicate.items():
    count += (v * k * K * (K-1) )//2

count += inner_count * K

print(count % (10**9 + 7))


Measured memory_bytes: 3700
<?php
fscanf(STDIN, '%d', $n);
$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
while (true) {
    $n = count($a);
    if ($n === 1) break;
    sort($a);
    $a_tmp = [$a[0]];
    for ($i = 1; $i < $n; $i++) {
        $x = $a[$i] % $a[0];
        if ($x > 0) $a_tmp[] = $x;
    }
    $a = $a_tmp;
}
echo $a[0];

Measured memory_bytes: 16884
import heapq
from math import ceil

n = int(input())
arr = list(map(int,input().split()))
arr = [-x for x in arr]
heapq.heapify(arr)
limit = -n+1

act = 0
while arr[0] < limit:
    x = arr[0]
    req = ceil((limit-x)/n)
    x+= req*(n+1)
    limit+= req
    act+= req
    heapq.heapreplace(arr, x)
print(act)

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

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

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll N, K; std::cin >> N >> K;
  std::vector<int> G(N);
  rep(i,N) {
    std::cin >> G[i];
    G[i]--;
  }

  std::set<int> s;
  std::vector<int> L;
  int start = 0;
  L.push_back(start);
  s.insert(start);
  std::stack<int> st;
  st.push(start);
  while( !st.empty() ) {
    int cur = st.top(); st.pop();
    int next = G[cur];
    L.push_back(next);
    if ( s.count(next) ) continue;
    s.insert(next);
    st.push(next);
  }

  int c = L.back();

  int head = 0;
  for(int i=0; i<sz(L); i++) {
    if ( L[i] != c ) head++;
    else break;
  }

  if ( K <= head ) std::cout << L[K]+1 << std::endl;
  else {
    K -= head;
    ll u = K % (sz(L)-head-1);
    std::cout << L[head+u]+1 << std::endl;
  }

  return 0;
}



Measured memory_bytes: 13872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
  string s,t;
  cin >> s >> t;
  ll a,b;
  cin >> a >> b;
  string u;
  cin >> u;
  if(u==s) a--;
  if(u==t) b--;
  cout << a << " " << b << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    llong a,b;
    cin >> a >> b;
    if(a>=13) cout << b << endl;
    else if(a>=6) cout << b/2 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 384
#include <cstdio>

int main() {
	int N,A,B;
	scanf("%d%d%d",&N,&A,&B);
	int max = A;
	if(A>B) max=B;
	int min=A+B-N;
	if(min<0) min=0;
	printf("%d %d\n",max,min);
	return 0;
}

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

int n, c;
int a[31], b[31];
int dp[31][1 << 16];

int score(int x){
	int ret = 0;
	while(x){
		if(x & 1)++ret;
		x >>= 1;
	}
	return ret;
}

int main(){
	while(true){
		std::cin >> n >> c;
		
		if(n == 0 && c == 0)break;
		
		for(int i = 0; i < 31; ++i)a[i] = 0, b[i] = 0;
		
		for(int i = 0; i <= n; ++i){
			for(int j = 0; j < (1 << 16); ++j){
				dp[i][j] = -1;
			}
		}

		for(int i = 0; i < n; ++i){
			for(int j = 0; j < 16; ++j){
				int x;
				std::cin >> x;
				if(x == 1)a[i] |= (1 << j);
			}
		}
		
		for(int i = 0; i < c; ++i){
			for(int j = 0; j < 16; ++j){
				int x;
				std::cin >> x;
				if(x == 1)b[i] |= (1 << j);
			}
		}
		
		dp[0][0] = 0;
		for(int i = 0; i < n; ++i){
			for(int j = 0; j < (1 << 16); ++j){
				if(dp[i][j] == -1)continue;
				
				int cur = (j | a[i]);
				for(int k = 0; k < c; ++k){
					int x = cur & b[k];
					int next = cur & (~b[k]);

					dp[i + 1][next] = std::max(dp[i + 1][next], dp[i][j] + score(x));
				}
			}
		}
		
		int ans = -1;
		for(int i = 0; i < (1 << 16); ++i){
			ans = std::max(ans, dp[n][i]);
		}
		
		std::cout << ans << std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 9096
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>

using namespace std;
int main() {
  int n;
  std::cin >> n;
  map<string, int> m;
  int max = 0;
  while(n--) {
    string str;
    cin >> str;
    if(m.find(str) == m.end()) {
      m[str] = 1;
      max = max > m[str] ? max : m[str];
    } else {
      m[str] += 1;
      max = max > m[str] ? max : m[str];
    }
  }
  vector<string> res;

  auto it = m.begin();
  while(it != m.end()) {
    if(it->second == max) {
      res.push_back(it->first);
    }
    ++it;  
  }
  
  sort(res.begin(), res.end());

  auto itt = res.begin();
  while(itt != res.end()) {
    std::cout << *itt << std::endl;
    ++itt;
  }
  return 0;
}

Measured memory_bytes: 23920
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
/*int p = 998244353;*/
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
bool can_move(vel &d) {
	int n = d.size();
	int now_pot = 0;
	int now_max = 0;
	while (now_pot < n) {
		if (now_pot > now_max) { return false; }
		mmax(now_max, now_pot + d[now_pot] / 10);
		now_pot++;
	}
	return true;
}
signed main(){
	int n; cin >> n;
	vel d(n);
	rep(i, n) { cin >> d[i]; }
	if (!can_move(d)) { cout << "no" << endl; return 0; }
	rev(d);
	if (!can_move(d)) { cout << "no" << endl; return 0; }
	cout << "yes" << endl;
	return 0;
}


Measured memory_bytes: 5228
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
using Graph = vector<vector<int>>;


int main() {
  ll n, k; cin >> n >> k;
  Vl x(n);
  rep(i, 0, n) cin >> x[i];
  ll l, r;
  ll ans = INF;
  Rep(i, 0, n-k){
    l = x[i], r = x[i+k-1];
    if(r <= 0){
      ans = min(ans, abs(l));
    }else if(l >= 0){
      ans = min(ans, r);
    }else{ //0をまたぐとき
      ans = min({ans, r*2 + abs(l), 2*abs(l) + r});
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>

using namespace std;
typedef long long ll;

int gcd(int x, int y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    int r = x % y;
    x = y;
    y = r;
  }
  return x;
}

/*迷路
const int INF = 50;

typedef pair<int,int> P;
char field[52][52];
int d[51][51];
int r,c;
int sx,sy;
int gx,gy;

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

int bfs(){
    queue<P> que;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            d[i+1][j+1] = INF;
        }
    }
    que.push(P(sy,sx));
    d[sy][sx]=0;
while(que.size()){
    P p=que.front();
    que.pop();
    if(p.second==gx&&p.first==gy) break;
    for(int i=0;i<4;i++){
        int nx=p.second+dx[i];
        int ny=p.first+dy[i];

        if(1<=nx&&nx<=c&&1<=ny&&ny<=r&&field[ny][nx]!='#'&&d[ny][nx]==INF){
            que.push(P(ny,nx));
            d[ny][nx] = d[p.first][p.second] + 1;
        }
    }
}
return d[gy][gx];
}
*/

int main(){
    int n,m;
    cin>>n>>m;
    vector<pair<ll,int> > pairs(n);
    for(int i = 0; i < n; i++){
        int a,b;
        cin>>a>>b;
        pairs[i].first = a;
        pairs[i].second = b;
    }
    sort(pairs.begin(),pairs.end());
    int i = 0;
    ll sum = 0;
    while(m>0){
        if(pairs[i].second<m){
            sum+=pairs[i].first*pairs[i].second;
            m-=pairs[i].second;
        }
        else{
            sum+=pairs[i].first*m;
            m=0;
        }
        i++;
        }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void) {
    int n, a, b, i, j, sum, x = 0;
    
    scanf("%d %d %d", &n, &a, &b);

    for (i = 1; i <= n; i++) {
        j = i;
        sum = 0;
        do {
            sum += j % 10;
            j /= 10;
        } while (j > 0);
        if (a <= sum && sum <= b) {
            x += i;
        }
    }

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


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int H,W;
string A,B,C,D;
ll mo=998244353;

ll combi(ll N_, ll C_) {
	const int NUM_=400001;
	static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}

ll modpow(ll a, ll n=mo-2) {
	ll r=1;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

ll L[101010],R[101010],P[101010],RS[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W>>A>>B>>C>>D;
	FORR(c,A) c-='0';
	FORR(c,B) c-='0';
	FORR(c,C) c-='0';
	FORR(c,D) c-='0';
	s=A+B+C+D;
	
	if(count(ALL(s),1)==0) return _P("1\n");
	ll ret=0;
	FOR(i,2) {
		ZERO(L);
		ZERO(R);
		ZERO(P);
		ZERO(RS);
		
		int NL=count(ALL(A),1);
		int NR=count(ALL(B),1);
		int NT=0,NB=0;
		P[0]=1;
		FOR(x,W) {
			if(C[x]==0 && D[x]==0) {
				L[x+1]=0;
			}
			else if(NL==0) {
				if(NT+NB==0) L[x+1]=1;
				else L[x+1]=0;
			}
			else {
				L[x+1] = combi(NT+NB+NL-1,NL-1);
			}
			P[x+1]=P[x];
			if(C[x]&&D[x]) P[x+1]=2*P[x]%mo;
			NT+=C[x];
			NB+=D[x];
		}
		NT=0,NB=0;
		for(x=W-1;x>=0;x--) {
			if(C[x]==0 && D[x]==0) {
				R[x+1]=0;
			}
			else if(NR==0) {
				if(NT+NB==0) R[x+1]=1;
				else R[x+1]=0;
			}
			else {
				R[x+1] = combi(NT+NB+NR-1,NR-1);
			}
			(R[x+1]*=P[x+1])%=mo;
			(RS[x+1]=RS[x+2]+R[x+1])%=mo;
			
			(ret += (C[x]+D[x])*L[x+1]*RS[x+1]%mo*modpow(P[x+1]))%=mo;
			
			NT+=C[x];
			NB+=D[x];
		}
		
		
		swap(H,W);
		swap(A,C);
		swap(B,D);
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 13836
#include <stdio.h>
#include <string.h>
 
int main() {
  unsigned int a, b, c, k;
  int sum = 0;
  scanf("%d %d %d %d", &a, &b, &c, &k);

  if (k >= a)
  {
    k -= a;
    sum += 1 * a;
  }
  else
  {
    sum += 1 * k;
    k = 0;
  }

  if (k >= b)
  {
    k -= b;
    sum += 0 * b;
  }
  else
  {
    sum += 0 * k;
    k = 0;
  }

  if (k >= c)
  {
    k -= c;
    sum += -1 * c;
  }
  else
  {
    sum += -1 * k;
    k = 0;
  }
    
  printf("%d\n", sum);
 
  return 0;
}

Measured memory_bytes: 2152
import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        Dice dice = new Dice(sc, x);
        if(check(dice)){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
    
    public static boolean check(Dice dice) {
        char[] pat = {'N','N','E','E','E','N'};
        for(int j = 0; j < dice.data.length; j++){
            for(int k = 0; k < dice.data.length; k++){
                if(j == k){ break; }
                for(char p:pat){
                    if(Arrays.equals(dice.data[j], dice.data[k])){
                        return true;
                    }
                    dice.roll(j, p);
                    for(int i = 0; i < 4; i++){
                        if(Arrays.equals(dice.data[j], dice.data[k])){
                            return true;
                        }
                        dice.roll(j, 'Z');
                    }
                }
            }
        }
        return false;
    }
}

class Dice {
    static int[][] data;

    public Dice(Scanner sc, int x){
        data = new int[x][6];
        for(int i = 0; i < data.length; i++){
            for(int j = 0; j < data[i].length; j++){
            data[i][j] = sc.nextInt();
            }
        }
    }

    public static void roll(int n, char p) {
        int temp = data[n][0];
        switch(p){
            case 'E':
                data[n][0] = data[n][2];
                data[n][2] = data[n][5];
                data[n][5] = data[n][3];
                data[n][3] = temp; break;
            case 'W':
                data[n][0] = data[n][3];
                data[n][3] = data[n][5];
                data[n][5] = data[n][2];
                data[n][2] = temp; break;
            case 'S':
                data[n][0] = data[n][1];
                data[n][1] = data[n][5];
                data[n][5] = data[n][4];
                data[n][4] = temp; break;
            case 'N':
                data[n][0] = data[n][4];
                data[n][4] = data[n][5];
                data[n][5] = data[n][1];
                data[n][1] = temp; break;
            case 'Z':
                temp = data[n][1];
                data[n][1] = data[n][2];
                data[n][2] = data[n][4];
                data[n][4] = data[n][3];
                data[n][3] = temp; break;
            default:
        }
    }
}

Measured memory_bytes: 29628
#include<bits/stdc++.h>
using namespace std;
int main() {
  string n, m;
  int count = 0;
  cin >> n;
  cin >> m;
  for (int i = 0; i < 3; i++) {
    if (n.at(i) == m.at(i)) {
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
/*input
81
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<ll,ll>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=4e18;
const int INF=1e6+1;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll sub(ll a,ll b){
    ll x=a-b;
    while(x<0) x+=MOD;
    while(x>MOD) x-=MOD;
    return x;
}
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=(res*a);
        if(res>1e10) return 1e11;
        a=(a*a);
        b>>=1;
    }
    return res;
}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
int main(){
    int n;
    cin>>n;
    REP(i,10){
        if(i!=0 and n%i==0 and n/i<=9){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define all(a)      a.begin(),a.end()
#define getc getchar_unlocked
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
/*---------------------------------------------------------------------------------------------------*/

void solve()
{
 
    char s;
    cin >> s;
    if(s>='A' && s<='Z')
        cout << "A\n";
    else
        cout << "a\n";
  return;
} 

signed main()
{
  FAST
  int T=1;
//   cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3644
n, m = map(int, input().split())
a = [int(i) for i in input().split()]

#%%

# n, m, a = 3, 3, [1,2,3,4,7,9, 10,8,16,14]

#%%
max_heap = [a[0]]
#%%
def add_heap(array, number):
    array.append(number)

    def swap(array, number, idx):
        if idx == 1:
            return array[idx-1]

        ai = array[idx-1]
        target_idx = (idx//2)
        target = array[target_idx-1]
        
        if ai >= target:
            array[idx-1], array[target_idx-1] =  target, ai

            number = swap(array, number, target_idx)
        else:
            return array[idx-1]

    return swap(array, number, len(array))


#%%
for ai in a[1:]:
    add_heap(max_heap, ai)

#%%
for _ in range(m):
    
    #half
    max_heap[0] //= 2
    
    def sort_heap(array, number, idx):
        top = number
        left_idx = idx*2
        right_idx = idx*2 + 1
        
        if left_idx > len(array):
            left = -1
        else:
            left = array[left_idx - 1]

        if right_idx > len(array):
            right = -1
        else:        
            right = array[right_idx - 1]

        if top >= left and top >= right:
            return array
        elif left > right:
            array[idx-1], array[left_idx-1] = left, top
            sort_heap(array, top, left_idx)
        else:
            array[idx-1], array[right_idx-1] = right, top
            sort_heap(array, top, right_idx)

    sort_heap(max_heap, max_heap[0], 1)

#%%
print(sum(max_heap))

#%%


Measured memory_bytes: 14480
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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 DEBUG_VLL(vec) REP(sz, vec.size()) cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    string s, t; cin >> s >> t;
    REP(i, n) {
        cout << s[i] << t[i];
    }
    cout << '\n';
    return 0;
}


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

signed main() {
	int n, q, num = 0;
	string s;
	cin >> n >> q >> s;
	vector<int> at(n);
	at[0] = 0;

	for (int i = 1; i < n; ++i) {
		if (s[i - 1] == 'A' and s[i] == 'C') {
			num++;
		}
		at[i] = num;
	}

	for (int i = 0; i < q; ++i) {
		int l, r;
		cin >> l >> r;
		int ans = at[r - 1] - at[l - 1];

		cout << ans << endl;
	}
}


Measured memory_bytes: 1408
package main

import "fmt"

func main() {
	var a int
	count := 0
	fmt.Scan(&a)
	num := make([]int, a)
	for i := 0; i < a; i++ {
		fmt.Scan(&num[i])
	}

	flag := true
	for flag {
		for i := 0; i < a; i++ {
			if num[i]%2 == 0 {
				num[i] = num[i] / 2
			} else {
				flag = false
			}
		}
		if flag {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf (long long)1e10
#define IO {\
	freopen("input.txt","r",stdin);\
	freopen("output.txt","w",stdout);\
}
#define fast() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define nmbr(c) (int)(c-'0')
#define ltr(c) (int)(c-'a')
#define bug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl ;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

ll lcm(ll a,ll b){
    return (a*b)/__gcd(a,b);
}


int main(){
    ll n,m;

    scanf("%lld %lld",&n,&m);

  ll a[n+2],b[n+2];

    ll l=1LL;

    for(ll i=0;i<n;i++){
        scanf("%lld",a+i);
        b[i]=a[i]/2;
        l=lcm(b[i],l);
    }

    for(ll i=0;i<n;i++){
        if(l/b[i]%2==0){
            return printf("0\n"),0;
        }
    }
    ll cnt(0);
    //bug(l)

    printf("%lld\n",(1+m/l)/2);
}





Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

const int INF = 1001001001;

int main(){
  string s;
  cin >> s;
  reverse(ALL(s));
  s.push_back('0');
  vector<vector<int>> dp(s.size()+1, vector<int>(2, INF));
  dp.at(0).at(0) = 0;
  rep(i, s.size())rep(j, 2){
    int now = s.at(i) - '0';
    now += j;
    rep(a, 10){
      int ni = i+1, nj = 0;
      int b = a - now;
      if(b < 0){
        nj++;
        b += 10;
      }
      dp.at(ni).at(nj) = min(dp.at(ni).at(nj), dp.at(i).at(j)+a+b);
    }
  }
  cout << dp.at(s.size()).at(0) << endl;
  return 0;
}

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

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


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=2050;
//ここまでテンプレ
int N,K;
int B[SIZE][SIZE]={};
int func(int x,int y,int X,int Y){
	return B[X][Y]-B[X][y-1]-B[x-1][Y]+B[x-1][y-1];
}
int main(){
	cin>>N>>K;
	for(int i=0;i<N;i++){
		int x,y;
		char c;
		cin>>x>>y>>c;
		//黒ならそのまま入れる
		if(c=='B')
			B[x%(2*K)+1][y%(2*K)+1]++;
		//白ならx座標をKずらして入れる
		else
			B[(x+K)%(2*K)+1][y%(2*K)+1]++;
	}
	/*
	for(int i=0;i<=2*K;i++){
		for(int j=0;j<=2*K;j++){
			cout<<B[i][j]<<" ";
		}
		cout<<i<<endl;
	}
	cout<<endl;
	*/
	//累積和を取る
	for(int i=0;i<=2*K+1;i++)
		for(int j=0;j<=2*K+1;j++)
			B[i][j+1]+=B[i][j];
	for(int i=0;i<=2*K+1;i++)
		for(int j=0;j<=2*K+1;j++)
			B[j+1][i]+=B[j][i];
	/*
	for(int i=0;i<=2*K;i++){
		for(int j=0;j<=2*K;j++){
			cout<<B[i][j]<<" ";
		}
		cout<<i<<endl;
	}
	*/
	int ans=0;
	//左下を全探索する
	for(int i=1;i<=K+1;i++){
		for(int j=1;j<=K+1;j++){
			int temp=0;
			//中央
			temp+=func(i,j,i+K-1,j+K-1);
			//右上
			temp+=func(i+K,j+K,2*K,2*K);
			//左下
			temp+=func(1,1,i-1,j-1);
			//左上
			temp+=func(i+K,1,2*K,j-1);
			//右下
			temp+=func(1,j+K,i-1,2*K);
			ans=max({ans,temp,N-temp});
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 16640
#include <iostream>
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl "\n"
using namespace std;

int N;
int main() {
	cin >> N;
	N %= 1000;
	cout << (1000 - N)%1000 << endl;
    return 0;
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
#define pb push_back
#define in insert
#define ff first
#define ss second
#define mp make_pair
#define int long long
#define uint unsigned long long
#define rep(i,x,m) for(int i=x;i<m;i++)
#define repr(i,x,m) for(int i=x;i>=m;i--)
#define MOD 1000000007
#define endl "\n"
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define vi vector<int>
#define vs vector<string>
#define print(v) for(int i=0;i<v.size();i++) cout<<v[i]<<" ";cout<<endl
using namespace std;
#define noob ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void ram5564()
{
    string s;
    cin>>s;
    rep(i,0,s.length())
    cout<<"x";
}

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

Measured memory_bytes: 256
N = int(input())

ans = []

for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        if i + j != N + 1 - N % 2:
            ans.append((i,j))

print(len(ans))
for a, b in ans:
    print(a, b)

Measured memory_bytes: 3956
#include <stdio.h>
#include <string.h>
#define bufsize 1<<22
char ibuf[bufsize];
char *ptr=ibuf;

void readint(int *i)
{
    *i=0;
    while(*ptr>='0')
    {
        *i=*i*10+*ptr-'0';
        ++ptr;
    }
    ++ptr;
}


main()
{
    fread(ibuf,1,bufsize,stdin);

    int h,w,k,sx,sy,tx,ty;
    readint(&h);
    readint(&w);
    readint(&k);
    readint(&sx);
    readint(&sy);
    readint(&tx);
    readint(&ty);
    sx--,sy--,tx--,ty--;

    struct po {int x,y;};
    struct po qu[1<<20];
    struct po *beg=qu,*end=qu+1;
    beg->x=sx,beg->y=sy;
    unsigned int dist[1<<20];
    memset(dist,-1,sizeof(dist));
    dist[sx*w+sy]=0;
    while(beg!=end)
    {
        int x=beg->x,y=beg->y;
        unsigned int d=dist[x*w+y];
        ++beg;
        char *pt=ptr+x*(w+1)+y;
        char *const pcp=pt;
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            a++,z+=w;
            pt+=w+1;
            if(a==h||*pt=='@'||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
        pt=pcp;
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            b++,z++;
            pt++;
            if(b==w||*pt=='@'||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
        pt=pcp;
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            a--,z-=w;
            pt-=w+1;
            if(a<0||*pt=='@'||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
        pt=pcp;
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            b--,z--;
            pt--;
            if(b<0||*pt=='@'||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
    }
    puts("-1");
}


Measured memory_bytes: 11332
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int,int,int> T;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using vvec = vector<vector<int>>;
using vec = vector<int>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    int memo=a[0];
    int ans=1;
    if(n==1){
        cout<<1<<endl;
    }
    else{
        for(int i=1;i<n;i++){
            if(a[i]>memo){

            }
            else{
                ans++;
            }
            memo=min(memo,a[i]);
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
int main(void){
    int n,m; cin >> n >> m;
    if(n == m) cout <<"Yes";
    else cout <<"No";
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  int s,t,x;
  cin>>s>>t;
  for(int i=0;i<s;i++){
    cin>>x;
  }
  cout<<(s+t-3)/(t-1)<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 110
#define M 100100
using namespace std;

const int dx[5]={-1,0,1,0};
const int dy[5]={0,1,0,-1};
const char fa[5]={'N','E','S','W'};

long long dp[N][N][5];
int h,w,ansx,ansy,ansf;
long long ll;
int map[N][N];
int stackx[M],stacky[M],stackf[M];

void dfs(int x,int y,int f,long long l)
{
	if (l==ll) { ansx=x,ansy=y,ansf=f; return;}
	if (dp[x][y][f])
	{
		long long loop= l-dp[x][y][f];
		long long rest=ll-dp[x][y][f]+1;
		//tofind(x,y,f,rest%loop-1);
		long long toxy=dp[x][y][f]+rest%loop-1;
		ansx=stackx[toxy]; ansy=stacky[toxy]; ansf=stackf[toxy];
		return;
	}
	stackx[l]=x; stacky[l]=y; stackf[l]=f;
	dp[x][y][f]=l; int tof=f;
	while (map[x+dx[tof]][y+dy[tof]]==0)
		tof=(tof+1)%4;
	//stackx[l]=x; stacky[l]=y; stackf[l]=tof;
	dfs(x+dx[tof],y+dy[tof],tof,l+1);
}

void dfs1(int x,int y,int f,long long l)
{
    int tof=f,loop=0;
    while (l<ll)
    {
        while (map[x+dx[tof]][y+dy[tof]]==0)
            tof=(tof+1)%4;
        x+=dx[tof]; y+=dy[tof];
        l++;
        if (dp[x][y][tof]!=-1)
        {
            //long long loop= l-dp[x][y][f];
            //long long rest=ll-dp[x][y][f]+1;
            //long long toxy=dp[x][y][f]+rest%loop-1;
            //ansx=stackx[toxy]; ansy=stacky[toxy]; ansf=stackf[toxy];
            /*long long loo=l-dp[x][y][tof];
            long long rest=ll-l;
            rest%=loo;
            l=ll-rest;*/
            long long loo=l-dp[x][y][tof];
            long long rest=ll-l;
            long long div=rest/loo;
            //rest%=loo;
            //l=ll-rest;
            l+=div*loo;
            memset(dp,-1,sizeof dp);
            //loop=1;
        }
        else dp[x][y][tof]=l;

    }
    ansx=x; ansy=y; ansf=tof;
}

int main()
{
	int sx,sy,sf;
	char c;
	//freopen("in.txt","r",stdin);
	while (scanf("%d%d%lld",&h,&w,&ll),h|w|ll)
	{
		//cout<<123123<<endl;
		memset(map,0,sizeof map);
		for (int i=1;i<=h;i++)
		{
			getchar();
			for (int j=1;j<=w;j++)
			{
				scanf("%c",&c);
				if (c=='.') map[i][j]=1;
				else if (c=='#') map[i][j]=0;
				else if (c=='N') map[i][j]=1,sx=i,sy=j,sf=0;
				else if (c=='E') map[i][j]=1,sx=i,sy=j,sf=1;
				else if (c=='S') map[i][j]=1,sx=i,sy=j,sf=2;
				else if (c=='W') map[i][j]=1,sx=i,sy=j,sf=3;
			}
		}
		//cout<<123123<<endl;
		memset(dp,-1,sizeof dp); dp[sx][sy][sf]=0;
		dfs1(sx,sy,sf,0);
		printf("%d %d %c\n",ansx,ansy,fa[ansf]);
	}
	return 0;
}

Measured memory_bytes: 1724
def II(H, W):
    return 0 if W%3 == 0 else H
def T(H, W):
    if W%2 == 0:return W/2
    a = (H-1)/3 if H%3==1 else (H+1)/3
    b = (W+1)/2 * (H-a)
    c = (W-1)/2 * (H-a)
    a *= W
    return max(a, b, c) - min(a, b, c)
     
H,W = map(int, raw_input().split())
print min(II(H, W), II(W, H), T(H, W), T(W, H))

Measured memory_bytes: 2568
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

l,r,d = readints()

ans = 0
for i in range(l,r+1):
    if i%d==0:
        ans += 1

print(ans)




Measured memory_bytes: 61788