akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdio.h>//printf("%.*f\n",*********);
#include<vector>//s.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char('a'=32+'A')
                //to_string,string,substr
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(a,n) rep(i,n)cin>>a[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define please return
#define AC 0
#define rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int KETA(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}

bool KIBN(string s) {
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {
	rapid_pleaseAC_fast;

	string s;
	cin >> s;

	if (s.size() < 4) {
		cout << "No" << rt;
	}
	else {
		Yes(s.substr(0, 4) == "YAKI");
	}

	please AC;
}
//参考：---

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

class Program
{
    public static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        int ans = 0;
        for(int i = 1; i<=N; i++)
        {
            if(i.ToString().Count() % 2 == 1)
            {
                ans += 1;
            }
        }
        
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 15312
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
typedef pair<int, int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;

int main()
{
	ll x, y;
	cin >> x >> y;
	int count = 0;
	while (y >= x){
		count++;
		x *= 2;
	}
	cout << count << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n;
	scanf("%d", &n);
	if(n/100 == 7 || n/10-n/100*10 == 7 || n-n/10*10 == 7){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
}

Measured memory_bytes: 1660
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=2e5;
char Istr[N+5];

int main(){
	scanf("%s",Istr+1);
	int len=strlen(Istr+1),ans=0;
	bool two=false;
	ans=1;
	for(int i=2;i<=len;i++){
		if(two){
			ans++;
			two=false;
		}
		else{
			if(Istr[i]==Istr[i-1]){
				if(i<len) ans++,i++;
				two=true;
			}
			else ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;
// 二部グラフの最大マッチング
struct BipartiteMatching{
    typedef vector<int> Node;
    typedef vector<Node> Graph;

    Graph G;
    vector<int> match;
    vector<bool> used;

    BipartiteMatching(int N) : G(N) {}

    void add_edge(int u, int v){
        G[u].push_back(v);
        G[v].push_back(u);
    }

    bool dfs(int u){
        used[u] = true;
        for(int v : G[u]){
            int w = match[v];
            if(w < 0 || (!used[w] && dfs(w))){
                match[u] = v;
                match[v] = u;
                return true;
            }
        }
        return false;
    }

    int matching(){
        int res = 0;
        match.assign(G.size(), -1);
        for(int u = 0; u < G.size(); u++){
            if(match[u] < 0){
                used.assign(G.size(), false);
                if(dfs(u)) res++;
            }
        }
        return res;
    }
};
int main(){
    int n;
    while(cin >> n){
        vector<int> w(n);
        vector<int> h(n);
        REP(i, n){
            cin >> w[i] >> h[i];
            if(w[i] > h[i]) swap(w[i], h[i]);
        }
        BipartiteMatching solver(2 * n);
        REP(i, n) REP(j, n){
            if(w[i] < w[j] && h[i] < h[j]){
                solver.add_edge(i, j + n);
            }
        }
        cout << n - solver.matching() << endl;
    }
    return 0;
}


Measured memory_bytes: 1276
import heapq
n,m=map(int,input().split())
q=[]
a=[-int(i) for i in input().split()]
for i in a:
    heapq.heappush(q,i)
ans=chk=0
for i in range(m):
    x=heapq.heappop(q)
    heapq.heappush(q,-(-x//2))
print(-sum(q))
exit()


Measured memory_bytes: 64792
def solve():
    w, h, n = [int(i) for i in input().split()]
    dic = dict()
    for i in range(n):
        a, b = map(lambda x: int(x) - 1, input().split())
        for j in range(3):
            for k in range(3):
                aj = a + j - 1
                bk = b + k - 1
                if 0 < aj and aj < w - 1 and 0 < bk and bk < h - 1:
                    if (aj, bk) in dic:
                        dic[(aj, bk)] += 1
                    else:
                        dic[(aj, bk)] = 1
    ans = [0 for i in range(10)]
    for v in dic.values():
        ans[v] += 1
    for i in range(10):
        if i == 0:
            print((w - 2) * (h - 2) - sum(ans))
        else:
            print(ans[i])


if __name__=="__main__":
    solve()


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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef long long ll;
const long long MOD = 1000000000 + 7;

int main(){
    int h, w;
    int ch, cw;
    int dh, dw;
    cin >> h >> w;
    cin >> ch >> cw;
    cin >> dh >> dw;
    vector<string> map(h);
    rep(i, h) cin >> map[i];
    int dx[4] = {0,1,0,-1};
    int dy[4] = {1,0,-1,0};
    int dx_w[5] = {-2,-1,0,1,2};
    int dy_w[5] = {-2, -1, 0, 1, 2};
    vector<vector<ll>> step(h, vector<ll>(w, INF));
    queue<pair<int, int>> que;
    queue<pair<int, int>> que_w;
    que.push({ch-1, cw-1});
    step[ch-1][cw-1] = 0;
    while (!que.empty())
    {
        pair<int, int> pos = que.front();
        que.pop();
        que_w.push(pos);
        ll ns = step[pos.first][pos.second];
        queue<pair<int, int>> que_wall;
        // 歩ける範囲の探索
        while(!que_w.empty())
        {
            pair<int, int> pos_w = que_w.front();
            que_w.pop();
            if (pos_w.first == dh-1 && pos_w.second == dw-1)
            {
                cout << ns << endl;
                return 0;
            }
            rep(i, 4) {
                int pos_w_y = pos_w.first + dy[i];
                int pos_w_x = pos_w.second + dx[i];
                if(pos_w_y < 0 || pos_w_x < 0 || pos_w_y >= h || pos_w_x >= w)
                {
                    continue;
                }
                if(map[pos_w_y][pos_w_x] == '.')
                {

                    if(step[pos_w_y][pos_w_x] > ns)
                    {
                        step[pos_w_y][pos_w_x] = ns;
                        que_w.push({pos_w_y, pos_w_x});
                    }
                }else
                {
                    que_wall.push(pos_w);
                }
            }
        }
        // 壁にぶつかったときのワープ探索
        while (!que_wall.empty())
        {
            pair<int, int> pos_wall = que_wall.front();
            que_wall.pop();
            rep(i, 5){
                rep(j, 5){
                    int pos_wall_y = pos_wall.first + dy_w[i];
                    int pos_wall_x = pos_wall.second + dx_w[j];
                    if (pos_wall_y < 0 || pos_wall_x < 0 || pos_wall_y >= h || pos_wall_x >= w)
                    {
                        continue;
                    }
                    if (map[pos_wall_y][pos_wall_x] == '.')
                    {
                        if (step[pos_wall_y][pos_wall_x] > ns + 1)
                        {
                            step[pos_wall_y][pos_wall_x] = ns + 1;
                            que.push({pos_wall_y, pos_wall_x});
                        }
                    }
                }
            }
        }
    }
    cout << -1 << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  
  int sum = 0;
  int num = 0;
  
    for (int i = 0; i < n; i++) {
      sum++;
     
      if (a. at(num) == 2) {
      cout << sum << endl;
        break;
      }
     
      else if (i == n - 1) {
        cout << -1 << endl;
      }
      
      num = a.at(num) - 1;
    }
}


Measured memory_bytes: 640
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	ll x, k, d; cin >> x >> k >> d;
	x = abs(x);
	ll t = x / d;
	if (t > k)cout << x - k * d << endl;
	else
	{
		k -= x / d;
		x %= d;
		if (k % 2 == 0)cout << x << endl;
		else cout << d - x << endl;
	}
}

Measured memory_bytes: 3620
#include <stdio.h>

int main(){
	int a[10]={20,19,20,19,20,19,20,19,20,19};
	int n,y,m,d,ans;
	int i,j,k,l;

	scanf("%d",&n);
	for(i=0; i<n; i++){
		scanf("%d %d %d",&y,&m,&d);
		ans=0;
		if(y%3==0)ans+=(20-d+1);
		else ans+=a[m-1]-d+1;
		for(j=y; j<1000; j++){
			if(j==y){
				for(k=m+1; k<=10; k++){
					if(j%3==0)ans+=20;
					else ans+=a[k-1];
				}
			}
			else{
				if(j%3==0)ans+=200;
				else ans+=195;
			}
		}
		printf("%d\n",ans);
	}


	return 0;
}

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

using namespace std;

typedef long long ll;

using line_t = ll;
const line_t is_query = -1e18;
struct Line {
    line_t m, b;
    mutable function<const Line*()> succ;
    bool operator<(const Line& rhs) const {
        if (rhs.b != is_query) return m < rhs.m;
        const Line* s = succ();
        if (!s) return 0;
        line_t x = rhs.m;
        return b - s->b < (s->m - m) * x;
    }
};
struct HullDynamic : public multiset<Line> { // upper hull
    bool bad(iterator y) {
        auto z = next(y);
        if (y == begin()) {
            if (z == end()) return 0;
            return y->m == z->m && y->b <= z->b;
        }
        auto x = prev(y);
        if (z == end()) return y->m == x->m && y->b <= x->b;
        return (x->b - y->b)*(z->m - y->m) >= (y->b - z->b)*(y->m - x->m);
    }
    void insert_line(line_t m, line_t b) {
        auto y = insert({ m, b });
        y->succ = [=] { return next(y) == end() ? 0 : &*next(y); };
        if (bad(y)) { erase(y); return; }
        while (next(y) != end() && bad(next(y))) erase(next(y));
        while (y != begin() && bad(prev(y))) erase(prev(y));
    }
    line_t query(line_t x) {
        auto l = *lower_bound((Line) { x, is_query });
        return l.m * x + l.b;
    }
} Hull;

int n;
ll C, H[200100], D[200100];

void push(int idx) {Hull.insert_line(2*H[idx],-H[idx]*H[idx]-D[idx]-C);}
int main() {
    int i;

    scanf("%d%lld",&n,&C);
    for (i=0;i<n;i++) scanf("%lld",&H[i]);
    push(0);
    for (i=1;i<n;i++) {
        D[i] = -Hull.query(H[i])+H[i]*H[i];
        push(i);
    }
    printf("%lld\n",D[n-1]);

    return 0;
}


Measured memory_bytes: 22144
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
signed main(){
  int a,b,d;
  cin>>a>>b;
  int c=b;
  rep(i,1000){
    if(a<c){
      d=i;
      break;
    }
    c*=b;
  }
  cout<<d+1<<endl;
}

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

public class Main {
  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String[] line = br.readLine().split(" ");
      int[] arrayS = new int[n];
      int i=0;
      for (String val : line) {
        arrayS[i++] = Integer.parseInt(val);
      }

      MergeSort merge = new MergeSort(arrayS);
      int cnt = merge.mergeSort(0, n);

      merge.dispIntArray();
      System.out.println(cnt);
    }
  }
}

class MergeSort {

  static private final int SENTINEL = Integer.MAX_VALUE;

  private int[] target;
  private int[] bufL;
  private int[] bufR;

  public MergeSort(int[] target) {
    this.target = target;
    bufL = new int[target.length/2+2];
    bufR = new int[target.length/2+2];

  }

  public int mergeSort(int left, int right) {
    int cnt =0;

    if(left+1 < right){
      int mid = (left + right) / 2;
      cnt += mergeSort(left, mid);
      cnt += mergeSort(mid, right);
      cnt += merge(left, mid, right);
    }

    return cnt;
  }

  private int merge(int left, int mid, int right) {
    int cnt = 0;
    int n1 = mid - left;
    int n2 = right - mid;
    
    for(int i=0; i<n1; i++)
      bufL[i] = target[left+i];
    bufL[n1] = MergeSort.SENTINEL;

    for(int i=0; i<n2; i++)
      bufR[i] = target[mid+i];
    bufR[n2] = MergeSort.SENTINEL;

    for(int i=0,j=0,k=left; k<right; k++) {
      if(bufL[i] <= bufR[j])
        target[k] = bufL[i++];
      else
        target[k] = bufR[j++];
      cnt++;
    }

    return cnt;
  }

  public int[] getArray() {
    return target;
  }

  public void dispIntArray() {
    StringBuilder s = new StringBuilder();

    for (int i : target) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
}


Measured memory_bytes: 142832
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, start, end) for(int i = start; i < (int)(end); ++i)

int c[13], a[13][13];
int main(){
    int n, m, x;
    cin >> n >> m >> x;
    rep(i,0,n){
        cin >> c[i];
        rep(j,0,m){
            cin >> a[i][j];
        }
    }
    int ans = INF;
    rep(i, 0, 1 << n){
        vector<int> tmp(m, 0);
        int sum = 0;
        rep(j, 0, n){
            if(1 & i >> j){
                rep(k, 0, m){
                    tmp[k] += a[j][k];
                }
                sum += c[j];
            }
        }
        bool flag = true;
        rep(k, 0, m){
            if(tmp[k] < x){
                flag = false;
                break;
            }
        }
        if(flag) ans = min(ans, sum);
    }
    if(ans == INF) ans = -1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
s = input()[::-1]
cur = [0] * 13
MOD = 10**9+7
c = 1
cur[0] = 1
for i in range(len(s)):
  pre,cur = cur,[0]*13
  if s[i] == '?':
    for j in range(10):
      for k in range(13):
        cur[(k+j*c)%13] += pre[k]
  else:
    i = int(s[i])
    for j in range(13):
      cur[(j+i*c)%13] += pre[j]
  c = (c*10) % 13
  for i in range(13):
    cur[i] = cur[i] % MOD
print(cur[5])

Measured memory_bytes: 42988
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

int main(){
  ll K; cin >> K;
  if(K==0){
    cout << 2 << endl; cout << 1 << " " << 1 <<endl;
  }
  else if(K==1){
    cout << 3 << endl; cout << 1 << " " << 0 << " " << 3 << endl;
  }
  else if(K<=50){
    cout << K << endl;
    rep(i, K){
      if(i!=0) cout << " ";
      cout << K; 
    }
  }
  else{
    cout << 50 << endl;
    rep(i, K%50){
      if(i!=0) cout << " ";
      cout << K/50 - (K%50) + 100;
    }
    rep(i, 50 - K%50){
      if((K%50) || i!=0) cout << " ";
      cout << K/50 - (K%50) + 49;
    }
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ROCK ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f first
#define sec second
using namespace std;
using namespace __gnu_pbds;
const long long int linf =(long long)9223372036854775807;
const int dx[8] =  {0,0,1,-1,1,-1,1,-1},dy[9] = {1,-1,0,0,1,-1,-1,1};
typedef long long int ll;

const int N=1e5+3;
ll arr[N],dp[N],n,k;

ll solve(int pos){
    if(pos>=n)return 1e9+5;
    if(pos==n-1)return 0;
    if(dp[pos]!=-1)return dp[pos];
    ll ans=1e9+5;
    for(int i=1;i<=k;i++)ans=min(ans,solve(pos+i)+abs(arr[pos]-arr[pos+i]));
    return dp[pos]=ans;
}

int main()
{
    ROCK;
    memset(dp,-1,sizeof dp);
    cin>>n>>k;
    for(int i=0;i<n;i++)cin>>arr[i];
    cout<<solve(0)<<endl;
    return 0;
}












Measured memory_bytes: 6528
#include <stdio.h>
#include <string.h>
int main()
{
    char s[1000],ans[1000];
    int len;
    while(~scanf("%s",s))
    {
        len = strlen(s);
        for(int i = 0;i < len;i++) ans[i] = s[len-i-1];
        ans[len] = '\0';
        puts(ans);
    }
    return 0;
}

Measured memory_bytes: 948
import math


if __name__ == "__main__":
    M, D = map(int, input().split())

    count = 0
    
    for m in range(M):
        for i in range(D):
            d = str(i+1).zfill(2)
            x = int(d[0])
            y = int(d[1])

            if x * y == m+1:
                if x >= 2 and y >= 2:
                    count += 1
    print(count)

Measured memory_bytes: 39536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }

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

    int N; cin >> N;
    vel a(N); rep(i,N) cin >> a[i];

    vel cnt(100005,0);
    int ans = 0;
    rep(i,N) {
        if(a[i] > 100000) ans++;
        else cnt[ a[i] ]++;
    }
    rep(i,100005){
        if(cnt[i] == 0) continue;
        else {
            if(cnt[i] == i) continue;
            else if(cnt[i] > i) ans += cnt[i]-i;
            else ans += cnt[i];
        }
    }
    cout << ans << endl;
    return 0;
}



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

#define ll long long int
using namespace std;

void Oli(){
    string a;
    cin>>a;
    if (a[a.size() - 1] == 's'){
        cout<<a<<"es";
    }else {
    cout<<a<<"s";
    }
}

int main()
{
    int a = 1;
    //cin>>a;
    while(a--){
        Oli();
    }

}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
					using namespace std;
					#define pll pair<ll,ll>
					typedef long long ll;
					#define mod 51123987
					#define fi first
					#define se second
					#define mp make_pair
					#define pb push_back
					#define INF 1e15
					
					
					int main()
					{
						string s;
						cin>>s;
						if(s=="AAA"||s=="BBB")
							cout<<"No";
						else
							cout<<"Yes";
						
					}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;
long long dp[300001][3][3][3],ans = 0,pw[300001],num[300001];
constexpr long long mod = 1000000007;
int main(){
	string s; cin >> s;
	int i,n = s.size();
	dp[0][2][2][2] = 1;
	pw[0] = 1;
	num[n] = 0;
	for(i=1;i<=n;i++){
		pw[i] = pw[i - 1]*2%mod;
	}
	for(i=n - 1;i>=0;i--){
		num[i] = num[i + 1] + (s[i]=='?');
	}
	for(i=1;i<=n;i++){
		if(s[i - 1]=='?' || s[i - 1]=='0'){
			(dp[i][0][2][2] += dp[i - 1][2][2][2]) %= mod;
			(dp[i][0][0][2] += dp[i - 1][0][2][2]) %= mod;
			(dp[i][1][0][2] += dp[i - 1][1][2][2]) %= mod;
			(dp[i][0][2][2] += dp[i - 1][0][0][2]) %= mod;
			(dp[i][0][2][2] += dp[i - 1][0][1][2]) %= mod;
			(dp[i][1][0][0] += dp[i - 1][1][0][2]) %= mod;
			(dp[i][1][0][2] += dp[i - 1][1][0][0]) %= mod;
		}
		if(s[i - 1]=='?' || s[i - 1]=='1'){
			(dp[i][1][2][2] += dp[i - 1][2][2][2]) %= mod;
			(dp[i][0][1][2] += dp[i - 1][0][2][2]) %= mod;
			(dp[i][1][1][2] += dp[i - 1][1][2][2]) %= mod;
			(dp[i][0][2][2] += dp[i - 1][0][0][2]) %= mod;
			(dp[i][1][2][2] += dp[i - 1][0][1][2]) %= mod;
			(dp[i][1][2][2] += dp[i - 1][1][0][2]) %= mod;
			(dp[i][1][0][2] += dp[i - 1][1][0][0]) %= mod;
		}
		(ans += dp[i][1][1][2]*pw[num[i]]%mod) %= mod;
		dp[i][1][1][2] = 0;
	}
	(ans += dp[n][1][2][2]) %= mod;
	cout << ans << endl;
}

Measured memory_bytes: 68612
def selection_sort(A, N):
    swap_count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            swap_count += 1
    return A, swap_count
N = int(input())
A = list(map(int, input().split(' ')))
sorted_A, swap_count = selection_sort(A, N)
print(" ".join(map(str, sorted_A)))
print(swap_count)


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
	int X,Y,Z;cin>>X>>Y>>Z;
	X=max(0ll,X-Z);
	cout<<(X)/(Y+Z)<<endl;
    return 0;
}

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

int main(void){
  long long N,K;
  cin >> N >> K;
  if(N%K==0){
    cout << 0 << endl;
    return 0;
  }
  
  if(N>K){
    N= N%K;
  }
  
  while((2*N) > K ){
    N=abs(N-K);
  }
  cout << N << endl; 
  return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100000 + 10;
const int M = 1000000007;
const double eps = 1e-9;
const double PI = acos(-1);
const int oo = 1000000000;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define pb push_back 
#define all(c) (c).begin(),(c).end()
int n,m,pos[N];
vector<ii> g[N];
bool vis[N];
void no(){
	cout<<"No\n";
	exit(0);
}
void dfs(int u){
	vis[u]=true;
	if(pos[u]==oo)
		pos[u]=0;
	for(int i=0; i<g[u].size(); ++i){
		int d=g[u][i].first,c=g[u][i].second;
		if(pos[d]==oo)
			pos[d]=pos[u]+c;
		else if(pos[d]!=pos[u]+c)
			no();
		if(!vis[d])
			dfs(d);
	}
}

int main(){
	cin>>n>>m;
	for(int i=0; i<n; ++i)
		pos[i]=oo;
	for(int a,b,c,i=0; i<m; ++i){
		scanf("%d%d%d",&a,&b,&c);
		--a;--b;
		g[a].pb(ii(b,c));
		g[b].pb(ii(a,-c));
	}
	for(int i=0; i<n; ++i)
		if(!vis[i])
			dfs(i);
	puts("Yes");
	return 0;	
}

Measured memory_bytes: 12032
#include <stdio.h>

int main()
{
  int i, j, n, a[100], swap;
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++)
    scanf("%d", &a[i]);
    
  for(i = 0; i < n-1; i++)
    printf("%d ", a[i]);
      
  printf("%d\n", a[n-1]);
    
  for(i = 1; i < n; i++){
    swap = a[i];
    j = i-1;
    
    while(j >= 0 && a[j] > swap){
      a[j+1] = a[j];
      j--;
    }
    
    a[j+1] = swap;
    
    for(j = 0; j < n-1; j++)
      printf("%d ", a[j]);
      
    printf("%d\n", a[n-1]);
    
  }
  

    return 0;
}

Measured memory_bytes: 1804
#include<bits/stdc++.h>
using namespace std;
#define Sheryang main
const int maxn=1e6+7;
typedef long long ll;
const int mod=1e9+7;
void Smax(ll &a,ll b){if(a<b) a=b;}
void Smin(ll &a,ll b){if(a>b) a=b;}
///#define getchar()(p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
///char buf[(1 << 21) + 1], *p1 = buf, *p2 = buf;
#define IO cin.tie(0),ios::sync_with_stdio(false);
#define pi acos(-1)
#define PII pair<ll,ll>
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
#define read read()
/** keep hungry and keep calm! **/



int Sheryang()
{
    int a=read,b=read,k=read;

    for(int i=min(a,b);i>=1;i--){
        if(a%i==0 && b%i==0){
            k--;
            if(!k){
                printf("%d\n",i);
                return 0;
            }
        }
    }

    return 0;
}


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

int cnt;
int r[4005],g[4005],b[4005];

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	string s;
	cin>>n>>s;
	
	for(int i=n-1; i>=0; i--)
	{
		if(s[i]=='R')
			r[i]=r[i+1]+1;
		else
			r[i]=r[i+1];
		if(s[i]=='G')
			g[i]=g[i+1]+1;
		else
			g[i]=g[i+1];
		if(s[i]=='B')
			b[i]=b[i+1]+1;
		else
			b[i]=b[i+1];
	}
	
	for(int i=0; i<n-2; i++)
	{
		for(int j=i+1; j<n-1; j++)
		{
			if(s[j]!=s[i])
			{
				char re;
				if(s[i]!='R' && s[j]!='R')
					re='R';
				else if(s[i]!='G' && s[j]!='G')
					re='G';
				else if(s[i]!='B' && s[j]!='B')
					re='B';
				if(re=='R')
					cnt+=r[j+1];
				else if(re=='G')
					cnt+=g[j+1];
				else if(re=='B')
					cnt+=b[j+1];
				if(2*j-i<n && s[2*j-i]==re)
					cnt--;
			}
		}
	}
	
	cout<<cnt<< endl;
	return 0;
}

Measured memory_bytes: 3716
s=input()
ans="Yes"
n = len(s) // 2
for i in range(0,n):
    if s[2*i] == "L":
        ans="No"
    if s[2*i+1] == "R":
        ans="No"
if len(s) % 2 == 1:
    if s[-1] == "L":
        ans="No"

print(ans)

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

typedef long long ll;

using namespace std;

ll burning_tree(ll X[], int N, ll L) {
    int i, lap=N;
    ll sum = 0;
    for (i=0; i<=N; i++) {
        sum += ( (i<N ? X[i] : L) - (i>0 ? X[i-1] : 0) ) * lap;
        if (i < N/2) lap -= 2;
        else if (i == N/2) lap = !lap;
        else lap += 2;
    }
    ll ans = sum;
    for (i=0; i<N-1; i++) {
        int last = i + (N-i+1)/2;
        int last_next = i + (N-i)/2;
        sum += X[last] - X[i];
        sum -= L - (X[last_next] - X[i]);
        ans = max(ans,sum);
    }
    return ans;
}

int main() {
    int N, i;
    ll L;
    scanf("%lld %d",&L,&N);
    ll X[N];
    for (i=0; i<N; i++) scanf("%lld",&X[i]);
    ll ans = burning_tree(X,N,L);
    reverse(X,X+N);
    for (i=0; i<N; i++) X[i] = L-X[i];
    printf("%lld\n",max(ans,burning_tree(X,N,L)));
    return 0;
}

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

string S;
ll N,Q;
int main(void){
    cin >> N >> Q;
    cin >> S;
    
    ll L[N],R[N];
    L[0] = 0;
    R[N-1] = 0;
    rep(i,N-1){
        if(S[i] == 'A' && S[i+1] =='C')L[i+1] = L[i]+1;
        else L[i+1] =L[i];
        
        if(S[N-i-1] =='C' && S[N-i-2] =='A' )R[N-i-2] = R[N-i-1]+1;
        else R[N-i-2] = R[N-i-1];
    }
    
    rep(i,Q){
        ll l,r;
        cin >> l >> r;
        cout << L[r-1] + R[l-1] - L[N-1] << endl; 
    }
    return 0;

}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long int 
using namespace std;
int main()
{
    ll n; cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
        cin>>a[i];
    ll ans=0;
    ll m=a[0];
    for(ll i=1;i<n;i++)
    {
        if(a[i]>m)
        {
            m=a[i];
        }
        else{
            ans+=(m-a[i]);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5188
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

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

	string s;
	cin >> s;

	map<int, int> mp;
    mp[0]++;
	int k = s[sz(s) - 1] - '0';
	int cnt = 1;
	mp[k]++;
	rep(i, sz(s) - 1) {
		k = k + (s[sz(s) - i - 2] - '0') * (cnt * 10) % 2019;
        k%=2019;
		mp[k]++;
		cnt *= 10;
		cnt %= 2019;
	}
	ll ans = 0;
	rep(i, 2019) {
		ans += (ll)(mp[i]) * (mp[i]-1) / 2;
	}
	cout << ans << endl;
}

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

int main() {
    int n;
    cin >> n;
    deque<string> ss;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        ss.push_back(s);
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        bool ok = true;
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                if (ss[j][k] != ss[k][j]) {
                    ok = false;
                }
            }
        }
        if (ok) cnt++;
        ss.push_front(ss.back());
        ss.pop_back();
    }
    cout << cnt * n << endl;
}

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

int main(){
    
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int ma = 0;
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(ma <= a[i]) ans++;
        ma = max(ma, a[i]);
    
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N;
	cin >> N;
	vector<P> blue(N);
	vector<P> red(N);
	rep(i,N)cin >> red[i].first >> red[i].second;
	rep(i,N)cin >> blue[i].first >> blue[i].second;
	sort(all(blue));
	vector<bool> red_used(N, false);
	int ans = 0;
	rep(i,N){
		int height = -1;
		int high_num = inf;
		rep(j,N){
			if(red[j].first < blue[i].first && !red_used[j]){
				if(red[j].second < blue[i].second && red[j].second > height){
					height = red[j].second;
					high_num = j;
				}
			}
		}
		if(high_num != inf){
			++ans;
			red_used[high_num] = true;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

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

#define pb push_back
#define fr first
#define sc second

struct SEG{
	ll l;
	ll r;
	ll s;
	ll t;
	bool ch;
	SEG *chl,*chr;
	void init(ll l_,ll r_,ll s_,ll t_){
		l = l_;
		r = r_;
		s = s_;
		t = t_;
		ch = false;
	}
	void mkch(){
		chl = new SEG;
		chl->init(l,(l+r)/2,0,0);
		chr = new SEG;
		chr->init((l+r)/2,r,0,0);
		ch = true;
	}
	void add(ll a,ll b,ll x){
		if(b <= l || r <= a)return;
		if(a <= l && r <= b){
			s += x*(r-l);
			t += x;
			return;
		}
		if(!ch){
			mkch();
		}
		chl->add(a,b,x);
		chr->add(a,b,x);
		s = t*(r-l) + chl->s + chr->s;
	}
	ll sum(ll a,ll b){
		if(b <= l || r <= a)return 0;
		if(a <= l && r <= b)return s;
		if(!ch){
			return t*max((ll)0,min(r,b)-max(l,a));
		}
		return chl->sum(a,b) + chr->sum(a,b) + t*max((ll)0,min(r,b)-max(l,a));
	}
};

int main(){
	static ll N;
	static ll a[100010];
	scanf("%lld",&N);
	for(int i = 1 ; i <= N ; i ++){
		scanf("%lld",&a[i]);
	}
	
	SEG seg;
	seg.init(0,1<<30,0,0);
	for(int i = 1 ; i <= N ; i ++){
		seg.add(1,a[i]+1,1);
	}
	
	static ll ret[100010] = {};
	static ll Max = 0;
	for(int i = 1 ; i <= N ; i ++){
		if(a[i] > Max){
			ret[i] = seg.sum(Max+1,a[i]+1);
			Max = a[i];
		}
	}
	
	for(int i = 1 ; i <= N ; i ++){
		printf("%lld\n",ret[i]);
	}
}



Measured memory_bytes: 119168
#include<bits/stdc++.h>
using namespace std ;
const int N=1e3+1, Mod = 1e9+7;
string arr[N];  
int H,W,Dp[N][N]; 
bool allow(int i ,int j ){
   if(i<H and j<W and arr[i][j]=='.')return true ; 
   return false ; 
} 
//345263555

int calc(int i , int j ){
    if(i==H-1 and j==W-1){
 //           cout<<"win"<<endl;
        return 1 ; 
    }
    if(i>=H or j>=W)return 0 ; 
    int &ret = Dp[i][j];
    if(ret!=-1)return ret%Mod ; 
    ret =0 ; 
    if(allow(i,j+1))
        ret +=calc(i,j+1)%(Mod);
    if(allow(i+1,j) )
        ret +=calc(i+1,j)%(Mod);
    return ret ; 
}
int main(){
    cin>> H>>W;
      for(int i =0;i<H;i++){cin>>arr[i]; }
    memset(Dp,-1, sizeof Dp);
    cout<<calc(0,0)%Mod;
}

Measured memory_bytes: 9532
#include <bits/stdc++.h>
using namespace std;;
#define llong long long
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
#define LINF 100000000000000
int main(){
    int n, m; cin >> n >> m;
    vector<int> a(m),b(m);
    vector<llong> c(m);
    llong cost[n+1];
    for(int i=1; i<=n; i++){
        cost[i] = -LINF;
    }
    for(int i=0; i<m; i++){
         cin >> a[i] >> b[i] >>c[i];
        
    }
    cost[1] = 0;
    llong ans = 0;
    for(int i=0; i<2*n; i++){
        for(int j=0; j<m; j++){
            if(cost[a[j]]!=-LINF){ 
                cost[b[j]] = max(cost[b[j]], cost[a[j]] + c[j]);
            }
        }
        if(i==n-2) ans = cost[n];
        if(i==2*n-1){
            if(ans!=cost[n])ans = -LINF;
        }
    }
    if(ans == -LINF){
        cout << "inf" << endl;
    }else{
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();


// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

bool fn_is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

bool isOK(int index, int key, vector<ll>& a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key, vector<ll>& a) {
    int ng = -1;
    int ok = a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key, a)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main()
{
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    int ans = 0;
    rep(i,n-1) ans += a[i];
    ans += a[n-1]/2;
    cout << ans << endl;
}


Measured memory_bytes: 3548
#include <stdio.h>

int main() {
	int N, A[1000];
	scanf("%d",&N);
	for (int i = 0; i < N;i++) {
		scanf("%d",&A[i]);
		if (A[i]%2==0) {
			if (A[i]%3!=0&&A[i]%5!=0) {
				printf("DENIED");
				return 0;
			}
		}
	}
	printf("APPROVED");
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  if(n % 1000 != 0) {
    cout << 1000 - (n % 1000) << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}

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

for h in range(N//4 +1, min(3501, 3*N//4 +1)):
  for n in range((N*h)//(4*h-N), min(3501, ((2*N*h)//(4*h-N))+1)):
    #print(h,n)
    x = 4*h*n - N*n - N*h
    y = N*h*n
    if x>0 and not y%x:
      print('{} {} {}'.format(h,n,y//x))
      exit()


Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<map>
using namespace std;

int main() {
    long N;
    cin>>N;
    long a[N], b[N];
    for(long i=0;i<N;++i){
        cin>>a[i];
    }
    b[0] = a[0];
    for(long i=1;i<N;++i){
        b[i] = b[i-1] + a[i];
    }

    map<long, long>ansmap;
    vector<long>arr;
    for(long i=0;i<N;++i){
        if(ansmap[b[i]]==0){
            arr.push_back(b[i]);
        }
        ansmap[b[i]]++;
    }
    long ans = 0;
    for(long i=0;i<arr.size();++i){
        if(ansmap[arr[i]]>1){
            ans += ansmap[arr[i]] * (ansmap[arr[i]] - 1) / 2;
        }
    }
    cout<<ans+ansmap[0]<<endl;
}


Measured memory_bytes: 17392
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;
vector<int> keta(int x) {
  vector<int> res;
  while(x) {
    res.push_back(x%10);
    x = x/10;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  bool b = false;
  rep(i, keta(n).size()) {
    if(keta(n)[i] == 9) b = true; 
  }
  yorn(b);
  return 0;
}

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

int main() {
  string s; cin >>s;
  for (int i=0; i<3; i++){
    if (s.at(i) == '1') s.at(i) = '9';
    else if (s.at(i) == '9') s.at(i) = '1';
  }
  cout <<s;
  cout <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define f(n) for(int i=0;i<n;i++)
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 1000000007
#define endl "\n"
#define int long long
#define ll long long
#define vi vector <int>
#define vvi vector <vector<int> >
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>=b;i--)
#define init(i,k) memset(i,k,sizeof i)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define maxe *max_element
#define mine *min_element
#define pow2(n) (1LL << (n))
#define sz(a) (int)a.size()
#define MOD 1000000007
#define PI 3.14159265359
inline ll add(ll a, ll b){ return ((a%MOD)+(b%MOD))%MOD;}
inline ll mul(ll a, ll b){ return ((a%MOD)*(b%MOD))%MOD;}
inline ll sub(ll a, ll b){ return ((a%MOD)-(b%MOD)+MOD)%MOD;}
int power(int x, unsigned int y, int p=MOD)  
{  
    if(y==0)
    {
    	return 1;
    }
    int ans=power(x,y/2,p);
    if(y%2)
    {
    	int z=((((ans*ans)%p)*x)%p);
		return z;
    }
    else
    {
    	int z=(ans*ans)%p;
    	return z;
    }
} 


int solve()
{
    int n;
    cin>>n;
    vi v(n);
    f(n)
        cin>>v[i];
    if(n==1)
    {
        return 0;
    }
    if(n==2)
    {
        return abs(v[1]-v[0]);
    }
    int dp[n+1]={0};
    dp[0]=0;
    dp[1]=abs(v[1]-v[0]);
    dp[2]=abs(v[2]-v[0]);
    for(int i=3;i<n;i++)
    {
        int x=abs(v[i]-v[i-1]);
        int y=abs(v[i]-v[i-2]);
        dp[i]=min(dp[i-1]+x,dp[i-2]+y);
    }
    return dp[n-1];
}
/********************************************/
signed main()
{   
    speed
    int t=1;
    //cin>>t;
    while(t--)
    {
    	cout<<solve()<<endl;
    }
    return 0;
}

Measured memory_bytes: 4692
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

int n, m, q, dp[15][N], u[N], a[N], v[N], d[N], c[N];
vector < int > g[N];

void yap(int v, int d, int c){
	if(dp[d][v])
		return;
	dp[d][v] = 1;
	if(!u[v]){
		a[v] = c;
		u[v] = 1;
	}
	if(d == 0)
		return;
	for(int i = 0; i < g[v].size(); i++)
		yap(g[v][i], d - 1, c);
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%d %d",&n ,&m);
	while(m--){
		int u, v;
		scanf("%d %d",&u ,&v);
		g[u].pb(v);
		g[v].pb(u);
	}
	scanf("%d",&q);
	for(int i = 1; i <= q; i++)
		scanf("%d %d %d",v + i, d + i, c + i);
	for(int i = q; i >= 1; i--)
		yap(v[i], d[i], c[i]);
	for(int i = 1; i <= n; i++)
		printf("%d\n", a[i]);
	return 0;
}

Measured memory_bytes: 63480
#include<bits/stdc++.h>
#define LL long long 
using namespace std;

LL x,k,d;

inline LL qr()
{
	LL w=1,x=0;char a=0;
	while(a<'0'||a>'9'){if(a=='-')w=-1;a=getchar();}
	while(a<='9'&&a>='0'){x=(x<<3)+(x<<1)+(a^48);a=getchar();}
	return x*w;
}

int main()
{
	x=qr();
	k=qr();
	d=qr();
	if(x<0)
		x=-x;
	LL op=x/d;
	if(k<op)
	{
		cout<<x-k*d<<endl;
		return 0;
	}
	else
	{
		k=k-op;
		k%=2;
		if(k)
		{
			LL ans=abs(x-(op+1)*d);
			cout<<ans<<endl;
			return 0;
		}
		cout<<x-op*d<<endl;
	}
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}
const int MOD = 1000000007;




int main() {
    string a,b,c;
    cin >> a >> b >> c;
    char now = a[0];
    int A=0,B=0,C=0;
    
    while(true){
        if(now == 'a'){
            if(A == a.length()){
                cout << "A";
                break;
            }
            now = a[A];
            A++;
            
        }else if(now == 'b'){
            if(B == b.length()){
                cout << "B";
                break;
            }
            now = b[B];
            B++;
            
        }else{
            if(C == c.length()){
                cout << "C";
                break;
            }
            now = c[C];
            C++;
            
        }
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int  ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
LL mod = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

const LL MAXN = 1e5+10;

string getSixDigit(LL n) {
	string ret = "";
	while(ret.length() != 6) {
		ret = char('0'+n%10) + ret;
		n /= 10;
	}
	return ret;
}

struct City {
	LL idx, prefect, year;
	string id;
	void setId(LL x) {
		id = getSixDigit(prefect) + getSixDigit(x);
	}
} cities[MAXN];

bool sortByYear(City a, City b) { return a.year < b.year; }

int main() {
	sll(n); sll(m);
	vector<City> pre_city[n+1];
	rep(i, 1, m+1) {
		cities[i].idx = i;
		cities[i].prefect = scanLong();
		cities[i].year = scanLong();
		pre_city[cities[i].prefect].push_back(cities[i]);
	}
	rep(i, 1, n+1) {
		sort(pre_city[i].begin(), pre_city[i].end(), sortByYear);
		rep(x, 0, pre_city[i].size())	cities[pre_city[i][x].idx].setId(x+1);
	}
	rep(i, 1, m+1)	cout << cities[i].id << endl;
}

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

int main ()
{
  long long int H;
  cin >> H;
  long long int count = 0;
  long long int add = 1;
  while(H != 0)
  {
    H /= 2;
    count = count + add;
    add *= 2;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256