akhauriyash/Code-Regression huggingface dataset:
#include <utility>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; std::cin >> N;
  int X; std::cin >> X;
  std::vector<int> m; m.reserve(N);
  int tmp;
  int min=1001;
  for (size_t i = 0; i < N; i++) {
    std::cin >> tmp;
    X -= tmp;
    min = std::min(tmp, min);
    m.push_back(tmp);
  }
  int num = N;
  while (X>=min) {
    X-=min;
    num++;
  }
  std::cout << num << '\n';


  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a[100],i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=n-1;i>=1;i--){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[0]);
	
	return 0;
}


Measured memory_bytes: 2112
#実はDPと割り切るとわかりやすい
mod=10**9+7
h,w,K=map(int,input().split())
dp=[[0]*w for j in range(h+1)]
dp[0][0]=1
for i in range(1,h+1):
    for k in range(2**(w-1)):
        for l in range(w-2):
            if ((k>>l)&1) and ((k>>(l+1))&1):
                break
        else:
            for l in range(w):
                if l==0:
                    if ((k>>l)&1):
                        dp[i][l+1]+=dp[i-1][l]
                    else:
                        dp[i][l]+=dp[i-1][l]
                elif l==w-1:
                    if ((k>>(l-1))&1):
                        dp[i][l-1]+=dp[i-1][l]
                    else:
                        dp[i][l]+=dp[i-1][l]
                else:
                    if ((k>>l)&1) or ((k>>(l-1))&1):
                        if ((k>>l)&1):
                            dp[i][l+1]+=dp[i-1][l]
                        else:
                            dp[i][l-1]+=dp[i-1][l]
                    else:
                        dp[i][l]+=dp[i-1][l]
            dp[i][l]%=mod
print(dp[h][K-1]%mod)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define int long long 
using ldb = long double;
using pa = pair < int, int >;
#define F  first
#define S  second
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k, n;
    cin >> k >> n;
    vector<int>q(n);
    f(i,0,n){
        cin >> q[i];  
    }
    int ans = 0;
    f(i,0,n-1){
        ans = max(ans,q[i+1]-q[i]);
    }
    ans = max(ans,q[0]+k-q[n-1]);
    cout << k - ans << endl;
    
    return 0;
}
 

Measured memory_bytes: 1792
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int H, W, N;
	cin >> H >> W >> N;

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

	int cnt = 0;
	vector<vector<int>> ans(H, vector<int>(W));
	for (int row = 0; row < H; row++) {
		for (int col = 0; col < W; col++) {

			if (row % 2) ans[row][col] = cnt + 1;
			else ans[row][W - col - 1] = cnt + 1;

			a[cnt]--;
			if (a[cnt] == 0) cnt++;

		}
	}
	assert(cnt == N);

	for (int row = 0; row < H; row++) {
		for (int col = 0; col < W; col++) {
			cout << ans[row][col] << " ";
		}
		cout << "\n";
	}
	

	return 0;
}

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

int main(){

  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D;
  E = A+B;
  F = C+D;
  
  if (E>F){
    cout << "Left" << endl;
  } else if (E<F) {
    cout << "Right" << endl;
  } else {
    cout << "Balanced" << endl;
  }

}


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

#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
void fst()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
}
int mod = 1e9 + 7;
int binpow(int a, int b)
{
    int res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = res * a;
            res %= mod;
        }
        a = a * a;
        a %= mod;
        b >>= 1;
        b %= mod;
    }
    return res;
}
#define Darr(x)           \
    cerr << #x << " = ";  \
    for (auto i : x)      \
        cerr << i << " "; \
    cerr << "\n";

#define all(a) a.begin(), a.end()
#define pb push_back
#define deb(x) cerr << #x << "=" << x << " ";
#define int long long
#define R(n) for (int i = 0; i < n; i++)
#define Rj(n) for (int j = 0; j < n; j++)
#define F(i, a, n) for (int i = a; i <= n; i++)
#define MN(x, y) x = min(x, y);
#define MX(x, y) x = max(x, y);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;

int n, k, tc, y, u, v;

int32_t main()
{
    fst();
    int a, b, c;
    cin >> a >> b >> c >> k;

    while (b <= a && k > 0)
    {
        b *= 2;
        k--;
    }
    while (c <= b && k > 0)
    {
        c *= 2;
        k--;
    }
    //cout<<a<<b<<c;
    if (a < b  && b< c && k >= 0)
        cout << "Yes";
    else
        cout << "No";
}


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

int main() {
  int A,B,C,D,E;
  cin >> A>>B>>C>>D>>E;
  int a,b,c,d,e,f;
  a = A -1;
  b = B -1;
  c = C -1;
  d = D -1;
  e = E - 1;
  a = a % 10;
  b = b % 10;
  c = c % 10;
  d = d % 10;
  e = e % 10;
  f = min ({a,b,c,d,e});
  cout<< ((A + 9) / 10 + (B + 9)/10 + (C + 9) / 10 + (D + 9) / 10 + (E + 9) / 10) * 10 - 9 + f;
}

Measured memory_bytes: 256
# 参考: https://qiita.com/y-tsutsu/items/aa7e8e809d6ac167d6a1

import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

# 多次元配列
# dp = [[0] * 3 for _ in range(5)]

# 入力を受け取る
A = int(input())
B = int(input())

if A * B == 2:
    print(3)
elif A * B == 3:
    print(2)
else:
    print(1)


Measured memory_bytes: 3572
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int n = 100;
        /*
        long n = long.Parse(Console.ReadLine());
        long[] input = new long[5];
        for(int a = 0; a < 5; a++)
        {
            input[a]=long.Parse(Console.ReadLine());
        }
        */
        int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        Console.WriteLine(input.Sum()+input.OrderBy(i=>-i).ToArray()[0]*9);


        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法
 
        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();

    }

}

Measured memory_bytes: 13396
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int n, p, q, a, b;
void dfs(vector<int>& temp){
  if(temp.size() == n){
    int val = 0;
    for(int v : temp) val = val*10+v;
    if(p>val)++a;
    if(q>val)++b;
    return;
  }
  rep(i,n){
    if(find(temp.begin(),temp.end(),(i+1)) != temp.end())continue;
    temp.emplace_back(i+1);
    dfs(temp);
    temp.pop_back();
  }
}
int main() {
  cin >> n;
  rep(i,n){
    int pi;
    cin >> pi;
    p = p*10+pi;
  }
  rep(i,n){
    int qi;
    cin >> qi;
    q = q*10+qi;
  }
  vector<int> t;
  dfs(t);
  cout << abs(a-b) << endl;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut ss = vec![];
    for i in 0..n {
        ss.push(read::<String>());
    }
    let mut count = HashMap::new();
    for s in ss.iter() {
        *count.entry(s).or_insert(0) += 1;
    }

    let max_count = *count.values().max().unwrap();

    let mut maxes = vec![];

    for (&k, &v) in count.iter() {
        if v == max_count {
            maxes.push(k);
        }
    }

    maxes.sort();
    for s in maxes {
        println!("{}", s);
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 24464
S = input()
S = S[:-1]
def cutstring(s):
    n = len(s)
    if n % 2 == 1:
        return cutstring(s[:-1])
    else:
        if s[:n//2] == s[n//2:]:
            return n
        else:
           return cutstring(s[:-1])
ans = cutstring(S)
print(ans)

Measured memory_bytes: 3060
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


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


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,ans=0;
  string s;
  cin>>n>>s;
  rep(i,n-2){
    if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdlib>5
#include<string>
#include<algorithm>
#define LL long long
#define INF 1000000009
using namespace std;
int main()
{
    int n,a[10000];
    scanf("%d",&n);
    for(int i=0;i<2*n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+2*n);
    int ans=0;
    for(int i=2*n-2;i>=0;i=i-2)
    {
        ans+=a[i];
       // printf("%d\n",a[i]);
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,d,x1,x2,x3,y1,y2,y3,*p,*q,*r,*s;
	while(scanf("%d%d%d",&a,&b,&d),d)
	{
		x1=y1=x2=y2=x3=y3=0;
		while(a*x1-d != b*y1)
			if(a*x1-d < b*y1)++x1;
			else ++y1;
		while(a*x2 != b*y2-d)
			if(a*x2 < b*y2-d)++x2;
			else ++y2;
		if(a<b)p=&a,q=&b,r=&x3,s=&y3;
		else p=&b,q=&a,r=&y3,s=&x3;
		while(d%*q)
			d-=*p,++*r;
		*s=d/ *q;
		if(*s<0 || *r<0)*s=*r=99999;

		if(x1+y1<x2+y2&&x1+y1<x3+y3)printf("%d %d\n",x1,y1);
		else if(x2+y2<x3+y3)printf("%d %d\n",x2,y2);
		else printf("%d %d\n",x3,y3);
	}
	return 0;
}

Measured memory_bytes: 0
N,M=[int(x) for x in input().split()]
H=[int(x) for x in input().split()]
f=[1]*N
for _ in range(M):
  A,B=[int(x) for x in input().split()]
  i=H[A-1]
  j=H[B-1]
  if i<=j: f[A-1]=0
  if i>=j: f[B-1]=0
print(sum(f))

Measured memory_bytes: 20144
#include <stdio.h>
#include <string.h>

int main(void){
	char s[2000001];
	int i, len, sum;

	scanf("%s", s);
	len = strlen(s);
	i = 0;
	sum = 0;
	while (i < len){
		sum += (s[i] -'0');
		i++;
	}
	if  (sum % 9 == 0){
		puts("Yes");
	}else{
		puts("No");
	}
}


Measured memory_bytes: 1800
#include <stdio.h>
#include <math.h>


int main(int argc, const char * argv[]) {
    double r,c,area;
    scanf("%lf",&r);
    c=r*2*M_PI;
    area=r*r*M_PI;
    printf("%.6f %.6f\n",area,c);
    return 0;
}

Measured memory_bytes: 652
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
const ll INF = 1e9;
//プロトタイプ宣言
void faster(void);
ll gcd(auto , auto);
ll get_digent(auto);
ll POW(auto , auto);

int main(){
  faster();
  ll ans=0,a=0,b=0,c=0,d=0;
  string s;
  cin >> s;
  a=s[0] - '0';
  b=s[1] - '0';
  c=s[2] - '0';
  d=s[3] - '0';
  rep(i,2)rep(j,2)rep(k,2){
      ans = a;
      if(i==0) ans += b;
      else if(i==1) ans-= b;
      if(j==0) ans += c;
      else if(j==1) ans-= c;
      if(k==0) ans += d;
      else if(k==1) ans-= d;
      if(ans == 7){
        if(i==0 && j==0 && k==0){
          cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
          return 0;
        }
        if(i==0 && j==0 && k==1){
          cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
          return 0;
        }
        if(i==0 && j==1 && k==0){
          cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
          return 0;
        }
        if(i==0 && j==1 && k==1){
          cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
          return 0;
        }
        if(i==1 && j==0 && k==0){
          cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
          return 0;
        }
        if(i==1 && j==0 && k==1){
          cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
          return 0;
        }
        if(i==1 && j==1 && k==0){
          cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
          return 0;
        }
        if(i==1 && j==0 && k==0){
          cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
          return 0;
        }
      }
  }
}








































//以下、ライブラリ

void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

ll gcd(auto a, auto b) {
  return (b ? gcd(b, a%b) : a);
} //ユークリッドの互除法

ll get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} //桁数取得

ll POW(auto x,auto y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} //べき乗計算

Measured memory_bytes: 256
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))

a.sort()

Ans = N
for i in range(N):
  x -= a[i]
  if x < 0:
    Ans = i
    break

if Ans == N and x != 0:
  Ans = N - 1

print(Ans)

Measured memory_bytes: 3060
#E A, B, C = gets.chomp.split.map(&:to_i)
N = gets.chomp.to_i
H = gets.chomp.split.map(&:to_i)

def can_decrease?
1.upto(N - 1).each do |i|
  if H[i] < H[i-1]
    return false
  elsif H[i] == H[i-1]
    # continue
  else  # H[i] > H[i-1]
    H[i] -= 1
    # continue
  end
end
  true
end

r = can_decrease?

# p H
if r
  print "Yes\n"
else
  print "No\n"
end

Measured memory_bytes: 9604
#include <stdio.h>
#include <math.h>

double dis(double x1,double y1, double x2,double y2){
  double x = x1-x2;
  double y = y1-y2;
  return sqrt( x*x+y*y );
}
double area(double x0,double y0, double x1,double y1,
	    double x2,double y2 ){
  double a,b,c,s;
  a=dis(x0,y0, x1,y1);
  b=dis(x1,y1, x2,y2);
  c=dis(x2,y2, x0,y0);
  s = (a+b+c)/2.0;

  return sqrt( s*(s-a)*(s-b)*(s-c) );
}

int main(void){
  double x[4],y[4];
  double th[3];
  double s,s1,s2,s3;
  double e=1.0e-6;
  int i;
  while( 1 ){
    for( i=0;i<4;i++ ){
      if( scanf("%lf %lf ",&x[i],&y[i])==EOF )
	return 0;
    }
    s = area(x[0],y[0], x[1],y[1], x[2],y[2] );
    s1= area(x[0],y[0], x[1],y[1], x[3],y[3] );
    s2= area(x[1],y[1], x[2],y[2], x[3],y[3] );
    s3= area(x[2],y[2], x[0],y[0], x[3],y[3] );

    if( fabs(s-s1-s2-s3)<e )
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define mod 1000000007
const double pi = 3.14159265358979323846;
typedef long long ll;
using namespace std;

const int M = (int)(2e6 + 239);

int getnum(string a)
{
    int i,p=0;
    rep0(i,a.size())
    {
        p*=10;
        p+=a[i]-'0';
    }
    return p;
}

int main()
{
    fast

    queue<ll>q;
    for(int i=1; i<=9; i++)
    {
        q.push(i);
    }
    ll a;
    cin>>a;
    for(int i=0; i<a; i++)
    {
        ll temp=q.front();
        if(i==a-1)
        {
            cout<<temp<<endl;
            break;
        }
        q.pop();
        if(temp%10!=0)
        {
            q.push((10*temp)+(temp%10)-1);
        }
        q.push((10*temp)+(temp%10));
        if(temp%10!=9)
        {
            q.push((10*temp)+(temp%10)+1);
        }
    }
}




Measured memory_bytes: 1792
/*
СТРОИМ СТЕНУ РАБОТЯГИ!
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
*/

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
    
     
     
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
/** Interface */
     
inline int readChar();
template <class T = int> inline T readInt(); 
template <class T> inline void writeInt( T x, char end = 0 );
inline void writeChar( int x ); 
inline void writeWord( const char *s );
     
/** Read */
     
static const int buf_size = 4096;
     
inline int getChar() {
    static char buf[buf_size];
    static int len = 0, pos = 0;
    if (pos == len) {
        pos = 0, len = fread(buf, 1, buf_size, stdin);
    }
    if (pos == len) {
        return -1;
    }
    return buf[pos++];
}
     
inline int readChar() {
    int c = getChar();
    while (c <= 32) {
        c = getChar();
    }
    return c;
}
     
template <class T>
inline T readInt() {
    int s = 1, c = readChar();
    T x = 0;
    if (c == '-')
        s = -1, c = getChar();
    while ('0' <= c && c <= '9')
        x = x * 10 + c - '0', c = getChar();
    return s == 1 ? x : -x;
}
     
/** Write */
     
static int write_pos = 0;
static char write_buf[buf_size];
     
inline void writeChar( int x ) {
    if (write_pos == buf_size)
        fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
    write_buf[write_pos++] = x;
}
     
template <class T> 
inline void writeInt( T x, char end ) {
    if (x < 0)
        writeChar('-'), x = -x;
     
    char s[24];
    int n = 0;
    while (x || !n)
        s[n++] = '0' + x % 10, x /= 10;
    while (n--)
        writeChar(s[n]);
    if (end)
        writeChar(end);
}
     
inline void writeWord( const char *s ) {     while (*s)
writeChar(*s++); }
     
struct Flusher {
    ~Flusher() {
        if (write_pos)
            fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
    }
} flusher;   
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228
#define prev prev228
#define y1 y1228  


int main() {
    string p;
    cin >> p;
    for (int i = 0; i < sz(p) - 1; i++) {
        if (p[i] == 'A' && p[i + 1] == 'C') {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
    return 0;
}


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

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		int n = Console.ReadLine().ToInt();
		var a = Input().ToInt();
		
		Array.Sort(a);
		
		int start = 0;
		if(n % 2 == 0)
			start = 1;
		int cnt = 0;
		long wa = 1;
		for(int i = 0; i < n; i++)
		{
			if(start == a[i])
			{
				cnt++;
			}
			else
			{
				Console.WriteLine(0);
				return;
			}
			if(start == 0 && cnt == 1)
			{
				cnt = 0;
				start += 2;
				wa = 1;
			}
			else if(cnt == 2)
			{
				cnt = 0;
				start += 2;
				wa *= 2;
				wa %= Giri;
			}
		}
		Console.WriteLine(wa % Giri);
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		int[] r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
	
}

Measured memory_bytes: 16864
def isort(n,a):
    print " ".join(map(str, a))
    for j in range(1,n):
        key = a[j]
        i = j-1
        while i >= 0 and a[i] > key:
            a[i+1] = a[i]
            i = i - 1
        a[i+1] = key
        print " ".join(map(str, a))

n = int(raw_input())
a = map(int, raw_input().split())
isort(n,a)

Measured memory_bytes: 4224
N = int(input())
L = list(map(int, input().split()))
 
ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            a = sorted([L[i], L[j], L[k]])
            if a[0] == a[1] or a[1] == a[2] or a[2] == a[0]:
                continue
            if a[0] + a[1] > a[2]:
                ans += 1
 
print(ans)

Measured memory_bytes: 9092
n, m = (int(i) for i in input().split()) 
l = [[int(i) for i in input().split()] for i in range(m)]

import numpy as np
nl = np.array(l)
mrange = l[(nl[:, 1] - nl[:, 0]).argmin()]

def judge(l):
  a = l[1]<mrange[0]
  b = l[0]<mrange[0] and l[1]>=mrange[0] and l[1]<=mrange[1]
  c = l[0]>=mrange[0] and l[1]<=mrange[1]
  d = l[0]>=mrange[0] and l[0]<=mrange[1] and l[1]>mrange[1]
  e = l[0]>mrange[1]
  return a, b, c, d, e

for ll in l:
  a, b, c, d, e = judge(ll)
  if a | e:
    mrange = [1, 0]
    break
  elif b:
    mrange = [mrange[0], ll[1]]
  elif c:
    mrange = ll # これは出現することがないはず
  elif d:
    mrange = [ll[0], mrange[1]]
    
print(mrange[1] - mrange[0] + 1)

Measured memory_bytes: 32792
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( [ $ t : ty ] ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( [ $ t : ty ] ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( [ $ t ] ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (n, l) = get!(i64, i64);
    let mut v: Vec<i64> = (l..l + n).collect();
    v.sort_by_key(|x| x.abs());
    v.remove(0);

    println!("{}", v.iter().sum::<i64>());
}


Measured memory_bytes: 8572
n, m = map(int, input().split())
h = [0] + list(map(int, input().split()))
G = [[] for _ in range(n + 1)]
for _ in range(m):
    a, b = map(int, input().split())
    G[a].append(b)
    G[b].append(a)

cnt = 0
for i in range(1, n + 1):
    is_high = True
    for v in G[i]:
        if h[i] <= h[v]:
            is_high = False
    if is_high:
        cnt += 1

print(cnt)

Measured memory_bytes: 29360
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << p.first << " " << p.second;
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N, K;
  std::cin >> N >> K;
  std::string S;
  std::cin >> S;

  S[K-1] += 'a' - 'A';

  print(S);

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  for (int i = 0; i < N; i++) {
    cin >> P.at(i);
  }
  vector<int> m(N);
  m.at(0) = P.at(0);
  for (int i = 1; i < N; i++) {
    m.at(i) = min(m.at(i - 1), P.at(i));
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (P.at(i) == m.at(i)) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
/////////////==========================
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define nl cout << '\n'
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

int main(){
    int n;
    cin >> n;
    long long sum = 0;
    for (int i = 1; i <= n; i++)
    {
        if( i%3 != 0 and i%5 !=0){
            sum+= i;
        }
    }
    cout << sum;
    
    
}

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

int main()
{
    int a,b;
    cin >> a >> b;
    
    if(a > b){
        cout << "a > b" <<endl;
    }
    else if (a < b){
        cout << "a < b" <<endl;
    }
    else{
        cout << "a == b" <<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1156
class BIT:
	"0-indexed apparently"
	
	def __init__(self, n):
		self.n = n
		self.data = [0] * (n+1)
		
	def point_add(self, index, value):
		index += 1
		while index <= self.n:
			self.data[index] += value
			index += index & -index
		
	def folded(self, r):
		"[0, r)"
		ret = 0
		while r > 0:
			ret += self.data[r]
			r -= r & -r
		return ret
		
	def bisect_left(self, value):
		index = 0
		k = 1 << ((self.n + 1).bit_length() - 1)
		while k > 0:
			if index + k <= self.n and self.data[index + k] < value:
				value -= self.data[index + k]
				index += k
			k >>= 1
		return index + 1
		
N = int(input())
As = list(map(int, input().split()))

A_inv = [0] * N
for i, A in enumerate(As):
	A_inv[A-1] = i
	
bit = BIT(N + 2)
bit.point_add(0, 1)
bit.point_add(N+1, 1)
ans = 0
for A, index in enumerate(A_inv):
	A += 1
	index += 1
	v = bit.folded(index)
	ans += A * (bit.bisect_left(v+1) - index - 1) * (index - bit.bisect_left(v) + 1)
	#print(A, ans)
	bit.point_add(index, 1)
	
print(ans)

Measured memory_bytes: 99668
#include <iostream>
#include <fstream>
#include <climits>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <list>

#define FOR(i,n)	for(int i = 0 ; i < n ; i++)
#define FORrev(i,n)	for(int i = n - 1 ; i >= 0 ; i--)
#define ALL(a)		a.begin(),a.end()
#define pii			pair<int , int>
#define mp(a , b)	make_pair(a , b)


typedef long long int ll; 

using namespace std;

int n , m;
ll a[1003];
vector<int> b[1003];
ll dp[(1<<12) + 10][1003];
ll masks[1003];
ll ans = 0;

ll mini(ll x , ll y) {
	if(x < y)
		return x;
	return y;
}

int main() {
	memset(masks , 0 , sizeof(masks));
	cin>>n>>m;
	FOR(i , m) {
		int t;
		cin>>a[i]>>t;
		FOR(j , t) {
			int x;
			cin>>x;
			b[i].push_back(x - 1);
		}
	}
	FOR(i , m) {
		FOR(j , (int)b[i].size()) {
			masks[i] |= 1 << b[i][j];
		}
	}
	FOR(i , n) {
		ans |= 1 << i;
	}
	FOR(i , (1 << 12) + 9 ) {		
		if(i > ans)
			break;
		for(int j = 0 ; j < m ; j++) {
			dp[i][j] = INT_MAX;
		}
	}
	dp[masks[0]][0] = a[0];
	FOR(i , m) {
		dp[masks[i]][i] = a[i];
	}
	for(int j = 0 ; j < m - 1 ; j++){				
		FOR(i , (1 << 12) + 9 ) {
			if(i > ans)
			break;
			dp[i | masks[j + 1]][j + 1] = min( dp[i | masks[j + 1]][j + 1] , 
				dp[i][j] + a[j + 1]);
			dp[i][j + 1] = mini(dp[i][j + 1] , dp[i][j]);
		}
	}
	ll sol = INT_MAX;
	FOR(i , m) {
		if(dp[ans][i] < INT_MAX) {
			sol = mini(sol , dp[ans][i]);
		}
	}
	if(sol == INT_MAX) {
		cout<<"-1";
	}
	else
		cout<<sol;
}

Measured memory_bytes: 32512
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
using namespace std;
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; }
const ll INF=1LL<<60;

int n;
vector<ll> h(100010,0);
vector<ll> dp(100010,INF);

int main(){
    cin>>n;
    rep(i,n) cin>>h[i];

    dp[0]=0;
    for(int i=1;i<=n;i++){
        chmin(dp[i],dp[i-1]+abs(h[i]-h[i-1]));
        if(i>1) chmin(dp[i],dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n-1]<<"\n";
    return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;

int main(){
  ll i, j;
  ll k, a, b;
  cin >> k >> a >> b;
  ll result1 = k + 1;
  ll result2 = 0;
  ll s = k - (a - 1);
  if(s % 2 == 0 && s >= 2)
    result2 = a + s * (b - a) / 2;
  else if(s >= 2)
    result2 = a + (s - 1) * (b - a) / 2 + 1;
  
  cout << max(result1, result2) << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
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;}

int main(){
    string s;
    int q;
    cin >> s;
    cin >> q;
    int cnt1 = 0;

    string sf = "";
    string sb = "";
    REP(i,q){
        int t;
        cin >> t;
        if(1 == t){
            cnt1++;
        }else{
            int f;
            string c;
            cin >> f;
            cin >> c;

            if((0 == cnt1%2 && 1 == f) || (0 != cnt1%2 && 2 == f)){
                sf = c + sf;
            }else{
                sb = sb + c;
            }
        }
    }

    if(0 != cnt1%2){
        reverse(s.begin(),s.end());
        reverse(sf.begin(),sf.end());
        reverse(sb.begin(),sb.end());
        s = sb + s + sf;
    }else{
        s = sf + s + sb;
    }

    cout << s << endl;

}

Measured memory_bytes: 1512
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define MAXN 10000
#define MAXQ 500


int main() {
	lli s[MAXN],t[MAXQ];
	int n,q,ans=0;
	
	cin >> n;
	for(int i=0;i<n;i++){
	    lli k;
	    cin >> k;
	    s[i] = k;
	}
	cin >> q;
	for(int i=0;i<q;i++){
	    lli k;
	    cin >> k;
	    t[i] = k;
	}
	sort(s,s+n);
	sort(t,t+q);
	int k=0;
	for(int i=0;i<q;i++){
	    for(int j=k;j<n;j++){
	        if(t[i]==s[j]){
	            ++ans;
	            k = j;
	            break;
	        }else if(t[i]<s[j]){
	            break;
	        }
	    }
	}
	
	
	
	cout << ans << endl;
	
	
	return 0;
}

Measured memory_bytes: 3124
#include "iostream"
using namespace std;
bool ispalin(string s)
{
    
    string k(s.rbegin(),s.rend());
    
    return k==s;
    
}

int main()
{
    string s;
    cin>>s;
    int n=(int)s.size();
    
    if(ispalin(s) && ispalin(s.substr(0,(n-1)/2)) && ispalin(s.substr((n+3-2)/2,n)))
    {
        cout<<"Yes"<<endl;
    }
    
    else
        cout<<"No"<<endl;
    
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int n=0;
  scanf("%d",&n);
  n=n%10;
  if(n==2 || n==4|| n==5|| n==7|| n==9){
    printf("hon");
  }
  else if(n==0|| n==1|| n==6|| n==8){
    printf("pon");
  }
  else{
    printf("bon");
  }
  return 0;
}

Measured memory_bytes: 1728
#include <stdio.h>

int main()
{
	int n;
	scanf("%d",&n);
	int ans=2*n;

	char a[n],b[n],c[n];
	scanf("%s %s %s",a,b,c);
	for (int i = 0; i < n; ++i)
	{
		int count=0;
		if(a[i]==b[i]) count++;
		if(a[i]==c[i]) count++;
		if(b[i]==c[i]) count++;

		if(count==3){
			ans-=2;
		}
		if(count==1){
			ans--;
		}
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) (a<<b)
#define Rshift(a,b) (a>>b)
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define swap(a,b) ( (a^=b) , (b^=a) , (a^=b) )
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;

string s;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> s;
    if (s.length() != 6 || s[2] != s[3] || s[4] != s[5]) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	cout << n*n*n << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3



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

dp = [float('inf') for i in range(N+1)]

dp[1] = 0
dp[2] = abs(H[1]-H[0])
for i in range(3, N+1):
    dp[i] = min(dp[i-1]+abs(H[i-1]-H[i-2]), dp[i-2]+abs(H[i-1]-H[i-3]))

print(dp[N])


Measured memory_bytes: 52600
N, A, B = map(int, input().split())
ans = []
for i in range(1, N + 1):
    i = str(i)
    tmp = 0
    for j in range(len(i)):
        tmp += int(i[j])
    if A <= tmp <= B:
        ans.append(int(i))

print(sum(ans))


Measured memory_bytes: 73780
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>

using namespace std;

long long f(int N,long long X, vector<long long>a, vector<long long>p){
  if(N==0&&X<=0)return 0;
  if(N==0&&X>0)return 1;
  if(N!=0){
    if(X<=1+a[N-1]){
      return f(N-1,X-1,a,p);
    }else{
      return p[N-1]+1+f(N-1,X-2-a[N-1],a,p);
    }
  }
}

int main() {
  int N;
  long long X;
  cin>>N>>X;
  vector<long long>a(N+1),p(N+1);
  a[0]=1;p[0]=1;
  for(int i=1;i<=N;i++){
    a[i]=a[i-1]*2+3;
    p[i]=p[i-1]*2+1;
  }
  cout<<f(N,X,a,p)<<endl;
}

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


int main() {
	int input;
	float output;

	cin >> input;
	if (input % 2 == 0)
	{
		output = 0.5;
		cout << output;
	}
	else if (input % 2 == 1)
	{
		float tmp;
		tmp = (input + 1) / 2;
		output = tmp / input;
		cout << output;
	}
}

Measured memory_bytes: 256
n=int(input())
a,b,c=[],[],[]
for i in range(n):
  a1,b1,c1=map(int,input().split())
  a+=[a1]
  b+=[b1]
  c+=[c1]

hp=[[0 for j in range(n)]for i in range(3)]
hp[0][0],hp[1][0],hp[2][0]=a[0],b[0],c[0]

for j in range(1,n):
  for i in range(3):
    
    if i==0:
      hp[i][j]+=max(hp[(2)][j-1],hp[(1)][j-1])+a[j]
    elif i==1:
      hp[i][j]+=max(hp[(0)][j-1],hp[(2)][j-1])+b[j]
    else:
      hp[i][j]+=max(hp[(1)][j-1],hp[(0)][j-1])+c[j]
    
    #print(i,j,hp[i][j])

#print(hp)
print(max(hp[0][n-1],hp[1][n-1],hp[2][n-1]))

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

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define all(a) a.begin(),a.end()
#define pb push_back

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef string S;

int main(){
    
    int w,h,n;
    cin >> w >> h >> n;
    
    vi x(n),y(n),a(n);
    rp(i,n){
        cin >> x.at(i) >> y.at(i) >> a.at(i);
    }
    
    int B[100][100];
    rp(i,h){
        rp(j,w){
            B[i][j]=0;
        }
    }
    
    rp(i,n){
    
        if(a.at(i)==1){
            rp(j,h){
                rp(k,x.at(i)){
                    B[j][k]++;
                }
            }
        }else if(a.at(i)==2){
            rp(j,h){
                rp(k,w-x.at(i)){
                    B[j][x.at(i)+k]++;
                }
            }
        }else if(a.at(i)==3){
            rp(j,y.at(i)){
                rp(k,w){
                    B[j][k]++;
                }
            }
        }else if(a.at(i)==4){
            rp(j,h-y.at(i)){
                rp(k,w){
                    B[j+y.at(i)][k]++;
                }
            }
        }
        
    }    
    int ans=0;
    rp(i,h){
        rp(j,w){
            if(!(B[i][j])){
                ans++;
            }
        }
    }
    
    cout << ans << endl;
    return 0;

}


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

int main(){
    int N,M;cin>>N>>M;
    vector<int> G(N+1,0);
    for(int i=0;i<M;i++){
        int l,r;cin>>l>>r;--l;
        G[l]++;
        G[r]--;
    }
    for(int i=0;i<N;i++)G[i+1]+=G[i];
    int res=0;
    for(int i=0;i<N;i++)if(G[i]==M)++res;
    cout<<res<<endl;
}

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

using namespace std;

int main()
{
    int n, x;
    int l[10010];
    int sum = 0;
    int ans = 1;

    cin >> n >> x;

    for (int i = 0; i < n; i++) {
        cin >> l[i];
    }

    for (int i = 0; i < n; i++) {
        sum += l[i];
        if (sum > x) {
            break;
        }
        ans++;
    }

    cout << ans << endl;

}


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

mod = 1000000007
N = int(input())
AA = list(map(int, input().split()))

num = [0,0,0]
ans = 1
for i in AA:
	f = False
	cnt = 0
	for j in range(3):
		if(num[j] == i):
			if f==False : 
				num[j] += 1
				f=True
			cnt += 1
	ans = (ans * cnt) % mod
print(ans)

Measured memory_bytes: 52972
import java.util.Scanner;
 
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int M = sc.nextInt();
    
    int A[] = new int[M];
    int S = 0;
    for(int i = 0;i < M;i++){
        A[i] = sc.nextInt();
        S += A[i];
    }
    if(S >= H){
        System.out.println("Yes");
    }else{
        System.out.println("No");
    }
  }
}

Measured memory_bytes: 50688
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a,b;
  cin>>a>>b;
  if(a<6){
    cout<<0<<endl;
  }
  else if(a>12){
    cout<<b<<endl;
  }
  else{
    cout<<b/2<<endl;
  }
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

double dp[305][305][305];
int cnt[4];

int main(){
    int n;
    cin >> n;
    rep(i,n){
        int a;
        cin >> a;
        cnt[a]++;
    }
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            for(int k=0;k<=n;k++){
                if(i+j+k==0){
                    dp[i][j][k]=0;
                    continue;
                }
                dp[i][j][k]=(double)n/(i+j+k);
                if(i!=0)dp[i][j][k]+=dp[i-1][j+1][k]*i/(i+j+k);
                if(j!=0)dp[i][j][k]+=dp[i][j-1][k+1]*j/(i+j+k);
                if(k!=0)dp[i][j][k]+=dp[i][j][k-1]*k/(i+j+k);
            }
        }
    }
   printf("%.10f\n",dp[cnt[3]][cnt[2]][cnt[1]]);
}

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

using namespace std;

inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}

const int maxn = 1e5 + 50;

int n , a[maxn];

int main( int argc , char * argv[] ){
	n = read();
	int f1 = 0 , f2 = 0 , cnt = 0;
	for(int i = 1 ; i <= n ; ++ i){
		a[i] = read();
		a[i] %= 4;
		if( a[i] == 0 ) ++ f1;
		else if( a[i] == 2 ) ++ f2;
		else ++ cnt;
	}
	if( f2 ) ++ cnt;
	int z = f1 ? f1 + 1 : 0;
	if( z >= cnt || ( f2 == n && n > 1 ) )
		puts( "Yes" );
	else
		puts( "No" );
	return 0;
}

Measured memory_bytes: 640