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


#define M 1000000007
#define pb push_back
#define mp make_pair
#define s second
#define f first
#define mod 998244353
#define sz(v) (int)(v).size()

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)

ll add(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a+b)%M;
	return (p+M)%M;
}

ll mul(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a*b)%M;
	return (p+M)%M;
}


int main()
{
	fastio;
	ll n,i,sq;
	cin>>n;
	sq=sqrt(n);
	ll ans=1;
	for(i=2;i<=sq;i++)
	{
		ll fl=0,pre=i;
		while(pre*i<=n)
		{
			fl += ((n-pre)%(pre*i)==0);
			fl += (n==pre*i);
			pre *= i;
		}
		ans += (fl>0);
		// cout<<fl<<" ";
	}
	// cout<<ans<<endl;
	sq=sqrt(n-1);
	for(i=2;i<=sq;i++)
	{
		if((n-1)%i==0)
		{
			ans++;
			if(n-1!=i*i)
				ans++;
		}
	}
	ans++;
	if(n==2)
		ans=1;
	cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 3680
#include <iostream>
#include <vector>

using namespace std;


int main(int argc, char const *argv[])
{
  int a, b;
  cin >> a >> b;
  int diff = b - a;
  int sum = 0;
  for (int i = 0; i <= diff; ++i) {
    sum += i;
  }
  cout << sum - b << endl;
  return 0;
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }
	int answer = 0;
	for(int i = 1; i < n; ++i){
		if(a[i] == a[i - 1]){
			a[i] = -1;
			++answer;
		}
	}
	cout << answer << endl;
	return 0;
}



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

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout << fixed;
    int n;
    cin >> n;
    vector<int> arr(n);
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    int swaps = 0;
    for (int i = 0; i < n; i++) {
        for (int j = n - 1; j >= i + 1; j--) {
            if (arr[j] < arr[j - 1]) {
                swap(arr[j], arr[j - 1]);
                ++swaps;
            }
        }
    }
    for (int i = 0; i < n - 1; i++) {
        cout << arr[i] << " ";
    }
    cout << arr[n - 1] << '\n';
    cout << swaps << endl;
    return 0;
}


Measured memory_bytes: 3180
class UnionFind():
    def __init__(self, n):	#初期化
        self.n = n
        self.parents = [-1] * n
    def find(self, x):		#属すグループの根(リーダー)
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):	#連結
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    def size(self, x):		#同じグループに属す頂点数
        return -self.parents[self.find(x)]
    def same(self, x, y):	#x,yが同じグループに属しているかどうか
        return self.find(x) == self.find(y)
    def members(self, x):	#同じグループに属すメンバー
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    def roots(self):		#全ての根(リーダー)
        return [i for i, x in enumerate(self.parents) if x < 0]
    def group_count(self):	#グループの数
        return len(self.roots())
    def all_group_members(self):#全てのグループのメンバー
        return {r: self.members(r) for r in self.roots()}
    def __str__(self):		#根：{所属しているメンバー}
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n,m,k = map(int,input().split())
suggest = UnionFind(n)
follow = [0]*n
block = [0]*n
for i in range(n):
    follow[i] = list()
    block[i]  = list()
for _ in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    suggest.union(a,b)
    follow[a].append(b)
    follow[b].append(a)

for _ in range(k):
    c,d = map(int,input().split())
    c -= 1
    d -= 1
    block[c].append(d)
    block[d].append(c)
ans = ""
suggestfriend = [0]*n
ans = ""
for i in range(n):
    blockperson = 0
    union = suggest.size(i)
    for j in range(len(block[i])):
        if(suggest.same(i,block[i][j])):
            blockperson += 1
    ans += str(union - blockperson -len(follow[i]) - 1) + " "
print(ans)

Measured memory_bytes: 45344
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	ll n,m;
	cin>>n>>m;
	ll ans=0;
	if(m==0){
		cout<<n*n<<endl;
		return 0;
	}
	for(int i=1;i<=n;i++){
		int q=n/i;
		int r=n%i;
		if(i>m){
			ans+=q*(i-m);
		}
		if(r>=m){
			ans+=r-m+1;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int llu;
typedef long double ld;
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pair<int,int>>
#define pb push_back
#define pf push_front
#define mp map<ll,ll>
#define INF 1000000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
ll gcd(ll a,ll b)
{
    if(a==0)
    {
        return b;
    }
    else
    {
        return gcd(b%a,a);   
    }
}
ll lcm(ll a,ll b)
{
    return a*b/gcd(a,b);
}
int f(char c)
{
    return (int)c-96;
}
/**********************************************************************
***********************************************************************
*********************ACTUAL CODE BEGINS HERE***************************/
int main()
{   
    fast;
    ll x,k,d;
    cin>>x>>k>>d;
    x=abs(x);
    if(x/d>=k)
    {
        cout<<x-k*d;
        return 0;
    }
    ll a;
    if((x/d)%2==k%2)
    {
        a=x-x/d*d;
    }
    else 
    {
        a=x-x/d*d+d;
    }
    cout<<min(a,abs(a-2*d));
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int inf = 1000000000;
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
const ll mod = 1e9+7;

int main(){
    ll n;
    cin >> n;
    if(n%2 == 0){
        ll t = 0;
        ll f = 0;
        ll i=1;
        ll j=1;
        while(n/pow(2,i)){
            t += i*(n/pow(2,i));
            i++;
        }
        ll x = 2;
        while(n>=(pow(5,j)*2)){
            j++;
            x*=5;
            f += n/x;
        }
        cout << f << endl;
        return 0;

    }
    else{
        cout << 0 << endl;
        return 0;
    }
}

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

int main() {
    int a, b, c, k;
    cin >> a >> b >>c >> k;
    int cnt = 0;
    if(a >= b) {
        while(1){
            if(a<b) break;
            b*=2;
            cnt++;
        }
    }
     if(b >= c) {
        while(1){
            if(c>b) break;
            c*=2;
            cnt++;
        }
    }
    if(cnt<=k) cout << "Yes" << endl;
    else cout  << "No" << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
main(){
int h,w;
while(true){
  cin>>h>>w;
  if(h==0&&w==0)break;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cout<<"#";
    }
    cout<<endl;
  }
  cout<<endl;
}
  return 0;
}



Measured memory_bytes: 3080
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;

int main() {
	char s[6];
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5])cout << "Yes";
	else cout << "No";
}

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

int main(){
  int64_t n, k;
  cin >> n >> k;
  int64_t count = 0;
  for (int i = k; i <= n + 1; i++){
    count += (n - i + 1) * i + 1;
    count %= 1000000007;
  }
  cout << count << endl;
  return 0;
}

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	int n, k, s;
	cin>>n>>k>>s;
	if (s == (int)1e9) {
		for (int i = 0; i < k; i++)
			cout<<s<<" ";
		for (int i = 0; i < n - k; i++)
			cout<<(s - 1)<<" ";
		return 0;
	}
	for (int i = 0; i < k; i++)
		cout<<s<<" ";
	for (int i = 0; i < n - k; i++)
		cout<<(s + 1)<<" ";
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <stdarg.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <functional>
#include <map>

#define ll long long

using namespace std;

ll mod = 1e9 + 7;

void
solve() {
  ll n, k;
  cin>>n>>k;

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

  vector<vector<ll>> dp(n, vector<ll>(k+1, 0));
  for (ll i=0; i<n; i++) {
    if (i==0) {
      for (ll j=0; j<=a[i]; j++)
        dp[i][j] = 1;
    }
    else {
      queue<ll> data;
      ll now = 0;
      for (ll j=0; j<=k; j++) {
        data.push(dp[i-1][j]);
        now += dp[i-1][j];
        now %= mod;
        if (j > a[i]) {
          now -= data.front();
          now %= mod;
          now += mod;
          now %= mod;
          data.pop();
        }
        dp[i][j] = now;
        //cout<<i<<","<<j<<":"<<now<<endl;
      }
    }
  }

  cout<<dp[n-1][k]<<endl;
}

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

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

  while (t > 0) {
    t--;
    solve();
  }

  return 0;
}



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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ll long long
#define PINT pair<int,int>
#define f1 first
#define s2 second
const int INF = 1e9 + 7;

using namespace std;

int main(){
    cin.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int a[n];
    REP(i,n) cin >> a[i];

    sort(a,a+n);
    if(n==2){
        cout << a[1] << " " << a[0] << endl;
        return 0;
    }
    cout << a[n-1] << " ";
    int t=lower_bound(a,a+n,a[n-1]/2)-a;
    if(a[t]-a[n-1]/2 <= a[n-1]/2-a[t-1]) cout << a[t] << endl;
    else cout << a[t-1] << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>

using namespace std;

void insertionSort(vector<int> &A) {
  
	for(int j = 0; j < A.size(); j++){
		cout << A[j];
      	if (j < A.size()-1) {
        	cout << " ";
      	}
    }
    cout << endl;
  
  for (int i = 1; i < A.size(); i++){
    int v = A[i];
    int j = i -1;
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    
    for(int j = 0; j < A.size(); j++){
      cout << A[j];
      if (j < A.size()-1) {
        cout << " ";
      }
    }
    cout << endl;
  }
}


int main(){
  int N;
  cin >> N;
  
  vector<int>A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  insertionSort(A);
  
  return 0;
}



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

int main()
{
    int x, max=0, i, j;
    cin>>x;
    if(x==1){
        cout<<"1";
        return 0;
    }
    j=2;
    start:
    i=2;
    while(1){
        if(pow(j,i)>x){
            break;
        }
        i++;
    }
    if(pow(j,i-1)>max){
        max=pow(j,i-1);
    }
    if(j*j<=x){
        j++;
        goto start;
    }
    cout<<max;
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
 
int main() {
 
  int n,i,j;
  int card[4][13];
  int num;
  long long moji;
 
  scanf("%d", &n);
 
  for(j=0; j<4; j++) {
  for(i=0; i<13 ;i++){
    card[j][i] = 0;
  }
  }
 
  for(i=0; i<2*n ; i++) {
    scanf("%c ",&moji);
    scanf("%d",&num);
    if(moji == 'S') {
      card[0][num-1] = 1;
    } else if(moji == 'H') {
      card[1][num-1] = 1;
    } else if(moji == 'C') {
      card[2][num-1] = 1;
    } else if(moji =='D') {
      card[3][num-1] = 1;
    }
  }
 
  for(j=1;j<=13;j++) {
    if(card[0][j-1] != 1) {
      printf("S %d\n",j);
    }
  }
  for(j=1;j<=13;j++) {
    if(card[1][j-1] != 1) {
      printf("H %d\n",j);
    }
  }
  for(j=1;j<=13;j++) {
    if(card[2][j-1] != 1) {
      printf("C %d\n",j);
    }
  }
  for(j=1;j<=13;j++) {
    if(card[3][j-1] != 1) {
      printf("D %d\n",j);
    }
  }
   return 0;
}


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

int main() {
	int N, out = 0;
	cin >> N;

	for (int i = 0; i < N; ++i)	{
		int l, r;
		cin >> l >> r;
		out += (r - l + 1);
	}
	cout << out << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long check(long x)
{
    long c=0;
    while(x%2==0)
    {
        x/=2;
        c++;
    }
    return min(c,2l);
}
int main()
{
    //ifstream cin("input.in");
   // ofstream cout("output.out");
    ios::sync_with_stdio(0);cin.tie(0);
    long n,x,a[3]={0};
    cin>>n;
    for(long i=0;i<n;i++)
    {
        cin>>x;
        a[check(x)]++;
    }
    a[2]-=a[0];
    if(a[2]==-1)
    {
        if(a[1]==0)
            cout<<"Yes";
        else
            cout<<"No";
    }
    else if(a[2]>=0)
        cout<<"Yes";
    else
        cout<<"No";

}

Measured memory_bytes: 256
S = input()
T = input()

Ans = []
for i in range(len(S)-len(T)+1):
    same = True
    for j in range(len(T)):
        if S[i+j] != T[j] and S[i+j]!="?":
            same = False
    if same:
        out = ""
        for k in range(i):
            out += ("a" if S[k] == "?" else S[k])
        out += T
        for k in range(i+len(T), len(S)):
            out += ("a" if S[k] == "?" else S[k])
        Ans.append(out)
        
Ans.sort()
print(Ans[0] if Ans else "UNRESTORABLE")

Measured memory_bytes: 3064
s = input()
s0 = ""
s1 = ""
for i in range(len(s)):
    s0 += str(i % 2)
    s1 += str((i + 1) % 2)
br0 = br1 = 0
for i in range(len(s)):
    if s[i] != s0[i]:
        br0 += 1
    if s[i] != s1[i]:
        br1 += 1
print(min(br0, br1))

Measured memory_bytes: 3316
n,x = map(int,input().split())

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

a.sort()
sum = 0
ans = 0

for i in a:
	sum += i
	if sum <= x:
		ans += 1
	else:
		break
if ans == n:
	if sum < x:
		ans -= 1
print(ans)

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



int sc1() {int x; scanf("%d", &x); return x;}

long long sc2() {long long x; scanf("%lld", &x); return x;}

#define  gcd(a,b)         __gcd(a,b)
#define  lcm(a,b)         (a*b)/gcd(a,b)
#define  Int              sc1()
#define  LL               sc2()
#define  For(n)           for(int i=0;i<n;i++)
#define  Forj(n)          for(int j=0;j<n;j++)
#define  Fork(n)          for(int k=0;k<n;k++)
#define  For1(n)          for(int i=1;i<=n;i++)
#define  ll               long long
#define  vi               std::vector<int>
#define  vll              std::vector<ll>
#define  qui              qu
#define  pb               push_back
#define  mpsi             std::map<string, int>







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

	int a , b;
	cin >> a >> b;

	for (int i = 0; 1; i++)
	{
		if ( ((a * i) - (i - 1)) >= b) {cout << i << endl; return 0;}

	}

	return 0;
}




Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

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

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=998244353;
struct BIT{
    vector<int> bit;
    int size;
    BIT(int n):size(n), bit(n+1, 0){}
    int sum(int i){
        int s=0;
        while(i>0){
            s+=bit[i];
            i-=(i&(-i));
        }
        return s;
    }
    void add(int i, int x){
        while(i<=size){
            bit[i]+=x;
            i+=(i&(-i));
        }
    }
};
int main()
{
    int n; cin>>n;
    int x[200020], y[200020], xs[200020], ys[200020];
    for(int i=0; i<n; i++){
        cin>>x[i]>>y[i];
        xs[i]=x[i];
        ys[i]=y[i];
    }
    sort(xs, xs+n);
    sort(ys, ys+n);
    P p[200020];
    for(int i=0; i<n; i++){
        x[i]=lower_bound(xs, xs+n, x[i])-xs;
        y[i]=lower_bound(ys, ys+n, y[i])-ys;
        p[i]=P(x[i], y[i]);
    }
    sort(p, p+n);
    ll p2[200020];
    p2[0]=1;
    for(int i=1; i<=n; i++) p2[i]=p2[i-1]*2%MOD;
    BIT b(n);
    ll ans=0;
    for(int i=0; i<n; i++){
        int y0=p[i].second+1;
        int m=b.sum(y0-1);
        b.add(y0, 1);
        ans+=(p2[n]-p2[n-y0]-p2[y0-1]-p2[i]-p2[n-1-i]+p2[m]+p2[y0-1-m]+p2[i-m]+p2[n-y0-i+m]-1+5*MOD);
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 7296
#include <stdio.h>

#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    map<long long, long long> M;

    for (int i = 0; i < N; i++) {
        long long A;
        cin >> A;
        M[A]++;
    }

    long long mx = 0;
    for (auto p : M) {
        mx = max(mx, p.second);
    }

    if (mx > 1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
    return 0;
}


Measured memory_bytes: 13568
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define lop(i, n) for(i=0; i<n; i++)

int main()
{
	int A, B, a, b, i;
	
	scanf("%d %d", &a, &b);
	
	for(i=1; i<1010; i++){
		A=i*8/100; B=i*10/100;
		
		if(A==a && B==b){ printf("%d", i); return 0; }
	}
	
	printf("-1");
	
	return 0;
}

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

int main(){
	int i,j,k,n,m,l;
	cin>>n>>m>>l;
	long a[n][m];
	long b[m][l];
	long c[n][l]={};
	for(i=0; i<n; i++){
		for(j=0; j<m; j++){
			cin>>a[i][j];
		}
	}
	for(i=0; i<m; i++){
		for(j=0; j<l; j++){
			cin>>b[i][j];
		}
	}
	for(i=0; i<n; i++){
		for(j=0; j<l; j++){
			for(k=0; k<m; k++){
				c[i][j]+=a[i][k]*b[k][j];
			}
		}
	}
	for(i=0; i<n; i++){
		for(j=0; j<l; j++){
			if(j!=0) cout<<" ";
			cout<<c[i][j];
		}
		cout<<endl;
	}
	return 0;
}


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

class DisjointSet{
public:
  vector<int> rank, p;

  DisjointSet(int size){
    rank.resize(size, 0);
    p.resize(size, 0);
    for(int i=0;i<size;i++) makeSet(i);
  }

  void makeSet(int x){
    p[x] = x;
    rank[x] = 0;
  }

  bool same(int x, int y){
    return findSet(x) == findSet(y);
  }

  void unite(int x, int y){
    link(findSet(x), findSet(y));
  }

  void link(int x, int y){
    if(rank[x] > rank[y]){
      p[y] = x;
    }
    else{
      p[x] = y;
      if(rank[x] == rank[y]) rank[y]++;
    }
  }

  int findSet(int x){
    if(x != p[x]) p[x] = findSet(p[x]);
    return p[x];
  }
};

int main(){
  int n, a, b, q;
  int t;

  cin >> n >> q;
  // DisjointSet ds = DisjointSet(n);
  DisjointSet ds(n);

  for(int i=0;i<q;i++){
    cin >> t >> a >> b;
    if(t == 0) ds.unite(a, b);
    else if(t == 1){
      if(ds.same(a, b)) cout << 1 << endl;
      else cout << 0 << endl;
    }
  }

  return 0;
}



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

int n;
int main() {
  cin >> n;
  int i = 1;
  while (++i <= n) {
    int x = i;
    if (x % 3 == 0) {
      cout << " " << i;
      continue;
    }
    while (x) {
      if (x % 10 == 3) {
        cout << " " << i;
        break;
      }
      x /= 10;
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3100
#include<stdio.h>

#define N 2000000

int H,n[N];
/*typedef struct node {
  int pa;
  int left;
  int right;
  int key;
} Tree;
*/
int pa(int x) {return x/2;}
int le(int x) {return x*2;}
int ri(int x) {return x*2+1;}

void maxHe(int x)
{
  int swp,l,r,big;
  l=le(x);
  r=ri(x);
  if(l <= H && n[l] > n[x]) big=l;
  else big=x;
  if(r <= H && n[r] > n[big]) big=r;

  if(big != x)
    {
      swp=n[x];
      n[x]=n[big];
      n[big]=swp;
      maxHe(big);
    }
}
  


int main()
{
  int i;
  
  
  scanf("%d",&H);

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

  for(i=H/2; i>=1; i--)
    {
      maxHe(i);
    }

  for(i=1; i<=H; i++)
    {
      printf(" %d",n[i]);
    }
  printf("\n");

  return 0;
}



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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

void printVec(vector<int>& vec) {
    for (auto& e : vec) {
        cout << e << " ";
    }
    cout << endl;
}

int func(long long r) {
    // cout << fixed << setprecision(8);

    // PI*r^2/PI*1^2
    // r^2/1^2
    cout << pow(r, 2) << endl;

    return 0;
}

int main() {
    long long r;
    scanf("%lld", &r);

    func(r);

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();

		int dist = Math.abs(B - A);

		if (dist % 2 == 0) {
			System.out.print("Alice");
		} else {
			System.out.print("Borys");
		}
	}
}


Measured memory_bytes: 22356
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define dmp(x) cerr<<#x<<":"<<x<<endl
#define FOR(i,a,b) for(int i=(int)a,c=(int)b;i<c;++i)
#define rep(i,b) FOR(i,0,b)
#define ROF(i,a,b) for(int i=b-1,c=(int)a;i>=c;--i)
#define per(i,b) ROF(i,0,b)
typedef pair<int,int> P;
typedef pair<int,P> PP; 
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;}
const int MOD = 1e9+7;

signed main(){
  int n;
  cin>>n;
  vector<int> s(n);
  rep(i,n)cin>>s[i];
  int ans=0;
  FOR(i,1,n){
    int f=0;
    set<int> used;
    used.insert(0);
    used.insert(n-1);
    FOR(k,1,n){
	 if(i*k>=n-1)break;
	 int l=k*i,r=n-1-k*i;
	 if(used.count(l)||used.count(r))break;
	 if(l==r)break;
	 if(r<i)break;
	 used.insert(l);
	 used.insert(r);
	 f=f+s[l]+s[r];
	 chmax(ans,f);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 5760
N, Q = map(int, input().split())
s = input()
TD = [input().split() for i in range(Q)]

def simulate(n):
    if n==-1:
        return -1
    if n==N:
        return 1
    for t, d in TD:
        if t==s[n]:
            if d=="L":
                n-=1
            else:
                n+=1
        if n==-1:
            return -1
        elif n==N:
            return 1
    return 0

l = -1
r = N
while l+1<r:
    n = (l+r)//2
    sim = simulate(n)
    if sim==-1:
        l=n
    else:
        r=n
L = l
l = -1
r = N
while l+1<r:
    n = (l+r)//2
    sim = simulate(n)
    if sim == 1:
        r = n
    else:
        l = n
R = r
print(R-L-1)



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

int main(){
    int x,y;

    while(1){
        cin >> x >> y;
        if (x==0 && y==0)break;
        if(x>y) cout << y << " " << x << endl;
        else cout << x << " " << y << endl;
    }

    return 0;
}


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

int main() {

    long long a,b,c,d;
	cin>>a>>b>>c>>d;
	long long x=max(a*c,a*d);
	long long y=max(b*c,b*d);
	cout<<max(x,y)<<endl;

	return 0;
}

Measured memory_bytes: 3560
import sys, math
from itertools import accumulate
sys.setrecursionlimit(10**9)

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    K = ii()
    print('ACL'*K)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9124
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] li = new int[9];
        for(int i = 0; i < n; i++){
            int ind = Math.min(8, sc.nextInt()/400);
            li[ind]++;
        }
        int min = 0;
        for(int i = 0; i < 9; i++){
            if(i == 8 && min != 0){
                continue;
            }else if(li[i] != 0){
                min++;
            }
        }
        int max = 0;
        for(int i = 0; i < 9; i++){
            if(i == 8){
                max += li[i];
            }else if(li[i] != 0){
                max++;
            }
        }
        System.out.println(min + " " + max);
    }
}

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

#define pb push_back
#define mp make_pair
#define ll long long
#define MOD 1000000007
#define INF 1000000000LL * 1000000000
#define FOR(i,a,b) for(int i=(a);(i)<(b);(i)++)

typedef unsigned int UI;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<char, int> PCI;
ll A , B , C;

ll diff = INF;
int main()
{
	cin >> A >> B >> C;
	diff = min(diff , A * B * (C % 2));
	diff = min(diff , A * C * (B % 2));
	diff = min(diff , C * B * (A % 2));
	cout << diff << endl;
    return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl "\n"     
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

int32_t main()
{
     IOS;
     int a[5],b[5];
     a[1]=1;a[2]=4;a[3]=7;a[4]=9;
     //set <int> s;
     for(int i=1;i<=4;i++)
     {
          cin>>b[i];
     }
     sort(b+1,b+5);
     for(int i=1;i<=4;i++)
          if(a[i]!=b[i])
          {
               cout<<"NO";
               return 0;
          }
     cout<<"YES";     
     return 0;
}

Measured memory_bytes: 256
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 

using namespace std;

int main()
{
	char n[10],str[2000];

	fgets(n,sizeof(n),stdin);

	for(int i=0;i<atoi(n);i++){
		fgets(str,sizeof(str),stdin);
		for(int j=0;str[j]!=NULL;j++){
			if(str[j]=='o' && j>=6){
				if(str[j-6]=='H'&&str[j-5]=='o'&&str[j-4]=='s'&&str[j-3]=='h'&&str[j-2]=='i'&&str[j-1]=='n') str[j]='a';
			}
		}
		cout<<str;
	}
	return 0;
}

Measured memory_bytes: 0
H,W = [ int(unko) for unko in input().split()]
h,w = [ int(unko) for unko in input().split()]
if 1 <= H and W <= 20:
    if 1 <= h <= H:
        if 1 <= w <= W:
            print((H * W) -  h * W - w * H + (h * w))

Measured memory_bytes: 2940
#include <iostream>
#include <deque>
#include <algorithm>

using namespace std;
const int maxn = 81;
const int maxc = 2 * maxn * maxn;

bool dp[maxn][maxn][4 * maxn * maxn];
short a[maxn][maxn];
short b[maxn][maxn];

void update_dp(int a, int b, int c) {
	c += maxc;
	dp[a][b][c] = true;
}

bool get_dp(int a, int b, int c) {
	c += maxc;
	return dp[a][b][c];
}

int main() {
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> b[i][j];
		}
	}
	update_dp(0, 0, b[0][0] - a[0][0]);
	update_dp(0, 0, -b[0][0] + a[0][0]);

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (i == 0 && j == 0)continue;
			for (int c = -maxc; c < maxc; c++) {
				if (i > 0) {
					if (get_dp(i-1,j,c)) {
						int nc = b[i][j] - a[i][j] + c;
						update_dp(i, j, nc);
						nc = a[i][j] - b[i][j] + c;
						update_dp(i, j, nc);
					}
				}
				if (j > 0) {
					if (get_dp(i,j-1,c)) {
						int nc = b[i][j] - a[i][j] + c;
						update_dp(i, j, nc);
						nc = a[i][j] - b[i][j] + c;
						update_dp(i, j, nc);
					}
				}
			}
		}
	}
	int ans = 1e9;
	for (int c = -maxc; c < maxc; c++) {
		if (get_dp(h-1,w-1,c)) {
			ans=min(ans,abs(c));
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 166912
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		int r = scan.nextInt();
		int g = scan.nextInt();
		int b = scan.nextInt();

		if ((r * 100 + g * 10 + b) % 4 == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 21844
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)

	a, b := getInt(), getInt()

	if a*b%2 == 0 {
		out("Even")
	} else {
		out("Odd")
	}

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

int main(){
  string s;
  cin >> s;
  int n=s.size();
  int cnt0=0, cnt1=0;
  rep(i,n){
    if(s[i]=='1'){cnt1++;}else{cnt0++;}
  }
  cout << min(cnt1,cnt0)*2 << endl; 
  return 0;
}


Measured memory_bytes: 512
s=input()
l=2**(len(s)-1)
count=0
for i in range(l):
    n=0
    buf=0
    while(i):
        if i & 1 ==1:
            count+=int(s[buf:n+1])
            buf=n+1
        n+=1
        i=i>>1
    count+=int(s[buf:])
print(count)

Measured memory_bytes: 39280
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<utility>
#include<set>
#include<stack>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PI;
using namespace std;
#define MAX  999999
int main(){
    string s;
    while(getline(cin,s)){
    rep(i,26){
        rep(j,s.size()){
            if(s[j]>='a'&&s[j] <='z')
                (s[j] == 'z') ? s[j] ='a' : s[j] = s[j]+1;
        }
        
        if(s.find("this")!= string::npos){cout<<s<< endl;}
        else if(s.find("that")!= string::npos){cout<<s<< endl;}
        else if(s.find("the")!= string::npos){cout<<s<< endl;}
        }
    }
    return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s;
	cin >> s;

	int m = (s[5] - '0') * 10 + s[6] - '0';
	if (m <= 4)
		cout << "Heisei" << endl;
	else
		cout << "TBD" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  int A, B, K;
  cin >> A >> B >> K;
  FORR(i, min(A, B), 1) {
    if (A % i == 0 && B % i == 0) {
      --K;
    }
    if (K == 0) {
      cout << i;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	n := getInt()
	as := getIntSlice(n)

	m := make(map[int]bool, 8)
	over3200 := 0
	for _, a := range as {
		if a >= 3200 {
			over3200++
		} else {
			m[a/400] = true
		}
	}

	min := len(m)
	if min == 0 {
		min = 1
	}

	max := len(m) + over3200
	// if max > 8 {
	// 	max = 8
	// }

	fmt.Println(min, max)
}

// -----------------------------------------

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

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

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  int r;
  cin >> r;

  const double Pi=3.14;

  cout << 2*r*Pi << endl;
  return 0;
}


Measured memory_bytes: 3772
#include <iostream>
#include <string.h>

using namespace std;

int main () {
    char s[201], p[101], t[101];
    cin >> s >> p;
    strcpy(t, s);
    strcat(s, t);
    cout << (strstr(s, p) == NULL ? "No" : "Yes") << endl;
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int ans, a;
	cin >> ans;
	rep(i,n){
		cin >> a;
		ans = __gcd(ans, a);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstring> 
using namespace std;
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define int long long int
#define mpp make_pair
#define F first
#define mem(a,b) memset(a,b,sizeof(a))
#define F first
#define S second
#define MOD 100000007
#define in_range(x, y, r, c) (x < r && y < c && x >= 0 && y >= 0)
const int MAXN = 1e5+5;
#define MAXI 2e18+3
#define all(v) v.begin(), v.end()
#define endl "\n"
# define PI 3.14159265358979323846

int c[20];
int a[20][20];
int ans = MAXI;
int n, m, x;

void abc(string s){
	if(s.length()>n)
		return;
	if(s.length()==n){
		int cnt[m+1];
		memset(cnt, 0, sizeof(cnt));
		int ans1=0, i;
		for(i=0;i<s.length();i++){
			if(s[i]=='1'){
				for(int j=1;j<=m;j++){
					cnt[j]+=a[i+1][j];
				}
				ans1+=c[i+1];
			}
		}
		int flag=1;
		for(i=1;i<=m;i++){
			if(cnt[i]<x){
				flag=0;
				break;
			}
		}
		if(!flag)
			;
		else{
			ans = min(ans, ans1);
		}
		return;
	}
	abc(s+"0");
	abc(s+"1");
}

signed main(){
 
    fast;
    
    #ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    

    cin>>n>>m>>x;
    int i, j;
    for(i=1;i<=n;i++){
    	cin>>c[i];
    	for(j=1;j<=m;j++){
    		cin>>a[i][j];
    	}
    }
    abc("0");
    abc("1");
    if(ans==MAXI){
    	cout<<-1<<endl;
    }
    else{
    	cout<<ans<<endl;
    }
}

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

#define UNDEF 1000000

struct node{
	int parent = 0;
	int child = 0;
	int brother = 0;
	int depth = 0;
};

int main(){

	int n;
	cin >> n;
	int id, k, c, prec;
	node nullnode;
	nullnode.parent = UNDEF;
	nullnode.child = UNDEF;
	nullnode.brother = UNDEF;
	nullnode.depth = 0;
	vector<node> tree(n, nullnode);
	for (int i = 0; i < n; i++){
		cin >> id >> k;
		for (int j = 0; j < k; j++){
			cin >> c;
			int cur = tree[id].child;
			if (j == 0){
				tree[id].child = c;
			}
			else{
				tree[prec].brother = c;
			}
			tree[c].parent = id;
			prec = c;
		}
	}

	for (int i = 0; i < n; i++){
		int cur = i;
		while (tree[cur].parent != UNDEF){
			cur = tree[cur].parent;
			tree[i].depth++;
		}
	}

	for (int i = 0; i < n; i++){
		cout << "node " << i;
		cout << ": parent = " << (tree[i].depth == 0 ? -1 : tree[i].parent);
		cout << ", depth = " << tree[i].depth << ", ";
		if (tree[i].depth == 0){
			cout << "root";
		}
		else if (tree[i].child == UNDEF){
			cout << "leaf";
		}
		else{
			cout << "internal node";
		}
		cout << ", [";
		bool isFirst = true;
		int c = tree[i].child;
		while (c != UNDEF){
			cout << ((isFirst) ? "" : ", ") << c;
			isFirst = false;
			c = tree[c].brother;
		}
		cout << "]" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 4344
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 4000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int x[N], y[N];
    rep(i, N) {
        cin >> x[i] >> y[i];
    }

    ll area = INF2;
    rep(a, N) {
        rep(b, N) {
            rep(c, N) {
                rep(d, N) {
                    int dx = x[b] - x[a];
                    int dy = y[d] - y[c];
                    if (dx <= 0 || dy <= 0) continue;
                    int countK = 0;
                    rep(i, N) {
                        if (x[a] <= x[i] && x[i] <= x[b] && y[c] <= y[i] && y[i] <= y[d]){
                            countK++;
                        }
                    }
                    if (countK >= K) area = min(area, (ll)dx*dy);
                    
                }
            }
        }
    }
    cout << area << endl;

    return 0;
}


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



int main(){
  ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
  ll i,n,k,x,y,t;
  // cin>>t;
  // while(t--)
  {
  ll l,r,d;
  cin>>l>>r>>d;
  cout<<r/d-(l-1)/d;
  
  }
}

Measured memory_bytes: 3632
def run(A, B):
    if A >= 13:
        fee = B
    elif A >= 6:
        fee = B / 2
    else:
        fee = 0
    return int(fee)


def main():
    A, B = map(int, input().split())
    print(run(A, B))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
from collections import deque

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
INF = 10 ** 5

adj = [[] for _ in range(n)]
for a, b in ab:
    a -= 1
    b -= 1
    adj[a].append(b)

mn = INF
for s in range(n):
    dq = deque([s])
    d = [-1] * n
    p = [-1] * n
    d[s] = 0
    last = []

    while dq:
        u = dq.popleft()
        for v in adj[u]:
            if d[v] == -1:
                d[v] = d[u] + 1
                p[v] = u
                dq.append(v)

            if v == s:
                last.append(u)

    for v in last:
        route = [v]
        while p[v] != s:
            v = p[v]
            route.append(v)

        route.append(s)
        size = len(route)
        if size < mn:
            mn = size
            ans = route[::-1]

if mn != INF:
    print(mn)
    for e in ans:
        print(e + 1)
else:
    print(-1)


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define FOR(i,s,e) for(int i=(s);i<(e);i++)
#define REP(i,n) FOR(i,0,n)
#define all(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

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

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

    vector<vector<int> > a(H, vector<int>(W, 0));
    REP(i, H)REP(j, W) cin >> a[i][j];
    vector<vector<int> > step(H*W, vector<int>(4, 0));
    int ans = 0;
    REP(i, H)REP(j, W-1){
        if(a[i][j] % 2){
            step[ans][0] = i;
            step[ans][2] = i;
            step[ans][1] = j;
            step[ans][3] = j+1;
            ++ans;
            a[i][j]--;
            a[i][j+1]++;
        }
    }

    REP(i, H-1){
        int j = W-1;
        if(a[i][j] % 2){
            step[ans][0] = i;
            step[ans][2] = i+1;
            step[ans][1] = j;
            step[ans][3] = j;
            ++ans;
            a[i][j]--;
            a[i+1][j]++;
        }
    }

    cout << ans << endl;
    REP(i, ans)REP(j, 4) cout << step[i][j]+1 << (j==3 ? "\n":" ");

    return 0;
}


Measured memory_bytes: 16768
// #pragma GCC optimize("Ofast,unroll-all-loops")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define all(v) v.begin(), v.end()
#define len(v) ((int)(v).size())
#define pb push_back
#define kek pop_back
#define pii pair<int, int>
#define mp make_pair
#define int ll

#define debug(x) cout << #x << " = " << x << endl;

const int INF = (is_same<int, ll>::value ? 1e18 + 666 : 1e9 + 666);

// const int MEM_SIZE = 1e8;
// char mem[MEM_SIZE];
// int cur_mem_ptr = 0;

// void* operator new(size_t n) {
//     cur_mem_ptr += n;
//     return mem + cur_mem_ptr - n;
// }

// void operator delete(void*) noexcept {}
// void operator delete(void*, size_t) noexcept {}

template<class t1, class t2>
bool cmin(t1 &a, const t2 &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class t1, class t2>
bool cmax(t1 &a, const t2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#ifndef LOCAL
void UseFiles(const string &s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}
#else
void UseFiles(const string&) {}
#endif

void run();

signed main() {
    // UseFiles("squads");
    iostream::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    run();
}

void run() {
    int k, a, b;
    cin >> k >> a >> b;
    for (int cur = 0; cur <= b; cur += k) {
        if (cur >= a) {
            cout << "OK" << endl;
            return;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3624
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int X = fs.nextInt();
        int Y = fs.nextInt();

        boolean flag = false;
        for (int i = 0; i <= X; ++i) {
            for (int j = 0; j <= X-i; ++j) {
                if (Y == i*2 + j*4 && i+j == X) {
                    flag = true;
                }
            }
        }

        if (flag) System.out.println("Yes");
        else System.out.println("No");
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}

    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() { return Double.parseDouble(next());}
}




Measured memory_bytes: 32532
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cmath>

using namespace std;

int main(int argc, char *argv[]) {
	int k, x;
	cin >> k >> x;
	for (int i = -k + 1; i < k; ++i) {
		if (i != -k + 1) cout << " ";
		cout << (i + x);
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
//#incldue <algorithm>
using namespace std;

int main(){
  int C, N, M; scanf("%d%d%d",&C,&N,&M); int s[N], p[N], dp[2][C+1], a=0;
  //for(int i=0; i<N; i++) for(int j=0; j<C; j++) dp[i][j] = 0;
  for(int i=0; i<N; i++) scanf("%d%d",&s[i],&p[i]);
  
  for(int i=0; i<=C; i++) dp[1][i] = 0;
  for(int i=N-1; i>=0; i--){
    //printf("%d ",i);
    for(int j=0; j<=C; j++){
      if (j < s[i]) dp[0][j] = dp[1][j];
      else dp[0][j] = max(dp[1][j], dp[1][j-s[i]] + p[i]);
      //printf("%d ",dp[1][j]);
    }//printf("\n");
    for(int j=0; j<=C; j++) dp[1][j] = dp[0][j];
  }
  
  for(int i=1; i<=M; i++){
    printf("%d\n",dp[0][C/i]*i);
    //printf("%d ",dp[0][C]);
  }
}


Measured memory_bytes: 3368
#include <iostream>
#include <vector>
#include <utility>
#include <set>


using namespace std;
using ll = long long int;

#define rep(i, n) for(ll i = 0; i < (n); i++)

template<class T, class U> void show_pair(pair<T, U> &p) {
  cout << '(' << p.first << "," << p.second << ")" << endl;
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  ll N, M; cin >> N >> M;
  vector<ll> s[10];
  vector<ll> p(M);

  rep(i, M) {
    ll k; cin >> k;
    rep(j, k) {
      ll tmp; cin >> tmp;
      s[i].push_back(tmp);
    }
  }

  rep(i, M) {
    cin >> p[i];
  }

  ll combs = 0;
  rep(bit, 1 << N) {
    ll count = 0;
    rep(i, M) {
      ll c = 0;
      for (ll x : s[i]) {
        c += ((bit >> (x-1)) & 1);
      }
      if (c % 2 == p[i]) {
        count++;
      }
    }
    if (count == M) {
      combs++;
    }
  }

  cout << combs << endl;

  return 0;
}


Measured memory_bytes: 3176