akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N, R;
  cin >> N >> R;
  if (N > 10) {
    cout << R << endl;
  } else {
    // R = X - 100 * (10 - N)
    cout << R + 100 * (10 - N) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import queue
H,W=map(int,input().split())
field=[list(input()) for _ in range(H)]

def meiro(s):
    que=queue.Queue()
    dist=[[-1 for _ in range(W)] for _ in range(H)]
    dist[s[0]][s[1]]=0
    que.put(s)
    mv=((1,0),(-1,0),(0,1),(0,-1))
    max=0
    while not que.empty():
        h,w=que.get()
        for y,x in mv:
            nh=h+y
            nw=w+x
            if nh<0 or nh>=H or nw<0 or nw>=W:
                continue
            elif field[nh][nw]=="#":
                continue
            elif dist[nh][nw]!=-1:
                continue
            else:
                dist[nh][nw]=dist[h][w]+1
                que.put((nh,nw))
                if max<dist[nh][nw]:
                    max=dist[nh][nw]

    return max

ans=0
for i in range(H):
    for k in range(W):
        if field[i][k]=="#":
            continue
        tmp=meiro((i,k))
        if tmp>ans:
            ans=tmp
print(ans)


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

int main() {
  int D;
  cin >> D;
  
  if ( D == 25 ) {
    cout << "Christmas" << endl;
  }
  else if ( D == 24 ) {
    cout << "Christmas Eve" << endl;
  }
  else if ( D == 23 ) {
    cout << "Christmas Eve Eve" << endl;
  }
  else {
    cout << "Christmas Eve Eve Eve" << endl;
  }

}


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

long double dp[3001][3001];

int main() {
    int n;
    cin >> n;
    vector<long double> p(n+1);
    for(int i = 1; i <= n; i++) cin >> p[i];
    long double res = 0.0;
    dp[0][0] = 1.0;
    for(int k = 1; k <= n; k++) {
        int i = 0, j = k;
        while (j >= 0) {
            if (i == 0) dp[i][j] = dp[i][j-1] * (1.0 - p[k]);
            else if (j == 0) dp[i][j] = dp[i-1][j] * p[k];
            else dp[i][j] = dp[i-1][j] * p[k] + dp[i][j-1] * (1.0 - p[k]);
            if (k == n && i > j) {
                res += dp[i][j];
            }
            i++;
            j--;
        }
    }
    cout << fixed << setprecision(10);
    cout << res << endl;
    return 0;
}


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


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

   int n,m; cin >> n >> m;
   vector<pair<int,int>> s;
   rep(i,0,n) {
   	int a,b;
   	cin >> a >> b;
   	s.push_back({a,b});
   }
   sort(s.begin(),s.end());
   long long ans=0;
   rep(i,0,n){
   	long long o=min(s[i].second,m);
   	ans+=s[i].first*o;
   	m-=o;
   	if(m==0) break;
   }
   cout << ans << endl;
}



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

int main(){
    int he;
    int wi;
    
    while(1){
        cin >> he >> wi;
        if (he == 0 && wi == 0) break;
        for (int i = 0; i < he; i++){
            for(int j = 0; j < wi; j++){
                if((i + j)%2 == 0){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}



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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;
template<int um> class UF {
	public:
	vector<int> par,rank;
	UF() {rank=vector<int>(um,0); for(int i=0;i<um;i++) par.push_back(i);}
	int operator[](int x) {return (par[x]==x)?(x):(par[x] = operator[](par[x]));}
	int operator()(int x,int y) {
		if((x=operator[](x))==(y=operator[](y))) return x;
		if(rank[x]>rank[y]) return par[x]=y;
		rank[x]+=rank[x]==rank[y]; return par[y]=x;
	}
};
UF<500000> uf;

int P[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	for(i=1;i<=N;i++) cin>>P[i];
	FOR(i,M) {
		cin>>x>>y;
		uf(x,y);
	}
	int ret=0;
	for(i=1;i<=N;i++) if(uf[i]==uf[P[i]]) ret++;
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 5364
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
#define INF 2000000000
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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
int main(){
	string a , b ;
	cin >> a >> b; 
	int i = 0;
	for(char x : a){
		cout<<x;
		if(i<b.size()){
			cout<<b[i];
			i++;
		}
	}
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int N;
  cin >> N;
  auto f = vect(N, vect(10, 0));
  cin >> f;
  auto p = vect(N, vect(11, 0));
  cin >> p;
  int ans = -INF;
  for (int i = 1; i < (1 << 10); i++) {
    vector<int> open(10);
    for (int j = 0; j < 10; j++) {
      if ((i >> j) & 1)
        open[j] = 1;
      else
        open[j] = 0;
    }
    int res = 0;
    for (int j = 0; j < N; j++) {
      int cnt = 0;
      for (int k = 0; k < 10; k++) {
        if (open[k] > 0 && f[j][k] > 0) cnt++;
      }
      res += p[j][cnt];
    }
    chmax(ans, res);
  }
  cout << ans << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();
  return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  Study
//
//  Created by 佐々木勇星 on 2020/03/12.
//  Copyright © 2020 佐々木勇星. All rights reserved.
//

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

using namespace std;


int main(int argc, const char * argv[]) {
    

    int n, ans = 0;
    int min = 2 * 100000 + 1;
    
    cin >> n;
    
    int p[n];
    
    for(int i=0; i<n; i++)
    {
        cin >> p[i];
        
        if (min > p[i])
        {
            min = p[i];
            ans++;
        }
        
        if(p[i] == 1) break;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int a[100009],dp[100009];
int dif(int c,int v){
	if(c>=v) return c-v;
	else return v-c;
}
int min(int c,int v){
	if(c>=v) return v;
	return c;
}
int f(int y){
	if(dp[y]!=-1) return dp[y];
	else {
		if(y==0) return 0;
		else if (y==1) return dp[y]=dif(a[0],a[1]);
		else {
			return dp[y]=min(f(y-1)+dif(a[y-1],a[y]),f(y-2)+dif(a[y],a[y-2]));
		}
	}
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	       for(int j=0;j<n;j++) dp[j]=-1;
	f(n-1);
	printf("%d\n",f(n-1));
}


Measured memory_bytes: 3328
N = int(input())
h = [0] * 10**4
h = list(map(int, input().split())) + h
INF = float('inf')
dp = [INF] * (10 ** 5 + 10)
dp[0] = 0
for i in range(N):
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
    dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print(dp[N - 1])

Measured memory_bytes: 13912
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(int i = a;i < n;i++)
#define repr(i,a,n) for(int i = n-1;i >= a;i--)
#define sort(x) sort(ALL(x))
#define ALL(v) v.begin(), v.end()
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
}

void YNout(bool check){
	if(check)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return;
}

void Yayout(bool check){
	if(check) cout << "Yay!" << endl;
	else cout << ":(" << endl;
	
	return;
}

/*
template <typename T>
void vecout(vector<T>& vecout_vec){
	
	rep(i,0,vecout_vec.size()){
		cout << vecout_vec.at(i) << endl;
	}
	
	return ;
}

template <typename T>
void vecin(vector<T>& vecin_vec, ll n){
	
	ll temp ;
	
	rep(i,0,n){
		cin >> temp;
		vecin_vec.push_back(temp);
		
	}
}

template <typename T>
void in(T& literal_in, T& literal_in2, ...){
	cin >> literal_in;
	in(literal_in2, ...);
	
	return;
}

template <typename T>
void in(T& literal_in){
	
	cin >> literal_in;
	
	return;
}

template <typename T>
void out(T& literal_out, T& literal_out2, ...){
	cout << literal_out << endl;
	out(literal_out2, ...);
	
	return;
}

template <typename T>
void out(T& literal_out){
	
	cout << literal_out << endl;
	
	return;
}
*/
signed main(){
	ll n,m,a,b,c,ans = 0,cnt = 0;
	cin >> a >> b;
	cout << (a*3+b)/2<< endl;
	return 0;
}


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

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

  int count = 0;
  int t = (sum + 4 * m - 1) / (4 * m);
  for (int i = 0; i < n; i ++) {
    if (a[i] >= t) count ++;
  }

  if (count >= m) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

#define pi 3.1415926536
#define mod 1000000007
#define lli long long int
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define repn(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define loop(i, a, b) for(int i = a ; i < b ; i++)
#define mod1 1000003
#define hello "hello"

using namespace std;

//fixed<<setprecision(9);

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
	return (a.second < b.second);
}

int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
}



int main()
{
	int a, b;

	cin>>a>>b;
	
	if(a <= 9 && b <= 9)
		cout<<a*b<<endl;
	else
		cout<<-1<<endl;
}	

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

#include <iostream>
using namespace std;
#define rep(i, n)                    \
  for (int i = 0; i < (int)(n); i++) \
    ;

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

int main() {
  int d, t, s;
  cin >> d >> t >> s;

  if (d <= t * s) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3620
n = int(input())
array = [int(item) for item in input().split()][:n]
colors = [0, 0, 0, 0, 0, 0, 0, 0, 0]
for rate in array:
    if rate > 0 and rate < 400:
        colors[0] += 1
    elif rate < 800:
        colors[1] += 1
    elif rate < 1200:
        colors[2] += 1
    elif rate < 1600:
        colors[3] += 1
    elif rate < 2000:
        colors[4] += 1
    elif rate < 2400:
        colors[5] += 1
    elif rate < 2800:
        colors[6] += 1
    elif rate < 3200:
        colors[7] += 1
    elif rate <= 4800:
        colors[8] += 1

count = 0
count += 1 if colors[0] > 0 else 0
count += 1 if colors[1] > 0 else 0
count += 1 if colors[2] > 0 else 0
count += 1 if colors[3] > 0 else 0
count += 1 if colors[4] > 0 else 0
count += 1 if colors[5] > 0 else 0
count += 1 if colors[6] > 0 else 0
count += 1 if colors[7] > 0 else 0
min = count
count += colors[8]
max = count
if colors[8] > 0 and min == 0:
    min = 1

print("{} {}".format(min, max))


Measured memory_bytes: 3064
import sys
input = sys.stdin.readline

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

b=[]
M = 0
count = [0 for _ in range(N+1)]
for i in reversed(range(1,N+1)):
    if count[i]%2 == a[i-1]: continue
    else:
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                count[j]+=1
                if j!=i//j:
                    count[i//j]+=1
        M+=1
        b.append(i)
print(M)
if M!=0:
    print(*b)


Measured memory_bytes: 71244
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/

int main() {
	lnt n,m,k;
	std::cin >> n >> m >> k;
	std::vector<std::vector<lnt> > g(n,std::vector<lnt>(m,0));
	std::vector<std::vector<std::vector<lnt> > > dp(n+1,std::vector<std::vector<lnt> >(m+1,std::vector<lnt>(4,0)));
	rep(i,k) {
		lnt a,b,c;
		std::cin >> a >> b >> c;
		a--;b--;
		g[a][b]=c;
	}
	rep(i,n) {
		rep(j,m) {
			if(g[i][j]) {
				dp[i+1][j][0]=std::max(dp[i+1][j][0],dp[i][j][2]+g[i][j]);
				dp[i][j][3]=std::max(dp[i][j][3],dp[i][j][2]+g[i][j]);
				dp[i][j][2]=std::max(dp[i][j][2],dp[i][j][1]+g[i][j]);
				dp[i][j][1]=std::max(dp[i][j][1],dp[i][j][0]+g[i][j]);
			}
			rep(c,4) {
				dp[i][j+1][c]=std::max(dp[i][j+1][c],dp[i][j][c]);
			}
			rep(c,4) {
				dp[i+1][j][0]=std::max(dp[i+1][j][0],dp[i][j][c]);
			}
		}
	}
	debug(dp);
	lnt max=0;
	rep(c,4) max=std::max(max,dp[n-1][m-1][c]);
	print(max);
}


Measured memory_bytes: 707168
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;

int main(){
   int n;
   cin>>n;
   vector<int> x(n),y(n);
   for(int i=0;i<n;i++){
       cin>>x[i];
       y[i]=x[i];
   }

   sort(y.begin(),y.end());
   int p=y[n/2-1];
   int q=y[n/2];

   for(int i=0;i<n;i++){
       if(p==q){
           cout<<p<<endl;
           continue;
       }
       if(x[i]<=p)cout<<q<<endl;
       if(x[i]>=q)cout<<p<<endl;
   }
}

   


Measured memory_bytes: 3712
#include<iostream>
#include<string>
#include<cstring>

using namespace std;

long long MOD = 1000000007;

long long we_love_abc(string s) {
  long long dp[100001][4];
  memset(dp, 0, sizeof(dp));

  for(int i=0;i<4;i++) {
    dp[0][i] = 0;
  }
  dp[0][0]  = 1;
  if(s[0] == 'A') {
    dp[0][1] = 1;
  } else if(s[0] == '?') {
    dp[0][0] = 3;
    dp[0][1] = 1;
  }
  for(int i=1;i<s.size();i++) {
    // j==0 && s[i] == 'a';
    if(s[i] == 'A') {
      dp[i][0] = dp[i-1][0];
      dp[i][1] = (dp[i-1][0] + dp[i-1][1]) % MOD;
      dp[i][2] = dp[i-1][2];
      dp[i][3] = dp[i-1][3];
      continue;
    }
    if(s[i] == 'B') {
      dp[i][0] = dp[i-1][0];
      dp[i][1] = dp[i-1][1];
      dp[i][2] = (dp[i-1][2] + dp[i-1][1]) % MOD;
      dp[i][3] = dp[i-1][3];
      continue;
    }
    if(s[i] == 'C') {
      dp[i][0] = dp[i-1][0];
      dp[i][1] = dp[i-1][1];
      dp[i][2] = dp[i-1][2];
      dp[i][3] = (dp[i-1][3] + dp[i-1][2]) % MOD;
      continue;
    }
    // s[i] == '?'
    for(int j= 0;j<4;j++) {
      dp[i][j] = (dp[i-1][j]*3) % MOD;
    }
    dp[i][1] = (dp[i][1] + dp[i-1][0]) % MOD;
    dp[i][2] = (dp[i][2] + dp[i-1][1]) % MOD;
    dp[i][3] = (dp[i][3] + dp[i-1][2]) % MOD;
  }
  return dp[s.size()-1][3];
}


int main() {
  string s;
  cin >> s;
  cout << we_love_abc(s);
}


Measured memory_bytes: 3584
def read_input():
    n, a, b = map(int, input().split())
    xlist = list(map(int, input().split()))
    return n, a, b, xlist


def submit():
    n, a, b, xlist = read_input()

    tired = 0

    for xs, xe in zip(xlist, xlist[1:]):
        dist = xe - xs

        if dist*a < b:
            tired += dist*a
        else:
            tired += b

    print(tired)
    return


if __name__ == '__main__':
    submit()


Measured memory_bytes: 62960
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

s=gets.chomp
puts s.swapcase


Measured memory_bytes: 8896
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long y = sc.nextLong();
        int count = 0;
        while (x <= y) {
            count++;
            x *= 2;
        }
        
        System.out.println(count);
    }
}


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

using namespace std;

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    set<int> s;

    for (int i = A; i < A + K; ++i) {
        if (i < A || B < i) break;
        s.insert(i);
    }
    for (int i = B - K + 1; i <= B; ++i) {
        if (i < A || B < i) break;
        s.insert(i);
    }

    for (int v : s) {
        cout << v << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x=nxt(),y=nxt(),z=nxt();
    x-=z;
    cout<<x/(y+z)<<endl;
    
    return 0;   
}




 
 


Measured memory_bytes: 256
import math
import itertools
import statistics
#import numpy as np
import collections

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
s = []
for i in range(1,n+1):
    s.append(i)

l = list(itertools.permutations(s, n))
l.sort()

start = -1
end = -1
for i in range(len(l)):
    if l[i]==tuple(p):
        start = i+1
    if l[i]==tuple(q):
        end = i+1

print(abs(end-start))


Measured memory_bytes: 10012
#include <iostream>

int main()
{
    int a, b;
    std::cin >> a >> b;

    if (a > b) {
        std::cout << "a > b" << std::endl;
    } else if (a < b) {
        std::cout << "a < b" << std::endl;
    } else {
        std::cout << "a == b" << std::endl;
    }


    return 0;
}


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

template <typename T = ll>
struct dijkstra
{
  static const int MAX_V = 200010;
  const T INF_d;
  dijkstra(T INF_d_ = LINF) : INF_d(INF_d_) {}

  struct edge
  {
    int to;
    T cost;
  };

  vector<edge> E[MAX_V];
  T d[MAX_V];
  using pt = pair<T, int>;

  void add_E(int a, int b, T c, bool undirected = false)
  {
    E[a].push_back(edge{b, c});
    if (undirected)
      E[b].push_back(edge{a, c});
  }

  void calc(int s)
  {
    priority_queue<pt, vector<pt>, greater<pt>> que;
    fill(d, d + MAX_V, INF_d);
    que.emplace(0LL, s);
    d[s] = 0;
    while (!que.empty())
    {
      pt p = que.top();
      que.pop();
      int v = p.second;
      if (d[v] < p.first)
        continue;
      for (auto &&e : E[v])
      {
        if (d[e.to] > d[v] + e.cost)
        {
          d[e.to] = d[v] + e.cost;
          que.emplace(d[e.to], e.to);
        }
      }
    }
  }
};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  dijkstra<> ds, ds2;
  vector<ll> ans;
  rep(i, m)
  {
    ll u, v, a, b;
    cin >> u >> v >> a >> b;
    ds.add_E(u, v, a, true);
    ds2.add_E(u, v, b, true);
  }
  ds.calc(s);
  ds2.calc(t);
  ll Min = LINF;
  for (int i = n; i >= 1; --i)
  {
    Min = min(Min, ds.d[i] + ds2.d[i]);
    ans.push_back((ll)(1e15) - Min);
  }
  reverse(all(ans));
  rep(i, n) cout << ans[i] << endl;
  return 0;
}


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

const int MOD = 1000000007;
const int64_t INF = 1LL << 60;

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

    int cnt = 0;
    for (int x = A; x <= B; x++) {
        int n = x;
        vector<int> y(5);
        for (int i = 0; i < 5; i++) {
            y.at(i) = (n % 10);
            n /= 10;
        }
        if ((y.at(0) == y.at(4)) && (y.at(1) == y.at(3))) {
            cnt++;
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
def resolve():
    A, B, K = map(int,input().split())

    '''
    for i in range(K):
        if 1 <= A:
            A-=1
        elif 1 <= B:
            B-=1
    '''

    if A < K:
        K -= A
        A = 0
        if B <= K:
            B = 0
        else:
            B -= K
    elif K <= A:
        A -= K

    print("{} {}".format(A,B))

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cstdlib>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
	int n, t;
	cin >> n;
	vector<int> a(n+1);
	a[0] = 0;
	for(int i = 1; i <= n; i++) {
		cin >> t;
		a[i] = t - a[i-1];
	}

	t = a[n] - a[0];

	for(int i = 0 ; i < n; i++) {
		if(i % 2 == 0) {
			cout << 2 * a[i] + t << " ";
		} else {
			cout << 2 * a[i] - t << " ";
		}
	}

	return 0;
}

Measured memory_bytes: 1664
while True:
    n = int(input())
    if n == 0:
        break
    else:
        words = []
        for i in range(n):
            w = input()
            words.append(w)
        check = [5, 7, 5, 7, 7]
        flag = 0
        count = 1
        while True:
            w_len = 0
            for i in range(count-1, n):
                w_len += len(words[i])
                if w_len == check[flag]:
                    flag += 1
                    w_len = 0
                elif w_len > check[flag]:
                    flag = 0
                    break
                if flag == 5:
                    print(count)
                    break
            if flag == 5:
                break
            else:
                count += 1



Measured memory_bytes: 5608
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()

ans = 0
a = 0
b = 0
ba = 0

for _ in range(N):
	s = input()
	ans += s.count("AB")
	if s[0] == "B" and s[-1] == "A":
		ba += 1
	elif s[0] == "B":
		b += 1
	elif s[-1] == "A":
		a += 1
if 0 < ba:
	if 0 < a and 0 < b:
		ans += ba + 1 + min(a-1, b-1)
	elif 0 < a or 0 < b:
		ans += ba
	else:
		ans += ba-1

else:
	ans += min(a, b)

print(ans)

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    long long x[n],y[n];
    map<pair<long long,long long>,int> m;
    for(int i=0;i<n;i++)
    {
        cin >> x[i] >> y[i];
        m.insert(make_pair(make_pair(x[i],y[i]),i));
    }
    int res=1000000000;
    if(n==1) res=1;
    for(int o=0;o<n;o++)
    {
        for(int i=o+1;i<n;i++)
        {
            long long a=x[o]-x[i];
            long long b=y[o]-y[i];
            vector<bool> vis(n,0);
            queue<long long> q;
            int cnt=0;
            for(int j=0;j<n;j++)
            {
                if(vis[j]==0)
                {
                    cnt++;
                    q.push(x[j]);
                    q.push(y[j]);
                    while(!q.empty())
                    {
                        long long e=q.front();
                        q.pop();
                        long long f=q.front();
                        q.pop();
                        if(m.find(make_pair(e+a,f+b))!=m.end())
                        {
                            if(vis[m[make_pair(e+a,f+b)]]==0)
                            {
                                q.push(e+a);
                                q.push(f+b);
                                vis[m[make_pair(e+a,f+b)]]=1;
                            }
                        }
                        if(m.find(make_pair(e-a,f-b))!=m.end())
                        {
                            if(vis[m[make_pair(e-a,f-b)]]==0)
                            {
                                q.push(e-a);
                                q.push(f-b);
                                vis[m[make_pair(e-a,f-b)]]=1;
                            }
                        }
                    }
                }
            }
            res=min(res,cnt);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  string S;
  cin >> S;
  int ans = S.length();
  int aa = 0;
  for(int i = 0; i < S.length(); i++){
    if(S[i] - '0' != i % 2) aa++;
  }
  ans = min(ans, aa);
  aa = 0;
  for(int i = 0; i < S.length(); i++){
    if(S[i] - '0' == i % 2) aa++;
  }
  ans = min(ans, aa);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>
#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222





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


  cin >> n >> m;
  priority_queue<ll> pq;
  rep(i, n) {
    cin >> tmp;
    pq.push(tmp);
  }
  rep(i, m) {
    tmp = pq.top();
    pq.pop();
    pq.push(tmp / 2);
  }
  while (!pq.empty()) {
    ans += pq.top();
    pq.pop();
  }
  cout << ans << endl;





  return 0;
}


Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  vector<int>arr(n);
  for(int i=0;i<n;++i)cin>>arr[i];
  int res = 0;
  int localMin = 1e9;
  for(int i=0;i<n;++i){
    if(arr[i]<localMin)res++;
    localMin = min(localMin,arr[i]);
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
bool judge(string ss,int l,int r)
{
	for(int i=l;i<=r;i++)
	{
		if(ss[i]==ss[l+r-i])
			continue;
		else return false;
	}
	return true;
}
int main()
{
	string s;
	cin >> s;
	int n=s.length();
	if(judge(s,0,(n-1)/2-1)&&judge(s,(n+3)/2-1,n-1)&&judge(s,0,n-1))
		cout<<"Yes";
	else cout << "No";
	return 0;
}

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

#define rep(i, e) for (int i = 0; i < e; i++)
#define repp(i, s, e) for (int i = s; i < e; i++)
#define N_Max 100
#define Card_Max 36
#define ll long long

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

int main()
{
    int x,y,z,ans=0; cin>>x>>y>>z;
    ans = x/(y+z);
    if(x%(y+z)!=z)ans--;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>



//文字は''でその者と比較できる。
int main()
{

	char mozi[5];
	int i = 0;
	int q, p = 0;
	int j, t;


	scanf("%s", mozi);

	for (i = 0; mozi[i] != '\0'; ++i);

	for (j = 3; j >= 0; j--)
	{

		for (t = 0; t < j; t++)
		{
			if (mozi[j] == mozi[t])
			{
				p++;
			}
		}
	}

	if (p == 2&& i == 4)
	{
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}

	return 0;
}




Measured memory_bytes: 128
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    try {
      int n = sc.nextInt();
      String s = sc.next();
      StringBuffer sb = new StringBuffer();
      for (int i = 0; i < s.length(); i++) {
        sb.append((char)((s.charAt(i) - 'A' + n) % 26 + 'A'));
      }
      System.out.println(sb.toString());
    } finally {
      sc.close();
    }
  }
}

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

int main() {
  int n,m;
  cin >> n >> m;
  vector<vector<int>> G(n);
  for(int i=0;i<m;i++){
    int a,b;
    bool al=false;
    cin >> a >> b;
    for(int x:G[a-1]){
      if(x==b-1) al=true;
    }
    if(!al){
      G[a-1].push_back(b-1);
      G[b-1].push_back(a-1);
    }
  } 
  int ans1=0,ans2=0;
  vector<bool> F(n,false);
  queue<int> bf;
  for(int i=0;i<n;i++){
    if(F[i]) continue;
    
    bf.push(i);
    F[i]=true;
    ans2=0;
    
    while(!bf.empty()){
      int k=bf.front();
      bf.pop();
      for(int x:G[k]){
        if(!F[x]) {
          bf.push(x);
          F[x]=true;
        }
      }
      ans2++;
    }
    
    ans1=max(ans1,ans2);
  }
  cout << ans1 << endl;     
  return 0;
}

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

int dp[(unsigned int)1e5];
int h[(unsigned int)1e5];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> h[i];
  dp[0] = 0;
  for (int i = 1; i < n; i++) {
    dp[i] = INT_MAX;
    for (int j = 1; j <= k; j++) {
      if (i - j < 0) continue;
      dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
    }
  }
  cout << dp[n - 1] << endl;
  return 0;
}

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

public class Main{

	public static void main(String[] args) throws IOException {
		int N = readInt(); boolean f = true; for(int i = 1; i<=N; i++) if(next().charAt(0) == 'Y') f=false; if(f) println("Three"); else println("Four");
		exit();
	}

	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}

	static long readLong() throws IOException {
		return Long.parseLong(next());
	}

	static float readFloat() throws IOException {
		return Float.parseFloat(next());
	}

	static boolean readBoolean() throws IOException {
		return Boolean.parseBoolean(next());
	}

	static short readShort() throws IOException {
		return Short.parseShort(next());
	}

	static byte readByte() throws IOException {
		return Byte.parseByte(next());
	}

	static int readInt() throws IOException {
		return Integer.parseInt(next());
	}

	static double readDouble() throws IOException {
		return Double.parseDouble(next());
	}

	static char readCharacter() throws IOException {
		return next().charAt(0);
	}

	static String readLine() throws IOException {
		return br.readLine().trim();
	}

	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	static void print(Object o) {
		pr.print(o);
	}

	static void println(Object o) {
		pr.println(o);
	}

	static void flush() {
		pr.flush();
	}

	static void println() {
		pr.println();
	}

	static void exit() throws IOException {
		br.close();
		pr.close();
		System.exit(0);
	}
}


Measured memory_bytes: 21204
#include<stdio.h>
int main(){
    int x[10000];
    int y[10000];
    int i;
    int length=0;
    do{
        scanf("%d %d", &x[length], &y[length]);
        length += 1;
    }while(x[length-1]!=0 || y[length-1]!=0);
    for(i=0; i<length-1; i++){
        if(x[i] <= y[i]){
            printf("%d %d\n", x[i], y[i]);
        }else{
            printf("%d %d\n", y[i], x[i]);
        }
    }
    return 0;
}

Measured memory_bytes: 624
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int[] p = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = Integer.parseInt(sc.next());
        }

        // 主処理
        int[] sum = new int[2000001];
        for (int i = 1; i < sum.length; i++) {
            sum[i] = sum[i - 1] + i;
        }

        double[] ev = new double[n];
        for (int i = 0; i < n; i++) {
            ev[i] = (double) sum[p[i]] / p[i];
        }

        double[] dp = new double[n + 1];
        for (int i = 0; i < k; i++) {
            dp[k - 1] += ev[i];
        }
        for (int i = k; i < n; i++) {
            dp[i] = dp[i - 1] - ev[i - k] + ev[i];
        }

        double result = Arrays.stream(dp).max().getAsDouble();

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 60536
#include<bits/stdc++.h>
using namespace std;
int a[100005];
int main()
{
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		a[x]++;
		a[x-1]++;
		a[x+1]++;
	}
	int ans=0;
	sort(a+1,a+100002);
	cout<<a[100001]<<endl;
	return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int[] sum = new int[5];
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(a==0 && b==0) break;
			sum[0] = a+b;
			int max = sum[0];
			for(int i=1;i<5;i++){
				sum[i] = sc.nextInt() + sc.nextInt();
				max = Math.max(max, sum[i]);
			}
			for(int i=0;i<5;i++){
				if(sum[i]==max){
					System.out.println((char)(65+i) + " " + sum[i]);
					break;
				}
			}
		}
	}	
}

Measured memory_bytes: 21116
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = 0
for i in range(N):
    ans += B[A[i]-1]
    if i > 0:
        if A[i-1] + 1 == A[i]:
            ans += C[A[i-1]-1]

print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)
template<class T>bool is_prime(T IN){
    if(IN<=1)return false;
    for(long long i=2;i*i<=IN;i++){
        if(IN%i==0){
            return false;
        }
    }
    return true;
}
long long INF = 1LL<<60;
int main( ){
    ll Q;
    cin>>Q;
    vb prime(100010,true);
    rep(i,0,100010){
        prime[i]=is_prime(i);
    }
    vll sumalike(100010,0);
    sumalike[0]=0;
    rep(i,1,100010){
        if(prime[i]&&prime[(i+1)/2]&&i%2){
            sumalike[i]=sumalike[i-1]+1;
        }
        else{
            sumalike[i]=sumalike[i-1];
        }
    }
    rep(i,0,Q){
        int l,r;
        cin>>l>>r;
        cout<<sumalike[r]-sumalike[l-1]<<endl;
    }
    return 0;
}




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

int main(){
  int n;
  string s;
  cin >> n;
  map<char,ll> mp;
  mp['M']=0;mp['A']=0;mp['R']=0;mp['C']=0;mp['H']=0;
  r(i,n){
    cin >> s;
    mp[s.at(0)]++;
  }
  cout << mp['M']*mp['C']*mp['H']+mp['A']*mp['C']*mp['H']+mp['M']*mp['R']*mp['H']+mp['M']*mp['R']*mp['C']+mp['M']*mp['A']*mp['R']+mp['M']*mp['A']*mp['C']+mp['M']*mp['A']*mp['H']+mp['A']*mp['R']*mp['C']+mp['A']*mp['R']*mp['H']+mp['R']*mp['C']*mp['H'] <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long MOD = 998244353;
long long modpow(long long a, long long b){
	a %= MOD;
	long long res = 1;
	while (b > 0){
		if (b % 2 == 1) res = res * a % MOD;
		a = a * a % MOD;
		b = b / 2;
	}
	return res;
}
long long modinv(long long a){
	return modpow(a, MOD - 2);
}
vector<long long> mf;
long long modfact(long long n){
	if (n < mf.size()){
		return mf[n];
	} else {
		if (mf.empty()) mf.push_back(1);
		long long res = mf.back();
		for (int i = mf.size(); i <= n; i++){
			res = res * i % MOD;
			mf.push_back(res);
		}
		return res;
	}
}
long long modbinom(long long n, long long r){
	long long res;
	res = modfact(n);
	res = res * modinv(modfact(r)) % MOD;
	res = res * modinv(modfact(n - r)) % MOD ;
	return res;
}
int main(){
  int N, M, K;
  cin >> N >> M >> K;
  long long ans = 0;
  for (int i = 0; i <= K; i++){
    long long tmp = modbinom(N - 1, i) * (M * modpow(M - 1, N - i - 1) % MOD) % MOD;
    ans = (ans + tmp) % MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 5296
N = int(input())
A = [int(x) for x in input().split()]

reg = 10**12
ans = 0
for i in range(min(A), max(A)+1):
    tmp = 0
    for a in A:
        tmp += (a-i)**2
    reg = min(reg, tmp)
    if reg==tmp:
        ans = reg
print(ans)

Measured memory_bytes: 3060
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";var n=998244353;function i(){for(var t=arguments,e=t[0],r=t.length;--r;)e=((e>>16)*t[r]%n*65536+(65535&e)*t[r])%n;return e}function o(t,e){for(var r=1;e;t=i(t,t),e>>=1)1&e&&(r=i(t,r));return r}t.exports=function(t){for(var e=t.in(),r=new Array(e),s=0;s<e;s++)r[s]=t.in();if(0==r[0]){for(var u=new Map,c=0,f=0;f<e;f++)u[r[f]]||(u[r[f]]=0),u[r[f]]++,c=Math.max(c,r[f]);if(1==u[0]){for(var l=1,a=1;a<=c;a++){if(!u[a])return void console.log(0);l=i(l,o(u[a-1],u[a]))%n}console.log(l)}else console.log(0)}else console.log(0)}}]);


Measured memory_bytes: 29712
/*
ID: 5ak0
PROG:
LANG: C++11
*/

#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define mpr make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 7;

ll a, b, c;

int main(){
    #ifndef SAKO
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    #endif // SAKO
    ios_base::sync_with_stdio(0);

    cin >> a >> b >> c;
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0)
        return !(cout << 0);
    cout << min(1ll * a * b, min(1ll * a * c, 1ll * b * c));

    return 0;
}


Measured memory_bytes: 256
l=list(input())
n=2**3
for i in range(n):
    sum=int(l[0])
    buf=l[0]
    for j in range(3):
        if i>>j & 1:
            buf+='+'+l[j+1]
            sum+=int(l[j+1])
        else:
            buf+='-'+l[j+1]
            sum-=int(l[j+1])
    if sum==7:
        print(buf+'=7')
        exit()

Measured memory_bytes: 3064