akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

struct Benri {
    Benri() {
        std::cin.tie(0); ios::sync_with_stdio(false);
        cout << fixed << setprecision(12);
    }
} benri;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 1000000007LL
#define MOD2 998244353LL
const int INF = 1 << 28;


int funi(char X) {
    if (X == 'R') return 0;
    if (X == 'G') return 1;
    else return 2;
}

int next_combination(int sub) {
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}


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

    vll dp(8, 0);
    dp[0] = N;
    ll ans = 1;

    rep(k, 3 * N) {
        int i = funi(S[k]);
        int n = 3;
        bool f = false;

        int j = (1 << 2) - 1;
        for (; j < (1 << n); j = next_combination(j)) {
            if ((j & (1 << i)) == 0 && dp[j] != 0) {
                ans = (ans * dp[j]) % MOD2;
                dp[j | (1 << i)]++;
                dp[j]--;
                f = true;
                break;
            }
        }
        if(f) continue;

        j = (1 << 1) - 1;
        for (; j < (1 << n); j = next_combination(j)) {
            if ((j & (1 << i)) == 0 && dp[j] != 0) {
                ans = (ans * dp[j]) % MOD2;
                dp[j | (1 << i)]++;
                dp[j]--;
                f = true;
                break;
            }
        }
        if(f) continue;

        j = 0;
        ans = (ans * dp[j]) % MOD2;
        dp[j | (1 << i)]++;
        dp[j]--;
    }

    cout << ans << endl;

}




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

using namespace std;

#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned long long ull;


struct Q {
    int a, b, c, d;

    void scan() {
        scanf("%d %d %d %d", &a, &b, &c, &d);
        --a; --b;
    }
    int score(vector<int>& v) {
        return (v[b] - v[a] == c) ? d : 0;
    }
};


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


    int n, m;
    scanf("%d %d", &n, &m);

    int q;
    scanf("%d", &q);
    vector<Q> v(q);
    for (int i = 0; i < q; ++i)
        v[i].scan();


    int ans = 0;
    vector<int> a(n);

    function<void(int, int)> gen = [&](int i, int last) {
        if (i == n) {
            int score = 0;
            for (Q qr : v)
                score += qr.score(a);
            ans = max(ans, score);
            return;
        }
        for (int x = last; x < m; ++x) {
            a[i] = x;
            gen(i + 1, x);
        }
    };

    gen(0, 0);

    printf("%d\n", ans);


}


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

int main() {
  int N;
  cin >> N;
  int a[N];

  for (int i = 0; i < N; i++) cin >> a[i];
  int t = 0;
  int ans = N;
  for (int i = 0; i < N; i++) {
    if (a[i] == t+1) {
      t++;
      ans--;
    }
  }
  if (ans == N) { 
    cout << -1 << endl;
    return 0;
  } 
  else cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <bitset>
#include <cmath>
#include <string>
#include <stdlib.h>

#define ll long long
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)

using namespace std;


int main() {
    int N; cin >> N;
    vector<long long> A(N);repp(i, 0, N) cin >> A[i];

    bool allEven = true;
    repp(i,0,N) allEven &= A[i] % 2 == 0;
    if (allEven) cout << "second" << endl;
    else cout << "first" << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		String ans = "No";

		if(s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5))
			ans = "Yes";

		System.out.println(ans);
	}

}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

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

    ll ans = LINF;

    for (int i = 0; i < 3; ++i) {
        ll d1 = l[i] / 2;
        ll d2 = l[i] - d1;

        for (int j = 0; j < 3; ++j) {
            if (i == j) continue;

            d1 *= l[j];
            d2 *= l[j];
        }

        ans = min(ans, abs(d1 - d2));
    }

    cout << ans << endl;
}

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

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            // 整数の入力
            int n = int.Parse(Console.ReadLine());

            // 文字列の入力
            string s = Console.ReadLine();

            int resultCount = 0;
            for (int i = 1; i < n; ++i) {
                var strList1 = new List<string>();
                for (int j = 0; j < i; ++j) {
                    strList1.Add(s.Substring(j, 1));
                }

                var strList2 = new List<string>();
                for (int k = i; k < n; ++k) {
                    strList2.Add(s.Substring(k, 1));
                }

                var itemCount = 0;
                foreach (var item in strList1) {
                    if (strList2.Contains(item)) {
                        while (strList2.Contains(item)) {
                            strList2.Remove(item);
                        }
                        ++itemCount;
                    }
                }

                if (resultCount < itemCount) {
                    resultCount = itemCount;
                }
            }

            Console.WriteLine(resultCount);

        }
    }
}

Measured memory_bytes: 13024
w1, h1, n = map(int, input().split())
w0 = 0
h0 = 0
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        w0 = max(w0, x)
    elif a == 2:
        w1 = min(w1, x)
    elif a == 3:
        h0 = max(h0, y)
    else:
        h1 = min(h1, y)
print(max(0, (w1 - w0)) * max(0, (h1 - h0)))

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

#define RPT(i, b, e) for (int i = (b); i <= (e); i++)
#define RPT0(i, n) RPT(i, 0, n - 1)
#define RPT1(i, n) RPT(i, 1, n)
#define ALL(v) v.begin(), v.end()

int N;
string ans;

void resolve()
{
    cin >> N;
    vector<int> A(N);
    RPT0(i, N) cin >> A[i];

    sort(ALL(A));

    ans = "YES";
    RPT(i, 0, N - 2)
    {
        if (A[i] == A[i + 1]) {
            ans = "NO";
            break;
        }
    }

    cout << ans << endl;
}

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


Measured memory_bytes: 1024
//#include <bits/stdc++.h>
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
//#include <bitset>
#include <iterator>
#include <tuple>
#include <utility>
#include <string>
#include <vector>
//#include <queue>
//#include <deque>
//#include <map>
//#include <unordered_map>
//#include <set>
//#include <unordered_set>
//#include <stack>
using namespace std;

#define V             vector
#define PQ            priority_queue

#define pb            push_back
#define mp            make_pair
#define ins           insert
#define endl          '\n'
#define all(x)        x.begin(),x.end()
#define debug(X)      { cerr<<endl<<(#X)<<" = "<<(X)<<endl; }
//#define cerr if(0)cerr

#define mod           (1e9+7)

typedef long long ll;
typedef unsigned long long ull;


int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    string s;
    cin>>s;

    cout<<(s[2]==s[3]&&s[4]==s[5]?"Yes":"No")<<endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define MAX_T 50
#define WIDTH 7100
pair<int, vector<vector<int>>> E[MAX_T][WIDTH], D[WIDTH*4];
vector<vector<int>>X;
int hantei(vector<vector<int>>a) {
	int sum = 0;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			int Num = (a[i][j] + 15) % 16; if (a[i][j] == 0)continue;
			sum += abs(i - (Num / 4)) + abs(j - (Num % 4));
		}
	}
	return sum;
}
int main() {
	for (int i = 0; i < 4; i++) {
		vector<int>FF; for (int j = 0; j < 4; j++) { int p; cin >> p; FF.push_back(p); }
		X.push_back(FF);
	}
	E[0][0] = make_pair(hantei(X), X);
	for (int i = 0; i < MAX_T; i++) {
		int CNT = 0;
		if (E[i][0].first == 0) { cout << i << endl; break; }
		for (int j = 0; j < WIDTH; j++) {
			if (E[i][j].second.size() == 0)break;
			int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
			vector<vector<int>>H = E[i][j].second; int I = E[i][j].first;
			int C = 0;
			for (int k = 0; k < 16; k++) {
				if (H[k / 4][k % 4] == 0) {
					C = k;
				}
			}
			for (int k = 0; k < 4; k++) {
				vector<vector<int>>J = H;
				int Ex = (C / 4) + dx[k], Ey = (C % 4) + dy[k];
				if (Ex < 0 || Ex > 3 || Ey < 0 || Ey > 3)continue;
				swap(J[C / 4][C % 4], J[Ex][Ey]);
				D[CNT] = make_pair(hantei(J), J); CNT++;
			}
		}
		sort(D, D + CNT); E[i + 1][0] = D[0]; int cnt2 = 1;
		for (int k = 1; k < CNT; k++) {
			if (D[k - 1] == D[k])continue;
			E[i + 1][cnt2] = D[k]; cnt2++;
		}
	}
	return 0;
}

Measured memory_bytes: 81108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string s;
    cin>>s;
    int len=s.size();
    ll ans=0,p=1,now=0,cnt[2020]={0};
    cnt[0]=1;
    for(int i=len;i--;)
    {
        now=(now+ll(s[i]-'0')*p)%2019;
        ans+=cnt[now]++;
        p=p*10%2019;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;

int main() {
    int N,M;
    cin>>N>>M;

    int a,b;
    vector<int> to[1010];
    vector<int> shortest[1010];
    for (int i = 0; i < M; ++i) {
        cin>>a>>b; --a; --b;
        to[a].push_back(b);
    }

    for (int i = 0; i < N; ++i) {
        vector<int> prev(N,-1);
        //prev[i]=i;
        queue<int> q;
        q.push(i);
        while (!q.empty()){
            int node=q.front();
            q.pop();
            for(auto tsugi:to[node]){
                if(tsugi==i) {
                    prev[i]=node;
                    goto esc;
                }
                if(prev[tsugi]>=0) continue;
                prev[tsugi]=node;
                q.push(tsugi);
            }
        }
        esc:

        if(prev[i]==-1) continue;
        //cout<<i<<":loop"<<endl;
        shortest[i].push_back(i);
        int node=prev[i];
        while(true){
            if(node==i) break;
            shortest[i].push_back(node);
            node=prev[node];
        }

    }
    int ans=-1, len=N+1;
    for (int i = 0; i < N; ++i) {
        if(shortest[i].empty()) continue;
        if(shortest[i].size()<len){
            ans=i;
            len=shortest[i].size();
        }
    }

    if(ans==-1){
        cout<<-1<<endl;
        return 0;
    }

    cout<<shortest[ans].size()<<endl;
    for(auto node:shortest[ans]) cout<<node+1<<endl;

    return 0;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b=0,n;cin>>n;
  set<int> s;
  while(cin>>a){
    if(a>3199)b++;
    else s.insert(a/400);
  }
  a=s.size();
  cout<<max(1,a)<<" "<<a+b;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

// 0100001011110 -> 1 1 4 1 1 4 1
vector<int> compressBitString(const string& s){
	vector<int> p;
	int t = s.front() - '0';
	int cnt = 0;
	rep(i,s.size()){
		if(s[i] == t + '0'){
			cnt++;
		}else{
			p.emplace_back(cnt);
			cnt = 1;
			t ^= 1;
		}
	}
	if(cnt != 0){
		p.emplace_back(cnt);
	}
	return p;
}

signed main(){
	int n, k;
	string s;
	cin >> n >> k >> s;

	auto p = compressBitString(s);

	bool f = s.front() == '0';
	vector<int> b(p.size());
	rep(i,p.size()){
		b[i] = (i + f) % 2;
	}

	//for(auto i : p) cout << i << ' '; cout << endl;

	int left = 0, right = 0;
	int ksum = 0, sum = 0;
	int ans = 0;
	while(left < p.size() and right < p.size()){
		while(right < p.size() && ksum + b[right] <= k){
			sum += p[right];
			ksum += b[right];
			right++;
		}
		ans = max(ans, sum);

		while(ksum == k){
			sum -= p[left];
			ksum -= b[left];
			left++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 2164
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1))
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

vector<int> prod_perm(const vector<int>&a, const vector<int> &b) {
	//bに置換aを実行して返す。
	//すなわち、[0..N]→a になるような置換"→"によって、
	//b→ansとなるようなansを求めて返す。

	assert(a.size() == b.size());

	vector<int>ans(b.size());
	rep(i, b.size())ans[i] = b[a[i]];
	return ans;
}

vector<int> pow_perm(const vector<int>&perm, const int K) {
	//置換permのK乗を返す。

	if (K == 0) {
		vector<int>ans(K - 1);
		rep(i, ans.size())ans[i] = i;
		return ans;
	}
	if (K == 1)return perm;

	vector<int>half = pow_perm(perm, K / 2);

	if (K % 2 == 0)return prod_perm(half, half);
	else return prod_perm(prod_perm(half, half), perm);
}

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

	int N, M, K;
	cin >> N;
	int x[100000];
	rep(i, N)cin >> x[i];
	cin >> M >> K;
	int a[100000];
	rep(i, M)cin >> a[i];

	vector<int> perm(N - 1);
	rep(i, N - 1)perm[i] = i;
	rep(i, M)swap(perm[a[i] - 2], perm[a[i] - 1]);
	auto permK = pow_perm(perm, K);

	int dx[100000];
	rep(i, N - 1)dx[i] = x[i + 1] - x[i];

	int ans = x[0];
	rep(i, N - 1) {
		cout << ans << endl;
		ans += dx[permK[i]];
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 5960
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	static int[] S ;
	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();

		String[] Ws = W.split(" ");
		long[] A = new long[Ws.length];
		for (int i = 0; i < Ws.length; i++) {
			A[i] = Long.parseLong(Ws[i]);
		}
		long ans = 0;
		long sum = A[1]+A[2];
		long div = A[0] / sum;
		long mod = A[0] % sum;
		ans = div * A[1] + Math.min(mod, A[1]);

		System.out.println(ans);
	}


}


Measured memory_bytes: 21204
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using ll = long long;
using namespace std;

int main(){
  int N,M; cin >> N >> M;

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

  for(int i=0;i<N;i++){
    cout << cnt[i] << endl;
  }


  return 0;
}


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

int main(){
    int N;cin>>N;
    string s;cin>>s;
    string t1,t2;
    REP(i,N/2) t1.push_back(s[i]);
    rep(i,N/2,N) t2.push_back(s[i]);
    if(t1==t2) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

// void cout_result(bool y_diff, bool x_diff, int add_result){
//   if(y_diff){
//     rep(i, abs(y_diff)){
//       cout << 'U';
//     }
//   }else{
//     rep(i, abs(y_diff)){
//       cout << 'D';
//     }
//   }
//   if(x_diff < 0){
//     rep(i, abs(x_diff)){
//       cout << 'R';
//     }
//   }else{
//     rep(i, abs(x_diff)){
//       cout << 'L';
//     }
//   }
// }

int main(int argc, const char * argv[]) {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  int x_diff = sx-tx;
  int y_diff = sy-ty;
  // 1回目
  if(y_diff < 0){
    rep(i, abs(y_diff)){
      cout << 'U';
    }
  }else{
    rep(i, abs(y_diff)){
      cout << 'D';
    }
  }
  if(x_diff < 0){
    rep(i, abs(x_diff)){
      cout << 'R';
    }
  }else{
    rep(i, abs(x_diff)){
      cout << 'L';
    }
  }
  // 1回目往復
  if(y_diff > 0){
    rep(i, abs(y_diff)){
      cout << 'U';
    }
  }else{
    rep(i, abs(y_diff)){
      cout << 'D';
    }
  }
  if(x_diff > 0){
    rep(i, abs(x_diff)){
      cout << 'R';
    }
  }else{
    rep(i, abs(x_diff)){
      cout << 'L';
    }
  }

  // 2回目
  if(x_diff > 0){
    cout << 'R';
  }else{
    cout << 'L';
  }

  if(y_diff < 0){
    rep(i, abs(y_diff)+1){
      cout << 'U';
    }
  }else{
    rep(i, abs(y_diff)+1){
      cout << 'D';
    }
  }
  if(x_diff < 0){
    rep(i, abs(x_diff)+1){
      cout << 'R';
    }
  }else{
    rep(i, abs(x_diff)+1){
      cout << 'L';
    }
  }

  if(y_diff > 0){
    cout << 'U';
  }else{
    cout << 'D';
  }

  // 2回目往復
  if(x_diff < 0){
    cout << 'R';
  }else{
    cout << 'L';
  }

  if(y_diff > 0){
    rep(i, abs(y_diff)+1){
      cout << 'U';
    }
  }else{
    rep(i, abs(y_diff)+1){
      cout << 'D';
    }
  }
  if(x_diff > 0){
    rep(i, abs(x_diff)+1){
      cout << 'R';
    }
  }else{
    rep(i, abs(x_diff)+1){
      cout << 'L';
    }
  }

  if(y_diff < 0){
    cout << 'U';
  }else{
    cout << 'D';
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
int main(){
    string s;
    cin>>s;
    int n=s.length();
    int ap,zp;
    bool a = false;
    rep(i,n){
        if(s[i]=='A' && !a){
            ap = i;
            a = true;
        }
        if(a && s[i]=='Z'){
            zp = i;
            //break;
        }
    }
    cout<<zp-ap+1<<endl;
}

Measured memory_bytes: 3716
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

int main() {
	IOS();
	ll r, d, x;
	cin >> r >> d >> x;
	for (int i = 0; i < 10; i++) {
		x = r * x - d;
		dump(x);
	}
	return 0;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        BigInteger A = new BigInteger(sc.next()).subtract(BigInteger.ONE);
        BigInteger B = new BigInteger(sc.next());
        BigInteger C = new BigInteger(sc.next());
        BigInteger D = new BigInteger(sc.next());

        BigInteger lcm = C.multiply(D).divide(gcd(C, D));
        BigInteger x = B.divide(C).subtract(A.divide(C));
        BigInteger y = B.divide(D).subtract(A.divide(D));
        BigInteger z = B.divide(lcm).subtract(A.divide(lcm));

        System.out.println(B.subtract(A).subtract(x.add(y).subtract(z)));
    }

    public static BigInteger gcd(BigInteger m, BigInteger n)
    {
        BigInteger temp;
        while (!m.mod(n).equals(BigInteger.ZERO))
        {
            temp = n;
            n = m.mod(n);
            m = temp;
        }
        return n;
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){std::fill( (T*)array, (T*)(array+N), val );};


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

  int n;
  cin >> n;
  int h[n], memo[n];
  rep(i, n) cin >> h[i];
  memo[0] = 0;
  memo[1] = abs(h[0] - h[1]);
  REP(i, 2, n) {
    memo[i] = min(memo[i - 1] + abs(h[i - 1] - h[i]), memo[i - 2] + abs(h[i - 2] - h[i]));
  }
  cout << memo[n - 1] << endl;
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  long a[n];
  for (int i=0;i<n;i++){
    cin >> a[i];
  } 
  int cnt = 0;
  int max = 0;
  for (int i=0;i<n-1;i++){
    if (a[i] >= a[i+1]){
      cnt++;
    }else{
      if (cnt > max){
    max = cnt;
  }
      cnt = 0;
    }
  }
  if (cnt > max){
    max = cnt;
  }
  cout << max;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for(int i=0;i<(int)(n);++i)
#define FOR(i, b, n)  for(int i=b;i<(n);++i)
#define ALL(c) (c).begin(),(c).end()
#define SS size()
#define PB push_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; }

template <typename T> void print(T& w) {
    for(auto e : w) cout << e << ", ";
    cout << endl;
}


int main() {
  int n; cin >> n; 
  set<int> s; 
  REP(i,n) {
    int x; cin >> x; 
    s.insert(x);
  }
  cout << s.SS << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define rep(i, l, r) for (long long i = (l); i < (r); i++)
#define repb(i, r, l) for (long long i = (r); i > (l); i--)
#define pb push_back
 
using namespace std;
typedef vector<long long> vl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector< pair<long long, long long> > vp;
typedef long long int lli;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull; 
const int MAX_CHAR=256;
 
 
ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
} 
 
const ll mod = 1e9 + 7;
 
ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % mod;
        ex >>= 1ll;
        x = (x * x) % mod;
    }
    return ans;
} 

ll nCrModp(ll n, ll r, ll p) 
{ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1; 
    for (ll i = 1; i <= n; i++) 
    { 
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
}
 
bool isPrime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true;  
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 

vl countFreq(ll arr[], ll n) 
{ 
    unordered_map<ll, ll> mp; 
    vector <ll> v;
    
    for (ll i = 0; i < n; i++) 
        mp[arr[i]]++; 
   
    for (auto x : mp) 
        v.pb(x.second);
    
    return v;
}



int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll h,w,n;
    cin >> h >>w >>n;
    
    ll p=max(h,w);
    if(n%p==0)
        cout << n/p << endl;
    else 
        cout << n/p+1 << endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits.h>
#include <climits>
#include <map>
#include <unordered_map>
#include <cmath>
#include <set>
#include <unordered_set>
#include <iterator>
#include <deque>
#include <assert.h>
#include <cstdlib>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
ull min(ull x, ull y){ if (x<y) return x; return y;}
ull max(ull x, ull y){ if (x<y) return y; return x;}
ll min(ll x, ll y){ if (x<y) return x; return y;}
ll max(ll x, ll y){ if (x<y) return y; return x;}
double min(double x, double y){ if (x<y) return x; return y;}
double max(double x, double y){ if (x<y) return y; return x;}
ull gcd(ull x, ull y){
    if (!x) return y;
    if (!y) return x;
    if (x>y) swap(x,y);
    return gcd(x, y%x);
}
ull inv(ull a, ull c){ // a,c are coprime and a<c
    if (a==1){
        return 1;
    }
    return ((c-(c/a))*inv(c%a,c))%c;
}


int main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int n, m, x;
    cin>>n>>m>>x;
    int c[n], mat[n][m];
    for (int i = 0; i < n; i++){
        cin>>c[i];
        for (int j = 0; j < m; j++){
            scanf("%d", &mat[i][j]);
        }
    }
    int ans = INT_MAX;
    for (int b = 0; b < (1<<n); b++){
        vector<int> a(m,0);
        int cost = 0;
        for (int i = 0; i < n; i++){
            if ((b>>i)&1){
                cost += c[i];
                for (int j = 0; j < m; j++){
                    a[j]+=mat[i][j];
                }
            }
        }
        int ok = 1;
        for (int i = 0; i < m; i++){
            if (a[i]<x) ok = 0;
        }
        if (ok){
            ans = min(ans,cost);
        }
    }
    if (ans==INT_MAX) cout<<"-1\n";
    else cout<<ans<<"\n";
    return 0;
}





Measured memory_bytes: 3192
import sys
readline=sys.stdin.readline

N = int(readline())

DIV = 10 ** 9 + 7

dp = [[0] * 4 for i in range(N + 1)]

dp[0][0] = 1

for i in range(1, N + 1):
  dp[i][0] += dp[i - 1][0] * 8
  dp[i][0] %= DIV
  
  dp[i][1] += dp[i - 1][0] + dp[i - 1][1] * 9
  dp[i][1] %= DIV
  
  dp[i][2] += dp[i - 1][0] + dp[i - 1][2] * 9
  dp[i][2] %= DIV
  
  dp[i][3] += dp[i - 1][1] + dp[i - 1][2] + dp[i - 1][3] * 10
  dp[i][3] %= DIV
  
print(dp[-1][3])


Measured memory_bytes: 191244
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
	ll k, n;
	cin >> n >> k;
	cout << ((n+1)/2 >= k ? "YES" : "NO");





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 998244353
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
signed main(){
	string st;
	cin>>st;
	int lef = 0, rig = st.size() - 1, ans = 0;
	while( lef < rig ){
		int lct = 0, rct = 0;
		while( st[lef] == 'x' && lef <= st.size()-1 ){
			lct ++ ;
			lef ++ ;
		}
		while( st[rig] == 'x' && rig >= 0 ){
			rct ++ ;
			rig -- ;
		}
		if( st[lef] != st[rig] ){
			cout<<-1<<endl;
			return 0;
		}
		else if ( lef <= rig ){
			ans += abs( rct - lct );
		}
		lef++; rig--;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
const int maxn = 1e5 + 5;
vector<int> G[maxn];
int n,k;
typedef pair<int,int> pii;
int main(int argc, char const *argv[])
{
	cin>>n;
	for(int i = 0;i < n - 1; ++i)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		x--,y--;
		G[x].push_back(y);
		G[y].push_back(x);
	}
	cin>>k;
	priority_queue< pii,vector<pii>,greater<pii> > pq;
	vector<int> d(n,-1);
	for(int i = 0;i < k; ++i)
	{
		int v,p;
		scanf("%d%d",&v,&p);
		v--;
		d[v] = p;
		pq.push(pii(p,v));
	}
	while(!pq.empty())
	{
		pii p = pq.top();
		pq.pop();
		int u = p.second;
		for(int v : G[u])
		{
			if(d[v] == -1)
			{
				d[v] = d[u] + 1;
				pq.push(pii(d[v],v));
			}
		}
	}
	for(int u = 0;u < n; ++u)
	{
		for(int v : G[u])
		{
			if(abs(d[v] - d[u]) != 1)
			{
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	for(int i = 0;i < n; ++i)
	{
		printf("%d\n",d[i]);
	}
	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int d,t,s;
    cin >> d >> t >> s;
    if(d>t*s) cout << "No" << "\n";
    else cout << "Yes" << "\n";

    return 0;
}

Measured memory_bytes: 3664
#include "bits/stdc++.h"

#define rep(i,n) for(int i = 0;i<n;i++)
#define vv(Type,Name, n,m,d)vector<vector<Type>> Name(n, vector<Type>(m, d))
#define P pair
using namespace std;
using ll = long long;

int n, m, q;
vector<int> a, b, c, d;
int ans = 0;
void dfs(vector<int> A) {
	

	if (A.size() == n+1) {
		//score
		int now = 0;
		rep(i, q) {
			if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
		}
		ans = max(ans, now);
		return;
	}

	A.push_back(A.back());
	while (A.back() <= m) {
		dfs(A);
		A.back()++;
	}



}





int main(void) {

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

	cin >> n >> m >> q;

	a = b = c = d = vector<int>(q);

	rep(i, q) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}

	dfs(vector<int>(1,1));
	cout << ans << endl;



	return 0;
}


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

typedef pair<int,int> P;
const int INF = 500000000;

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

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int main(){
	int n;
	cin >>n;
		int card[205]={0};
		int cardA[205]={0};
		int cardB[205]={0};
		for(int i=0;i<2*n;i++){card[i]=i+1;}
		int m;
		cin >>m;
		for(int i=0;i<m;i++){
			int k;
			cin >>k;
			if(k==0){
				for(int i=0;i<n;i++){cardA[i]=card[i];}
				for(int i=0,j=n;i<n;i++,j++){
                        cardB[i]=card[j];
                }
				for(int i=0;i<n;i++){
					card[2*i] = cardA[i];
					card[2*i+1] = cardB[i];
                    }
                }
			else{
				for(int i=0;i<k;i++){cardA[i]=card[i];}
				for(int i=k,j=0;i<2*n;i++,j++){cardB[j]=card[i];}
				for(int i=0;i<2*n-k;i++){card[i]=cardB[i];}
				for(int i=2*n-k,j=0;i<2*n;i++,j++){card[i] = cardA[j];}
			}
		}
		for(int i=0;i<2*n;i++){
			cout <<card[i]<<endl;
		}
	}

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

int main() {

	int N;
	cin >> N;

	int mod = 1'000'000'007;
	map<int,int> soinsu;
	for(int i=2; i<=1000; i++) {
		int cnt = 0;
		for(int j=2; j<=i; j++) {
			if(i%j == 0)cnt++;
		}
		if(cnt==1)soinsu.insert({i,0});
	}

	for(int i=1; i<=N; i++) { //1~Nそれぞれの素因数の数をかぞえる
		for(auto &x : soinsu) {
			int y = i;
			while(y%x.first == 0) {
				y /= x.first;
				x.second++;
			}
		}
	}
	ll ans = 1;
	for(auto x : soinsu) {
		ans = (ans * (x.second + 1)%mod)%mod;
	}

	cout << ans << endl;

}

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

int main(){
  int n;
  string s;
  cin >> n >> s;
  for(int i = 0; i < s.size(); i++){
    for(int j = 0; j < n; j++){
      if(s[i] != 'Z')
        s[i]++;
      else
        s[i] = 'A';
    }
  }
  cout << s << endl;
}

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

bool ans=false;

int main(){
    string s;cin>>s;
    for(int i=0;i<s.length()-1;i++){
        for(int j=i+1;j<s.length();j++){
            if(s[i]=='C'&&s[j]=='F')ans=true;
        }
    }
    ans ? cout<<"Yes"<<endl : cout<<"No"<<endl;
    return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll,int> ii;
typedef pair <ii,int> iii;

const int mod = 1e9 + 7;
const int N = 200005;

int v[N], dp[N], n;

int solve(int i){
    if(dp[i] != -1)
        return dp[i];
    int ans = 0;
    if(i + 1 < n)
        ans = solve(i+1) + abs(v[i]-v[i+1]);
    if(i + 2 < n)
        ans = min(ans, solve(i+2) + abs(v[i] - v[i+2]));
    return dp[i] = ans;
}

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


Measured memory_bytes: 9436
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    vector<pair<ll, ll>> vec(n);
    rep(i, n) {
        ll a, b;
        cin >> a >> b;
        vec[i] = make_pair(b, a);
    }
    sort(vec.begin(), vec.end());
    cout << vec[0].first + vec[0].second << endl;
}

Measured memory_bytes: 1792
<?php
fscanf(STDIN, "%d", $N);
$d = fgets(STDIN);
$D = explode(" ", $d);

$point = 0;
for($i=0; $i<$N-1; $i++) {
  for($j=$i+1; $j<$N; $j++) {
    $point += $D[$i] * $D[$j];
  }
}
echo $point;

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

int main(){
    int k,x;
    cin >> k >> x;
    if(500*k<x) puts("No");
    else puts("Yes");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
using namespace std;
main(){
	queue<pair<string,int> >v;
	int N,Q,T;
	string s;
	for(cin>>N>>Q;N--;)cin>>s>>T,v.push(make_pair(s,T));
	for(T=0;!v.empty();){
		pair<string,int>p=v.front();v.pop();
		if(p.second>Q)T+=Q,p.second-=Q,v.push(p);
		else T+=p.second,cout<<p.first<<' '<<T<<endl;
	}
}

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

int main() {
    int N;
    cin >> N;
    int A[N] = {};
    int B[N] = {};
    int C[N - 1] = {};
    for (int i = 0;i < N;i++){
        cin >> A[i];
    }
    for (int i = 0;i < N;i++){
        cin >> B[i];
    }
    for (int i = 0;i < N - 1;i++){
        cin >> C[i];
    }
    int a;
    int ans = 0;
    for (int i = 0;i < N;i++){
        ans += B[A[i] - 1];
        if (i > 0){
            if (A[i] == A[i - 1] + 1){
                ans += C[A[i - 1] - 1];
            }
        }
    }
    cout << ans << endl;
}

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


double calc(int a,int b){
    return abs(a - b) * abs(a - b);
}
int main(){
    int ans = 0;
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    for (int i = 0; i < N;i++)
    {
        for (int j = 0; j < D;j++)
        {
            cin >> X[i][j];
        }
    }
    for (int i = 0; i < N;i++)
    {
        for (int j = i + 1; j < N;j++)
        {
            double calced = 0;
            for (int k = 0; k < D; k++)
            {
                calced = calced +(double)calc(X[i][k], X[j][k]);
            }
            calced = sqrt(calced);
            if (floor(calced) == calced)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	int pn = 1;
	if (ci - cn + 16 > cm) {
		if ((ct = getcha()) == '-') { pn = -1; ct = getcha(); }
		A = ct - '0';
		while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
	else {
		if ((ct = *ci++) == '-') { pn = -1; ct = *ci++; }
		A = ct - '0';
		while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
}

const int dm = 1 << 20;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

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


	int N = getint();
	int sa[100001];
	int mae = 0;
	rep1(i, N) {
		int tugi = getint();
		sa[i] = tugi - mae;
		mae = tugi;
	}
	int L = getint(), Q = getint();

	int LA[100001][17];
	rep(i, 17) LA[0][i] = 0;

	int j = 0;
	int d = 0;
	rep1(i, N) {
		d += sa[i];
		while (d > L) {
			j++;
			d -= sa[j];
		}
		LA[i][0] = j;
		int k = j;
		rep1(p, 16) {
			LA[i][p] = LA[k][p - 1];
			k = LA[i][p];
		}
	}

	rep(i, Q) {
		int a = getint(), b = getint();
		if (a > b) swap(a, b);

		int kotae = 0;
		for (int k = 16; k >= 0; k--) {
			if (LA[b][k] >= a) {
				kotae += 1 << k;
				b = LA[b][k];
			}
		}
		putint(kotae + (a != b));
	}

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}

Measured memory_bytes: 8576
#define ENABLE_LL
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std;

void init();
void solve();
int main(){
try { 

#ifndef CUSTOM_MAIN
#ifdef MULTIPLE_TEST_CASES_WITH_T

int T; scanf("%d",&T); while(T--) {init(); solve();}

#else
#ifdef MULTIPLE_TEST_CASES_WITHOUT_T

while(1) {try{init(); } catch(bool t){return 0;} solve(); }

#else

init(); solve();

#endif
#endif
#endif

} catch (const char* s) { return 0; }
    return 0;
}

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr; typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; } char nextChar(){ char r; ist>>r; return r;} }; Scanner sc(cin);
void ALERT(bool judgememt, const char* phrase) { if (judgememt) { puts(phrase); throw "ALERT"; } }
bool alert(bool judgememt, const char* phrase) { if (judgememt) puts(phrase); return judgememt; }

const int N = 100005;
vector < int > a;
int n, q;
int qs[N];

void init() {
    scanf(II,&n,&q);
    repa (i,q) qs[i] = sc.nextInt();
    a.push_back(n);
    repa (i,q) {
        while (a.size() && a.back() >= qs[i]) a.pop_back();
        a.push_back(qs[i]);
    }
    q = a.size();
}

int sum[N], ans[N];
void solve() {
    sum[q-1] = 1;
    repb (i,q-1,0) {
        int pos=a[i];
        int p = i-1;
        while (p>=0) {
            ses(pos);ses(a[p]);ses(sum[i]);see(p);
            sum[p] += (pos/a[p]) * sum[i];
            see(sum[p]);
            pos %= a[p];
            p = lower_bound(a.begin(),a.begin()+p,pos)-a.begin()-1;
        }
        ans[pos] += sum[i];
        ses(pos);see(sum[i]);
    }
    repb (i,n,1) ans[i] += ans[i+1];
    repa (i,n) printf(IN,ans[i]);
}


Measured memory_bytes: 6424
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <list>
#include <cmath>
using namespace std;
#define rep(i,m,n) for (int i = (int) (m); i < (int) (n); i++)
#define rep1(i,m,n) for (int i = (int) (m); i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
int main(void){
    int N,R;
    cin>>N>>R;
    if(N>=10)cout<<R<<endl;
    else cout<<R+100*(10-N)<<endl;
}

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

int main(){
	int n;
	cin>>n;
	vector<int> d(n);
	for(int i=0;i<n;++i) cin>>d[i];
	set<int> anko;
	for(int i=0;i<n;++i) anko.insert(d[i]);
	cout << anko.size() << endl;
	return 0;		
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int long long i = 0; i < (int)(n); i++)
#define intll int long long

int main() {
 intll a , b , c ;
  cin >> a >> b >> c ;
  string ans = "NO";
  rep(i,100000000){
    if((b*i+c) % a == 0){
      ans = " YES";
      break;
    }
  }
  
  cout << ans ;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



string s;

signed main() {
	cin >> s;
	cout << (s<="2019/04/30" ? "Heisei" : "TBD") << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
   		Scanner sc=new Scanner(System.in);
    	int n=sc.nextInt();
    	int k=sc.nextInt();
        int a=1;
      	int c=0;
        while(a<=n){
            int h=sc.nextInt();
        	if(h>=k){
            	c++;
            }
          	h=0;
          	a++;
        }
      System.out.println(c);
    }
}

Measured memory_bytes: 47280