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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  int L,R,d; cin >> L >> R >> d;
  cout << R/d -(L-1)/d << endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
void rec(int mi,int index,vector<vector<int>> &v,vector<int> v1,int &mii,int x,int m)
{
    if(index==v.size())
    {
        int f=0;
        for(int j=1;j<=m;j++)
        {
            if(v1[j]<x)
            {
                f=1;
                break;
            }
        }
        if(f==0)
        {
            mii=min(mii,mi);
        }
        return;
    }
    for(int j=1;j<=m;j++)
    {
       v1[j]+=v[index][j];
    }
    mi+=v[index][0];
    rec(mi,index+1,v,v1,mii,x,m);
    for(int j=1;j<=m;j++)
    {
       v1[j]-=v[index][j];
    }
    mi-=v[index][0];
    rec(mi,index+1,v,v1,mii,x,m);
}
int main()
{
    int n,m,x;
    cin>>n>>m>>x;
    vector<vector<int>> v(n,vector<int>(m+1));
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            cin>>v[i][j];
        }
    }
    int f=0;
    for(int j=1;j<=m;j++)
    {
        int su=0;
        for(int i=0;i<n;i++)
        {
            su+=v[i][j];
        }
        if(su<x)
        f=1;
    }
    if(f==1)
    cout<<-1<<endl;
    else
    {
        vector<int> v1(m+1,0);
        int mii=INT_MAX;
        int mi=0;
        rec(mi,0,v,v1,mii,x,m);
        cout<<mii<<endl;
    }
}

Measured memory_bytes: 3636
x = int(input())
 
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)

Measured memory_bytes: 9068
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000000
#define MAX 200001
#define MOD 1000000007

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for(int i = 0; i < H; i++) cin >> S[i];
    vector<vector<vector<int>>> cnt(H, vector<vector<int>>(W, vector<int>(4)));
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(j == 0){
                if(S[i][j] == '.') cnt[i][j][0] = 1;
            }
            else{
                if(S[i][j] == '.') cnt[i][j][0] = cnt[i][j - 1][0] + 1;
            }
        }
    }
    for(int i = 0; i < H; i++){
        for(int j = W - 1; j >= 0; j--){
            if(j == W - 1){
                if(S[i][j] == '.') cnt[i][j][1] = 1;
            }
            else{
                if(S[i][j] == '.') cnt[i][j][1] = cnt[i][j + 1][1] + 1;
            }
        }
    }
    for(int i = 0; i < W; i++){
        for(int j = 0; j < H; j++){
            if(j == 0){
                if(S[j][i] == '.') cnt[j][i][2] = 1;
            }
            else{
                if(S[j][i] == '.') cnt[j][i][2] = cnt[j - 1][i][2] + 1;
            }
        }
    }
    for(int i = 0; i < W; i++){
        for(int j = H - 1; j >= 0; j--){
            if(j == H - 1){
                if(S[j][i] == '.') cnt[j][i][3] = 1;
            }
            else{
                if(S[j][i] == '.') cnt[j][i][3] = cnt[j + 1][i][3] + 1;
            }
        }
    }
    ll res = 0;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            ll ans = 0;
            for(int k = 0; k < 4; k++){
                ans += cnt[i][j][k];
            }
            res = max(res, ans);
        }
    }
    cout << res - 3 << endl;
}

Measured memory_bytes: 229680
import bisect

n,m = map(int,input().split())
years = [[]for i in range(n)]
yearss = []

for i in range(m):
  p,y = map(int,input().split())
  years[p-1].append(y)
  yearss.append([p,y])


for i in range(n):
  years[i].sort()

for i in range(m):
  print("{0:06d}".format(yearss[i][0]),"{0:06d}".format(bisect.bisect_right(years[yearss[i][0]-1],yearss[i][1])),sep="")


Measured memory_bytes: 32832
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>

using namespace std;

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

Node *root, *NIL;

Node * find(Node *u, int k) {
	while(u != NIL && k != u->key) {
		if(k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;
	
	z = (Node *)malloc(sizeof(Node));
	z->key   = k;
	z->left  = NIL;
	z->right = NIL;
	
	while(x != NIL) {
		y = x;
		if(z->key < x->key) {
			x = x->left;
		} else {
			x = x->right;
		}
	}
	
	z->parent = y;
	if(y == NIL) {
		root = z;
	} else {
		if( z->key < y->key) {
			y->left = z;
		} else {
			y->right = z;
		}
	}
}

void inorder(Node *u) {
	if(u == NIL) return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}
void preorder(Node *u) {
	if(u == NIL) return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}
	
int main(void) {
	int n, i, x;
	string com;
	scanf("%d",&n);
	
	for(i=0;i<n;i++) {
		cin >> com;
		if(com[0] == 'f') {
			scanf("%d",&x);
			Node *t = find(root,x);
			if(t != NIL) printf("yes\n");
			else printf("no\n");
		} else if(com == "insert") {
			scanf("%d",&x);
			insert(x);
		} else if(com == "print") {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}

	return 0;
}

/*
8
insert 30
insert 88
insert 12
insert 1
insert 20
find 12
insert 17
insert 25
find 16
print
*/


Measured memory_bytes: 22036
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>

using namespace std;
typedef pair<int, int> Pi;

Pi operator- (Pi a, Pi b) {
	Pi ret;
	ret.first = a.first - b.first;
	ret.second = a.second - b.second;
	return ret;
}

int N;
vector<vector<Pi>> oresen;

int main() {

	while (1) {
		int N;
		cin >> N;
		if (N == 0)break;

		oresen.resize(N + 1);
		for (int i = 0; i < N + 1; i++) {
			int m;
			cin >> m;
			Pi base;
			cin >> base.first >> base.second;
			
			for (int j = 1; j < m; j++) {
				Pi input;
				cin >> input.first >> input.second;
				oresen[i].push_back(input - base);
				base = input;
			}
		}
		
		//比較
		set<int> ans;
		for (int i = 1; i < N + 1; i++) {
			for (int j = 0; j < 2; j++) {
				if (oresen[i].size() != oresen[0].size())goto end;
				if (j == 1) {
					reverse(oresen[0].begin(), oresen[0].end());
				}
				
				for (int k = 0; k < 4; k++) {
					bool f = true;
					for (int j = 0; j < oresen[i].size(); j++) {
						//四方向
						int tmp = oresen[i][j].first;
						oresen[i][j].first = -oresen[i][j].second, oresen[i][j].second = tmp;
						if (oresen[0][j] != oresen[i][j])f = false;
						
					}
					if (f)ans.insert(i);
				}
			end:;

			}

		}

		for (auto i = ans.begin(); i != ans.end(); i++) {
			cout << *i << endl;
		}

		oresen.clear();
		cout << "+++++" << endl;
	}

	return 0;
}


Measured memory_bytes: 3100
#include<iostream>
using namespace std;
int main(){
  while(1){
    int x,y,s,ans=0,a,b;
  cin>>x>>y>>s;
  if(x==0)break;
  for(a=1;a<s;a++)
    for(b=a;b+a<=s;b++){
      int m=a*(100+y)/100+b*(100+y)/100;
      if(a*(100+x)/100+b*(100+x)/100==s&&ans<m)ans=m;
    }
  cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	int size;
	while(true){
		cin >> size;
		if(size == 0){
			break;
		}
		int maxv=-1;
		int minv = 100000000;
		int sum = 0;
		for(int i=0;i<size;i++){
			int num;
			cin >> num;
			sum += num;
			minv = min(minv,num);
			maxv = max(maxv,num);
		}
		int result = (sum-minv-maxv)/(size-2);
		cout << result << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n;
  cin >> n;
  vector<int> a(n+2);
  int sum = 0;
  
  a[0] = 0;
  a[n+1] = 0;
  
  for (int i = 1; i <= n; i++){
    cin >> a[i];
  }
  
  for (int i = 1; i <= n+1; i++){
    sum += abs(a[i] - a[i-1]);
  }
  
  for (int i = 1; i < n+1; i++){
    cout << sum - abs(a[i] - a[i-1]) - abs(a[i+1] - a[i]) + abs(a[i+1] - a[i-1]) << endl;
  }
  return 0;
}

Measured memory_bytes: 1664
import java.util.*;
import java.io.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] P = new int[M];
    int[] Y = new int[M];

    int[][] arr = new int[M][4];

    for (int i = 0; i < M; i++) {
      P[i] = sc.nextInt() - 1;
      Y[i] = sc.nextInt();
      arr[i][0] = P[i];
      arr[i][1] = Y[i];
      arr[i][2] = 0;
      arr[i][3] = i;
    }

    sc.close();

    int[] count = new int[N];

    Arrays.sort(arr, (a,b) -> Integer.compare(a[1],b[1]));

    for (int i = 0; i < M; i++) {
      count[arr[i][0]]++;
      arr[i][2] = count[arr[i][0]];
    }

    Arrays.sort(arr, (a,b) -> Integer.compare(a[3],b[3]));

    PrintWriter out = new PrintWriter(System.out);
    
    for (int i = 0; i < M; i++) {
      out.println(String.format("%06d", arr[i][0]+1) + String.format("%06d", arr[i][2]));
    }

    out.flush();

  }

}

Measured memory_bytes: 164076
// 基本テンプレート

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

signed main() {
    string s, t; cin >> s >> t;
    int N = s.length(), M = t.length();

    string ans(N, 'z' + 1), init = ans;
    rep(i,0,N-M+1) {
        bool ok = true;
        rep(k,0,M) {
            if(s[i+k] != '?' && s[i+k] != t[k]) ok = false;
        }
        if(ok) {
            string temp = s;
            rep(k,0,M) temp[i+k] = t[k];
            rep(k,0,N) if(temp[k] == '?') temp[k] = 'a';
            chmin(ans, temp);
        }
    }
    cout << (ans == init ? "UNRESTORABLE" : ans) << endl;
    return 0;
}

Measured memory_bytes: 256
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

N,M=map(int,input().split())
S = input()
T = input()
L = lcm(N,M)

tmp = T
ss = L//N
tt = L//M
for i in range(N):
    if (i * ss) % tt == 0:
        if S[i] != T[(i*ss)//tt]:
            print('-1')
            quit()

print(L)

Measured memory_bytes: 5344
n=int(input())
A=list(map(int,input().split()))
flag=1
count=0
while flag:
  flag=0
  for j in range(n-1,0,-1):
    if A[j] < A[j-1]:
      A[j], A[j-1]=A[j-1],A[j]
      flag=1
      count += 1
a=map(str,A)
print(" ".join(a))
print(count)


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}

ll n,m;
ll dp[2010][2010];
ll sum[2010][2010];

int main(){
	cin >> n >> m;
	vector<ll> s(n),t(m);
	rep(i,n)cin >> s[i];
	rep(i,m)cin >> t[i];
	dp[0][0] = 1;
	rep(i,n+1)sum[i][0] = 1;
	rep(i,m+1)sum[0][i] = 1;
	rep(i,n){
		rep(j,m){
			if(s[i] == t[j])dp[i+1][j+1] = sum[i][j];
			sum[i+1][j+1] += sum[i+1][j]; 
			sum[i+1][j+1] %= MOD; 
			sum[i+1][j+1] += sum[i][j+1]; 
			sum[i+1][j+1] %= MOD; 
			sum[i+1][j+1] -= sum[i][j];
			sum[i+1][j+1] += MOD; 
			sum[i+1][j+1] %= MOD; 
			sum[i+1][j+1] += dp[i+1][j+1];
			sum[i+1][j+1] %= MOD; 
		}
	}
	// rep(i,n+1){
	// 	rep(j,m+1)cout << dp[i][j] << " ";
	// 	cout << endl;
	// }
	// cout << endl;
	// rep(i,n+1){
	// 	rep(j,m+1)cout << sum[i][j] << " ";
	// 	cout << endl;
	// }
	cout << sum[n][m] << endl;
}

Measured memory_bytes: 63104
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll N;
    cin >> N;

    ll s;
    ll sum = 0;
    ll minS = 101;
    rep(i, N){
        cin >> s;
        sum += s;
        if(s < minS && s % 10 != 0){
            minS = s;
        }
    }

    if(sum % 10 != 0){
        cout << sum << endl;
    }else if(minS != 101){
        cout << sum - minS << endl;
    }else{
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

ll fc(ll l, int c, int d, ll a){
  ll res = a/c + a/d - a/l;
  cerr << res << endl;
  res = a - res;
  return res;
}

int main(){
  ll a, b;
  cin >> a >> b;
  ll c, d;
  cin >> c >> d;
  int g = gcd(c, d);
  ll l = c/g*d;
  a--;
  cout << fc(l, c, d, b) - fc(l, c, d, a) << endl;
  return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	string s;
	cin >> s;
	int l = 0, r = 0;
	rep(i, n) {
		if (s[i] == '(') l++;
		else {
			if (l > 0) l--;
		}
	}
	reverse(all(s));
	rep(i, n) {
		if (s[i] == ')') r++;
		else {
			if (r > 0) r--;
		}
	}
	reverse(all(s));
	if (l > 0) {
		while (l) {
			s.push_back(')'); l--;
		}
	}
	reverse(all(s));
	if (r > 0) {
		while (r) {
			s.push_back('('); r--;
		}
	}
	reverse(all(s));
	dunk(s);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main(){
	ios::sync_with_stdio(0), cin.tie(0);
	int n, a, breaks=0, i=1, limit;
	cin >> n;
	limit = n - 1;
	while(n){
		cin >> a;
		if(a != i){
			if(breaks < limit){
				breaks++;
			}
			else{
				cout << -1 << '\n';
				return 0;
			}
		}
		else{
			i++;
		}
		n--;
	}
	cout << breaks << '\n';
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  int n, p, sum = 0, mx = 0;
  cin >> n;
  rep(i,n)
  {
    cin >> p;
    sum += p;
    mx = max(mx, p);
  }
  cout << sum - mx / 2;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  
  double data[8],vec[4],cross;

  int i;

  while(1){
    for(i = 0; i < 8; i++){
      if(i == 0){
	if(scanf("%lf",&data[i]) == EOF) return 0;
      }
      else
	scanf("%lf",&data[i]);
    }
    vec[0]=data[2]-data[0];
    vec[1]=data[3]-data[1];
    vec[2]=data[6]-data[4];
    vec[3]=data[7]-data[5];
    
    cross = vec[0] * vec[2] + vec[1] * vec[3];
    
    if(cross == 0)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

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

ll x, y;

int main()
{
	cin >> x >> y;

	ll n = x, m = y;
	int ans = 0;
	while (n <= m) {
		n *= 2;
		ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
require 'prime'

n, pp = gets.chomp.split.map(&:to_i)
if pp == 1
  puts 1
else
  pd = Prime.prime_division(pp).select{|t| t[1]>=n}
  ans = 1
  pd.each do |pdd|
    ans *= pdd[0]**(pdd[1]/n)
  end
  puts ans
end

Measured memory_bytes: 2300
#include<bits/stdc++.h>
#define M1 1000000007
#define M2 998244353
#define ll long long int
#define N (int)1e5+3
#define test(t) while(t--)
#define PI acos(-1.0)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mii map<int,int>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repp(i,b,a) for(ll i=b-1;i>=a;i--)
#define clr(ar, val) memset(ar, val, sizeof(ar))
#define F first
#define S second
#define PB push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define V(a) vector<a>
#define M(a,b) map<a,b>
#define endl '\n'
#define all(x) begin(x),end(x)
#define allr(x) rbegin(x),rend(x)
#define pr(a) cout<<a<<endl;
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int dx[4] = { 0, -1, 0, 1 };
const int dy[4] = { -1, 0, 1, 0 };
using namespace std;

ll CalculateMex(set<ll> Set){
    ll Mex = 0;
    while(Set.find(Mex)!=Set.end()){
        Mex++;
    }
    return Mex;
}

ll floor_div(ll a, ll b) {
	return a / b - (((a ^ b) < 0) and a % b);
}
ll ceil_div(ll a, ll b){
    return a / b + (((a ^ b) >= 0) and a % b);
}

inline void INP()
{
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);   
	    freopen("output.txt","w",stdout);
	#endif 
}

void solve()
{
    ll n,m;
    cin>>n>>m;
    ll a[n];
    ll t = 0;
    rep(i,0,n) {
        cin >> a[i];
        t += a[i];
    }
    ll ct = 0;
    rep(i,0,n){
        if (a[i]*(4*m) >= t) ct++;
    }
    if (ct >= m) cout << "Yes" << endl;
    else cout << "No" << endl;

}

int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    test(t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rep3(k,n) for(int k = 0; k < (n); ++k)
#define rep4(l,n) for(int l = 0; l < (n); ++l)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define drep2(j,n) for(int j = (n)-1; j >= 0; --j)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define srep2(j,s,t) for (int j = s; j < t; ++j)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  int r = 0,b = 0;
  rep(i,sz(s)){
    if(s[i] == 'R') {
      r++;
    } else {
      b++;
    }
  }
  if(r > b) {
    cout << "Yes" << endl;
   } else {
     cout << "No" << endl;
   }
  return 0;
}

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


int main() {

	int r, g, b, n;
	cin >> r >> g >> b >> n;
	int cnt = 0;

	for (int i = 0; i <= n/r; i++) {//500
		for (int j = 0; j <= n/g; j++) {//100
			
			int sum = r * i + g * j;//R,Gの個数
			if (sum <= n) {

				int others = n - sum;
							   
				if (others % b == 0) {
					cnt++;
				}
			}
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

fn main() {
    input! {
        A: i64,
        B: i64,
        C: i64,
        D: i64,
    }

    let cands = vec![A * C, A * D, B * C, B * D];
    let mut ans = std::i64::MIN;

    for &cand in cands.iter() {
        ans = max(ans, cand);
    }

    println!("{}", ans);
}


Measured memory_bytes: 2164
//https://atcoder.jp/contests/nomura2020/tasks/nomura2020_d
#include<bits/stdc++.h>
using namespace std;
int h1,m1,h2,m2,k;
signed main(){
	scanf("%d%d%d%d%d",&h1,&m1,&h2,&m2,&k);
	int s=h1*60+m1,t=h2*60+m2;
	cout<<max(0,t-s-k);
	
	return 0;
} 

Measured memory_bytes: 3656
N = input()
S = raw_input()

T = [[N,N] for _ in range(N)]
if S[0]==".":
  T[0][0] = 0
  T[0][1] = 1
else:
  T[0][0] = 1
  T[0][1] = 0

for i in range(1,N):
  for p in range(2):
    for c in range(2):
      if not (p==1 and c==0):
        if S[i]==".":
          t = c
        else:
          t = 1-c
        T[i][c] = min(T[i][c], T[i-1][p]+t)
print min(T[N-1])


Measured memory_bytes: 40804
N, M = map(int, input().split())
a = []
b = []
for i in range(M):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)

c = []
d = []

for i in range(M):
    if a[i] == 1:
        c.append(b[i])

for i in range(M):
    if b[i] == N:
        d.append(a[i])

e = set(c) & set(d)

if len(e) != 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')




Measured memory_bytes: 34028
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

struct edge {
    ll to;
    ll cost;
};

void dfs(ll s, vector<bool> &flg, vector<vector<edge>> &g, vector<ll> &cost) {
    flg[s] = true;
    for ( auto u: g[s] ) {
        ll to = u.to;
        ll len = u.cost;
        if ( cost[to] == 1e18 ) {
            cost[to] = cost[s] + len;
        }
        if ( cost[to] != cost[s] + len ) {
            cout << "No" << endl;
            exit(0);
        }
        if ( !flg[to] ) {
            dfs(to, flg, g, cost);
        }
    }
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<edge>> g(n);
    vector<ll> cost(n, 1e18);
    vector<bool> flg(n, false);
    rep(i, m) {
        ll l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        g[l].push_back((edge){r, d});
        g[r].push_back((edge){l, -d});
    }
    rep(i, n) {
        if ( !flg[i] ) {
            cost[i] = 0LL;
            dfs(i, flg, g, cost);
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 18304
#include <iostream>
#include<stdio.h>
using namespace std;
int main(void){
    int a;
    cin>>a;
    int b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;
    b=a%1==0&&a/1<10;
    c=a%2==0&&a/2<10;
    d=a%3==0&&a/3<10;
    e=a%4==0&&a/4<10;
    f=a%5==0&&a/5<10;
    g=a%6==0&&a/6<10;
    h=a%7==0&&a/7<10;
    i=a%8==0&&a/8<10;
    j=a%9==0&&a/9<10;
    if(b||c||d||e||f||g||h||i||j) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

constexpr int INF = 1e8;
constexpr int MOD = 1e9+7;
constexpr int ESP = 1e-9;
constexpr double PI = acos(-1);

int main(void) {
    int i, n, l;
    string s[100];
    cin >> n >> l;
    REP (i,n) cin >> s[i];
    sort(s,s+n);
    REP (i,n) cout << s[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int K, S;
    cin >> K >> S;

    int res = 0;
    for (int i = 0; i <= K; i++)
    {
        for (int j = 0; j <= K; j++)
        {

            int k = S - i - j;
            if (0 <= k && k <= K)
            {
                res++;
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
using ll = long long;
using ull = unsigned long long;

int main() {
    FAST;

    int n;
    cin >> n;

    int ans = (n + 1) / 2;
    println(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int m, n;
int p[101010];
int c[505], e[505];
 
int dp[512][10101];
 
int dfs(int i = 0, int j = 0, int cost = 0)
{
  if (i == n){
    return 0;
  }
  int &ret = dp[i][j];
  if (ret != -1) return ret;
 
  int v = min(j + c[i], m);
  ret = max(dfs(i + 1, v, cost + e[i]) + p[v] - p[j] - e[i], dfs(i + 1, j, cost));
  ret = max(0, ret);
 
  return ret;
}
 
int main()
{
  memset(dp, -1, sizeof(dp));
  cin >> m >> n;
  for (int i = 1; i <= m; i++){
    cin >> p[i];
  }
  sort(p + 1, p + m + 1, greater<int>());
  for (int i = 1; i <= m; i++){
    p[i] += p[i - 1];
  }
 
  for (int i = 0; i < n; i++){
    cin >> c[i] >> e[i];
  }
 
  cout << dfs() << endl;
}

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

char s1[123], s2[123];

int main() {
	scanf("%s\n%s", s1, s2);

	for(int i=0; i<strlen(s1); i++) {
		int ok=1;
		for(int j=0; ok && j<strlen(s1); j++) {
			if(s1[j]!=s2[(i+j)%(strlen(s1))]) ok=0;
		}
		if(ok) {
			printf("Yes\n");
			return 0;
		}
	}

	printf("No\n");

	return 0;
}

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

int main() {
	int a, b, c,k;
	cin >> a >> b >> c>>k;
	int s;
	if (a >= k) {
		s = k;
	}
	else if (a + b >= k) {
		s = a;
	}
	else {
		int m;
		m = k - (a + b);
		s = a - m;
	}
	cout << s;
	return 0;
}

Measured memory_bytes: 3624
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val t = sc.nextLine()
    var n = 0
    var w = 0
    var s = 0
    var e = 0
    for (i in 0 until t.length) {
        if (t[i] == 'N') n++
        if (t[i] == 'W') w++
        if (t[i] == 'S') s++
        if (t[i] == 'E') e++
    }
    var ok = false
    if (n > 0 && w > 0 && s > 0 && e > 0) ok = true
    if (n > 0 && s > 0 && w == 0 && e == 0) ok = true
    if (n == 0 && s == 0 && w > 0 && e > 0) ok = true
    println(if (ok) "Yes" else "No")
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 31264
#include<bits/stdc++.h>
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using namespace std;

int main(){
  int a,b,c,k;cin>>a>>b>>c>>k;
  rep(i,k){
    if(a>=b)b*=2;
    else if(b>=c)c*=2;
  }
  if(a<b&&b<c)cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 3672
#include<iostream>
#include<cstdio>
using namespace std;
long long n,m,h;
int main()
{
    cin>>n>>m;
    h=min(n,m/2);
    m=m-n*2;n=0;
    m=max(m,n);
    cout<<h+m/4;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using  namespace std;
#define ll long long
#define pb push_back
#define sc second
#define fr first
#define mp make_pair
const int N = 2e3 + 10 , Max = 50 + 10;
const int  MOD = 1e9 + 7 ;
ll dp[N][N];
char c[N][N];
int n , m ;
int main() {
   cin >> n >> m;
   for(int i = 1;i<=n;++i) {
    for(int j = 1;j<=m;++j) {
        cin >> c[i][j];
    }
   }
   dp[1][1] = 1;
   for(int i = 1;i<=n;++i) {
    for(int j = 1;j<=m;++j) {
        if(i == j && i == 1)
            continue;
        if(c[i][j] == '#')
            continue;
        dp[i][j] += dp[i - 1][j] + dp[i][j - 1];
        dp[i][j]%=MOD;
    }
   }
   cout << dp[n][m] << endl;
}


Measured memory_bytes: 20608
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
#define PI acos(-1)
using namespace std;
int main(){
  int i,j;
  int num[110000]={1,1,0};
  
  for(i=3;i<110000;i+=2){
    if(num[i]==1)
      continue;
    for(j=3*i;j<110000;j+=i*2)
      num[j]=1;
  }
  for(i=4;i<110000;i+=2)num[i]=1;

  int n;
  while(cin>>n,n){
    int sum=0;
    int count=0;
    loop(i,2,110000){
      if(!num[i]){
	count++;
	sum+=i;
      }
      if(count==n)break;
    }
    cout<<sum<<endl;
  }


}

Measured memory_bytes: 1592
package main

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

func max(nums []int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func minFactors(n int) []int {
	mf := make([]int, n+1)
	mf[0], mf[1] = -1, -1
	for i := 2; i <= n; i++ {
		for j := 1; i*j <= n; j++ {
			if mf[i*j] == 0 {
				mf[i*j] = i
			}
		}
	}
	return mf
}

func primeFactors(a []int) []map[int]int {
	// 各数の素因数分解結果を入れるmap配列
	m := make([]map[int]int, len(a))
	for i := range m {
		m[i] = map[int]int{}
	}
	// 最小素因数テーブル
	mf := minFactors(max(a))
	for i := range a {
		for j := a[i]; j > 1; j /= mf[j] {
			m[i][mf[j]]++
		}
	}
	return m
}

func lcmFactorFast(a []int) map[int]int {
	pfs := primeFactors(a)
	m := map[int]int{}
	for x, y := range pfs[0] {
		m[x] = y
	}
	for i := 1; i < len(a); i++ {
		for x := range pfs[i] {
			if pfs[i][x] > m[x] {
				m[x] = pfs[i][x]
			}
		}
	}
	return m
}

func pow(a, n int) int {
	ret := 1
	for n > 0 {
		if n&1 == 1 {
			ret *= a
		}
		a *= a
		n >>= 1
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := nextInts(n)

	ans := 0
	lf := lcmFactorFast(a)
	for i := range a {
		f := 1
		for x, y := range lf {
			f = (f * pow(x, y)) % a[i]
		}
		f--
		if f < 0 {
			f = a[i] - 1
		}
		ans += f
	}
	puts(ans)
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
	static int MAX = 100001;
	static boolean[] isPrime = new boolean[MAX];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int Q = sc.nextInt();
		int[] l = new int[Q];
		int[] r = new int[Q];
		for(int i = 0; i < Q; i++) {
			l[i] = sc.nextInt();
			r[i] = sc.nextInt();
		}
		sc.close();
		aryPrime();
		int[] c = new int[MAX];
		for(int i = 3; i < 100000; i++) {
			if(isPrime[i]) {
				if(isPrime[(i + 1) / 2]) {
					c[i] = c[i - 1] + 1;
				}else {
					c[i] = c[i - 1];
				}
			}else {
				c[i] = c[i - 1];
			}
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < Q; i++) {
			int cnt = c[r[i]] - c[l[i] - 1];
			sb.append(cnt).append("\n");
		}
		System.out.print(sb.toString());
//		for(int i = 0; i < 15; i++) {
//			System.out.println(i + " " + c[i]);
//		}
//		for(int p = 3; p < 10; p++) {
//			if(isPrime[p]) {
//				System.out.println(p);
//			}
//		}
	}
	static void aryPrime(){
        int l = isPrime.length;
        for(int i = 0; i < l; i++) {
            isPrime[i] = true;
        }
        isPrime[0] = false;
        isPrime[1] = false;
        isPrime[2] = true;
        int max = (int)Math.sqrt(l);
        for(int i = 2; i <= max; i++) {
            if(isPrime[i]) {
                for(int j = i * 2; j < l; j += i) {
                    isPrime[j] = false;
                }
            }
        }
    }
}

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


class Program
{


    static void Main(string[] args)
    {
        Solve();
    }

    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();

        int n =sc.intarr[0];
        var k = sc.intarr;
        int d = k[0];
        int x = k[1];

        int ans = x;
        for(int i = 0; i < n; ++i)
        {
            int a = sc.intarr[0];
            for(int j = 1; j <= d; j+=a)
            {
                ans++;
            }
        }



        wr.wri(ans);



    }


}
    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => strarr.Select(char.Parse).ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


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

double abs(double x)
{
	if (x >= 0) {
		return x;
	}
	else {
		return -x;
	}
}

int main()
{
	double N, T, A, H[100000];
	double temp, ans, num = 0;

	//入力部分
	cin >> N;
	cin >> T >> A;
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}

	//計算部分
	for (int i = 0; i < N; i++) {
		temp = T - H[i] * 0.006;
		if (i == 0) {
			ans = abs(temp - A);
		}
		else if (abs(temp - A) <= ans) {
			ans = abs(temp - A);
			num = i;
		}
	}
	
	//出力部分
	cout << num + 1 << endl;

	return 0;
}

Measured memory_bytes: 256
s = input()

mod = 1000000007
n = 13

dp = [0] * 13
dp[0] = 1

mul = 1
for i in reversed(range(len(s))):
    nextDp = [0] * 13
    if s[i] == '?':
        for k in range(10):
            for j in range(n):
                nextDp[(k * mul + j) % n] += dp[j]
        for j in range(n):
            nextDp[j] %= mod
    else:
        k = int(s[i])
        for j in range(n):
            nextDp[(k * mul + j) % n] = dp[j]

    mul *= 10
    mul %= n
    dp = nextDp
print(dp[5])

Measured memory_bytes: 43500
#include <bits/stdc++.h>
using namespace std;
int f(int x)
{
	for (int i = 0; ; ++i)
	{
		if ((i + 1) * (i + 2) / 2 > x)
		{
			return i;
		}
	}
}
int main(int argc, char const *argv[])
{
	long long int n;
	int ans = 0;
	cin>>n;
	for (long long int i = 2; i*i <= n; ++i)
	{
		if (n%i == 0)
		{
			int ctr = 0;
			while (n%i == 0)
			{
				n/=i;
				ctr++;
			}
			ans+=f(ctr);
		}
	}
	if (n > 1)
	{
		ans++;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;

void reverse(int ind[8]) {
  int tmp;
  tmp = ind[0];
  ind[0] = ind[5];
  ind[5] = tmp;
  tmp = ind[1];
  ind[1] = ind[6];
  ind[6] = tmp;
  tmp = ind[2];
  ind[2] = ind[7];
  ind[7] = tmp;
  tmp = ind[3];
  ind[3] = ind[4];
  ind[4] = tmp;
}

void roll1(int n, int ind[8]) {
  for(int i = 0; i < n; ++i) {
    int tmp;
    tmp = ind[3];
    ind[3] = ind[0];
    ind[0] = ind[1];
    ind[1] = ind[2];
    ind[2] = tmp;
    tmp = ind[4];
    ind[4] = ind[7];
    ind[7] = ind[6];
    ind[6] = ind[5];
    ind[5] = tmp;
  }
}

void roll2(int n, int ind[8]) {
  for(int i = 0; i < n; ++i) {
    int tmp;
    tmp = ind[0];
    ind[0] = ind[2];
    ind[2] = ind[4];
    ind[4] = tmp;
    tmp = ind[1];
    ind[1] = ind[5];
    ind[5] = ind[7];
    ind[7] = tmp;
  }
}

class Octahedra {
public:
  string s[8];
  bool operator < (const Octahedra &oct) const {
    for(int i = 0; i < 8; ++i) {
      if(s[i] != oct.s[i]) return s[i] < oct.s[i];
    }
    return false;
  }
};

string str[8];

void show(string s[8]) {
  for(int i = 0; i < 8; ++i) {
    cout << s[i] << " ";
  }
  cout << endl;
}

void allInsert(set<Octahedra> &vis, Octahedra oc) {
  int ind[8];
  Octahedra no;
  for(int i = 0; i < 8; ++i) ind[i] = i;
  for(int k = 0; k < 8; ++k) {
    if(k == 4) {
      reverse(ind);
    }
    for(int j = 0; j < 3; ++j) {
      for(int i = 0; i < 8; ++i) {
	no.s[i] = oc.s[ind[i]];
      }
      if(vis.find(no) == vis.end()) {
	vis.insert(no);
      }
      roll2(1, ind);
    }
    roll1(1, ind);
  }
}

int solve() {
  set<Octahedra> vis;
  Octahedra oct;
  int cnt = 0;
  for(int i = 0; i < 8; ++i) oct.s[i] = str[i];
  sort(oct.s, oct.s+8);
  do {
    if(vis.find(oct) == vis.end()) {
      ++cnt;
      allInsert(vis, oct);
    }
  } while(next_permutation(oct.s, oct.s+8));
  return cnt;
}

main() {
  while((cin >> str[0])) {
    for(int i = 1; i < 8; ++i) cin >> str[i];
    cout << solve() << endl;
  }
}

Measured memory_bytes: 3136
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

struct edge{
	ll cost;int a,b;
};

int parent[(int)1e5+3];
int find(int a){
	if(parent[a] == a){
		return a;
	}else{
		return parent[a] = find(parent[a]);
	}
}
void unite(int a, int b){
	int pa = find(a);
	int pb = find(b);
	if(pa == pb) return;
	parent[pa] = pb;
	return;
}


vector<edge> G;

int main(void){
	int n;
	cin>>n;
	rep(i,n){
		parent[i] = i;
	}
	int x,y;
	vector<pair<int,int>> xs,ys;
	rep(i,n){
		cin>>x>>y;
		xs.push_back(pair<int,int>{x,i});ys.push_back(pair<int,int>{y,i});
	}
	sort(all(xs));
	sort(all(ys));
	rep(i,n-1){
		G.push_back(edge{xs[i+1].first - xs[i].first, xs[i].second, xs[i+1].second});
		G.push_back(edge{ys[i+1].first - ys[i].first, ys[i].second, ys[i+1].second});
	}
	sort(all(G),[](const edge& a, const edge& b){return a.cost < b.cost;});
	int count = 0;
	ll ans = 0;
	rep(i,G.size()){
		ll cost = G[i].cost;
		int a = G[i].a;
		int b = G[i].b;
		if(find(a) == find(b)){
			continue;
		}
		ans += cost;
		unite(a,b);
		count++;
		if(count == n-1) break;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 8424
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m = [list(map(int, input().split())) for i in range(M)]
C = [a[x - 1] + b[y - 1] - c for x, y, c in m]
print(min(min(C), min(a) + min(b)))


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

int main()
{
  int i,n;
  double x1,x2,x3,y1,y2,y3,xp,yp,r;
  scanf("%d",&n);
  for (i=0;i<n;i++){
    scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);

    xp=((pow(y1,2)+pow(x1,2))*(y2-y3)
        +(pow(y2,2)+pow(x2,2))*(y3-y1)
        +(pow(y3,2)+pow(x3,2))*(y1-y2))/
      (2*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)));

    yp=((pow(y1,2)+pow(x1,2))*(x2-x3)
        +(pow(y2,2)+pow(x2,2))*(x3-x1)
        +(pow(y3,2)+pow(x3,2))*(x1-x2))/
      (2*(y1*(x2-x3)+y2*(x3-x1)+y3*(x1-x2)));

    xp = ((y1-y3)*(y1*y1 - y2*y2 + x1*x1 - x2*x2) - (y1-y2)*(y1*y1-y3*y3+x1*x1-\
x3*x3))/(2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3));
    yp = ((x1-x3)*(x1*x1 - x2*x2 + y1*y1 - y2*y2) - (x1-x2)*(x1*x1-x3*x3+y1*y1-\
y3*y3))/(2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));
    r = sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));


    printf("%.3f %.3f %.3f\n",xp,yp,r);
  }
  return 0;
}

Measured memory_bytes: 656
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = int(input())
print(a[n-1])

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int x1,y1,x2,y2,x3,y3,x4,y4;
	cin>>x1>>y1>>x2>>y2;
	int z1=x2-x1;
	//cout<<"z1="<<z1;
	int z2=y2-y1;
	//cout<<"z2="<<z2;
	y4=y2+z1;
	x4=x2-z2;
	y3=y1+z1;
	x3=x1-z2;
	cout<<x4<<" "<<y4<<" "<<x3<<" "<<y3<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}


int main()
{
	int n, k, c;
	cin >> n >> k >> c;
	string s;
	cin >> s;
	int now = 0;
	vector<int> l;
	vector<int> r;
	while (now < n)
	{
		if(l.size() >= k)
			break;
		if (s[now] == 'o')
		{
			l.push_back(now);
			now += c + 1;
		}
		else
		{
			now++;
		}
	}
	now = n - 1;
	while (now >= 0)
	{
		if(r.size() >= k)
			break;
		if (s[now] == 'o')
		{
			r.push_back(now);
			now -= c + 1;
		}
		else
		{
			now--;
		}
	}
	reverse(all(r));
	// for (int x:l)
	// 	cout << x << " ";
	// cout << endl;
	// for (int x:r)
	// 	cout << x << " ";
	// cout << endl;

	rep(i, l.size()){
		if(l[i] == r[i])
			cout << l[i] + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3448