akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    List<Long> list = new ArrayList<>();

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

    void run() {
        long n = sc.nextLong();

        long cnt = 0;

        Set<Long> nj = new HashSet<>();
        Set<Long> remain = new HashSet<>();

        nj.add(n);


        long root = (int)Math.sqrt(n);

        for (long i=1; i<=root; i++) {
            if (n%i==0) {
                nj.add(i);
                nj.add(n/i);
            }
        }
        for (long i=1; i<=root; i++) {
            if ((n-1)%i==0) {
                remain.add(i);
                remain.add((n-1)/i);
            }
        }

        List<Long> tmp = new ArrayList<>();

        for (long t: nj) {
            long tN = n;
            if (t==1) continue;
            while (tN%t==0) {
                tN /= t;
            }
            if (tN%t==1) {
                cnt++;
                tmp.add(t);
            }
        }



//        System.out.println(nj);
//        System.out.println("tmp"+tmp);
//        System.out.println(remain);

//        System.out.println(cnt);
        System.out.println(cnt+remain.size()-1);

    }

}


Measured memory_bytes: 24020
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
using namespace std;
#define ll long long
#define mod 1000000007;

int main() {
	string s, t;
	cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i])ans++;
	}
	cout << ans << endl;
	return 0;
}

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

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

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

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

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

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

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

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

fn main() {
    input! {
    	e:chars,
        a:chars
    }
    let mut cnt = 0;
    if e[0]==a[0] { cnt += 1 }
    if e[1]==a[1] { cnt += 1 }
    if e[2]==a[2] { cnt += 1 }
       
    println!("{}", cnt);
}

Measured memory_bytes: 4352
#[test]
fn test_solve() {
    assert_eq!(solve("010\n"), "2\n");
    assert_eq!(solve("100000000\n"), "8\n");
    assert_eq!(solve("00001111\n"), "4\n");
    assert_eq!(solve("10101010\n"), "4\n");
}
fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);

    let s: Vec<char> = sc.get().chars().collect();
    let n = s.len();
    let mut k = n;

    use std::cmp::{min,max};
    for i in 0..n-1 {
        if s[i] != s[i+1] {
            k = min(k, max(i+1, n-i-1));
        }
    }

    format!("{}\n", k)
}
fn main() {
    let mut buf = String::new();
    use std::io::{Read, Write};
    std::io::stdin().read_to_string(&mut buf).unwrap();
    std::io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}
struct Scanner<'a>(std::str::SplitWhitespace<'a>);
impl<'a> Scanner<'a> {
    fn from_str(src: &str) -> Scanner {
        Scanner(src.split_whitespace())
    }
    fn get(&mut self) -> &str {
        self.0.next().unwrap()
    }
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.get().parse().ok().unwrap()
    }
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

typedef struct node{
  struct node* parent;
  struct node* left;
  struct node* right;
  int k;
}Node;

Node* tree;

void insert(int);
void inorder(Node*);
void preorder(Node*);
Node* find(Node*,int);

int main(){
  int m,i,k;
  char s[10];
  Node* f;

  scanf("%d",&m);

  for(i=0;i<m;i++){
    scanf("%s",s);
    if(s[0]=='i'){
      scanf("%d",&k);
      insert(k);
    }
    else if(s[0]=='p'){
      inorder(tree);
      printf("\n");
      preorder(tree);
      printf("\n");
    }
    else if(s[0]=='f'){
      scanf("%d",&k);
      f=find(tree,k);
      if(f!=NIL) printf("yes\n");
      else printf("no\n");
    }
  }

  return 0;
}

void insert(int k){
  Node* y = NIL;
  Node* x = tree;
  Node* z;
  z=(Node *)malloc(sizeof(Node));
  z->k=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL){
    y=x;
    if(z->k < x->k ){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }
  z->parent = y;

  if(y==NIL) tree=z;
  else if(z->k < y->k) y->left=z;
  else y->right=z;
  return;
}

void inorder(Node* tree){
  if(tree != NIL){
    inorder(tree->left);
    printf(" %d",tree->k);
    inorder(tree->right);
  }
  return;
}

void preorder(Node* tree){
  if(tree != NIL){
    printf(" %d",tree->k);
    preorder(tree->left);
    preorder(tree->right);
  }
  return;
}

Node* find(Node* tree,int f){
  if(tree != NIL){
    if(tree->k == f) return tree;
    if(tree->k > f) return find(tree->left,f);
    else return find(tree->right,f);
  }
  else return NIL;
}

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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var s = Console.ReadLine();
        var day = DateTime.Parse("2019/04/30");
        Console.WriteLine(DateTime.Parse(s) <= day ? "Heisei" : "TBD");
    }
}


Measured memory_bytes: 11744
AB, BC, CA = map(int, input().split())

# 直角三角形 ABCがあります。
#  ∠ABC= 90°です。
#  三角形ABCの三辺の長さである |AB|,|BC|,|CA|が与えられるので、直角三角形 ABCの面積を求めて下さい。

i = (AB * BC) // 2
print(i)

Measured memory_bytes: 9140
#include<bits/stdc++.h>
#define int long long int  //comment for large arrays
#define pll pair<int,int>
#define dbl long double
#define ff first
#define ss second
#define endl "\n"
#define mod 1000000007
#define eps 0.00000001
#define INF 10000000000000001
#define all(x) (x).begin(),(x).end()
#define LB(v,x) (lower_bound(all(v),x) - v.begin()) 
#define UB(v,x) (upper_bound(all(v),x) - v.begin())
#define size(x) (int)(x).size()
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define popb() pop_back()
#define popf() pop_front()
#define mp(x,y) make_pair((x),(y))
#define vec(dt) vector<dt>
#define vv(dt) vector<vector<dt>>
#define fastio(x) ios_base::sync_with_stdio(x); cin.tie(NULL)
#define init(v,s) memset(v,s,sizeof(v)) 
#define bug(x) cerr<<"LINE: "<<__LINE__<<" || click to see test details "<<#x<<" = "<<x<<endl
#define loop(i,s,n) for(int i=s;i<n;i++)
#define print(v) for(auto it:v) cout<<it<<" "; cout<<endl 
using namespace std;


signed main()
{
	fastio(0);
	int n;
	cin>>n;
	int a[n+1],dp[n+1][n+1];
	loop(i,1,n+1) 
	{
		cin>>a[i];
		dp[i][i] = a[i];
	}
	for(int i=n;i>0;i--)
		for(int j=i+1;j<=n;j++)
			dp[i][j] = max(a[i] - dp[i+1][j], a[j] - dp[i][j-1]);
	cout<<dp[1][n]<<endl;
	return 0;		
}

Measured memory_bytes: 70144
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
struct ans{int u,v,d;};
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int L;
    cin>>L;
    if(L==2){
        cout<<2<<" "<<2<<"\n";
        cout<<"1 2 0\n";
        cout<<"1 2 1\n";
        return 0;
    }
    L--;
    int n=log2(L)+1;
    vector<ans> ANS;
    rep1(i,n-1) ANS.push_back({i,i+1,0}),ANS.push_back({i,i+1,(int)pow(2,n-i-1)});
    while(L>=pow(2,n-1)){
        int a=0,b=0;
        while(L-(b+pow(2,a))>=pow(2,n-1)&&a<n-2) b+=pow(2,a),a++;
        ANS.push_back({1,n-a,L-b});
        L-=b+1;
    }
    cout<<n<<" "<<ANS.size()<<"\n";
    for(auto i:ANS) cout<<i.u<<" "<<i.v<<" "<<i.d<<"\n";
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<int, int>;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}
struct edge {
  ll to, cost;
};

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main() {
  int n; cin >> n;
  auto p = prime_factor(n);
  cout << n << ":";
  for(auto x : p) {
    REP(i, x.second) {
      cout << " " << x.first;
    }
  }
  cout << endl;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  long long total = 0;
  for (int i=1; i<=N; i++) {
    if (i%3 == 0) continue;
    if (i%5 == 0) continue;
    total += i;
  } cout << total;
}

Measured memory_bytes: 3624
ans=[]
s=[3,5,7]
def dfs(n):
    if n>=10**9:
        return
    ans.append(n)
    for i in s:
        dfs(10*n+i)
dfs(3)
dfs(5)
dfs(7)
N=int(input())
cnt=0
for i in ans:
    if i<=N and len(set(str(i)))==3:
        cnt+=1
print(cnt)

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

using namespace std;

typedef long long int lli;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vii;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(int i=a;i<b;i++)

#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main() {
//	#ifndef ONLINE_JUDGE
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
//	#endif
	
	FASTIO

	int T=1;
//	cin >> T;

	while(T--) {
		int x,y;
		cin >> x >> y;

		if (y<=4*x && y>=2*x && y%2==0) {
			cout << "Yes";
		}
		else {
			cout << "No";
		}
	}

	return 0;
}

Measured memory_bytes: 3644
N = int(input())
d0 = N//100
a0 = N % 100
d1 = a0 // 10
d2 = a0 % 10
if d0 == 7:
    print('Yes')
elif d1 == 7:
    print('Yes')
elif d2 == 7:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9172
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

struct event {
  int x, l, r;

  bool operator < (const event& e) const {
    return x < e.x;
  }
};

int main() {
  int n, q;
  cin >> n >> q;
  vector<event> e(n);
  rep(i, n) {
    int s, t, x;
    cin >> s >> t >> x;
    e[i] = {x, s - x, t - x};
  }
  set<pair<int, int>> d;
  rep(i, q) {
    int t;
    cin >> t;
    d.insert({t, i});
  }

  sort(e.begin(), e.end());
  vector<int> ans(q, -1);
  rep(i, n) {
    auto it = d.lower_bound(make_pair(e[i].l, -1));
    while (it != d.end()) {
      if (it->first >= e[i].r) break;
      ans[it->second] = e[i].x;
      d.erase(it++);
    }
  }
  rep(i, q) cout << ans[i] << endl;



  
  return 0;
}

Measured memory_bytes: 14336
import java.util.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                int[] a = new int[n];
                int[] 鶏 = new int[n];
                int 負の数 = 0;
                for(int i = 0 ; i < n ; i++){
                        a[i] = sc.nextInt();
                        if(a[i] < 0) 負の数++;
                        鶏[i] = Math.abs(a[i]);
                }
                sc.close();
                Arrays.sort(a);
                
                long yoﾉ = 0;
                for(int i = 0 ; i < n ; i++){
                        yoﾉ += 鶏[i];
                }

                if(負の数 % 2 != 0){
                        if(負の数 == n) 負の数--;
                        yoﾉ += 2 * a[負の数 - 1];
                        yoﾉ = Math.max(yoﾉ , yoﾉ + 2 * Math.abs(a[負の数 - 1]) - 2 * Math.abs(a[負の数]));
                }
                sc.close();
                System.out.println(yoﾉ);
        }
}

Measured memory_bytes: 60472
#include<iostream>
#include<algorithm>
#include<iterator>
#include<vector>
#include<string>
#include<map>
using namespace std;


#define mod(cans) cans%10**9+7
#define cin_pl(x,y) for(int i=0;i<x;i++){cin>>y[i];}
#define pl_twin(x,y,z) for(int i=0;i<x;i++){cin>>y[i]>>z[i];}
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define st(s) size_t size = s.length()
#define prians(Answer) cout<<Answer<<"\n"
#define make_pair m_p;
#define com_div(x,Co) for(int i=1;i<x+1;i++){if(x%i==0){Co++;}}
#define elcon else{continue;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int,int> pr;
typedef greater<int> gi;

int main(void)
{
    int n,a;
    cin>>n>>a;
    n%500<=a?cout<<"Yes":cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
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=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};


template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
using Graph =vector<vector<int>>;
//A 65
//a 97

int main(){
  int p,q,r;cin>>p>>q>>r;
  priority_queue<int> queue;
  queue.push(p);
  queue.push(q);
  queue.push(r);
  queue.pop();
  int ans=0;
  ans+=queue.top();
  queue.pop();
  ans+=queue.top();
  cout<<ans<<endl;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
const int N=1e5 + 5;
int par[N];
int siz[N];

int find(int u)
{
    if(par[u]==u) return u;
    return par[u] = find(par[u]);
}


void combine(int u, int v)
{
    u = find(u); v=find(v);
    if(u==v) return;
    par[v]=u;
    siz[u] = siz[u]+siz[v];
}


int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n,m,k; cin>>n>>m>>k;
	//memset(par,-1,sizeof(par));
	for(int i=0;i<n;i++) siz[i]=1;
	//for(int i=0;i<n;i++) cout<<siz[i]<<' '; cout<<endl;
	for(int i=0;i<n;i++) par[i] = i;
	vector < pair <int,int> > v1;
	for(int i=0;i<m;i++)
	{
	    int p,q; cin>>p>>q; p--; q--;
	    v1.pb(mp(p,q));
	    combine(p,q);
	}
	vector < pair <int,int> > v2;
	for(int i=0;i<k;i++)
	{
	    int p,q; cin>>p>>q; p--; q--;
	    v2.pb(mp(p,q));
	}
	int ans[n]={0};
	//for(int i=0;i<n;i++) cout<<siz[i]<<' '; cout<<endl;
	for(int i=0;i<n;i++)
	{
	    ans[i] = siz[find(i)] - 1;
	}
	for(int i=0;i<m;i++)
	{
	    ans[v1[i].first]--; ans[v1[i].second]--;
	}
	for(int i=0;i<k;i++)
	{
	    if( find(v2[i].first) == find(v2[i].second) )
	    {
	        ans[v2[i].first]--; ans[v2[i].second]--;
	    }
	}
	for(int i=0;i<n;i++) cout<<ans[i]<<' ';
	
	
	return 0;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
int main() {
    int n,k;cin >> n >> k;
    if(k==1){
        cout << 0 << endl;
        return 0;
    }
    n-=k;
    cout << n<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int N;

vector<i64> A;

int main(){
  cin >> N;
  A.resize(N);
  rep(i,0,N - 1) cin >> A[i];

  if(A[0] != 0){
    cout << -1 << endl;
    return 0;
  }
  i64 ans = 0;
  ans += A[N - 1];
  for(int i = N - 2;i >= 0;i--){
    if(A[i + 1] >= A[i]){
      if(A[i + 1] - A[i] >= 2){
        cout << -1 << endl;
        return 0;
      }
      else if(A[i + 1] == A[i]){
        ans += A[i + 1];
      }
    }
    else{
      ans += A[i];
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <numeric>
#include <cassert>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using namespace std;
vector<int8_t> encode(string const & x) {
    int n = x.size();
    vector<int8_t> y(n);
    repeat (i,n) y[n-i-1] = x[i] - '0';
    return y;
}
vector<int8_t> encode(int x) {
    vector<int8_t> y;
    while (x) {
        y.push_back(x % 10);
        x /= 10;
    }
    return y;
}
void normalize(vector<int8_t> & x) {
    int n = x.size();
    repeat (i,n) {
        while (x[i] < 0) {
            assert (i+1 != n);
            x[i+1] -= 1;
            x[i] += 10;
        }
        while (10 <= x[i]) {
            assert (i+1 != n);
            x[i+1] += 1;
            x[i] -= 10;
        }
    }
    while (not x.empty() and x.back() == 0) x.pop_back();
}
vector<int8_t> add(vector<int8_t> const & x, vector<int8_t> const & y) {
    int n = max(x.size(), y.size());
    vector<int8_t> z(n);
    repeat (i, x.size()) z[i] += x[i];
    repeat (i, y.size()) z[i] += y[i];
    normalize(z);
    return z;
}
vector<int8_t> mul(vector<int8_t> const & x, int8_t k) {
    int n = x.size();
    vector<int8_t> y(n+1);
    repeat (i,n) {
        y[i+1] += x[i] * k / 10;
        y[i  ] += x[i] * k % 10;
    }
    normalize(y);
    return y;
}
bool pred(vector<int8_t> const & n, int k) {
    vector<int8_t> a = mul(add(n, encode(k)), 9);
    return whole(accumulate, a, 0) <= 9 * k;
}
int main() {
    string s; cin >> s;
    vector<int8_t> n = encode(s);
    int l = 0;
    int r = 9 * s.size();
    while (r - l > 1) {
        int m = (l + r) / 2;
        (pred(n, m) ? r : l) = m;
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 2296
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  int h=1,i;
  int a[4]={10,50,100,500};
  int n;
  while(cin>>n,n){
    int b[4],c[4];
    for(i=0;i<4;++i)
      cin>>b[i];
    copy(b,b+4,c);
    int sm=0;
    for(i=3;i>=0;--i){
      if(sm<n){
	int p=min(c[i],(n-sm)/a[i]+((n-sm)%a[i]?1:0));
	sm+=a[i]*p;
	c[i]-=p;
      }
    }
    sm-=n;
    for(i=3;i>=0;--i){
      c[i]+=sm/a[i];
      sm-=sm/a[i]*a[i];
    }
    for(i=0;i<3;++i){
      c[i+1]+=c[i]/(a[i+1]/a[i]);
      c[i]-=c[i]/(a[i+1]/a[i])*(a[i+1]/a[i]);
    }
    if(h)
      h=0;
    else
      cout<<endl;  
    for(i=0;i<4;++i){
      if(b[i]>c[i])
	cout<<a[i]<<" "<<b[i]-c[i]<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 868
#include<stdio.h>
int main() {
int a,bang[3],up;
for(a = 0; a < 3; a++) {
scanf("%d",&bang[a]);
}
for(a = 0; a < 2; a++) {
if(bang[a] > bang[a + 1]) {
up = bang[a]; bang[a] = bang[a + 1]; bang[a + 1] = up;
}
if(bang[a] > bang[2]) {
up = bang[a]; bang[a] = bang[2]; bang[2] = up;
}
}
printf("%d %d %d\n",bang[0],bang[1],bang[2]);
return 0;
}

Measured memory_bytes: 1808
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			var s = new string[n];
			for (int i = 0; i < n; i++) {
				s[i] = cin.Next();
			}

			var dic = new Dictionary<string, int>();
			for (int i = 0; i < n; i++) {
				if (dic.ContainsKey(s[i])) {
					dic[s[i]] += 1;
				} else {
					dic[s[i]] = 1;
				}
			}

			int max = dic.Max(x => x.Value);
			var cmp = new StringComparator();
			var ss = dic.Where(x => x.Value == max)
				.Select(x => x.Key)
				.OrderBy(x => x, cmp)
				.ToArray();
			var sb = new StringBuilder();
			for (int i = 0; i < ss.Length; i++) {
				sb.AppendLine(ss[i]);
			}

			Console.WriteLine(sb.ToString());
		}
	}

	public class StringComparator : IComparer<string>
	{
		int IComparer<string>.Compare(string a, string b)
		{
			int length = Math.Min(a.Length, b.Length);
			for (int i = 0; i < length; i++) {
				if (a[i] < b[i]) {
					return -1;
				} else if (a[i] > b[i]) {
					return 1;
				}
			}

			if (a.Length < b.Length) {
				return -1;
			}

			if (a.Length > b.Length) {
				return 1;
			}

			return 0;
		}
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private readonly Func<string> reader_;
		private string[] buf_;
		private int index_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 53044
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            var N = GetInt();
            int[] d = new int[N];
            for(int i = 0; i < N; i++)
            {
                d[i] = GetInt();
            }
            var ans = d.Distinct().Count();

            Console.WriteLine(ans);
            Console.ReadKey();
        }

        static void Solve()
        {
        }


        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

Measured memory_bytes: 13280
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int i=0; i<n; i++)
#define REP2(i, a, b) for(int i=a; i<b; i++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    long long X;
    cin >> X;
    for(long long x=X;;x++){
        bool ok = true;
        for(long long y=2; y*y<=X; y++){
            if(x%y==0){
                ok = false;
                break;
            }
        }
        if(ok){
            cout << x << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong a[3][3];
llong b[3][3];
llong n;

int main() {
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[i][j];
        }
    }

    cin >> n;
    for (int k = 0; k < n; k++) {
        llong tmp;
        cin >> tmp;

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (a[i][j] == tmp) {
                    b[i][j] = 1;
                }
            }
        }
    }

    bool f = false;
    for (int i = 0; i < 3; i++ ){
        if (b[i][0] && b[i][1] && b[i][2]) f = true;
        if (b[0][i] && b[1][i] && b[2][i]) f = true;
    }

    if (b[0][0] && b[1][1] && b[2][2]) f = true;
    if (b[0][2] && b[1][1] && b[2][0]) f = true;

    if (f) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

#define PI 4*atan(1)
#define INF 1e8

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

int main(){
  long long int x, cnt = 0;
  cin >> x;
  if(x < 11){
    if(x - 6 <= 0)cnt = 1;
    else cnt = 2;
  }else {
    cnt = x / 11 * 2;
    x %= 11;
    if(x != 0){
      if(x - 6 <= 0)cnt += 1;
      else cnt += 2;
    }
  }
  cout << cnt << endl;
}


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

//.define
// #define FILE_IN_OUT
#define RET(_x)    return cout << (_x) << '\n', 0;
#define all(_obj)  (_obj).begin(), (_obj).end()
#define loop(_n)   for (int i = 0; i < (_n); ++i)
#define sz(_obj)   static_cast<int>((_obj).size())
#ifdef SHJ_LOCAL
#define debug(_x)  std::cerr << (#_x) << " = " << (_x) << '\n' << std::flush;
#else
#define debug(_x)  {}
#endif
#define endl "\n"
template<typename P, typename Q>
P CeilDiv(P _dividend, Q _divider) {
    return static_cast<P>((_dividend - 1LL + _divider) / _divider);
}
template<typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
    for (Tp current = _begin; current != _end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);

//.data

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream cin ("input.txt",  std::ios::in);
    std::ofstream cout("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    int n;
    cin >> n;
    int last_dig = n % 10;
    if (last_dig != 1 && last_dig != 3 && last_dig != 7 && last_dig != 9) {
        RET(-1);
    }
    int x = 7 % n;
    for (int i = 1; i <= 1000100; ++i) {
        if (x % n == 0) {
            RET(i);
        }
        x *= 10;
        x += 7;
        x %= n;
    }
    cout << -1 << endl;

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 3652
def get():
    N = int(input())
    permutation = [int(x) for x in input().split(" ")]
    _min = []
    for item in permutation:
        if (len(_min) == 0):
            _min.append(item)
        else:
            _min.append(min(_min[len(_min)-1], item))
    count = 0
    for i in range(len(_min)):
        if (permutation[i] == _min[i]):
            count += 1
    print(count)

get()

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

ll a[100010];
ll sum[3][200010];



int main(void){
	ll n,m;
	cin >> n >> m;
	rep(i,n) cin >> a[i],a[i]--;

	ll ans = 0;
	rep(i,n-1) ans += (a[i+1] - a[i] + m) % m;



	rep(i,n-1){
		ll from = a[i],to = a[i+1];
		if(to < from) to += m;
		const ll len = to - from;
		sum[0][from] +=1 ;
		sum[0][to-1] -=len;
		sum[0][to] += len-1;
	}

	rep(i,2){
		rep(j,1,2*m+1){
			if(j-1>=0) sum[i+1][j] = sum[i+1][j-1] + sum[i][j-1];
		}
	}

	
	ll cmax = 0;
	rep(i,m) chmax(cmax,sum[2][i]+sum[2][m+i]);
	ans -= cmax;

	cout << ans << endl;

	//rep(i,m) cout << sum[i] << endl;
	return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#include <cstring>
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define PI acos(-1.0)
typedef long long ll;
const int INF=0x3f3f3f3f;
//const ll INF=1000000000000000000;
 
//priority_queue<int, vector<int>, greater<int> >p;
int s[500005];
int main()
{
    ll n,a,b;
    scanf("%lld%lld%lld",&n,&a,&b);
    ll sum=n-a;
    if(a+b-1>n||a*b<n)
    {
        printf("-1\n");
        return 0;
    }
    for(int i=1;i<=n;i++)
        s[i]=i;
    for(int i=n;i>0;i-=b)
    {
        int t=b-1;
        if(sum<=t)
        {
            t=sum;
            for(int j=i;j>i-sum-1;j--)
            {
                s[j]=i-t;
                t--;
            }
            break;
        }
        sum-=t;
        for(int j=i;j>i-b;j--)
        {
            s[j]=i-t;
            t--;
        }
    }
    printf("%d",s[1]);
    for(int i=2;i<=n;i++)
        printf(" %d",s[i]);
    printf("\n");
    return 0;
}
 

Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

void funcA(){

  int x;
  cin >> x;
  if (x == 0) cout << 1;
  else cout << 0;

}

void funcB() {

  long long a, b, c, d;
  cin >> a >> b >> c >> d;

  long long ac, ad, bc, bd;
  ac = a * c;
  ad = a * d;
  bc = b * c;
  bd = b * d;

  long long maxnum;
  maxnum = max(ac, ad);
  maxnum = max(maxnum, bc);
  maxnum = max(maxnum, bd);

  cout << maxnum;
  

  /*
  cin >> a >> b >> c >> d;

  if (b > 0 && d > 0) {
    if (a * c > b * d) cout << a * c;
    else cout << b * d;
  }
  else if(a < 0 && c < 0) {
    cout << a * c;
    }
  else if (a > 0 && b > 0 && c >)
  }
  */


}

long long keisan(long long n, int x) {

  const long long mod = pow(10, 9) + 7;

  long long ans = 1;
  for (int i = 0; i < n; ++i) {
    ans *= x;
    ans %= mod;
  }

  return ans;
}

void funcC() {

  int n;
  cin >> n;
  const long long mod = pow(10, 9) + 7;

  long long all = keisan(n, 10);
  long long other = keisan(n, 9);
  other *= 2;
  other %= mod;
  long long kaburi = keisan(n, 8);

  long long ans = all - other + kaburi;
  if (ans < 0) ans += mod;
  cout << ans;
 

  
}

int main() {

  //funcA();
  //funcB();
  funcC();

  return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);
  
using namespace std;
 
const ll inf = 2e9;
const ll N = 1e5+100;
const ll bits = 20;
const ll mod = 1e9+7;
const ld pi = 3.14159265358979323846;


int main(){
    FASTIO;
    PRECISION;

	int n;
	cin>>n;
	
	int temp;
	int done = 1;
	for(int i=0;i<n;i++){
		cin>>temp;
		
		if(temp%2==0){
			if(temp%3!=0 && temp%5!=0){
				done = 0;
			}
		}
	}
	
	if(done){
		cout<<"APPROVED\n";
	}else{
		cout<<"DENIED\n";
	}

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <queue>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define vsort(v) sort(v.begin(),v.end)
using namespace std;
signed main() {
	string s;
	cin >> s;
	if (s == "ani")cout << "square1001" << endl;
	else cout << "e869120" << endl;
}


Measured memory_bytes: 3192
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

double n, sum = 0, divi = 1;

int main()
{
    cin >> n;
    vector<pair<double, double>> order(n);
    for (int in = 0; in < n; in++)
    {
        cin >> order[in].first >> order[in].second;
    }
    sort(order.begin(), order.end());

    for (int i = 1; i <= n; i++) divi *= i;

    do
    {
        for (int i = 0; i < n - 1; i++)
        {
            sum += sqrt((order[i + 1].first - order[i].first) * (order[i + 1].first - order[i].first) + (order[i + 1].second - order[i].second) * (order[i + 1].second - order[i].second));
        }
    } while(next_permutation(order.begin(), order.end()));

    cout << setprecision(30) << sum / divi << endl;
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
#define ll long long
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
using namespace std;
#include<bits/stdc++.h>
using namespace std;
int main()
{
   ll a,k=0,ans=0;
   cin>>a;
   std::vector<ll> v;
   for(int i=0;i<a;i++)
   {
      int q;
      cin>>q;
      if(q%2==1)
         k++;
      v.pb(q);
   }
   for(int i=0;i<a;i++)
   {
      if(v[i]%2==0)
      {
         while(v[i]%2!=1)
         {
            v[i]=v[i]/2;
            ans++;
         }
      }
   }
   cout<<ans<<endl;
   return 0;
}

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


int main() {
  string S;
  cin >> S;

  map<ll, ll> p;
  ll n = 0;
  ll keta = 1;
  p[0] = 1;
  reverse(S.begin(), S.end());
  for(int i = 0; i < S.size(); i++) {
   
    n = (n + (S[i] - '0') * keta) % 2019;
    p[n % 2019] += 1; 
     keta *= 10;
     keta %= 2019;

  }
  ll ans = 0;
  for(int i = 0; i < 2019; i++) {
    if(p[i] > 0)
    ans += (p[i] * (p[i] - 1)) / 2;
  }

  cout << ans;
  return 0;

}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define ull unsigned long long
using namespace std;
int main()
{
	int n,p;
	cin>>n>>p;
	bool flag=false;
	int x;
	for (int i=1;i<=n;i++)
	{
		cin>>x;
		if (x&1) {
			flag=true;
			break;
		}
	}
	ull ans1=(ull)1<<(n-1);
	ull ans2=(ull)1<<n;
	if (flag)
		cout<<ans1<<endl;
	else if (p==0) cout<<ans2<<endl;
	else cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]
#CW = [list(map(int, list(input()))) for _ in range(H)]


S = str(input())
ans = "Yes"

for i in range(4):
  if(S.count(S[i])!=2):
    ans = "No"

print(ans)



Measured memory_bytes: 68720
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int K=n/2;
  double S=n/2;
  if(n%2==0){
    cout<<fixed<<setprecision(10)<<0.5<<endl;
  }
  else{
    cout<<fixed<<setprecision(10)<<double((S+1)/n)<<endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define N 500000

struct node{
  int key;
  struct node *parent;
  struct node *left, *right;
};
typedef struct node Node;
Node *root;

void insert(int);
void inorder(struct node *);
void preorder(Node *);
int find(int);
void delete(int);

int main(){
  int n,i,j,z;
  char com[10],in[] = "insert",pr[] = "print",fi[] = "find",de[] = "delete";

  scanf("%d",&n);
  root=NULL;
  for(i = 0;i < n;i++){
    scanf("%s",com);
    if(strcmp(com,pr)==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(strcmp(com,in)==0){
      scanf("%d",&z);
      insert(z);
    }
    else if(strcmp(com,fi)==0){
      scanf("%d",&z);
      if(find(z) == 1) printf("yes\n");
      else printf("no\n");
    }
    else{
      scanf("%d",&z);
      delete(z);
    }
  }
  
  
  return 0;
}

void insert(int key){
  Node *y = NULL;
  Node *x = root;//y->xの親 x->root
  Node *z;

  z = (struct node *)malloc(sizeof(struct node));
  z->key = key;
  z->left = NULL;
  z->right = NULL;
  
  while(x != NULL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;

  if(y == NULL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}

void inorder(Node *r){
  if(r == NULL) return;
  inorder(r->left);
  printf(" %d",r->key);
  inorder(r->right);
}

void preorder(Node *r){
  if(r == NULL) return;
  printf(" %d",r->key);
  preorder(r->left);
  preorder(r->right);
}

int find(int z){
  Node *x = root;
  while(1){
  if(z == x->key) return 1;
  else if(z > x->key) x = x->right;
  else x = x->left;
  if(x == NULL) return 0;
  }
}

void delete(int delkey){
  Node *y;
  Node *x = root;
  Node *z;
  Node *child;
  
  
   while(1){
  if(delkey == x->key) break;
  else if(delkey > x->key) x = x->right;
  else x = x->left;
  }
   z = x;
  if(z->left == NULL || z->right == NULL){
    y = z;
    if(z->left != NULL) child = z->left;
    else child = z->right;
  }
  else{
    x = x->right;
    while(1){
      if(x->left != NULL) x = x->left;
      else break;
    }
    y = x;
  }
  if(y == z){
    if(child != NULL){
      child->parent = y->parent;
    }
    if(y->key < y->parent->key){
      y->parent->left = child;
    }
    else y->parent->right = child;
  }
  else{
    z->key = y->key;
    if(y->key < y->parent->key){
      y->parent->left = NULL;
    }
    else y->parent->right = NULL;
  }
  free(y);
}



Measured memory_bytes: 20524
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>

typedef long long ll;
typedef unsigned short int unsi;
typedef unsigned int uni;
typedef unsigned long int unli;

using namespace std;

int main(){
	int N;
	vector<pair<int, int>>Students;

	cin >> N;

	int InputA;

	for (int i = 0; i < N; i++) {
		cin >> InputA;
		Students.push_back(make_pair(InputA, i + 1));
	}
	
	sort(Students.begin(), Students.end());

	for (int i = 0; i < N; i++) {
		if (i < N - 1) {
			cout << Students[i].second << " ";
		} else {
			cout << Students[i].second << endl;
		}
	}
}

Measured memory_bytes: 1780
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner kbScanner = new Scanner(System.in);
		
		int[] input = new int[3];
		for(int i = 0; i < input.length; i++){
			input[i] = kbScanner.nextInt();
		}
		
		int[] output = input.clone();
		int p = 0;//???????????? 
		for(p = 0; p < output.length - 1; p++){
			for(int i = p; i < output.length - 1; i++){
				if(output[p] > output[i + 1]){
					int oki = output[p];
					output[p] = output[i + 1];
					output[i + 1] = oki;
				}
			}
		}
		
		System.out.println(output[0] + " " + output[1] + " " + output[2]);
	}
}

Measured memory_bytes: 26324
#include <iostream>
#include<queue>
#include <stack>
#include <string.h>
#include <algorithm>
using namespace std;

int main() {
	int n,l;
	cin >>n>> l;
	int i,j;
	string s[100];
	for (i = 0; i < n; i++) {
			cin >> s[i];
	}
	
	sort(s, s + n);

	for (i = 0; i < n; i++) {
			cout << s[i];
	}
	cout << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    rep(i, 1, 3501) rep(j, 1, 3501) {
        if (4*i*j-n*i-n*j <= 0) continue;
        if (n*i*j % (4*i*j-n*i-n*j) != 0) continue;
        ll k = n*i*j / (4*i*j-n*i-n*j);
        cout << i << " " << j << " " << k << endl;
        return 0;
    }
}

Measured memory_bytes: 256
/**
 * 
 */
import java.util.*;
/**
 * @author akira
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String str;
		while(scan.hasNext()){
			str = scan.nextLine();
			while(str.indexOf(" ") != -1){
				String tmp1 = str.substring(0,str.indexOf(" "));
				String tmp2 = str.substring(str.indexOf(" ") + 1,str.length());
				str = tmp1 + tmp2;
			}
			while(str.length() != 1){
				int n = str.length() - 1;
				String tmp = "";
				for(int i = 0;i < n;i++){
					tmp += (Integer.parseInt("" + str.charAt(i)) + Integer.parseInt("" + str.charAt(i + 1))) % 10;
				}
				str = tmp;
			}

			System.out.println(str);
		}
	}

}

Measured memory_bytes: 17332
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define RREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const long long INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
int solve(){
  int h,w,n;
  cin>>h>>w>>n;
  int tmp = max(h,w);
  cout << (n + tmp - 1) / tmp << endl;
  return 0;
}
int main(){
  ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

int main(){
    int A[3];
    for(int i=0;i<3;i++) cin >> A[i];
    sort(A,A+3);
    cout << A[0] << " " << A[1] << " " << A[2] << endl;
    
    return 0;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {

    jaldi

    int x;
    cin>>x;
    if(x>=30) {
        cout<<"Yes"<<'\n';
    }
    else {
         cout<<"No"<<'\n';
    }
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,x;
    while(cin >> n >> x){
	if(n==0 && x == 0)break;
	int ans = 0;
	for(int i=1;i<=n;i++){
	    for(int j=i+1;j<=n;j++){
		for(int k=j+1;k<=n;k++){
		    if(i+j+k==x) ans++;
		}
	    }
	}
	cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3116