akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define MINF(a) memset(a, 0x3f, sizeof(a))
#define POW(n) (1LL << (n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e, v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;



void _main() {
    int r;
    cin >> r;
    cout << r * r << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i')) freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o')) freopen("output.txt", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
  cin >> n;
  int l, r;
  int seat = 0;
  for(int i = 0;i < n; ++i){
    cin >> l >> r;
    seat += (r - l + 1);
  }
  cout << seat << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <unordered_map>
#include <cmath>
using namespace std;

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18

int main()
{
    string S;
    cin >> S;
    if ((S[0] == '7') || (S[1] == '7') || (S[2] == '7'))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3632
import collections

if __name__ == '__main__':

    n = int(input())
    a = list(map(int, input().split()))

    c = collections.Counter(a)

    all = 0

    for item in c.items():
        all += item[1] * (item[1] - 1) //2

    for i in range(n):
        item = c[a[i]]
        after = item * (item-1) // 2
        before = (item-1) * (item-2) // 2
        #print(after, before)
        ans = all - after + before
        print(ans)


Measured memory_bytes: 26780
#include <stdio.h>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <iomanip>
using namespace std;


struct KUSURI {
	int p;
	int x;
};


int main()
{
	int n, m;
	int *T;
	KUSURI *ku;

	cin >> n;

	T = new int[n];

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

	cin >> m;

	ku = new KUSURI[m];

	for (int i = 0; i < m; i++) {
		cin >> ku[i].p >> ku[i].x;
	}

	int score = 0;
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			if (ku[i].p - 1 == j) {
				score += ku[i].x;
			}
			else {
				score += T[j];
			}
		}
		cout << score << endl;
		score = 0;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

typedef tuple<ll, ll, ll> T;

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

ll H,W,N;
ll A[111111],B[111111];
set<LP> coord, S;//入力座標，入力座標の周辺座標
ll ans[100];
void make(ll y, ll x){
    REP(i,3){
        REP(j,3){
            int ny = y-i, nx = x-j;
            if(ny>=1 && ny<=H-2 && nx>=1 && nx<=W-2){
                S.insert({ny,nx});
            }
        }
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>H>>W>>N;
    REP(i,N){
        cin>>A[i]>>B[i];
        coord.insert({A[i],B[i]});
        make(A[i],B[i]);
    }
    ll white = (W-2)*(H-2);
    for(LP p : S){
        ll y = p.first, x = p.second;
        int cnt = 0;
        for(ll i = y;i<y+3;i++){
            for(ll j=x;j<x+3;j++){
                if(coord.find({i,j})!=coord.end()) cnt++;
            }
        }
        if(cnt) white--;
        ans[cnt]++;
    }
    ans[0]=white;
    REP(i,10) cout<<ans[i]<<endl;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"
#define int ll

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

  int D;
  cin>>D;
  int N=26;
  vector<int>c(N);
  for(int i=0;i<N;i++)cin>>c[i];
  vector<vector<int>>s(D,vector<int>(N));
  for(int i=0;i<D;i++)for(int j=0;j<N;j++)cin>>s[i][j];
  vector<int>t(D);
  for(int i=0;i<D;i++)cin>>t[i];
  for(int i=0;i<D;i++)t[i]--;
  ll ans=0;
  vector<int>last(N,-1);
  for(int i=0;i<D;i++){
    ans+=s[i][t[i]];
    last[t[i]]=i;
    for(int j=0;j<N;j++){
      if(last[j]==-1)ans-=c[j]*(i+1);
      else ans-=c[j]*(i-last[j]);
    }
    cout<<ans<<endl;
  }

  return 0;
}


Measured memory_bytes: 3752
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>

using namespace std;


struct Place{
    int id;
    int num;
};

int main(){
    int n, m, i, j, which;
    ifstream in("input.txt");
    ofstream out("output.txt");
    while(true){
        Place places[100];
        cin >> n >> m;
        if(n == 0 && m == 0){
            break;
        }
        for(i = 0; i < m; ++i){
            places[i].id = i + 1;
            places[i].num = 0;
        }
        for(i = 0; i < n; ++i){
            for(j = 0; j < m; ++j){
                cin >> which;
                if(which){
                    ++places[j].num;
                }
            }
        }
        for(i = m; i > 0; --i){
            for(j = 0; j < m - 1; ++j){
                if(places[j].num < places[j + 1].num){
                    swap(places[j], places[j + 1]);
                }
            }
        }
        for(i = 0; i < m; ++i){
            if(i){
                cout << " ";
            }
            cout << places[i].id;
        }
        cout << endl;
    }
    return 0;
}

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

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

    int n;
    cin >> n;
    int d[n];
    rep (i, n) cin >> d[i];
    int res = 0;
    rep (i, n-1) {
        Rep(j, i+1, n) {
            res += d[i] * d[j]; 
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define get(c,x) (upper_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
ll ans;
void solve() {
	int n;
	cin >> n;
	VI a(n), b(n), c(n);
	rep(i, 0, n)cin >> a[i];
	rep(i, 0, n)cin >> b[i];
	rep(i, 0, n)cin >> c[i];
	sort(all(a));
	sort(all(b));
	sort(all(c));
	int aa = 0, cc = 0;
	rep(i, 0, n) {
		while (aa < n&&a[aa] < b[i])aa++;
		while (cc<n&&b[i]>=c[cc])cc++;
		ans += 1LL * aa*(n - cc);
	}
	
	cout << ans << endl;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T_ = 1;
	//cin >> T_;
	for (int i = 0; i < T_; i++)solve();
	return 0;
}







Measured memory_bytes: 1408
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>
typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

using Graph = vector<vector<int> >;

int main() {
    // 頂点数と辺数
    int N, M; cin >> N >> M;

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
    }

    // BFS のためのデータ構造
    vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    que.push(0);

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }

    // 結果出力 (各頂点の頂点 0 からの距離を見る)
    if (dist[N-1] == 2) {
        cout << "POSSIBLE" << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 9592
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		int result = 0;
		for (int i = 0; i < N; i++) {
			int li = sc.nextInt();
			int ri = sc.nextInt();
			result += (ri - li + 1);
		}
		sc.close();
		System.out.println(result);
	}
}

Measured memory_bytes: 25044
using System;

namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            const int MaxCount = 26;
            var count = new int[MaxCount];
            for(string input; (input = Console.ReadLine()) != null;
                Array.ForEach(input.ToLower().ToCharArray(), p => {
                    if(Char.IsLower(p)) {
                        ++count[p - 'a'];
                    }
            }));
            for(int i = 0; i < MaxCount; ++i){
                Console.WriteLine("{0} : {1}", (char)('a' + i), count[i]);
            }
        }
    }
}

Measured memory_bytes: 5684
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(int i=0;i<n;i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
int arr[3003][3003];
    

int main(){
    string s,t;
    cin>>s>>t;
    IOS
    int l1=sz(s);
    int l2=sz(t);
    
    

    FOR(i,1,l1){
        FOR(j,1,l2){
            arr[i][j]=0;
            if(s[i-1]==t[j-1]) arr[i][j]=1+arr[i-1][j-1];   
                
            else arr[i][j]=max(arr[i-1][j],arr[i][j-1]);
        }
    }

    int x_in=l1;
    int y_in=l2;
     
     string ans;
    while(x_in>0&&y_in>0){
        if(s[x_in-1]==t[y_in-1]) {
            ans=ans+s[x_in-1];
            x_in=x_in-1;
            y_in=y_in-1;
        }
        else if(arr[x_in][y_in-1]>=arr[x_in-1][y_in]){
            y_in=y_in-1;
        }
        else if(arr[x_in][y_in-1]<arr[x_in-1][y_in]){
            x_in=x_in-1;
        }
    }  
     reverse(all(ans));
    cout<<ans<<endl;
 

    
}

Measured memory_bytes: 35456
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, a, b) for (int i = a; i < (b); i++)
#define FOR(i, n) for (int i = n; i >= 0; i--)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
using namespace std;
long long c[51][51];

int main() {
  int n, p;
  cin >> n >> p;
  int a[51];
  REP(i, n) cin >> a[i];
  c[0][0] = 1;
  for (int i = 1; i < 51; i++) {
    c[i][0] = 1;
    c[i][i] = 1;
    for (int j = 1; j < i; j++) {
      c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
    }
  }
  int odd = 0, even = 0;
  REP(i, n) if (a[i] % 2 == 1) odd++;
  even = n - odd;

  unsigned long long ans1 = 0, ans2 = 0;
  REP(i, even + 1) ans1 += c[even][i];

  for (int i = p; i < odd + 1; i += 2) ans2 += c[odd][i];
  cout << ans1 * ans2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5+7;
int u[N],v[N],c[N],group[N],num[N];
int f[N];
bool vis[N];
int sf(int x){
    return f[x]==x ? x : f[x] = sf(f[x]);
}
void un(int a,int b){
    f[sf(a)] = sf(b);
}
int main()
{
    ll m;
    ll Minedge=0,Maxedge=0;
    int n,q;
    scanf("%d%lld%d",&n,&m,&q);
    for(int i=0;i<=n;i++)f[i]=i;
    for(int i=0;i<q;i++){
        scanf("%d%d%d",&u[i],&v[i],&c[i]);
        if(c[i] == 0){
            un(u[i], v[i]);
        }
    }
    int cnt=0;
    for(int i=0;i<n;i++){
        if(!vis[sf(i)])cnt++;
        vis[sf(i)] = 1;
        group[i] = cnt;
        num[cnt]++;
    }
    bool flag = 0;
    for(int i=0;i<q;i++){
        if(c[i] == 1){
        	flag = 1;
        	if(sf(u[i]) == sf(v[i])){
        		puts("No");
        		return 0;
			}
        }
    }
    if(flag && cnt <= 2){
    	puts("No");return 0;
	}
	else{
		for(int i=1;i<=cnt;i++){
			Minedge += num[i] - 1;
		}
		Maxedge = Minedge + 1ll * cnt * (cnt-1) / 2;
		if(flag) Minedge += cnt;
		else Minedge += cnt - 1;
	}
	//Maxedge = Minedge + 1ll * cnt * (cnt-1) / 2 - cnt + (!flag ? 1 : 0);
    if(Minedge <= m && m <= Maxedge){
        puts("Yes");
    }
    else{
        puts("No");
    }
}

Measured memory_bytes: 2688
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N, K;
  string S;
  cin >> N >> K >> S;
  int64_t neq = 0;
  for (int64_t i = 0; i <= N - 2; ++i) {
    if (S[i] != S[i + 1]) {
      ++neq;
    }
  }
  neq -= min(neq, K * 2);
  const int64_t result = (N - 1) - neq;
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3784
def main():
    n = int(input())
    d = set()
    for i in range(n):
        c, w = input().split()
        if c == "insert":
            d.add(w)
        else:
            if w in d:
                print("yes")
            else:
                print("no")


if __name__ == '__main__':
    main()



Measured memory_bytes: 30996
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
	int H, W;
	cin >> H >> W;
	vector<string> S( H );
	for( auto &x : S )
    {
        cin >> x;
    }
	for( int i = 0; i < H; ++i )
	{
		for( int j = 0; j < W; ++j )
		{
			if( S[ i ][ j ] == '#' )
			{
				continue;
			}
			int cnt{};
			for( int k = i - 1; k <= i + 1; ++k )
			{
				for( int l = j - 1; l <= j + 1; ++l )
				{
					if( k >= 0 && l >= 0 && k != H && l != W && S[ k ][ l ] =='#' )
					{
						cnt++;
					}
				}
				S[ i ][ j ] = '0' + cnt;
			}
		}
	}
	for( auto &x : S )
	{
		cout << x << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int gcd(int X,int Y) {
    if(X%Y == 0) {
        return Y;
    }
    else {
        return gcd(Y,X%Y);
    }
}
signed main() {
    int N,K;
    cin >> N >> K;
    vector<int>A(N);
    int gd = 0,mx = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        mx = max(mx,A[i]);
        if(i) gd = gcd(gd,A[i]);
        else gd = A[i];
    }
    if(mx >= K && (K-mx)%gd == 0) {
        cout << "POSSIBLE" << endl;
    }
    else {
        cout << "IMPOSSIBLE" << endl;
    }
}


Measured memory_bytes: 3868
#include <stdio.h>
int main() {
	int n,a,p = 0,d = 0,q = 0;
	scanf("%d",&n);
	for(int i = 0; i < n; i++) {
		scanf("%d",&a);
		if(a%2 == 0) {
			if(a%4 == 0) {
				q++;
			} else {
				d++;
			}
		}
	}
	p = n - d - q;
//  	printf("%d%d%d",p,d,q);
 	if(d == 0) {
 		if(q >= p - 1) printf("Yes");
 		else printf("No");
 	} else {
 		if(q >= p) printf("Yes");
 		else printf("No");
 	}
	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int h,w,K,ans=1<<30,i,j,k,qx[805*805],qy[805*805],bg,ed,f[10][5]={{-1,0},{1,0},{0,-1},{0,1}},dis[805][805];
char s[805][805];
bool v[805][805];
int main()
{
	scanf("%d%d%d",&h,&w,&K);
	for(i=1;i<=h;++i)
	{
		scanf("%s",s[i]+1);
		for(j=1;j<=w;++j)
			dis[i][j]=1000000;
	}
	for(i=1;i<=h;++i)
	{
		for(j=1;j<=w;++j)
			if(s[i][j]=='S')
				break;
		if(j<=w)
			break;
	}
	bg=ed=1;
	qx[1]=i,qy[1]=j;
	v[i][j]=true;
	dis[i][j]=0;
	while(bg<=ed)
	{
		for(i=0;i<4;++i)
		{
			j=qx[bg]+f[i][0],k=qy[bg]+f[i][1];
			if(j>=1&&j<=h&&k>=1&&k<=w&&s[j][k]!='#'&&!v[j][k])
			{
				v[j][k]=true;
				++ed;
				qx[ed]=j,qy[ed]=k;
				dis[j][k]=dis[qx[bg]][qy[bg]]+1;
			}
		}
		++bg;
	}
	for(i=1;i<=h;++i)
		for(j=1;j<=w;++j)
			if(s[i][j]!='#'&&dis[i][j]<=K)
			{
				int g=min(min(i-1,j-1),min(h-i,w-j));
				if(g==0)
					ans=1;
				else
					ans=min(ans,(g-1)/K+2);
			}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 8960
#include <stdio.h>

int main() {
    int n, k;
    scanf("%d %d", &n, &k);

    int x[n], i, sum=0;
    for(i=0; i<n; i++) {
        scanf("%d", &x[i]);
        if(k-x[i]>x[i]) {
            sum += x[i];
        } else {
            sum += k-x[i];
        }
    }

    printf("%d\n", 2*sum);

    return 0;
    
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int k = s.nextInt();
   if(n%k==0)
       System.out.print(0);
   else
       System.out.print(1);
    }
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
string s;
int n;

void solve(){
    int target = 0;
    while(n>0){
        while(s[target]=='a'){
            if(target==s.size()-1)break;
            target++;
        }
        if(('z'+1)-s[target]<=n) {
            n -= ('z'+1)-s[target];
            s[target] = 'a';
        }
        if(target != s.size()-1)target++;
        if(target==s.size()-1){
            n = n%26;
            if(s[target]+n<='z')s[target]+=n;
            else s[target] = 'a'+ s[target] + n - 'z' - 1;
            break;
        }
    }
    cout << s << endl;
}

int main() {
    cin >> s;
    cin >> n;
    solve();
    return 0;
}

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

using namespace std;

int main(int argc, char *argv[]) {
  int64_t N, M;
  cin >> N >> M;
  int begin = 1, last = N;
  for(int i = 0; i < M; i++){
    int l, r;
    cin >> l >> r;
    begin = max(begin, l);
    last = min(last, r);
  }
  int ans = last - begin + 1;
  cout << (ans > 0 ? ans : 0) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fori(x,a,b) for (int x=a;x<=b;x++)
using namespace std;
int n,x;
int cnt[5];
double f[310][310][310];

double dp(int a,int b,int c)
{
    if (a+b+c==0) return 0.0;
    if (f[a][b][c] > -0.5) return f[a][b][c];
    double tg = (double) n/(a+b+c);
    double r=0;
    if (a)
    {
        r+=( dp(a-1,b,c) + tg)*a/(a+b+c);
    }
    if (b)
    {
        r+=( dp(a+1,b-1,c) + tg)*b/(a+b+c);
    }
    if (c)
    {
        r+=( dp(a,b+1,c-1) + tg)*c/(a+b+c);
    }
    return f[a][b][c] = r;
}
int main()
{
    cin>>n;
    fori(i,1,n)
    {
       cin>>x;
       cnt[x]++;
    }
    fori(i,0,n)
    fori(j,0,n)
    fori(k,0,n) f[i][j][k] = -1;
    double kq = dp(cnt[1],cnt[2],cnt[3]);
    cout<<fixed<<setprecision(14)<<kq;
}


Measured memory_bytes: 224464
from collections import Counter

N = int(input())
V = list(map(int, input().split()))
V1 = Counter(V[::2]).most_common()
V2 = Counter(V[1::2]).most_common()
lengthV1 = (N+1)//2
lengthV2 = N//2

if V1[0][0] != V2[0][0]:
    print(N-V1[0][1] - V2[0][1])
else:
    if len(V2) > 1:
        ans1 = N - V1[0][1] - V2[1][1]
    else:
        ans1 = N - V1[0][1] - 0
    if len(V1) > 1:
        ans2 = N - V2[0][1] - V1[1][1]
    else:
        ans2 = N - V2[0][1] - 0
    print(min(ans1, ans2))


Measured memory_bytes: 64620
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

vi dp;
vvi edges;

int dfs(int x) {
  if (dp[x] != -1) return dp[x];

  int mx = 0;
  rep(i, edges[x].size()) {
    int next = edges[x][i];
    mx = max(mx, dfs(next) + 1);
  }
  return dp[x] = mx;
}

int main() {
  int N, M; cin >> N >> M;
  edges.resize(N);
  vi x(M), y(M);
  rep(i, M) {
    cin >> x[i] >> y[i];
    x[i]--; y[i]--;
    edges[x[i]].pb(y[i]);
  }
  dp.assign(N, -1);
  int ans = 0;
  rep(i, N) {
    ans = max(ans, dfs(i));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10112
#include <iostream>

using namespace std;

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

	int n;
	cin >> n;

	int odd = 0;
	for (int i=0 ; i<n ; i++)
	{
		int x;
		cin >> x;

		if (x%2) odd++;
	}

	if (odd%2) cout << "NO" << endl;
	else cout << "YES" << endl;
}


Measured memory_bytes: 256
using static System.Math;
using System;

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var s = Console.ReadLine().Trim();
            if (s == "#") break;
            var ans = startL(s);
            var ans2 = startR(s);
            Console.WriteLine(Min(ans,ans2));
        }
    }
    static int startR ( string s)
    {
        var sL = s.Length;
        var count = 0;
        var r = int.Parse(s[0].ToString());
        var L = -1;
        var p = 1;
        var nextLeg = 'L';
        while (p < sL)
        {
            if (nextLeg == 'r')
            {
                r = int.Parse(s[p].ToString());
                if (!checkR(L, r)) { count++; L = r; nextLeg = 'r'; }
                else nextLeg = 'L';
            }
            else
            {
                L = int.Parse(s[p].ToString());
                if (!checkR(L, r)) { count++; r = L; nextLeg = 'L'; }
                else nextLeg = 'r';
            }
            p++;
        }
        return count;
    }
    static int startL (string s )
    {
        var sL = s.Length;
        var count = 0;
        var L = int.Parse(s[0].ToString());
        var r = -1;
        var p = 1;
        var nextLeg = 'r';
        while (p < sL)
        {
            if (nextLeg == 'r')
            {
                r = int.Parse(s[p].ToString());
                if (!checkR(L, r)) { count++; L = r;   nextLeg = 'r'; }
                else nextLeg = 'L';
            }
           else
            {
                L = int.Parse(s[p].ToString());
                if (!checkR(L, r)) { count++; r = L; nextLeg = 'L'; }
                else nextLeg = 'r';
            }
            p++;
        }
        return count;
    }
    static bool checkL (int L , int r)
    {
        if (r == 1 | r == 4 | r == 7)
            return (L == 1 | L == 4 | L == 7);
        if (r == 2 | r == 8)
            return (L == 2 | L == 8 | L == 1 | L == 4 | L == 7);
        return true;
    }
    static bool checkR (int L , int r)
    {
        if (L == 3 | L == 6 | L == 9)
            return (r == 3 | r == 6 | r == 9);
        if (L == 2 | L == 8)
            return (r == 2 | r == 8 | r == 3 | r == 6 | r == 9);
        return true;
    }
}



Measured memory_bytes: 19744
#######################################
import numpy as np
#######################################
n = int(input())
a = list(map(int, input().split()))
ret = np.zeros(n+1, dtype="int")
ret2 = []

for i in reversed(list(range(n))): 
  if sum(ret[::i+1][1:])%2 != a[i]:
    ret[i+1] = 1
    ret2.append(i+1)

print(sum(ret[1:]))
print(" ".join(list(map(str, ret2[::-1]))))

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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');

        var gcp = EuclideanAlgorithm(long.Parse(input[0]), long.Parse(input[1]));

        var primeNum = CountPrimeFactor(gcp);

        Console.WriteLine(primeNum + 1);

        Console.ReadLine();


    }

    public static long EuclideanAlgorithm(long a, long b)
    {
        if (a < b)
        {
            var temp = a;
            a = b;
            b = temp;
        }

        long result = 0;
        while (true)
        {
            var remainder = a % b;
            if (remainder == 0)
            {
                result = b;
                break;
            }
            else
            {
                a = b;
                b = remainder;
            }
        }

        return result;
    }

    public static int CountPrimeFactor(long max)
    {
        var primeList = new List<long>();

        for (long i = 2; i * i <= max; i++)
        {
            while (max % i == 0)
            {
                primeList.Add(i);
                max /= i;
            }
        }
        if(max > 1)
        {
            primeList.Add(max);
        }
        return primeList.Distinct().Count();
    }
}



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

int main(){
  ll N,A,B,x,y,sum=0;
  cin >> N >> A >> B >> x;
  for(int i=1;i<N;i++){
    y=x;
    cin >> x;
    sum += min(A*(x-y),B);
  }
  cout << sum << endl;
}

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

int main() {
  int n,k;
  cin >> n >> k;

  if(k > (n - 1) * (n - 2) / 2) {
    cout << -1 << '\n';
    return 0;
  }

  vector<pair<int,int>> ans;
  for (int i = 2; i <= n; i++) {
    ans.emplace_back(1, i);
  }
  int tot = (n - 1) * (n - 2) / 2;
  for (int i = 2; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if(tot == k) break;
      ans.emplace_back(i, j);
      tot--;
    }
    if(tot == k) break;
  }

  cout << ans.size() << '\n';
  for(auto it : ans) {
    cout << it.first << " " << it.second << '\n';
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;

int main() {
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  int minOne = min(A + B, C * 2);
  int ans = min(X, Y) * minOne;
  int remain = abs(X - Y);
  ans += (X > Y ? min(remain * minOne, remain * A): min(remain * minOne, remain * B));
  cout << ans << endl;
  return 0;
}



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

string t = "keyence";

int main(){
	string s;
	cin >> s;
	string temp = s;
	int n = s.size();
	bool ok = false;
	
	if(n==7){
		if(s==t){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
		return 0;
	}
	
	rep(i,8){
		if(s.erase(i,n-7) == t){
			ok = true;
		}
		s = temp;
	}
	
	if(ok){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
// #include <bits/std++.h>

#include <algorithm>
#define MAX_N 110 
#define MAX_W 100010
using namespace std;

int n,w;
int in[MAX_N][2];
long long dp[MAX_W][MAX_N];
long long maxv = 0;

long long rec(long long curw,long long curi){
    if(curi > n)
        return 0;
    if(curw > w)
        return 0;

    if(dp[curw][curi] != 0){
        return dp[curw][curi];
    }

    long long take = rec(curw + in[curi][0],curi + 1) + in[curi][1];
    if(curw + in[curi][0] > w)
        take = dp[curw][curi];
    long long skip = rec(curw,curi + 1);

    dp[curw][curi] = max(take,skip);
    return dp[curw][curi];

}

int main(int argc,char* argv[]){
    scanf("%d %d\n",&n,&w);


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

    long long out = rec(0,0);

    printf("%lld",out);


    return 0;
}



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

using namespace std;

int main(){
    int a, b, c, x, y;
    int ans = 0;
    scanf("%d %d %d %d %d", &a, &b, &c, &x, &y);
    if (a + b <= 2 * c){
        ans = a * x + b * y;
    } else{
        ans += 2 * c * min(x, y);
        if (x > y){
            if (a > 2 * c){
                ans += 2 * c * (x - y);
            }else{
                ans += a * (x - y);
            }
        }else {
            if (b > 2 * c){
                ans += 2 * c * (y - x);
            }else{
                ans += b * (y - x);
            }
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 128
def two_input():
    return map(int, input().split())

N, M = two_input()
L, R = [], []
for i in range(M):
    l, r = two_input()
    L.append(l)
    R.append(r)
    
maxl = max(L)
minr = min(R)

ans = 0
for i in range(N):
    if maxl <= i+1 <= minr:
        ans += 1

print(ans)

Measured memory_bytes: 11012
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
long long  mod = 1000000007;
long long A[100010], B[100010];
int main()
{
	int N;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%lld%lld", &A[i], &B[i]);
	}
	long long an = 0;
	for (int i = N - 1; i >= 0; i--) {
		A[i] += an;
		if (A[i] % B[i] != 0) {
			an += B[i] - (A[i] % B[i]);
		}
	}
	printf("%lld", an);
	return 0;
}

Measured memory_bytes: 1792
n = int(input())
h = list(map(int, input().split()))

sol = [0 for i in range(n)]
sol[0] = 0
sol[1] = abs(h[1]-h[0])
for i in range(2, n):
    sol[i] = min(sol[i-2] + abs(h[i-2]-h[i]), sol[i-1] + abs(h[i-1]-h[i]))

print(sol[n-1])


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

ll dp[111][111111];

int main(){
	
	ll n,w;cin >> n >> w;
	vector<pair<ll,ll>> v(n);
	REP(i,n)cin >> v[i].FI >> v[i].SE;
	
	REP(i,111)REP(j,111111)dp[i][j] = LLINF;
	dp[0][0] = 0;
	
	REP(i,n){
		REP(j,111111){
			dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
			if(j+v[i].SE < 111111)dp[i+1][j+v[i].SE] = min(dp[i+1][j+v[i].SE],dp[i][j] + v[i].FI);
		}
	}
	
	ll ans = 0;
	REP(i,111111)if(dp[n][i] <= w)ans = i;
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 96640
#include<iostream>
using namespace std;
int main()
{
    int c[4][4];
    for(int i = 1; i <= 3; i++){
        for(int j = 1; j <= 3; j++){
            cin >> c[i][j];
        }
    }
    bool check = true;
    if(c[1][1] + c[2][2] != c[1][2] + c[2][1]){
        check = false;
    }
    if(c[1][1] + c[3][3] != c[1][3] + c[3][1]){
        check = false;
    }
    if(c[1][2] + c[2][3] != c[1][3] + c[2][2]){
        check = false;
    }
    if(c[3][3] + c[2][2] != c[3][2] + c[2][3]){
        check = false;
    }
    if(c[2][1] + c[3][2] != c[2][2] + c[3][1]){
        check = false;
    }
    if(check == true){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  string s,t;
  cin >> s >> t;
  ll n=s.size();
  for(ll i=0;i<n;i++) {
    ll f=1;
    for(ll j=0;j<n;j++) {
      if(s[j]!=t[(j+i)%n]) f=0;
    }
    if(f) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
A,B,C = list(map(int, input().split()))
K = int(input())
for i in range(K):    
    if B >= C:
        C *= 2
    elif A >= B:
        B *= 2
#    print(A,B,C)
if A < B < C:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9180
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <functional>
#include <utility>
#include <unordered_map>
#define INF 2147483647
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
int main() {
	int N,H;
	cin >> N >> H;
	vector<int> a(N),b(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
	}
	int main_weapon = max_element(a.begin(), a.end()) - a.begin();
	sort(b.begin(), b.end(), greater<int>());
	int ans = 0;
	for (ans = 0; H > 0; ans++) {
		if (!b.empty() && b[0] > a[main_weapon]) {
			H -= b[0];
			b.erase(b.begin());
		}
		else {
				int at_n;
				int at = H;
				if (at % a[main_weapon] == 0)at_n = at / a[main_weapon];
				else at_n = at / a[main_weapon] + 1;
				H -= a[main_weapon] * at_n;
				ans += at_n - 1;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
N,K = map(int, input().split())
mod = 10**9+7
ans = 0
dp = [0] * (K+10)

for i in range(K,0,-1):
    x = K//i
    a = pow(x, N, mod)
    cnt = 2
    while i*cnt <= K:
        a -= dp[i*cnt]
        cnt += 1
    a %= mod
    dp[i] = a
    ans += a*i
    ans %= mod
print(ans)

Measured memory_bytes: 68840
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int n;
    int r;
    int minv = ~(2<<30);
    int maxv = (2<<30);
    cin>>n;
    for (int i=0; i<n; ++i) {
        cin>>r;
        maxv = max(maxv, r - minv);
        minv = min(minv, r);
    }
    cout<<maxv<<endl;
    return 0;
}



Measured memory_bytes: 3092
import java.io.*;

public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			int n;
			while (0 != (n = Integer.parseInt(in.readLine()))) {
				int[][] a = new int[n + 1][n + 1];
				for (int i = 0; i < n; i++) {
					String[] s = in.readLine().split(" ");
					int sum = 0;
					for (int j = 0; j < n; j++) {
						a[i][j] = Integer.parseInt(s[j]);
						sum += a[i][j];
					}
					a[i][n] = sum;
				}
				for (int i = 0; i <= n; i++) {
					int sum = 0;
					for (int j = 0; j <= n; j++) {
						sum += a[j][i];
					}
					a[n][i] = sum;
				}
				for (int i = 0; i <= n; i++) {
					for (int j = 0; j <= n; j++) {
						System.out.printf("%5d", a[i][j]);
					}
					System.out.println();
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 12000
import math
from collections import deque

def create_table(N, A):
    num_block = int(-(-math.log2(N)//1)) + 1
    dp = [[-1]*num_block for i in range(N)]
    for i in range(N):
        dp[i][0] = i
    for k in range(1, num_block):
        for i in range(N):
            e = min(N-1, i + (1 << (k - 1)))
            former = dp[i][k-1]
            later = dp[e][k-1]
            if A[former] > A[later]:
                dp[i][k] = later
            else:
                dp[i][k] = former
            if e == N-1:
                break
    return dp

def query(i, j, dp, A):
    if i == j:
      return i
    length = int(math.log2(abs(i-j)))
    former = dp[i][length]
    later = dp[j-(1<<length)+1][length]
    if A[former] > A[later]:
        return later
    return former
      
def run():
  N = int(input())
  g = {}
  for n in range(N):
    kc = list(map(int, input().split()))
    g[n] = kc[1:]
  Q = int(input())
  uv = [tuple(map(int, input().split())) for q in range(Q)]
  euler = []
  depths = []
  order = [-1]*N
  def dfs(now, pred, d):
    stacks = deque([(now, pred, d)])
    while stacks:
      now, pred, d = stacks.pop()
      euler.append(now)
      depths.append(d)
      if order[now] != -1:
        continue
      if order[now] == -1:
        order[now] = len(euler) - 1
      for nxt in g[now]:
        if nxt == pred:
          continue
        stacks.append((now, pred, d))
        stacks.append((nxt, now, d+1))
  dfs(0, -1, 0)
  #RMQ
  len_li = len(depths)
  dp = create_table(len_li, depths)
  #LCA
  for u, v in uv:
    o1, o2 = order[u], order[v]
    o1, o2 = min([o1, o2]), max([o1, o2])
    o = query(o1, o2, dp, depths)
    print(euler[o])
    if len(uv) == 1:
      exit()
  
if __name__ == '__main__':
  run()


Measured memory_bytes: 101172
#include <iostream>

#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)

const int A[] = {11, 31, 41, 61, 71, 101, 131, 151, 181, 191, 211, 241, 251, 271, 281, 311, 331, 401, 421, 431, 461, 491, 521, 541, 571, 601,
 631, 641, 661, 691, 701, 751, 761, 811, 821, 881, 911, 941, 971, 991, 1021, 1031, 1051, 1061, 1091, 1151, 1171, 1181, 1201,
 1231, 1291, 1301, 1321, 1361, 1381};

int main(void){
  int n; scanf("%d", &n);
  REP(i, n-1) printf("%d ", A[i]);
  printf("%d\n", A[n-1]);
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n;
	scanf("%d", &n);
	
	int ans = 0;
	for(int i=1;i<=n;i++){
		if( (1<=i && i<=9 ) || (100<=i && i<=999) || (10000<=i && i<=99999) )	ans++;
	}
	printf("%d", ans);
		
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n,k;cin >> n >> k;
  double res = 0;
  rep1(i,n){
    double x = (double)1./n;
    int j = i;
    while(j<k){
      j *= 2;
      x /= 2.;
    }
    res += x;
  }
  printf("%.11f\n", res);
  return 0;
}


Measured memory_bytes: 256
/*
  ∧,,∧
( 'ω' )つ ＜WA,またお前か！！　
（m9 ＼ 　　
　 ＼　 ＼
　 　 ) ) ＼
　 ／／ ＼ ＼
　 (＿） 　 (＿)
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int A, B;
    cin >> A >> B;

    int add, sub, mul = 0;
    add = A + B;
    sub = A - B;
    mul = A * B;

    int ans = max({add, sub, mul});
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int64_t Gcd(int64_t a,int64_t b){
    if(a%b==0) return b;
    Gcd(b,a%b);
}

int main(){
    int64_t N,M; cin>>N>>M;
    string S,T; cin>>S>>T;

    int64_t g=Gcd(N,M);
    bool possible=true;
    rep(i,0,g){
        if(S.at(N/g*i)!=T.at(M/g*i)) possible=false;
    }

    int64_t ans=-1;
    if(possible) ans=N/g*M;

    cout<<ans<<endl;
}

Measured memory_bytes: 512
sx, sy, tx, ty = map(int, input().split())

ans = ""
for j in range(ty-sy):
    ans += "U"
for i in range(tx-sx):
    ans += "R"
for j in range(ty-sy):
    ans += "D"
for i in range(tx-sx+1):
    ans += "L"
for j in range(ty-sy+1):
    ans += "U"
for i in range(tx-sx+1):
    ans += "R"
ans += "D"
ans += "R"
for j in range(ty-sy+1):
    ans += "D"
for i in range(tx-sx+1):
    ans += "L"
ans += "U"

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

vl fact,finv;
ll modpw(ll x,ll k){
	ll res=1;
	while(k!=0){
		if(k&1)res=res*x%MOD;
		x=x*x%MOD;
		k=k>>1;
	}
	return res;
}

ll comb(ll n,ll k) {
	if(n==0&&k==0)return 1;
	if(n<k||n<0)return 0;
	return fact[n]*finv[n-k]%MOD*finv[k]%MOD;
}

struct ferm{
	ferm(ll n){
		fact.resize(n);
		finv.resize(n);
		fact[0]=1;
		finv[0]=1;
		rep(i,n-1){
			fact[i+1]=(fact[i]*(i+1))%MOD;
			finv[i+1]=modpw(fact[i+1],MOD-2);
		}
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k,ans=0;
	cin>>n>>k;
	ferm(200001);
	chmin(k,n-1);
	rep(i,k+1){
		ll sum=1;
		sum*=(comb(n,i)*comb(n-1,i));
		ans+=sum;ans%=MOD;
	}
	puta(ans);
}


Measured memory_bytes: 3456
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}


vector<pair<pair<ll,string>, pair<ll,ll> > > py;

bool func1(pair<pair<ll, string>, pair<ll,ll> >a, pair<pair<ll,string> , pair<ll,ll> >b){
	if(a.second.first == b.second.first){
		return a.second.second < b.second.second;
	}
	else return a.second.first < b.second.first;
}

bool func2(pair<pair<ll, string>, pair<ll,ll> >a, pair<pair<ll,string> , pair<ll,ll> >b){
	return a.first.first < b.first.first;
}

string tosix(ll i){
	string ans = to_string(i);;
	while(ans.size() != 6){
		ans = '0' + ans;
	}
	return ans;
}

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

	ll N , M ;
	cin >> N >> M  ;
	rep(i, M){
		ll P , Y ;
		cin >> P >> Y ;
		py.pb(mp(mp(i, ""), mp(P,Y)));
	}

	sort(all(py), func1);

	ll idx = 0 ;
	rep(i, M){
		if(i != 0){
			if(py[i].second.first != py[i-1].second.first){
				idx = 0 ;
			}
		}
		idx ++;

		py[i].first.second = tosix(py[i].second.first) + tosix(idx);
	}

	sort(all(py), func2);

	rep(i,M){
		cout << py[i].first.second << endl;
	}

	//cout << fixed << setprecision(16) << ans << endl;
	return 0;
}


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

#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<30)
#define INFLL (1<<62LL)

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  array<int, 3> A;
  cin >> A[0] >> A[1] >> A[2];
  sort(A.begin(), A.end(), greater<int>());

  int ans = A[0] - A[1];

  int bc = A[1] - A[2];
  if (bc != 0) {
    if (bc % 2 == 0) ans += bc / 2;
    else ans += bc / 2 + 2;
  }

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


Measured memory_bytes: 256