akhauriyash/Code-Regression huggingface dataset:
N, T = list(map(lambda x: int(x), input().split(' ')))
t_list = map(lambda x: int(x), input().split(' '))

summary = 0
time_until = 0
for t in t_list:
    if(time_until <= t):
        summary += T
    else:
        summary += t + T - time_until
    time_until = t + T

print(summary)

Measured memory_bytes: 20856
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

const int MAX_S = 2010 * 2010;
bitset<MAX_S> b;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, sum = 0;
    cin >> n;
    b[0] = 1;
    rep(i, 0, n){
        int a;
        cin >> a;
        sum += a;
        b |= (b << a);
    }
    int ans = (sum + 1) / 2;
    while(!b[ans]) ans++;
    cout << ans << endl;
}

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

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

#define ALL(v) (v).begin(), (v).end()

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl

int past[1252830];

int main(){
    while(true){
        int a,l;
        cin>>a>>l;
        if(a+l==0)break;
        fill(past,past+1252830,-1);
        past[a] = 0;
        int i = 1;
        while(true){
            string s = to_string(a);
            while(s.size()!=l)s += "0";
            sort(ALL(s));
            int mn = stoi(s);
            reverse(ALL(s));
            int mx = stoi(s);
            a = mx - mn;
            if(past[a] != -1){
                printf("%d %d %d\n", past[a], a, i-past[a]);
                break;
            }
            past[a] = i;
            i++;
        }
    }
    return 0;
}


Measured memory_bytes: 8156
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


class UnionFind:
    def __init__(self, size):
        self.parent = [i for i in range(size)]
        self.rank = [0 for _ in range(size)]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            return self.find(self.parent[x])

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def __str__(self):
        ret = "parents\n"
        ret += " ".join(map(str, self.parent))
        ret += '\n'
        ret += " ".join(map(str, self.rank))
        return ret


N, K, L = map(int, input().split())


def solve1():
    root = UnionFind(N)
    train = UnionFind(N)

    for _ in range(K):
        a, b = map(lambda x: int(x)-1, input().split())
        root.union(a, b)

    for _ in range(L):
        a, b = map(lambda x: int(x)-1, input().split())
        train.union(a, b)
    ans = [1]*N
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            else:
                if root.same(i, j) and train.same(i, j):
                    ans[i] += 1
    print(" ".join(map(str, ans)))


def solve2():
    ans = [0]*N
    root = UnionFind(N)
    train = UnionFind(N)
    for _ in range(K):
        a, b = map(lambda x: int(x)-1, input().split())
        root.union(a, b)

    for _ in range(L):
        a, b = map(lambda x: int(x)-1, input().split())
        train.union(a, b)

    d = 10**6
    nums = dict()
    for i in range(N):
        n = root.find(i)+train.find(i)*d
        if n in nums.keys():
            nums[n] = nums[n]+1
        else:
            nums[n] = 1

    for i in range(N):
        ans[i] = nums[root.find(i)+train.find(i)*d]

    print(" ".join(map(str, ans)))


solve2()


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

public class Test
{
	public static void Main()
	{
		// your code goes here
		
		var b = Console.ReadLine().Split().Select(y => int.Parse(y)).ToArray();
		int x = b[0];
		int a = b[1];
		
		if(x<a){Console.WriteLine("0");}else{Console.WriteLine("10");}
	}
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define reps(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define rep(i, n) reps(i, 0, n - 1)
#define sper(i, s, n) for (int i = (s); i >= (int)(n); i--)
#define per(i, n) sper(i, n - 1, 0)
using namespace std;
using ll = long long;
using P = pair<int, int>;

void solve()
{
    int k, s;
    cin >> k >> s;
    int ans = 0;
    reps(x, 0, k) reps(y, 0, k)
    {
        int z = s - x - y;
        if (z < 0 || z > k)
            continue;
        ans++;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3508
#include <algorithm>
#include <functional>
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
 
int main() {

  int n;
  cin >> n;
  int ans=0;

  for(int i=1;i<=n;i++){
    string s=to_string(i);
    if(s.length()%2!=0){
      ans++;
    }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(){
   long int a,b,res1,res2,k;
    
    scanf("%ld %ld",&a,&b);
    
    k=(a+b)/2;
    
    res1=abs(a-k);
    res2=abs(b-k);
    
    if(res1==res2){
        printf("%ld\n",k);
    }
    
    else {
        printf("IMPOSSIBLE\n");
    }
    
    return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
	"sort"
)

type row struct {
	p int
	y int
}

func main() {
	var N, M int
	fmt.Scan(&N, &M)

	a := make([]row, M)
	y := make([][]int, N)

	var P, Y int
	for i := 0; i < M; i++ {
		fmt.Scan(&P, &Y)
		p := P - 1
		y[p] = append(y[p], Y)
		a[i] = row{p: P, y: Y}
	}

	for i := 0; i < N; i++ {
		sort.Ints(y[i])
	}

	for i := 0; i < M; i++ {
		r := a[i]
		idx := sort.SearchInts(y[r.p-1], r.y)
		fmt.Printf("%06d%06d\n", r.p, idx+1)
	}
}


Measured memory_bytes: 11776
# D - Equals

class UnionFind():
    def __init__(self, n):
        self.par = [-1]*n
    
    def _find(self, x):
        if self.par[x] < 0:
            return x
        self.par[x] = self._find(self.par[x])
        return self.par[x]

    def _union(self, x, y):
        x = self._find(x)
        y = self._find(y)
        if (x==y): 
            return False
        if (self.par[x]>self.par[y]):
            x, y = y, x
        self.par[x] += self.par[y]
        self.par[y] = x
        return True
    
    def _is_same_group(self, x, y):
        return self._find(x)==self._find(y)
    

N, M = map(int, input().split())
P = [int(p) for p in input().split()]
u = UnionFind(N+1)
for _ in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    u._union(P[x], P[y])

ans = 0
for i in range(N):
    if u._is_same_group(P[i], P[P[i]-1]):
        ans += 1

print(ans)

Measured memory_bytes: 20556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int ,int> P;
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
int main(){ 
int n;
cin>>n;
cout<<n*800-n/15*200<<endl;
return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
#include <assert.h>
#include <array>

using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mn(x) *min_element((x).begin(),(x).end())
#define mx(x) *max_element((x).begin(),(x).end())
#define sum(x) accumulate((x).begin(),(x).end(),0ll)
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef  unsigned long long  ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

const ld pi=acos(-1);
const ll inf=(ll)1e9+1;
const int mod=1000000007;
//const int mod=998244353;

ll n,m,k;
const int N=1e6;






int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    int q,t,u,v,h;
    ll x,a,b,c,d,y,z;
    cin >> n >> x >> t;
    cout << (x+n-1)/x*t << el;
    
    return 0;
}



Measured memory_bytes: 3644
from sys import exit
X = int(input())
p = [0]*122
for i in range(122):
    p[i] = pow(i , 5)
for i in range(122):
    a = p[i]
    for j in range(i):
        if a-p[j] == X:
            print(i, j)
            exit()
    for j in range(i, 122):
        if a+p[j] == X:
            print(i, -1*j)
            exit()


Measured memory_bytes: 64120
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
#define ld long double
using namespace std; 
 
const int N = 2e5 + 1000, OO = 1e14 + 100, M = 1e9 + 7, P = 6151, SQ = 120, lg = 31;
typedef pair <int, int> pii;
int fac[N], inv[N], a[N];
 
int pw(int x, int y) {
	if(y == 0)
		return 1;
	int cnt = pw(x, y / 2);
	cnt = (cnt * cnt) % M;
	cnt = (cnt * (y % 2 == 1 ? x : 1)) % M;
	return cnt;
}
 
void prepro() {
	fac[0] = 1;
	for(int i = 1; i <= N - lg; i++) 
		fac[i] = (fac[i - 1] * i) % M;
	inv[N - lg] = pw(fac[N - lg], M - 2);
	for(int i = N - lg - 1; i > -1; i--) 
		inv[i] = (inv[i + 1] * (i + 1)) % M;
}
 
int c(int x, int y) {
	return ((fac[x] * inv[y] % M) * inv[x - y]) % M;
}

int32_t main() {
    use_fast;
    prepro();
	int n, k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
    	cin >> a[i];
    sort(a + 1, a + n + 1);
    int ans = 0;
    for(int i = 1; i <= n; i++) {
    	if(i < k)
    		continue;
    	int h = (a[i] * c(i - 1, k - 1)) % M;
    	ans = (ans + h) % M;
	}
	for(int i = 1; i <= n; i++) {
		if(i > (n - k + 1))
			continue;
		int h = (a[i] * c(n - i, k - 1)) % M;
		ans = (ans - h) % M;
		ans = (ans + M) % M;
	}
	cout << ans << endl;
	return 0;
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ... 
*/	

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

int min(int a,int b){
  return a > b? b : a;
}

int main(){
  int i;
  // 入力値の受け取り
  int N, K;
  cin >> N >> K;
  int *inp = new int[N];
  for(i = 0; i < N; i++){
    cin >> inp[i];
  }


  unsigned int ans = -1;
  for(i = 0;i <= (N - K);i++){
    int u = min( abs(inp[i]), abs(inp[K + i - 1]));
    int v = inp[K + i - 1] - inp[i];
    if(ans > u + v) ans = u + v;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
import sys
import itertools
import copy
from collections import defaultdict

input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n = I()
mylist = [0 for i in range(8)]
mylist2 = MI()
num = 0

for i in mylist2:
    temp = i // 400
    if temp <= 7:
        mylist[temp] = 1
    else:
        num += 1
        
max = sum(mylist) + num

min = sum(mylist)
if min == 0:
    min = 1
    
print(str(min) + " " + str(max))

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

N, M = map(int, input().split())
G = [set() for _ in range(N+1)]
for _ in range(M):
    A, B = map(int, input().split())
    G[A].add(B)
    G[B].add(A)
if M % 2 == 1:
    print(-1)
    exit()
G2 = [set() for _ in range(N+1)]
parent = [0] * (N+1)
depth = [-1] * (N+1)
depth[1] = 0
stack = [1]
while stack:
    v = stack.pop()
    if len(G[v]) > 0 and v != 1:
        depth[v] = depth[parent[v]] + 1
    for c in G[v]:
        G2[v].add(c)
        parent[c] = v
        if v in G[c]:
            G[c].remove(v)
        stack.append(c)
    G[v] = set()
nodes = sorted(list(range(1, N+1)), key=lambda v: -depth[v])
ans = []
for v in nodes:
    for c in G2[v]:
        ans.append((v, c))
    if len(G2[v]) % 2 == 1:
        p = parent[v]
        ans.append((v, p))
        G2[p].remove(v)
for u, v in ans:
    print(u, v)


Measured memory_bytes: 152468
#include<iostream>
using namespace std;
int n,y,m,d,endD,cnt;
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>y>>m>>d;
    cnt=0;
    while(1){
      if(y==1000&&m==1&&d==1)break;
      cnt++;
      d++;
      if(y%3==0||m%2==1){
	endD=20;	
      }else{
	endD=19;
      }
      if(d>endD){
	d=1;
	m++;
      }
      if(m>10){
	m=1;
	y++;
      }
    }
    cout<<cnt<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int gcd(int x,int y){
  return y==0?x:gcd(y,x%y);
}

int main(){
  int n;
  cin>>n;
  int a[n+1]={};
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int ans=a[0];
  for(int i=1;i<n;i++){
    ans=gcd(ans,a[i]);
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 640
#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() {
  i64 N, K;
  std::cin >> N >> K;
  std::cout << (K == 1 ? 0 : N - K) << std::endl;
  return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

int gcd(ll a, ll b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

  return b ? gcd(b, a % b) : a;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a, b;
  cin >> a >> b;
  cout << a * b / gcd(a, b) << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int ans;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    if (N < 10) {
        printf("%d\n", N);
    } else if (N < 100){
        printf("%d\n", 9);
    } else if (N < 1000) {
        printf("%d\n", N-90);
    } else if (N < 10000) {
        printf("%d\n", 909);
    } else if (N < 100000) {
        printf("%d\n", N-9090);
    } else {
        printf("%d\n", 90909);
    }
    return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];

    int l = 1, r = 1e9;
    while(r - l > 1)
    {
        int cnt = 0;
        int mid = (l + r) / 2;
        for(int i=0; i<N; i++)
        {
            cnt += (A[i] - 1) / mid;
        }
        if(cnt <= K)
        {
            r = mid;
        }
        else
        {
            l = mid;
        }
    }
    {
        int cnt = 0;
        for(int i=0; i<N; i++)
        {
            cnt += (A[i] - 1) / l;
        }
        if(cnt <= K) r = l;
    }

    cout << r << endl;

    return 0;
}


Measured memory_bytes: 3992
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<55)+1e9; // ~ 3.6 * 1e16
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  Int n;
  cin>>n;
  vector<Int> R(n);
  cin>>R;

  Int ans = -INF;
  Int mx = -INF;
  for(Int i=n-1;i>=0;i--){
    Max(ans, mx - R[i]);
    Max(mx, R[i]);
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 4412
///  author:Kissheart  ///
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string.h>
#include<vector>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<deque>
#include<ctype.h>
#include<map>
#include<set>
#include<stack>
#include<string>
#define INF 0x3f3f3f3f
#define FAST_IO ios::sync_with_stdio(false)
const double PI = acos(-1.0);
const double eps = 1e-6;
const int MAX=1e5+10;
const int mod=1e9+7;
typedef long long ll;
using namespace std;
#define gcd(a,b) __gcd(a,b)
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll qpow(ll a,ll b){ll r=1,t=a; while(b){if(b&1)r=(r*t)%mod;b>>=1;t=(t*t)%mod;}return r;}
inline ll inv1(ll b){return qpow(b,mod-2);}
inline ll exgcd(ll a,ll b,ll &x,ll &y){if(!b){x=1;y=0;return a;}ll r=exgcd(b,a%b,y,x);y-=(a/b)*x;return r;}
inline ll read(){ll x=0,f=1;char c=getchar();for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;for(;isdigit(c);c=getchar()) x=x*10+c-'0';return x*f;}
//freopen( "in.txt" , "r" , stdin );
//freopen( "data.txt" , "w" , stdout );
int a,b,k;
int sum;
vector<int>v;
int main()
{
    scanf("%d%d%d",&a,&b,&k);
    for(int i=min(a,b);i>=1;i--)
    {
        if(a%i==0 && b%i==0)
        {
            sum++;
            if(sum==k)
            {
                printf("%d\n",i);
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


LL dfs(LL d, LL p, LL lp, LL sub, bool fst){
	if(p < lp){ return d == 0; }
	d = abs(d);
	LL ret = 0;
	LL q = p - sub;
	LL t = d / q;
	for(int i = 0; i <= 1; ++i){
		int s = t + i;
		if(s <= 9){
			LL u = dfs(d - s * q, p / 10ull, lp, sub * 10 + 1, false);
			if(fst){ u *= 9 - s; }
			else{ u *= 10 - s; }
			ret += u;
		}
	}
	return ret;
}

void mainmain(){
	LL ps[19];
	ps[0] = 1;
	for(int i = 1; i < 19; ++i){
		ps[i] = ps[i - 1] * 10 + 1;
	}

	LL d;
	cin >> d;
	if(d % 9){
		puts("0");
		return;
	}
	d /= 9;

	LL ans = 0;
	for(int w = 2; w <= 18; ++w){
		LL f = w / 2;
		LL fp = ps[w - 2];
		LL lp = ps[w - f - 1];
		LL t = dfs(d, fp, lp, 0, true);
		if(w % 2){ t *= 10; }
		ans += t;
	}
	cout << ans << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 256
/* 
* Rooted tree
* output 1)node_number, 2)parent_number, 3)depth, 4)kind_of_node, 5)child_list
*/

/* inclution */
#include <stdio.h>

/* Definition */
#define MAX 100000
#define NIL -1

/* Prototype */
void printTree(int);
void getDepth(int, int);

/* Global Variables */
struct Node {
  int parent, left, right;
};
struct Node T[MAX]; //array for tree
int n,D[MAX]; //array for depth

/* main */
int main(){
  int i,j,node,degree,child,left,right;
  
  /* input the number of A[] */
  scanf("%d",&n);
  
  /* initialize array */
  for(i=0;i<n;i++) { //??¨??????NIL??§?????????
    T[i].parent = NIL;
    T[i].left = NIL;
    T[i].right = NIL;
  }
  
  /* input datas */
  for(i=0;i<n;i++){
    scanf("%d%d",&node, &degree);
    for(j=0;j<degree;j++){ //??¨?????¨?????¨????§????
      scanf("%d", &child);
      if(j==0) {
        T[node].left = child; //?????????left??????
      }else {
        T[left].right = child; //left?????????right????????????
      }
      left = child;
      T[child].parent = node; //???????¨????
    }
  }

  /* input Depth datas */
  for(i=0;i<n;i++) {
    if(T[i].parent == NIL) {
      right = i;
    }
  }
  getDepth(right, 0);
    
  /* print out */
  for(i=0;i<n;i++) {
    printTree(i); //print????????????
  }

  return 0;
}

/* Print ???????????? */
void printTree(int u) { //u???node??????
  int i, c;
  /* each elements */
  printf("node %d: ",u); //node
  printf("parent = %d, ", T[u].parent);
  printf("depth = %d, ", D[u]);
  
  /* kind of node */
  if(T[u].parent == NIL) {
    printf("root, ");
  }else if(T[u].left == NIL) {
    printf("leaf, ");
  }else {
    printf("internal node, ");
  }
  
  /* print child list */
  printf("[");
  c = T[u].left; //??????????????????
  while(c!=NIL){ //?????????????????¨????????????????????????????????????
    if(c==T[u].left){ //???????????????????????´
      printf("%d",c);
    }else {
      printf(", %d", c); 
    }
    c = T[c].right; //?????????????????????
  }
  printf("]\n");
}


void getDepth(int u, int d){ //u: node??????
  D[u] = d;
  if(T[u].right!=NIL) { //????????????????¢????
    getDepth(T[u].right, d);
  }
  if(T[u].left!=NIL) { //???????¢????
    getDepth(T[u].left, d+1); //?????????????????¨????????¨???,depth??????????¢????????????????????????????
  }
}

Measured memory_bytes: 5296
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007 //10^9+7
#define div 998244353
#define rep(i,n) for(int i=0;i<n;i++)
string s;
bool ans=false;
string c[]={"KIHBR","AKIHBR","KIHABR","AKIHABR","KIHBAR","AKIHBAR","KIHABAR","AKIHABAR","KIHBRA","AKIHBRA","KIHABRA","AKIHABRA","KIHBARA","AKIHBARA","KIHABARA","AKIHABARA"};
signed main(){
    cin>>s;
    rep(i,16){
        if(s==c[i])ans=true;
    }
    if(ans)puts("YES");
    else puts("NO");
    return 0;
}


Measured memory_bytes: 256
import Control.Applicative

main :: IO ()
main = solve <$> f >>= print
  where
    f = map read <$> words <$> getLine

solve :: [Int] -> Int
solve [a, b, c] = f 0
  where
    f t
      | t == (a + b) = -1
      | otherwise = let d = 60 * t + c
                        u = d `div` (a + b)
                        mn = u * (a + b)
                        mx = mn + a
                    in if mn <= d && d <= mx
                       then d
                       else f (t + 1)



Measured memory_bytes: 3620
import java.util.Scanner;

public class Main{
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int n =sc.nextInt();
        int i =1;
        do{
            int x = i;
       
             if ( x % 3 == 0 ){
                System.out.print(" "+ i);  
                continue;
            }
                while(true){
            if ( x % 10 == 3 ){
                System.out.print(" "+ i); 
                break;
            }

            x /= 10;

            if (x!=0) {
                continue;
            }else{
                break;
            } 
        }
        
        }while(++i<=n);
        
        System.out.println();
    }
}

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

void hantei(int W, int H, int x, int y, int r){
  bool left = (x - r >= 0), right = (x + r <= W),
  up = (y + r <= H), down = (y - r >= 0);


  if(left && right && up && down){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


int main(){
  int W, H, x, y, r;

  cin >> W >> H >> x >> y >> r;

  hantei(W, H, x, y, r);
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define rep(i, l, r) for(int i = (l), i##end = (r);i <= i##end;++i)
using std::cin; using std::cout;
const int maxn = 3030;
typedef long long ll;
const int mod = 1e9 + 7;
inline void reduce(int & x) {
	x += x >> 31 & mod;
}
int n, m;
char c[maxn];
int max[maxn], s[maxn];
int f[maxn][maxn];
int main() {
	std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> m;
	rep(i, 1, n) {
		cin >> c[i];
		s[i] = s[i - 1] + c[i] % 2;
		max[i] = i;
	}
	rep(i, 1, m) {
		int l, r;
		cin >> l >> r;
		max[l] = std::max(max[l], r);
	}
	f[1][s[max[1]]] = 1;
	rep(i, 1, n) {
		max[i + 1] = std::max(max[i + 1], max[i]);
		int lol = s[max[i + 1]] - s[max[i]];
		rep(j, 0, n) {
			if(j != 0) { 
				reduce(f[i + 1][j + lol - 1] += f[i][j] - mod);
			}
			if(i + j - 1 != max[i]) {
				reduce(f[i + 1][j + lol] += f[i][j] - mod);
			}
		}
	}
	cout << f[n + 1][0] << '\n';
}


Measured memory_bytes: 35840
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<ll>
#define vvint vector<vint>
#define P pair<ll,ll>

using namespace std;
typedef long long ll;

int times(ll h) {
	int res =0;
	while (h > 0) {
		res++;
		h /= 2;
	}
	return res;
}

int main(void) {
	ll h; cin >> h;
	ll n = times(h);
	ll ans =((ll)1 << n);
	cout << ans-1 << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;


class Program {

	const long mod = 1000000007;
	//public static int[] max;

	static void Main(string[] args) {

		char[] cs = new char[] { ' ', ',' };
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res="";
		//int res = 0; ;
		//int n = int.Parse(Console.ReadLine());
		int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();

		if ( vals[0] + vals[1] == 15 ) {

			Console.WriteLine("+");
			return;
		}


		if ( vals[0] * vals[1] == 15 ) {

			Console.WriteLine("*");
			return;
		}
		//for ( int i = 0; i < n; i++ ) {

		//}



		Console.WriteLine("x");

		return;
	}


	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for (int i = 0; i < str.Length; i++) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for (int i = 0; i < str.Length; i++) { nums[i] = long.Parse(str[i]); }
		return nums;
	}
	
	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for (int i = 0; i < str.Length; i++) { re[i] = str[i].ToString(); }
		return re;
	}

}

Measured memory_bytes: 11092
#include <cstdio>
#include <utility>
#define MP make_pair
#define FR first
#define SE second
using namespace std;
typedef pair<int,int> PII;
const int N=300010;
const int INF=1e9;
int n,m;
int a[N];
PII f[N];
inline int max(int x,int y){
	return x>y?x:y;
}
inline void updateMax(int &x,int y){
	x=(y>x)?y:x;
}
void readData(){
	scanf("%d",&n);
	m=1<<n;
	for(int i=0;i<m;i++) scanf("%d",&a[i]);
}
void insertNumber(PII &x,int y){
	if(y==-1)
		return;
	if(a[y]>a[x.FR]){
		x.SE=x.FR;
		x.FR=y;
	}
	else if(x.SE==-1||a[y]>a[x.SE])
		x.SE=y;
}
PII mergePair(PII &x,PII &y){
	PII res=x;
	insertNumber(res,y.FR);
	insertNumber(res,y.SE);
	return res;
}
void calc(){
	for(int i=0;i<m;i++) f[i]=MP(i,-1);
	PII u,v;
	for(int i=2;i<=m;i<<=1)
		for(int j=0;j<m;j+=i)
			for(int k=0;k<(i>>1);k++){
				u=f[j+k];
				v=f[j+(i>>1)+k];
				f[j+k]=u;
				f[j+(i>>1)+k]=mergePair(u,v);
			}
}
void solve(){
	int ans=-INF;
	for(int k=1;k<m;k++){
		updateMax(ans,a[f[k].FR]+a[f[k].SE]);
		printf("%d\n",ans);
	}
}
int main(){
	readData();
	calc();
	solve();
	return 0;
}


Measured memory_bytes: 6016
#include <stdio.h>

int main()
{
  int i,j,n,count=0,k=0;
  int A[100];

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

  for(i=0;i<=n-1;i++)
    {
      for(j=n-1;j>=i+1;j--)
	{
	  if(A[j] < A[j-1])
	    {
	      k = A[j];
	      A[j] = A[j-1];
	      A[j-1] = k;
	      count++;
	    }
	}
    }
  for(i=0;i<n-1;i++)
    {
      printf("%d ",A[i]);
    }
  printf("%d\n",A[n-1]);
  printf("%d\n",count);

  return 0;
}

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

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int A;
	cin >> A;
	int lb = 0, ub = 1e5;
	while (ub - lb > 1) {
		int m = (lb + ub) >> 1;
		if ((long long)m * (m + 1) / 2 >= A) {
			ub = m;
		}
		else {
			lb = m;
		}
	}
	int n = ub;
	vector<int> sp(n);
	for (int i = 0; i < n; i++) {
		if (A >= i + 1) {
			A -= i + 1;
		}
		else {
			sp[i] = i + 1 - A;
			A = 0;
		}
	}
	string res(n * 2, ')');
	int it = 0;
	for (int i = 0; i < n; i++) {
		it += sp[i];
		res[it++] = '(';
	}
	reverse(res.begin(), res.end());
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 3300
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class CChristmasEve {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            int n = in.ints(), k = in.ints();
            int[] h = in.ints(n);
            Arrays.sort(h);
            int ans = Integer.MAX_VALUE;
            for (int i = 0; i <= n - k; i++) {
                ans = Math.min(ans, h[i + k - 1] - h[i]);
            }
            out.println(ans);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

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

        public int ints() {
            return Integer.parseInt(string());
        }

        public int[] ints(int length) {
            return IntStream.range(0, length).map(x -> ints()).toArray();
        }

    }
}



Measured memory_bytes: 37380
#include <iostream>
#include <sstream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

typedef pair<int,string> P;

int main(){
  int n;

  while(cin >> n, n){
    string s;
    getline(cin, s);

    map<string,int> cnt;

    for(int i = 0; i < n; i++){
      getline(cin, s);
      stringstream ss(s);
      string ts;

      while(ss >> ts){
	cnt[ts]++;
      }
    }

    char ch;
    cin >> ch;

    vector<P> v;

    for(map<string,int>::iterator iter = cnt.begin(); iter != cnt.end(); iter++){
      if((iter->first)[0] == ch){
	v.push_back(P(-1 * iter->second, iter->first));
      }
    }

    if(v.size() > 0){
      sort(v.begin(), v.end());
      for(int i = 0; i < min((int)v.size(), 5); i++){
	if(i != 0) cout << " ";
	cout << v[i].second;
      }
      cout << endl;
    }
    else{
      cout << "NA" << endl;
    }
  }
}

Measured memory_bytes: 1244
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])


Measured memory_bytes: 7748
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;

void main(){
	auto c=readln.chomp.to!char;
	if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o')writeln("vowel");
	else writeln("consonant");	
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define pi pair<int,int>
#define pl pair<ll,ll>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912 2の29乗
const long double PI = acos(-1);
const ll DEP = 1e18;
const int I = 1001001001001ll;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int main(){
    int a,p; cin >> a >> p;
    int sum = a*3 + p;
    cout << sum/2 << endl;
}


Measured memory_bytes: 256
n,m = gets.chomp.split(" ").map(&:to_i)
a,b = m.times.map{gets.split.map(&:to_i)}.transpose
range = []
m.times do |i|
  range << [a[i],b[i]]
end
range = range.sort_by{|x| x[1]}
cnt = 0
while !range.empty?
  v = range[0]
  range.delete_if{|x| x[0] < v[1]}
  cnt += 1
end
puts cnt

Measured memory_bytes: 27016
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
    string s;
    int ans=700;
    cin>>s;
    REP(i,3){
      if(s[i]=='o')ans=ans+100;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<iomanip>
#include <cmath>
#include <climits>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <list>
#include <string>
#include <numeric>
#include <utility>
#include <cfloat>

using namespace std;


int main(){
    int H;
    int W;
    int h;
    int w;
    cin >> H >> W;
    cin >> h >> w;

    cout << (H - h)  * (W - w) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define SIZE 100000
int main(){
  int n,k,i;
  int a[SIZE];
  int min,count=1;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  min=a[0];
  for(i=1;i<n;i++){
   if(min==a[i]){
     count++;
   } 
   if(min>a[i]){
     min=a[i];
     count=1; 
   }
  }
  if((n-count)%(k-1)==0) printf("%d\n",(n-count)/(k-1));
  else printf("%d\n",(n-count)/(k-1)+1);
  
  return 0;
}


Measured memory_bytes: 512
N, M = gets.split.map(&:to_i)
a = N.times.map{gets.to_i}

(1..M).each do |k|
  (0...(N-1)).each do |i|
    r1, r2 = a[i] % k, a[i + 1] % k
    a[i], a[i + 1] = a[i + 1], a[i] if r1 > r2
  end
end

puts a

Measured memory_bytes: 8680
#include <bits/stdc++.h>
#define ll long long
#define mod (ll)(1e9 + 7)
using namespace std;

ll sub(ll a, ll b){
	ll r = (a - b)%mod;
	r += mod;
	r %= mod;
	return r;
}

ll add(ll a, ll b){
	return (a + b)%mod;
}

ll mul(ll a, ll b){
	return a * b % mod;
}

ll my_pow(ll a, ll b){
	// a^b
	ll res = 1LL;
	while(b){
		if(b&1) res = mul(res,a);
		a = mul(a,a);
		b = b / 2;
	}
	return res;
}

int main() {
	// your code goes here
	ll n;
	cin>>n;
	ll a = add(my_pow(10,n),my_pow(8,n));
	ll b = mul(2,my_pow(9,n));
	ll ans = sub(a,b);
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		String A = tmp[0];
		String B = tmp[1];

		int ans = 0;
		for(int i = Integer.parseInt(A);i<=Integer.parseInt(B);i++){
			if(kaibun(String.valueOf(i)))ans++;
		}
		System.out.println(ans);
	}

	static boolean kaibun(String n){
		char a = n.charAt(0);
		char b = n.charAt(1);
		char aa = n.charAt(4);
		char bb = n.charAt(3);

		if(a == aa && b == bb)return true;
		else return false;
	}

}


Measured memory_bytes: 24404
while True:
    h,w =map(int, input().split())
    
    if h == 0 and w == 0:
      break
      
    for i in range(h):
        if i == 0 or i == h-1:
           print('#' * w)  
        else:
           print('#'+'.'*(w-2)+'#')
    print()


Measured memory_bytes: 5608
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int X = sc.nextInt();
    
    if (K*500 >= X) {
      System.out.print("Yes");
    } else {
      System.out.print("No");
    }
  }
}

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

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

int main() {
	int n, k, q;
	cin >> n >> k >> q;
	vector<int> a(n);
	rep(i, n) a[i] = 0;
	rep(i, q) {
		int x;
		cin >> x;
		a[x - 1]++;
	}
	rep(i, n) {
		if (a[i] > (q - k)) cout << "Yes" << endl;
		else cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{
	int a;
	int b;
	cin >> a;
	cin >> b;
	int people[100];
	int get[100];
	int score[100];
	int count = 0;

	for (int i = 0; i < 100; i++)
	{
		get[i] = 0;
		people[i] = 0;
		score[i] = 0;
	}
	for (int i = 0; i < b; i++)
	{
		cin >> get[i];
	}
	for (int i = 0; i < b; i++)
	{
		count = 0;
		for (int j = 0; j < a; j++)
		{
			cin >> people[j];
			if (get[i] == people[j])
			{
				score[j]++;
				count++;
			}
		}
		score[get[i] - 1] += (a - count);
	}
	for (int i = 0; i < a; i++)
	{
		cout << score[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main() {
  ll N;
  cin >> N;
  ll ans = 0;
  for(ll x=ceil(sqrt(N-1)); x>0; x--)
    if((N - x) % x == 0) {
      ll m = (N - x) / x;
      if(x < m)
	ans += m;
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
ans=0
count=0
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        count+=1
    else:
        ans=max(ans,count)
        count=0
ans=max(ans,count)
if ans>=3:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 62408
#include <bits/stdc++.h>
using namespace std;
#define F(i,a,b) for(ll i=a;i<b;i++)
#define ll long long

vector<int>a(401);
vector<vector<pair<ll,ll>>> dp(401,vector<pair<ll,ll>> (401,make_pair(-1,-1)));
pair<ll,ll> f(int i,int j)
{
  if(i==j) return make_pair(a[i],0);
  if(dp[i][j].first!= -1) return dp[i][j];
  pair<ll,ll> ans={0,1e14},l,r;
  for(ll k=i;k<j;k++)
  {
    l = f(i,k);
    r = f(k+1,j);
    if(l.second+r.second + l.first +r.first < ans.second)
    {
      ans.first = l.first+r.first;
      ans.second = l.second+r.second + l.first +r.first;  
    }
  }  
  dp[i][j] = ans;
  return ans;
}

int main()
{
  int n;
  cin>>n;
  for(int i=0;i<n;i++) cin>>a[i];
  cout<<f(0,n-1).second;
  /*
  for(ll i=0;i<n;i++)
  {
    for(ll j=0;j<n;j++)
    {
      cout<<i<<" "<<j<<" "<<f(i,j)<<endl;
    }
  }
  */
  return 0;
}

Measured memory_bytes: 6188
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define mod 1000000007
#define ll long long
#define ull unsigned long long
#define mem(a) memset(a,0,sizeof(a))
#define cio ios::sync_with_stdio(false);

int main()
{
   	int a, b, h, m;
   	cin >> a >> b >> h >> m;
   	double x = 1.0*h*5+1.0*m/12;
   	double y = 1.0*m;
   	double z = fabs(x-y);
   	double jd = 1.0*z*6*(pi/180);
   	double c = sqrt(a*a+b*b-2*a*b*cos(jd));
   	printf("%.10lf", c);
    return 0;
}

Measured memory_bytes: 4136
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();// s
		long M = sc.nextLong();// c
		long ans = 0;
		long tmp = Math.min(N, M / 2);
		ans += tmp;
		N -= tmp;
		M -= tmp * 2;
		ans += M / 4;
		System.out.println(ans);
	}
}

Measured memory_bytes: 21972
#include <iostream>

char X, Y;

int main() {
    std::cin >> X >> Y;
    if (X == Y) {
        std::cout << '=' << std::endl;
    } else if (X < Y) {
        std::cout << '<' << std::endl;
    } else {
        std::cout << '>' << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int dataset = 0;
	int a = 0;
	int b = 0;
	int c = 0;
	int i;
	scanf("%d",&dataset);
	for(i = 0;i < dataset;i++)
	{
		scanf("%d",&a);
		scanf("%d",&b);
		scanf("%d",&c);
		if(a*a + b*b == c*c || b*b + c*c == a*a || c*c + a*a == b*b)
		{
			printf("YES\n");
		}else{
			printf("NO\n");
		}

	}
	return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007
using namespace std;
typedef pair<llint, llint> P;
typedef pair<llint, P> E;

llint n;
bool ans[105][105];

int main(void)
{
	cin >> n;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(i == j) continue;
			ans[i][j] = true;
		}
	}
	
	for(int i = 1; i <= n; i++){
		if(n%2) ans[i][n-i] = false;
		else ans[i][n+1-i] = false;
	}
	
	vector<P> avec;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(i >= j) continue;
			if(ans[i][j]) avec.push_back(P(i, j));
		}
	}
	
	cout << avec.size() << endl;
	for(int i = 0; i < avec.size(); i++) cout << avec[i].first << " " << avec[i].second << endl;
	
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }

template <class T>
void VecRowShow(vector<T> vec) {
	rep(i, vec.size()) {
		if (i != vec.size() - 1) cout << vec[i] << " ";
		else cout << vec[i] << endl;
	}
}

unsigned euclidean_gcd(unsigned a, unsigned b) {
	if (a < b) return euclidean_gcd(b, a);
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}

int main() {

	ll n;
	cin >> n;
	vector<ll> e(n), o(n), q(n);
	rep(i, n) {
		ll a;
		cin >> a;
		q[i] = a;
		if (i % 2 == 0) {
			if (i == 0) {
				e[0] = a;
			}
			else {
				ll z = e[i - 2];
				e[i] = z + a;
			}
		}
		else {
			if (i == 1) {
				o[1] = a;
			}
			else {
				ll z = o[i - 2];
				o[i] = z + a;
			}
		}
	}

	vector<vector<pair<ll, ll>>> li(n);
	rep(i, n) {
		if (i == 0) {
			li[0].push_back(make_pair(0, 0));
			li[0].push_back(make_pair(1, q[0]));
		}
		else if (i == 1) {
			li[1].push_back(make_pair(0, 0));
			li[1].push_back(make_pair(1, q[1]));
		}
		else {
			ll m1 = (i + 1) / 2;
			ll m1m = -10000000000000000;
			FOR(j, 2, 7) {
				if (i - j < 0) {
					break;
				}
				rep(k, li[i - j].size()) {
					if (li[i - j][k].first == m1 - 1) {
						m1m = max(m1m, li[i - j][k].second);
					}
				}
			}
			li[i].push_back(make_pair(m1, m1m + q[i]));


			ll m2 = (i + 2) / 2;
			ll m2m = -10000000000000000;
			FOR(j, 2, 7) {
				if (i - j < 0) {
					break;
				}
				rep(k, li[i - j].size()) {
					if (li[i - j][k].first == m2 - 1) {
						m2m = max(m2m, li[i - j][k].second);
					}
				}
			}
			li[i].push_back(make_pair(m2, m2m + q[i]));
		}
	}

	ll i = n - 1;
	ll m3 = n / 2;
	ll m3m = -10000000000000000;
	FOR(j, 0, 7) {
		if (i - j < 0) {
			break;
		}
		rep(k, li[i - j].size()) {
			if (li[i - j][k].first == m3) {
				m3m = max(m3m, li[i - j][k].second);
			}
		}
	}
	cout << m3m << endl;

}




Measured memory_bytes: 22068