akhauriyash/Code-Regression huggingface dataset:
### SNIPPET
  # n = gets.split.map(&:to_i)
  # array = n.times.map { gets.split.map(&:to_i) }
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # [1,2,3,4,5].select { |num| num.even? }  # => [2, 4]
  # ["a","a","b"].group_by(&:itself).map{|k,v| [k, v.count]}.to_h #=> {"a"=>2, "b"=>1}
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さ = a * Math.sin(w / 180.0 * Math::PI), 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  # def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end

h,a = gets.split.map(&:to_i)

atk_num = 0
sum = 0
while h > sum
  atk_num += 1
  sum += a
end
puts atk_num

Measured memory_bytes: 1788
//By Tushar Gautam
#include <bits/stdc++.h>
using namespace std;
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for ll)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
#pragma GCC optimize ("-O2")
const int LIM = 5e5+5, MOD = 1e9+7;
int t,n,m,k,x,y;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    cin>>x>>y;
    cout<< ((y-x)*(y-x-1))/2-x;
    return 0;
}

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

namespace _0008
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = 0;

            while (int.TryParse(Console.ReadLine(),out n))
            {
                int answer = 0;
                for (int a = 0; a < 10; a++)
                {
                    for (int b = 0; b < 10; b++)
                    {
                        for (int c = 0; c < 10; c++)
                        {
                            for (int d = 0; d < 10; d++)
                            {
                                if (n == a + b + c + d)
                                {
                                    answer += 1;
                                }
                            }
                        }
                    }
                }

                Console.WriteLine(answer);
            }
        }
    }
}



Measured memory_bytes: 15872
/*
 * StandardDeviation.cpp
 *
 *  Created on: 2014/07/21
 *      Author: WanWan1985
 */
#include <iostream>
#include <vector>
#include <iomanip>	// for setprecision
#include <cmath>	// for pow
#include <numeric>	// for accumulate
using namespace std;

int main(void) {

	vector<vector<int> > vecData;
	while(1) {
		int iStudentNum = 0;
		cin >> iStudentNum;
		if (0 == iStudentNum) {
			break;
		}

		vector<int> vecScore;
		for (int i = 0; i < iStudentNum; i++) {
			int iScore = 0;
			cin >> iScore;
			vecScore.push_back(iScore);
		}

		vecData.push_back(vecScore);
	}

	for (unsigned int i = 0; i < vecData.size(); i++) {
		vector<int> vecDataSet = vecData.at(i);
		// 平均値
		double dAverageScore = accumulate(vecDataSet.begin(), vecDataSet.end(), 0.0) / vecDataSet.size();

		// 分散
		double dSum = 0.0;
		for (unsigned int j = 0; j < vecDataSet.size(); j++) {
			dSum += pow(vecDataSet.at(j) - dAverageScore, 2);
		}
		double dVariance = dSum / vecDataSet.size();

		cout << fixed << setprecision(8) << sqrt(dVariance) << endl;
	}
	return 0;
}

Measured memory_bytes: 1300
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    string S_,T;
    cin >> S_ >> T;
    bool ok=false;
    ll key = 0;
    for(ll i=0;i<=ll(S_.size())-ll(T.size());i++)
    {
        ll cnt=0;
        for(ll j=0;j<T.size();j++)
        {
            if(S_[i+j]=='?'||S_[i+j]== T[j]) cnt++;
        }
        if(cnt==T.size())
        {
            key = i;
            ok=true;
        }
    }
    if(ok)
    {
        string ans="";
        for(ll i=0;i<S_.size(); i++)
        {
            if(i==key)
            {
                i+=T.size()-1;
                ans += T;
            }else
            {
                if(S_[i]=='?') ans += 'a';
                else ans += S_[i];
            }
        }
        cout << ans << endl;
    }else
    {
        cout << "UNRESTORABLE" << endl;
    }
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3580
#[allow(unused_imports)]
use std::io::{self, BufRead};
#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(dead_code)]
fn readln_to_vec<T>(buf: &mut BufRead) -> Vec<T> 
where T: std::str::FromStr,
      <T as std::str::FromStr>::Err: std::fmt::Debug
{
    let mut s = String::new();
    buf.read_line(&mut s).unwrap();
    s.split(" ")
        .map(|x| x.trim())
        .filter(|x| !x.is_empty())
        .filter_map(|x| x.parse().ok())
        .collect()
}

#[allow(dead_code)]
fn readln_to<T>(buf: &mut BufRead) -> T
where T: std::str::FromStr + std::clone::Clone,
      <T as std::str::FromStr>::Err: std::fmt::Debug
{
    readln_to_vec::<T>(buf)[0].clone()
}

#[allow(unused_macros)]
macro_rules! readln_to_tuple {
    (
        $bufRead: expr, ( $( $t: ty ),* )
    ) => (
        {
            let buf: &mut BufRead = $bufRead;
            let ln = readln_to_vec::<String>(buf);
            let mut i = ln.into_iter();
            ( $( i.next().unwrap().parse::<$t>().unwrap() ),* )
        }
        )
}


fn main() {
    let stdin = io::stdin();
    let mut stdin = stdin.lock();
    let stdin = &mut stdin;

    let (q, h, s, d) = readln_to_tuple!(stdin, (i64, i64, i64, i64));
    let n: i64 = readln_to(stdin);

    println!("{}", min(min(n * q * 4, n * h * 2), min(n * s, (n/2) * d + (n % 2) * min(min(q*4, h*2), s))));
}




Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

ll n, m;
ll p[101010], y[101010];
string id[101010];
int main() {
    cin>>n>>m;
    REP(i, 0, m) cin>>p[i]>>y[i];
    REP(i, 0, m) id[i]="000000000000";

    vector<vector<pair<ll, ll>>> vvp(n);
    REP(i, 0, m){
        vvp[p[i]-1].emplace_back(make_pair(y[i], i));
    }
    REP(i, 0, n){
        sort(vvp[i].begin(), vvp[i].end());
    }

    REP(i, 0, n){
        REP(j, 0, vvp[i].size()){
            ll year=j+1;
            ll city=i+1;
            ll idx=0;

            while(city>0){
                id[vvp[i][j].second][5-idx]=(char)('0'+(city%10));
                city/=10;
                ++idx;
            }

            idx=0;
            while(year>0){
                id[vvp[i][j].second][11-idx]=(char)('0'+(year%10));
                year/=10;
                ++idx;
            }
        }
    }

    REP(i, 0, m){
        cout<<id[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 13952
#include<bits/stdc++.h>
using namespace std;
#define DEKAI 1000000007
#define INF (1<<28)
#define lp(i,n) lps(i,0,n)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define FDST int hogehogehoge;cin>>hogehogehoge

int main(){
  int n,rc=0,lc=0;
  string s;
  cin>>n>>s;
  if(s[0]=='>' || s[s.size()-1]=='<') cout<<n<<endl;
  else{
    for(int i=0;i<s.size();i++){
      if(s[i]=='<') rc++;
      else break;
    }
    for(int i=s.size()-1;i>=0;i--){
      if(s[i]=='>') lc++;
      else break;
    }
    cout<<n-min(lc,rc)<<endl;
  }
  return 0;
}



Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
const int N=310;
int n,m,a[N][N],rk[N][N],fans,ans,pos;
int cnt[N],t;

int main()
{
//	freopen("in.txt","r",stdin);
	scanf("%d%d",&n,&m);fans=n;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			scanf("%d",&a[i][j]),rk[i][a[i][j]]=j;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(rk[i][j]==1)
				cnt[j]++;
	for(int i=1;i<=m;i++)
		if(cnt[i]>ans)
		{
			ans=cnt[i];
			pos=i;
		}
	fans=min(fans,ans);
	t=1;
	while(t++!=m)
	{
		memset(cnt,0,sizeof(cnt));
		for(int i=1;i<=n;i++)
			rk[i][pos]=m+1;
		for(int i=1;i<=n;i++)
		{
			int minn=m+1,mpos;
			for(int j=1;j<=m;j++)
				if(rk[i][j]<minn)
				{
					minn=rk[i][j];
					mpos=j;
				}
			cnt[mpos]++;
		}
		ans=0;
		for(int i=1;i<=m;i++)
			if(cnt[i]>ans)
			{
				ans=cnt[i];
				pos=i;
			}
		fans=min(ans,fans);
	}
	printf("%d",fans);
	return 0;
} 

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

ll nkai(ll n){
    if(n==0) return 1;
    return n*nkai(n-1);
}

double dist(ll x1,ll x2,ll y1,ll y2){
    double x=pow(x1-x2,2),y=pow(y1-y2,2);
    return sqrt(x+y);
}

int main(void)
{
    ll n; cin>>n;
    vector<P> a(n);
    vector<ll> p(n);
    rep(i,n){
        ll x,y;
        cin>>x>>y;
        a[i]=make_pair(x,y);
        p[i]=i;
    }
    double sum=0;
    do{
        rep(i,n-1){
            sum+=dist(a[p[i]].first, a[p[i+1]].first, a[p[i]].second, a[p[i+1]].second);
        }

    }while(next_permutation(all(p)));
    printf("%.10lf\n",sum/nkai(n));
    return 0;
}

Measured memory_bytes: 3844
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    vector<int> d(N);
    int count = 0;
    for(int i = 0; i < N; i++){
        cin >> d[i];
    }
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            count += d[i]*d[j];
        }
    }
    cout << count;
}


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

#define FOR(i,N) for(int i=0;i<N;i++)
#define ROF(i,N) for(int i=N-1;i>=0;i--)
#define ROF1(i,a,b) for(int i=(b);i>=(a);i--)
#define FOR1(i,a,b) for(int i=(a);i<=(b);i++)
#define FORi(i,a,b,c) for(int i=(a);i<=(b);i+=(c))

#define read freopen("IN.txt","r",stdin)
#define write freopen("OT.txt","w",stdout)
#define fastread {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mem(a,b)          memset(a,b,sizeof(a))
#define EPS 1e-9
#define PI              acos(-1.0)
#define INF             2e16

#define ll              long long
#define ull             unsigned long long
#define ft              first
#define sd              second
#define bn              begin
#define en              end
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>
#define all(x) x.begin(), x.end()


#define dbg(args...) {cerr<<"-->";debugger::call(#args,args);cerr<<"\n";}
struct debugger {
    static void call(const char* it) {}
    template<typename T, typename ... aT>
    static void call(const char* it, T a, aT... rest) {
        string b;
        for (; *it&&*it != ','; ++it) if (*it != ' ')b += *it;
        cerr << b << "=" << a << " ";
        call(++it, rest...);
    }
};

int main()
{
#ifdef SunWalker
    //read;
   //write;
#endif

     int n,a[100010],last=LONG_MAX,c=0,mx=0;
     cin>>n;

     FOR(i,n)
     {
          cin>>a[i];
          if(i>0){
          if(a[i]<=a[i-1])c++;
          else c=0;
          }
          mx = max(mx,c);
     }

     cout<<mx<<"\n";
return 0;
}



Measured memory_bytes: 640
package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)


func nextInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func swap(ints []int, b, e, t int) []int {
	for k := 0; k < e-b; k++ {
		ints[b+k], ints[t+k] = ints[t+k], ints[b+k]
	}
	return ints
}

func main() {
	scanner.Split(bufio.ScanWords)
	n := nextInt()
	a := make([]int, n)
	for i := range a {
		a[i] = nextInt()
	}
	q := nextInt()
	for i := 0; i < q; i++ {
		b := nextInt()
		e := nextInt()
		t := nextInt()
		a = swap(a, b, e, t)
	}
	for i := range a {
		if i == len(a)-1 {
			fmt.Println(a[i])
		} else {
			fmt.Printf("%d ", a[i])
		}
	}
}


Measured memory_bytes: 1128
#include <cstdio>
using namespace std;
int v[200005];
int main() {
    int n;
    scanf("%d",&n);
    bool f=true;
    long long s=0;
    for(int i=0;i<n;i++)
        scanf("%d",&v[i]);
    for(int i=n;i--;)
    {
        if(v[i]>i||(i<n-1&&v[i]+1<v[i+1]))
            f=false;
        else if(i<n-1&&v[i]+1==v[i+1])continue;
        else s+=v[i];
    }
    if(f)
        printf("%lld\n",s);
    else
        printf("-1\n");
    return 0;
}


Measured memory_bytes: 896
n = int(input())
s = [('', 0)]
cnt = 0
ans = []
while s:
    t, k = s.pop()
    if len(t) == n:
        print(t)
    else:
        s.append((t + chr(k + 97), k + 1))
        for i in range(k - 1, -1, -1):
            s.append((t + chr(i + 97), k))


Measured memory_bytes: 4412
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    vector<int> pos, neg;
    cin >> n;
    for(int i = 0, x; i < n; ++i) {
        cin >> x;
        if(x >= 0) pos.push_back(x);
        else       neg.push_back(x);
    }
    sort(begin(pos), end(pos));
    sort(neg.rbegin(), neg.rend());
    
    int ans = 0;
    vector<pair<int, int>> op;
    
    if(pos.size() && neg.size()) {
        int mx = pos.back();
        int mn = neg.back();
        pos.pop_back();
        neg.pop_back();

        for(auto x : pos) {
            op.push_back({mn, x});
            mn -= x;
        }
        for(auto x : neg) {
            op.push_back({mx, x});
            mx -= x;
        }
        op.push_back({mx, mn});
        ans = mx - mn;

    } else if(pos.size()) {
        for(int i = 1; i < pos.size(); ++i) ans += pos[i];
        ans -= pos[0];
        for(int i = 1; i < (int)pos.size() - 1; ++i) {
            op.push_back({pos[0], pos[i]});
            pos[0] -= pos[i];
        }
        op.push_back({pos.back(), pos[0]});
    } else {
        for(int i = 1; i < neg.size(); ++i) {
            op.push_back({neg[0], neg[i]});
            neg[0] -= neg[i];
        }
        ans = neg[0];
    }
    cout << ans << endl;
    for(auto& x : op) cout << x.fi << ' ' << x.se << endl;
}


Measured memory_bytes: 3444
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> W(N),S(N);
    for (int i=0; i<N; i++) {
        cin>>W[i];
    }
    S[0]=W[0];
    for (int i=1; i<N; i++) {
        S[i]=S[i-1]+W[i];
    }
    
    
    int ans=S[N-1];
    for (int i=0; i<N; i++) {
        if (ans>abs((S[N-1]-S[i])-S[i])) {
            ans=abs((S[N-1]-S[i])-S[i]);
        }
    }
    
    
    cout << ans << endl;
}


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

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var item1 = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var A = item1[0];
            var B = item1[1];
            var M = item1[2];

            var item2 = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var a = new List<int>();
            foreach (var i in Enumerable.Range(0, A))
            {
                a.Add(item2[i]);
            }

            var item3 = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var b = new List<int>();
            foreach (var i in Enumerable.Range(0, B))
            {
                b.Add(item3[i]);
            }

            var answer = a.Min() + b.Min();
            foreach (var i in Enumerable.Range(0, M))
            {
                var item4 = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
                var x = item4[0];
                var y = item4[1];
                var c = item4[2];
                answer = Math.Min(a[x - 1] + b[y - 1] - c, answer);
            }

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 38876
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef pair<double,double> P;
typedef pair<double,P> PP;

vector<PP> d;

int main() {
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) {
    double x,y;
    cin >> x >> y;
    d.push_back(PP(atan2(y,x),P(x,y)));
  }

  sort(d.begin(),d.end());


  long double ans = 0;

  for(int i = 0; i < n; i++) {
    long double x = 0;
    long double y = 0;
    for(int j = 0; j < n; j++) {
      x += d[(i+j) % n].second.first;
      y += d[(i+j) % n].second.second;
      ans = max(ans,sqrt(x*x+y*y));
    }
  }

  cout << setprecision(20) << ans << endl;
  

 
}
	


Measured memory_bytes: 384
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define MOD 1000000007 
#define MAX 1000005
#define loop(i,a,b) for(long long int i=a;i<b;i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
typedef long long int ll;
using namespace __gnu_pbds;
using namespace std;
//using namespace boost::multiprecision;

#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>

ll fact[MAX],inv_fact[MAX];

ll modular_expo(ll x,ll n)
{
	ll ans = 1;
	while(n)
	{
		if(n&1)
		ans = (ans * x)%MOD;
		x = (x*x)%MOD;
		n = n>>1;
	}
	return ans%MOD;
}

void fun()
{
	fact[0] = 1;
	for(ll i=1;i<MAX;i++)
	fact[i] = (fact[i-1] * i)%MOD;
	inv_fact[MAX-1] = modular_expo(fact[MAX-1],MOD-2);
	for(ll i=MAX-2;i>=0;i--)
	inv_fact[i] = (inv_fact[i+1] * (i+1))%MOD;
}


int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

//fun();

ll t=1;
//cin>>t;

while(t--)
{
	string str;
	cin>>str;
	
	string s="";
	
	for(auto it: str)
	{
		if(it == '?')
		s += 'D';
		else
		s+=it;
	}
	cout<<s<<"\n";
}



return 0;
}

Measured memory_bytes: 3892
a,b=map(int,input().split())

big=max(a,b)
sma=min(a,b)

while sma>0:
    mod=big%sma
    big=sma
    sma=mod

#print(big)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

if big==1:
    print(1)
else:
    print(len(factorization(big))+1) 

Measured memory_bytes: 3064
class SortingThreeNumbers
	def sorting(array)
		array.sort.each_with_index do |val, i|
			 unless i == 2 #配列の末尾ではない場合はスペースを付加  
			 	print "#{val} "
			 else
			 	puts "#{val}"
			 end
		end
	end
end

INPUT_LIMIT = 3
input = gets.split.map(&:to_i)

if input.length == INPUT_LIMIT
	SortingThreeNumbers.new.sorting(input)
else
	puts "You must input only #{INPUT_LIMIT} parameter"	
end

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n-1);
  rep(i,n){
    cin >> a[i];
  }
  rep(i,n){
    cin >> b[i];
  }  
  rep(i,n-1){
    cin >> c[i];
  }
  int ans;
  ans = 0;
  rep(i,n){
    ans += b[a[i]-1];
    if(i > 0 && a[i] == a[i-1] + 1){
      ans += c[a[i-1]-1];
    }
  }
  cout << ans;
  return 0;
}

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

int main() {
	string S, T;
	cin >> S;
	cin >> T;
	bool ans=false;
	if (S.size() == T.size() - 1) {
		for (int i = 0; i < S.size(); i++) {
			if (S[i] == T[i]) {
				ans = true;
			}
			else {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	
	if (ans == true) {
		cout << "Yes" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3588
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long GCM(long x, long y)
        {
            var s = x;
            var t = y;
            if (x < y) GCM(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return s / x * t;
        }



        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var input = Reads();
            var n = input[0];
            var a = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = Read();
            }
           
            var data = new long[n][];
          
            
        
            Array.Sort(a);
            data[0] = new long[2];
            data[0][0] = a[0];
            data[0][1]=1;
            var j = 0;
            for (int i = 1; i < n; i++)
            {
                data[i] = new long[2];
                if (a[i - 1] == a[i])
                {
                    data[j][1]++;
                }
                else
                {
                    j++;
                    data[j][0] = a[i];
                    data[j][1] = 1;
                }
            }
          
           
     
            long ans = 0;
            for (int i = 0; i < n; i++)
            {
                if (data[i][1]%2==1)
                {
                    ans++;
                }
            }
            Console.WriteLine(ans);

            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 25052
H, W = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]

for k in range(10):
	for i in range(10):
		for j in range(10):
			C[i][j] = min(C[i][j], C[i][k]+C[k][j])

ans = 0

for i in range(H):
	for j in range(W):
		if A[i][j] == -1:
			continue
		else:
			ans += C[A[i][j]][1]

print(ans)

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
struct Event {
    int a, b, c;
    Event() {
        a = b = c = 0;
    }
    Event(int _a, int _b, int _c) {
        a = _a;
        b = _b;
        c = _c;
    }
};
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N, Q;
    cin >> N >> Q;
    int s, t, x;
    vector<Event> E(2*N);
    for (int i = 0; i<N; i++) {
        cin >> s >> t >> x;
        E[i*2] = Event(s-x, 1, x);
        E[i*2+1] = Event(t-x, 0, x);
    }
    sort(E.begin(), E.end(), [](const Event &_a, const Event &_b) {
        if (_a.a == _b.a) return _a.b < _b.b;
        return _a.a < _b.a;
    });
    vector<int> D(Q);
    for (auto& d : D) cin >> d;
    int i = 0;
    set<int> S;
    for (auto d : D) {
        while (i < (int)E.size() && E[i].a <= d) {
            if (E[i].b) {
                S.insert(E[i].c);
            } else {
                S.erase(E[i].c);
            }
            i++;
        }
        printf("%d\n", S.empty() ? -1 : *(S.begin()));
    }
    return 0;
}


Measured memory_bytes: 16128
S = input()
week = {'SUN': 0, 'MON': 1, 'TUE': 2, 'WED': 3,
        'THU': 4, 'FRI': 5, 'SAT': 6}
if S == 'SUN':
    print(7)
else:
    print(7 - week[S])

Measured memory_bytes: 8748
# Single Source Shortest Path 2
from heapq import heappush, heappop

INF = 10**15
N = int(input())
W = [tuple(zip(*[map(int, input().split()[2:])]*2)) for _ in [0]*N]

H = []
checked = [False]*N
D = [INF]*N
D[0] = 0


heappush(H, (D[0], 0))

while H:
    d, v = heappop(H)
    checked[v] = True

    if D[v] < d:
        continue

    for u, w in W[v]:
        if not checked[u]:
            if D[v] + w < D[u]:
                D[u] = D[v] + w
                heappush(H, (D[u], u))


[print(i, d) for i, d in enumerate(D)]



Measured memory_bytes: 68124
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import qualified Data.Text.Lazy.Read as T
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  as <- map unsafeTextToInt . T.words <$> T.getContents :: IO [Int]
  let
    as' = VU.fromList as :: VU.Vector Int
    x1 = VU.foldl1 subtract $ as' :: Int
    xs = VU.prescanl subtract x1 . VU.map (2 *) $ as' :: VU.Vector Int
  putStrLn . unwords . map show . VU.toList $ xs

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 7252
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
print(s[0] + str(len(s)-2) + s[-1])

Measured memory_bytes: 74384
#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>;

set<int> g[100010];
set<int> bl[100010];
set<int> s;
int cnt(int i) {
  s.emplace(i);

  int ans = 0;
  for (int p : g[i]) {
    if (s.count(p) == 0) {
      ans += cnt(p);
    }
  }
  return ++ans;
}
int main() {
  int n,m,k;
  cin >> n >> m >> k;

  rep(i,m){
    int a,b;
    cin >> a >> b;
    --a;--b;
    g[a].emplace(b);
    g[b].emplace(a);
  }
  rep(i,k){
    int c,d;
    cin >> c >> d;
    --c;--d;
    bl[c].emplace(d);
    bl[d].emplace(c);
  }

  vector<int> ans(n,-1);
  rep(i,n) {
    if (ans[i]>=0) {
      continue;
    }
    s = set<int>();
    int c = cnt(i);
    for (int j : s) {
      ans[j] = c;
      for (int k : g[j]) {
        if (s.count(k)>0) {
          ans[j]--;
        }
      }
      for (int k : bl[j]) {
        if (s.count(k)>0) {
          ans[j]--;
        }
      }
      ans[j]--;
    }
  }
  
  rep(i,n) {
    if (ans[i]== -1) ans[i]=0;
    printf("%d ",ans[i]);
  }
  cout << endl;
}


Measured memory_bytes: 29568
#include <iostream>
using namespace std;
int main (){
int a,b,ans;
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: 3088
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;cin>>n;
	int ac=0,wa=0,tle=0,re=0;
	for(int i=0;i<n;i++){
	    string s;
	    cin>>s;
	    if(s=="AC"){ac++;}
	    if(s=="WA"){wa++;}
	    if(s=="TLE"){tle++;}
	    if(s=="RE"){re++;}
	}
	cout<<"AC"<<" "<<"x"<<" "<<ac<<endl;
	cout<<"WA"<<" "<<"x"<<" "<<wa<<endl;
	cout<<"TLE"<<" "<<"x"<<" "<<tle<<endl;
	cout<<"RE"<<" "<<"x"<<" "<<re<<endl;
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    ll n;
    int k;
    cin>>n>>k;
    if(k==0){
        cout<<n*n<<endl;
        return 0;
    }
    ll res=0;
    for(int b=k+1;b<=n;b++){
        ll shuki=(n+1)/b;
        ll par=b-k;
        ll rest=n%b-k+1;
        if(rest<0 || (n+1)%b==0) rest=0;
        res+=par*shuki+rest;
    }
    cout<<res<<endl;
    
    return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <cmath>
# include <cstdio>
# include <cstring>
# include <algorithm>
# include <vector>
# define pb push_back
using namespace std;
typedef long long LL;
int main()
{
    int n;
    cin >> n;
    int cnt = 0;
    int x = n;
    while(x)
    {
        cnt += x%10;
        x /= 10;
    }
    if(n%cnt==0) puts("Yes");
    else puts("No");
    return 0;
}


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

int main() {
  int32_t n;
  cin >> n;
  int32_t c[100002];
  for (int32_t i = 0; i < 100002; i++) {
    c[i] = 0;
  }
  for (int32_t i = 0; i < n; i++) {
    int32_t a;
    cin >> a;
    c[a]++;
    c[a + 1]++;
    c[a + 2]++;
  }
  int32_t max = 0;
  for (int32_t i = 0; i < 100002; i++) {
    if (c[i] > max) {
      max = c[i];
    }
  }
  cout << max << endl;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main() {
	int c1, c5, c10, c50, c100, c500;
	cin >> c1 >> c5>>  c10>>c50>>c100>>c500;
	if (c1*1 + c5*5 + c10*10 + c50*50 + c100*100 + c500*500 > 999)
		cout << 1 << endl;
	else
		cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <utility>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

vector<int> vec[100010];

int main(){
    int n,m;
    cin >> n >> m;
    vector<pii> vpii(m);
    map<pii,int> mp;

    int p,y;
    
    rep(i,m){
        cin >> p >> y;
        vpii[i] = make_pair(p,y);
        vec[p].push_back(y);
    }

    reps(i,1,n+1){
        sort(vec[i].begin(),vec[i].end(),less<int>() );
        
        rep(j,vec[i].size()){
            mp[make_pair(i,vec[i][j])] = j+1;
        }
    }

    rep(i,m){
        p = vpii[i].first;
        y = vpii[i].second;
        int order = mp[make_pair(p,y)];
        printf("%06d%06d\n",p,order);
    }    

    return 0;
}


Measured memory_bytes: 13952
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 200200;
const int LOG = 18;
int n;
vector<int> g[N], g2[N];
int X, Y;
int h[N];
int dist[N];
int par[N][LOG];
int q[N];
int topQ;

void read()
{
	scanf("%d%d%d", &n, &X, &Y);
	X--;Y--;
	for (int i = 1; i < n; i++)
	{
		int v, u;
		scanf("%d%d", &v, &u);
		v--;u--;
		g[v].push_back(u);
		g[u].push_back(v);
	}
	for (int i = 1; i < n; i++)
	{
		int v, u;
		scanf("%d%d", &v, &u);
		v--;u--;
		g2[v].push_back(u);
		g2[u].push_back(v);
	}
	return;
}

void dfs(int v)
{
	for (int u : g2[v])
	{
		if (h[u] != -1) continue;
		h[u] = h[v] + 1;
		par[u][0] = v;
		for (int k = 1; k < LOG; k++)
		{
			int w = par[u][k - 1];
			if (w == -1)
			{
				par[u][k] = -1;
				continue;
			}
			par[u][k] = par[w][k - 1];
		}
		dfs(u);
	}
	return;
}

int up(int v, int dh)
{
	for (int k = LOG - 1; k >= 0; k--)
	{
		if (dh >= (1 << k))
		{
			dh -= 1 << k;
			v = par[v][k];
		}
	}
	return v;
}
int LCA(int v, int u)
{
	if (h[v] > h[u]) swap(v, u);
	u = up(u, h[u] - h[v]);
	if (v == u) return v;
	for (int k = LOG - 1; k >= 0; k--)
	{
		if (par[v][k] != par[u][k])
		{
			v = par[v][k];
			u = par[u][k];
		}
	}
	return par[v][0];
}

void precalc()
{
	for (int i = 0; i < n; i++)
	{
		h[i] = -1;
		for (int j = 0; j < LOG; j++)
			par[i][j] = -1;
	}
	h[Y] = 0;
	dfs(Y);
	return;
}

void solve()
{
	for (int i = 0; i < n; i++)
		dist[i] = N;
	topQ = 1;
	q[0] = X;
	dist[X] = 0;
	int ans = 0;
	for (int k = 0; k < topQ; k++)
	{
		int v = q[k];
		ans = max(ans, 2 * h[v]);
		for (int u : g[v])
		{
			int w = LCA(v, u);
			if (h[v] + h[u] - 2 * h[w] >= 3)
			{
				printf("-1\n");
				return;
			}
			if (dist[u] <= dist[v] + 1) continue;
			if (h[u] < dist[v] + 1) continue;
			if (h[u] == dist[v] + 1)
			{
				ans = max(ans, 2 * h[u]);
				continue;
			}
			dist[u] = dist[v] + 1;
			q[topQ++] = u;
		}
	}
	printf("%d\n", ans);
	return;
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	read();
	precalc();
	solve();

	return 0;
}

Measured memory_bytes: 46588
n = int(input())
a = list()

for i in range(n):
	x, y = input().split()
	y = int(y)
	if x == "S":
		a.append(y + 0)
	if x == "H":
		a.append(y + 13)
	if x == "C":
		a.append(y + 26)
	if x == "D":
		a.append(y + 39)
        
for i in range(1, 53):
	if not (i in a):
		if i <= 13:
			print("S {}".format(i - 0))
		elif i <= 26:
			print("H {}".format(i - 13))
		elif i <= 39:
			print("C {}".format(i - 26))
		else:
			print("D {}".format(i - 39))



Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;



int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS


    int n,m,c;
    cin >> n >> m >> c;

    vector<int> b(m);

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

    int ans = 0;

  for(int j = 0; j < n; j++)
  {
    int val = c;

    for(int i = 0; i < m; i++)
    {
      int x;
      cin >> x;
      val += x*b[i];
    }
    if(val > 0)ans++;
  }

  cout << ans;

    return 0; 
}


Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

const int INF = INT_MAX / 2;

long long solve(const vector<int>& a)
{
    int n = a.size();
    vector<long long> dp(5, 0);
    for(int i=0; i<n; ++i){
        vector<long long> nextDp(5, INF);
        long long tmp = dp[0];
        nextDp[0] = tmp + a[i];

        tmp = min(tmp, dp[1]);
        nextDp[1] = tmp + (a[i] == 0 ? 2 : a[i] % 2);

        tmp = min(tmp, dp[2]);
        nextDp[2] = tmp + ((a[i] + 1) % 2);

        tmp = min(tmp, dp[3]);
        nextDp[3] = tmp + (a[i] == 0 ? 2 : a[i] % 2);

        tmp = min(tmp, dp[4]);
        nextDp[4] = tmp + a[i];

        dp = move(nextDp);
    }
    return *min_element(dp.begin(), dp.end());
}

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

    vector<int> b = a;
    reverse(b.begin(), b.end());

    long long ans = min(solve(a), solve(b));
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1920
n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

k.times do
  arr = Array.new(n + 1) { 0 }

  a.each_with_index do |e, idx|
    l = [idx - e, 0].max
    r = [idx + e + 1, n].min
    arr[l] += 1
    arr[r] -= 1
  end

  tmp = 0
  arr.map! { |e| tmp += e }
  arr.pop
  a = arr

  if a.count(n) == n
    puts a.join(' ')
    exit
  end
end

puts a.join(' ')

Measured memory_bytes: 80656
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;

int main() {
  string s;cin>> s;
  int cnt_n = 0;
  int cnt_s = 0;
  int cnt_e = 0;
  int cnt_w = 0;
  for(int i=0;i<s.size();++i){
    string sub = s.substr(i,1);
    if(sub=="N"){
      ++cnt_n;
    } else if(sub=="S"){
      ++cnt_s;
    } else if (sub=="E"){
      ++cnt_e;
    } else if(sub=="W"){
      ++cnt_w;
    }
  }
  bool valid = false;
  if((cnt_n ==0 && cnt_s ==0) ||(cnt_n !=0 && cnt_s !=0)) {
    if((cnt_w ==0 && cnt_e ==0) ||(cnt_w !=0 && cnt_e !=0)){
      valid = true;
    }
  }
  if(valid){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

#define ll long long
#define ld long double
#define xx first
#define yy second
#define vl vector<ll>
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()

#define MAX 400005

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

    ll a, b, n;
    cin >> a >> b >> n;

    ll lo=1, hi=n, mx = 0;

    while(lo<=hi)
    {
        ll mid = (lo+hi)/2;

        if((a*mid)/b -(a*(mid/b))>=mx)
        {
            mx = (a*mid)/b -(a*(mid/b));

            lo = mid+1;
        }
        else hi = mid-1;
    }

    cout << mx << endl;
    
    

    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;
typedef pair<double, double> dd;
#define mp make_pair
#define pb push_back
#define debug(x) cerr << #x << " = " << x << " "

const int N = 18;
const int B = 1<<N;
const int D = 2;
struct Maxi
{
  int a[D];
  void update(int x)
  {
    for (int i = 0; i < D; ++i)
      if (a[i] < x) swap(x, a[i]);
  }
  void update(const Maxi &rhs)
  {
    for (int i = 0; i < D; ++i) update(rhs.a[i]);
  }
  void init(int x)
  {
    memset(a, 0, sizeof(a));
    a[0] = x;
  }
  ll sum()
  {
    ll ret = 0;
    for (int i = 0; i < D; ++i) ret += a[i];
    return ret;
  }
} d[B];
int main()
{
  int n;
  while (~scanf("%d", &n))
    {
      for (int i = 0; i < (1<<n); ++i)
	{
	  int x; scanf("%d", &x);
	  d[i].init(x);
	}
      for (int i = 0; i < n; ++i)
	for (int j = 0; j < (1<<n); ++j)
	  if ((j>>i)&1)
	    d[j].update(d[j^(1<<i)]);
      ll ans = 0;
      for (int i = 1; i < (1<<n); ++i)
	{
	  ans = max(ans, d[i].sum());
	  printf("%lld\n", ans);
	}
    }
}


Measured memory_bytes: 5120
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		WriteLine(GetString().Substring(0, 3));
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 25812
n,k = (int(i) for i in input().split())
d = list(int(i) for i in input().split())
for i in range(n,10*n):
    si = str(i)
    flag = True
    for j in range(len(si)):
        if int(si[j]) in d:
            flag = False
            break
    if flag:
        print(si)
        break 

Measured memory_bytes: 3064
// ABC085

// inputに入力データ全体が入る
function Main(input) {
  var arr = input.split("\n");
  arr.shift(); //先頭は要素数なのでいらない
  // 重複を削除したリスト
  arr = arr.filter(function (x, i, self) {
    return self.indexOf(x) === i;
  });
  console.log(arr.length-1); //先頭の要素数は空白の状態で存在するのでその分-1
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n,m,k;
  cin >> n >> m >> k;
  bool judge = false;
  REP(i,n+1){
    REP(j,m+1){
      if(k==i*(m-j)+(n-i)*j){
        judge = true;
      }
      if(k==i*j + (n-i)*(m-j)){
        judge = true;
      }
    }
  }
  if(judge) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char input_data, output_data;
  scanf("%c", &input_data);

  if(input_data == 'A') output_data = 'T';
  else if(input_data == 'G') output_data = 'C';
  else if(input_data == 'C') output_data = 'G';
  else if(input_data == 'T') output_data = 'A';
  
  printf("%c\n", output_data);

  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>

using namespace std;
/*
int find(int x, vector<int> &p) {
if (p[x] == x)return x;
return p[x] = find(p[x], p);
}

void uni(int x, int y, vector<int> &p) {
x = find(x, p);
y = find(y, p);
p[x] = y;
}

int same(int x, int y, vector<int> p) {
if (find(x, p) == find(y, p))return 1;
return 0;
}
*/

int main() {
	long long N, K, cnt = 0, tmp, ans = 0;
	long long r, D, X;

	cin >> r >> D >> X;
	ans = X;
	for (int i = 0; i < 10; i++) {
		ans = r*ans - D;
		cout << ans << endl;
	}

	char qq;
	cin >> qq;
	return 0;
}

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

int main() {
	long N,H,Tdamage=0;
	double slash=0;
	cin >> N>> H;
	vector<int> A(N), B(N);
	for (size_t i = 0; i < N; i++)
	{
		cin >> A.at(i) >> B.at(i);
	}
	sort(A.begin(), A.end(),greater<int>());
	sort(B.begin(), B.end(),greater<int>());
	int cnt = 0;
	while (cnt<N && B.at(cnt)>A.at(0)&&H>0) {
		//cout << "ポイ";
		H -= B.at(cnt);
		cnt++;
	}
	if (H>0)slash = ceil((H /double( A.at(0))));
	//cout << slash;
	cout <<long(( cnt + slash));
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    ll n;
    cin >> n;
    ll x, m;
    cin >> x >> m;
    ll ans = 0;
    rep(i,m){
        n--;
        ans += x;
        x = x * x % m;
        if(n==0){
            cout << ans << endl;
            return 0;
        }
    }
    vector<ll> a;
    a.push_back(x);
    if(x * x % m == x){
        cout << ans + n * x << endl;
        return 0;
    }
    while(1){
        ll t = a.back() * a.back() % m;
        if(t != x)a.push_back(t);
        else break;
    }
    ans += n/a.size() * accumulate(a.begin(), a.end(), 0LL);
    n %= a.size();
    while(n--){
        ans += x;
        x = x * x % m;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3824
N, M = map(int, input().split())

from collections import defaultdict
fav = defaultdict(int)
for i in range(N):
    KA = list(map(int, input().split()))
    for i in range(1, KA[0]+1):
        fav[str(KA[i])] += 1

ans = 0
for i in fav.keys():
    if fav[i] == N:
        ans += 1
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
map <int,int> used;
main () {
	int n,m;
	cin >>n >>m;
	int a;
	for (int i = 1; i <= m; i++) {
		cin >>a;
		used[a] = 1;
	}
	int mn = 1e9, ans = n;
	for (int i = 0; i <= 1000; i++) {
		if (used[i] == 0) {
			if (abs(n - i) < mn) {
				mn = abs(n - i);
				ans = i;
			}
		}
	}
	cout <<ans;
}

Measured memory_bytes: 3688