akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		for(int i=0;n+1>i;i=i+4) {
			for(int j=0;n+1>j;j=j+7) {
				if(i+j==n) {
					System.out.println("Yes");
					System.exit(0);
				}
			}
		}
		System.out.println("No");
	}
}

Measured memory_bytes: 21844
// abc177_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (ll)(1e9)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int idx=0;idx<(n-1);idx++) cout << (vec)[idx] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << "\n";}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    string S, T;
    cin >> S >> T;

    int ans = INF;
    REP(i, S.size() - T.size() + 1){
        int tmp = 0;
        REP(j, T.size()){
            if (S[i+j] != T[j]){
                tmp++;
            }
        }
        ans = min(ans, tmp);
    }
    print(ans);


    return 0;
}


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

typedef long long int llint;

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

  int cnt = 0;
  
  for(int i = 1; i <= n; i += 2) {
    int c = 0;
    for(int j = 1; j <= i; j++) {
      if(i % j == 0) c++;
    }
    if(c == 8) cnt++;
  }

  cout<< cnt <<endl;
  
  return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << (b?"YES\n":"NO\n");}
void Yes(bool b) {cout << (b?"Yes\n":"No\n");}
void yes(bool b) {cout << (b?"yes\n":"no\n");}
void Yay(bool b) {cout << (b?"Yay!\n":":(\n");}

long long powmod(long long a,long long b){
    long long c=1;
    while(b>0){
        if(b&1) c=a*c%mod;
        a=a*a%mod;
        b>>=1;
    }
    return c;
}

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n,ans=1;
	map<ll,ll> m;
	m[0]=3;
	cin >> n;
	vll a(n);
	rep(i,n) cin >> a[i];
	rep(i,n){
		if(m[a[i]]==0){
			cout << 0 << endl;
			return 0;
		}
		else{
			ans=ans*m[a[i]]%mod;
			m[a[i]]--;
			m[a[i]+1]++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;
lint p=1e9+7;

lint pow_mod(lint a,lint b,lint p){
  if(b==0)return 1;
  if(b%2==0){
    lint d=pow_mod(a,b/2,p);
    return (d*d)%p;
  }else{
    return (a*pow_mod(a,b-1,p))%p;
  }
}

int main(){
  lint N,K;
  cin>>N>>K;
  vector<lint> A(K+1,0);
  A[K]=1;
  for(lint i=K-1;i>0;i--){
    A[i]=pow_mod(K/i,N,p);
    for(lint j=2;i*j<=K;j++){
      A[i]+=p-A[i*j];
      A[i]%=p;
    }
  }
  lint ans=0;
  REP(i,K+1){
    ans+=A[i]*i;
    ans%=p;
  }
  // for(auto e:A)cerr<<e<<" ";
  // cerr<<endl;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3996
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin>>a[i];

  bool flag=true;
  for(int i=0;i<n;i++){
    if(a[i]%2==0){
      if(a[i]%3!=0 && a[i]%5!=0){
        flag=false;
        break;
      }
    }
  }
  if(flag)cout<<"APPROVED"<<endl;
  else cout<<"DENIED"<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int g = sc.nextInt();
		int b = sc.nextInt();
		
		System.out.println( (r *100 + g * 10 + b) % 4 == 0 ? "YES" : "NO" );
	}
}


Measured memory_bytes: 21332
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,a[300005];
ll ans;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n*3;++i)scanf("%d",a+i);
    sort(a+1,a+n*3+1);
    for(int i=1;i<=n;++i)ans+=a[n+i*2-1];
    printf("%lld\n",ans);
    //system("pause");
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int	n;
int main()
{
	cin>>n;
	if(n<=81)
		for(int i=1;i<=9;i++)
			if(n%i==0&&n/i<=9)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
	cout<<"No"<<endl;
	return 0;
} 	

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

#define FASTIO ios::sync_with_stdio(NULL); cin.tie(NULL);
#define show(x) cerr << #x << " = " << x << "\n"
#define mem( a , b ) memset( a , b , sizeof a )
#define popcnt(x) __builtin_popcount(x)
#define all(x) x.begin() , x.end()
#define SZ(a) (int)a.size()
#define ll  long long
#define ld  long double
#define vii vector  <ll>
#define dqi deque   <ll>
#define sii set     <ll>
#define vpi vector  <pii>
#define mii map     <ll,ll>
#define pii pair    <ll,ll>
#define vss vector  <string>
#define pb  push_back
#define F   first
#define S   second
#define L   length()
#define PI  3.141592654
#define OO (ll)1e18
using namespace std;
void ONLINE__JUDGE();

pii swapii( pii pr ){ return { pr.S , pr.F }; }
int dx[] = {  0 ,  0 , -1 , +1 , -1 , +1 , -1 , +1 };
int dy[] = { -1 , +1 ,  0 ,  0 , -1 , +1 , +1 , -1 };

const ll MOD = 1e9 + 7;
const ll MAX = 1e5 + 9;

ll a , b , c , d;

ll get( ll x , ll y , ll z )
{
    if ( z > y ) return 0;
    ll remX = x%z; ll xx = x-remX;
    if ( xx < x ) xx += z;

    ll remY = y%z; ll yy = y-remY;
    if ( yy > y ) yy -= z;

    ll n   = yy - xx + 1;
    ll ret = n/z + (bool)(n%z);
    return ret;
}

int main()
{
    FASTIO //ONLINE__JUDGE();

    cin >> a >> b >> c >> d;
  
    ll del = c*d / __gcd(c , d);
    cout << b - a + 1 - (get(a,b,c) + get(a,b,d) - get(a,b,del));
    return 0;
}

void ONLINE__JUDGE()
{
    #ifndef ONLINE_JUDGE
    freopen( "inp.c"         , "r" , stdin  );
    //freopen( "OutPut.txt"   , "w" , stdout );
    #endif // ONLINE_JUDGE
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

vector<P> G[100100];
deque<int> deq;
int dist[100100];

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

    int K;
    std::cin >> K;

    for(int i=0;i<K;++i){
        G[i].emplace_back((i + 1) % K, 1);
        G[i].emplace_back(i * 10 % K, 0);
    }

    fill(dist, dist + K, 100100);
    dist[1] = 0;
    deq.push_front(1);

    while(!deq.empty()){
        int x = deq.front();
        deq.pop_front();

        for(auto &e : G[x]){
            int y, c;
            tie(y, c) = e;

            if(dist[y] > dist[x] + c){
                dist[y] = dist[x] + c;
                if(c == 0){
                    deq.push_front(y);
                }else{
                    deq.push_back(y);
                }
            }
        }
    }

    std::cout << (dist[0] + 1) << std::endl;
}

Measured memory_bytes: 6272
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int
int dp[51][51][2501];

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

    //rep(i, N) cout << x[i] << " ";
    //cout << endl;

    dp[0][0][0] = 1;
    rep(k, N) {
        rep(i, N) {
            rep(j, 2501) {
                dp[k][i+1][j] += dp[k][i][j];
                if (j - x[i] >= 0) dp[k+1][i+1][j] += dp[k][i][j-x[i]];
            }
        }
    }

    int ans = 0;
    REP(i, 1, N) ans += dp[i][N][A*i];
    REP(i, 1, N) {
        //cout << "dp[" << N << "][" << A*i << "] =" << dp[i][N][A*i] << endl;
    }
    cout << ans << endl;




    return 0;
}


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

typedef long long ll;

struct Node{
    int key;
    Node* next;
    Node* pre;
};

struct List{
    Node *first;

    void init(){
        first = (Node*)malloc(sizeof(Node));
        first->key=0;
        first->next=first;
        first->pre=first;
    }

    void insert(int x){
        Node *nextnode = (Node*)malloc(sizeof(Node));
        nextnode->key = x;
        nextnode->next = first->next;
        first->next->pre = nextnode;
        first->next = nextnode;
        nextnode->pre = first;
    }

    void delete_x(int x){
        for(Node* p=first->next; p != first; p = p->next){
            if(p->key == x){
                p->next->pre = p->pre;
                p->pre->next = p->next;
                free(p);
                return;
            }
        }
    }

    void deleteFirst(){
        Node *p = first->next;
        p->next->pre = p->pre;
        first->next = p->next;
        free(p);
    }

    void deleteLast(){
        Node *p = first->pre;
//        for(p = first; p->next != first; p=p->next);
        p->pre->next = p->next;
        p->next->pre = p->pre;
    }

    void print_list(){
        bool flg=false;
        for(Node* p=first->next; p != first ; p=p->next){
            if(flg)cout << " ";
            cout << p->key;
            flg=true;
        }
        cout << endl;
    }

};

int main(){
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    List list;
    list.init();
    string s;
    int k;
    for(int i=0;i<n;i++){
        cin >> s;
        if(s=="insert"){
            cin >> k;
            list.insert(k);
        }else if(s=="delete"){
            cin >> k;
            list.delete_x(k);
        }else if(s=="deleteFirst"){
            list.deleteFirst();
        }else{
            list.deleteLast();
        }
    }
    list.print_list();
}



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

int main(void){
	
	int a, b;

	std::cin >> a >> b;

	std::cout << std::max(a + b, std::max(a - b, a * b)) << std::endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        long x = scan.nextLong();
        long taka = 100;
        long years = 0;
        
        while(taka<x) {
        	years++;
        	taka*=1.01;
        }

		System.out.println(years);
	    scan.close();	
    }
}

Measured memory_bytes: 35752
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> *i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n;
    cin>>n;
    vector<int> p={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,
        59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,
        131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,
        211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,
        293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,
        389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,
        479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,
        587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,
        673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,
        773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,
        881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};
    // cout<<SZ(p)<<endl;
    vector<int> cnt(200,0);
    REPF(i,1,n+1) {
        int t=i;
        REP(j,168) {
            while(t%p[j]==0) {
                cnt[j]++;
                t/=p[j];
            }
        }
    }
    
    const int MOD=1e9+7;
    int ans=1;
    REP(i,168) {
        ans*=(cnt[i]+1);
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);

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

  int n = 50;

  ll p = k/n;
  int q = k%n;

  vector<ll> a(50,0);
  REP(i,50)a[i]=p+49;

  REP(i,q){
    sort(ALL(a));
    a[0]+=n;
    FOR(j,1,a.size())a[j]--;
  }

  cout << n << endl;
  REP(i,n){
    if(i!=0)cout << " ";
    cout << a[i];
  }
  cout << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

#define N 1000003


int GetChar(char);
long long getkey(char *);
int Find(char *);
void Insert(char *);
int hash1(int);
int hash2(int);

int n = 0;
char Hash[N][13];

int main () {
  int i;
  char c[7], str[13];

  for(i = 0 ; i < N ; i++) Hash[i][0] = '\0';
  

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++) {
    scanf("%s %s",c,str);

    if(strcmp(c,"insert") == 0) {
      Insert(str);
    }
    
    else {
      if(Find(str) ==  1) printf("yes\n");
      else printf("no\n");
    }
  }

  return 0;
}


int Find(char *str) {
  long long i = 0, j = 0, len = 0;

  len = getkey(str);
  while(i < N) {

    j = (hash1(len) + i * hash2(len)) % N;
    if(strcmp(Hash[j], str) == 0) return 1;
    else if(strlen(Hash[j]) == 0) return 0;
    else i++;
  }
 
  return 0;
}


void Insert(char *str) {
  long long i = 0, j = 0, h = 0, len = 0;

  len = getkey(str);
  while(i < N) {
    
    h = (hash1(len) + i * hash2(len)) % N;
    if(strcmp(Hash[h],str) == 0) break; 
    else if(strlen(Hash[h]) == 0) {
      strcpy(Hash[h], str);
      break;
    }
    else i++;
  }
}


int hash1(int x) {
  return x % N;
}


int hash2(int x) {
  return 1 + (x % (N - 1));
}


int GetChar(char ch) {
  
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  
}


long long getkey(char str[]){
  
  long long sum = 0, p = 1, i;
  
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(GetChar(str[i]));
    p *= 5;
  }

  return sum;
}



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

typedef long long int lli;

const lli maxn = lli(1e5)+5, inf = lli(1e18)+5;

lli res = inf, a[maxn], st0[4*maxn];
pair<lli, lli> st1[4*maxn];

inline lli left(lli node) { return (node<<1); }
inline lli right(lli node) { return (node<<1)+1; }

void upd0(lli node, lli L, lli R, lli a, lli b, lli v)
{
	if(a > R || b < L) return;
	else if(a <= L && R <= b) st0[node] += v;
	else
	{
		upd0(left(node), L, (L+R)/2, a, b, v), upd0(right(node), (L+R)/2+1, R, a, b, v);
	}
}

void upd1(lli node, lli L, lli R, lli a, lli b, lli v)
{
	if(a > R || b < L) return;
	else if(a <= L && R <= b) st1[node].first += v, st1[node].second++;
	else
	{
		upd1(left(node), L, (L+R)/2, a, b, v), upd1(right(node), (L+R)/2+1, R, a, b, v);
	}
}

void qry(lli node, lli L, lli R, pair<pair<lli, lli>, lli> a)
{
	a.first.first += st1[node].first, a.first.second += st1[node].second;
	a.second += st0[node];
	if(L == R)
	{
		res = min(res, a.first.first-a.first.second*L+a.second);
		//cout << L << " " << a.first.first-a.first.second*L+a.second << "\n";
	}
	else
	{
		qry(left(node), L, (L+R)/2, a), qry(right(node), (L+R)/2+1, R, a);
	}
}

int main(void)
{
	lli n, m;
	scanf("%lld%lld", &n, &m);

	for(lli i = 0;i < n;i++) scanf("%lld", &a[i]);

	for(lli i = 0;i < n-1;i++)
	{
		if(a[i] < a[i+1])
		{
			upd0(1, 1, m, 1, a[i], a[i+1]-a[i]);
			upd0(1, 1, m, a[i+1]+1, m, a[i+1]-a[i]);
			upd1(1, 1, m, a[i]+1, a[i+1], a[i+1]+1);
		}
		else
		{
			upd0(1, 1, m, a[i+1]+1, a[i], a[i+1]+m-a[i]);
			upd1(1, 1, m, a[i]+1, m, a[i+1]+m+1);
			upd1(1, 1, m, 1, a[i+1], a[i+1]+1);
		}
	}

	qry(1, 1, m, {{0, 0}, 0});
	printf("%lld\n", res);
}

Measured memory_bytes: 9344
#include<stdio.h>

int main(){
	int d, i, s;
	
	while(scanf("%d", &d) != EOF){
		for(i = 1, s = 0; i * d < 600; i++)
			s += i * i * d * d * d;
		
		printf("%d\n", s);
	}
	
	return 0;
}

Measured memory_bytes: 592
N, M = map(int,input().split())

switch = []
for _ in range(M):
    S = list(map(int,input().split()))
    switch.append(S[1:])

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

ans = 0
for bits in range(1<<N):
    flag = True

    for i in range(M):
        cnt = 0
        for s in switch[i]:
            if(bits>>(s-1) & 1):
                cnt += 1

        if cnt % 2 != P[i]:
            flag = False
    
    if flag: ans += 1

print(ans)

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=LI()
    B=LI()
    
    dp=[0]*(N+1)
    #i番目まで見てj個使って何個増やせたか
    
    v=[]
    for i in range(3):
        vv=B[i]-A[i]#差分だけ増える
        v.append(vv)
        
    for i in range(3):
        for j in range(A[i],N+1,1):
            dp[j]=max(dp[j-A[i]]+v[i],dp[j])
            
    N2=N#A=>Bでどこまで増えたか
    for j in range(N+1):
        temp=N+dp[j]
        N2=max(N2,temp)

        
    #B=>A
    dp2=[0]*(N2+1)
    for i in range(3):
        for j in range(B[i],N2+1,1):
            dp2[j]=max(dp2[j-B[i]]-v[i],dp2[j])#価値が逆転
            
    ans=N2
    for j in range(N2+1):
        temp=N2+dp2[j]
        ans=max(ans,temp)
        
    print(ans)
            
  
            

main()


Measured memory_bytes: 266872
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
int main(){
string a,b,c;
cin>>a>>b;
c=a+a;
if(c.find(b)!=string::npos){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;}
return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define ll  long long int
#define out  cout<<

using namespace std;



int main(){
    string s;
    cin>>s;
    string p;
    if(s[s.size()-1]!='s')
        out s+"s"<<endl;
    else{
        
        out s+"es"<<endl;
    }

return 0;}


Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
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;
}
int main() {
	int n;
	cin >> n;
	int dp[100020] = {};
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		dp[a]++;
	}
	int ans = 0;
	for (int i = 1; i <= 99999; i++) {
		ans = max(ans, dp[i - 1] + dp[i] + dp[i + 1]);
	}
	cout << ans;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;


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




int main() {
    int n, m;
    cin >> n >> m;
    int ans = 0;
    ans += n * (n - 1) / 2;
    ans += m * (m -1) / 2;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
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;}

template<typename K>
struct Matrix{
  typedef vector<K> arr;
  typedef vector<arr> mat;
  mat dat;

  Matrix(size_t r,size_t c):dat(r,arr(c,K())){}
  Matrix(mat dat):dat(dat){}

  size_t size() const{return dat.size();};
  bool empty() const{return size()==0;};
  arr& operator[](size_t k){return dat[k];};
  const arr& operator[](size_t k) const {return dat[k];};
  
  static Matrix cross(const Matrix &A,const Matrix &B){
    Matrix res(A.size(),B[0].size());    
    for(int i=0;i<(int)A.size();i++)
      for(int j=0;j<(int)B[0].size();j++)
        for(int k=0;k<(int)B.size();k++)
          res[i][j]+=A[i][k]*B[k][j];
    return res;
  }

  static Matrix identity(size_t n){
    Matrix res(n,n);
    for(int i=0;i<(int)n;i++) res[i][i]=K(1);
    return res;
  }
  
  Matrix pow(long long n) const{
    Matrix a(dat),res=identity(size());
    while(n){
      if(n&1) res=cross(res,a);
      a=cross(a,a);      
      n>>=1;
    }
    return res;
  }
};


template<typename T,T MOD = 1000000007>
struct Mint{
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(int k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }
  
  Mint inv(){return pow(MOD-2);}
  
  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}
  
  Mint operator+(Mint a) const{return Mint(v)+=a;};
  Mint operator-(Mint a) const{return Mint(v)-=a;};
  Mint operator*(Mint a) const{return Mint(v)*=a;};
  Mint operator/(Mint a) const{return Mint(v)/=a;};

  Mint operator-(){return v?MOD-v:v;}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}

};

//INSERT ABOVE HERE
signed main(){
  int n,m;
  cin>>n>>m;
  vector<int> x(m);
  for(int i=0;i<m;i++) cin>>x[i];
  x.emplace(x.begin(),0);
  x.emplace_back(n);

  using M = Mint<int>;
  using MM = Matrix<M>;

  MM A(3,3);
  A[0][0]=2;A[0][1]=1;A[0][2]=1;
  A[1][0]=2;A[1][1]=1;A[1][2]=0;
  A[2][0]=1;A[2][1]=1;A[2][2]=1;
  
  MM B(3,3);
  B[0][0]=1;B[0][1]=0;B[0][2]=0;
  B[1][0]=2;B[1][1]=1;B[1][2]=0;
  B[2][0]=1;B[2][1]=1;B[2][2]=1;

  MM C(3,1);
  C[0][0]=1;
  C[1][0]=0;
  C[2][0]=0;
  
  for(int i=0;i<=m;i++){
    int l=(x[i+1]-x[i])-1;
    C=MM::cross(A.pow(l),C);
    if(i!=m) C=MM::cross(B,C);
  }

  M ans(0);
  ans+=C[0][0];
  ans+=C[1][0];
  ans+=C[2][0];

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


Measured memory_bytes: 1024
arr = gets.chomp.split(' ').map(&:to_i)
b = gets.chomp.split(' ').map(&:to_i)

max = b.max
half = (max + 1) / 2
diff = [half * 3]
index = 0
b.each_with_index do |val, i|
  next if val == max
  diff[i] = (half - val).abs
  index = diff[index] > diff[i] ? i : index
end
puts "#{max} #{b[index]}"


Measured memory_bytes: 10444
import java.util.*;
import java.lang.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer x = Integer.parseInt(scanner.next());
        Integer y = Integer.parseInt(scanner.next());
        Integer[] hito = new Integer[x];

        for(int i = 0; i < x; i++) {
            hito[i] = Integer.parseInt(scanner.next());
        }

        int count = 0;
        for(int i= 0; i < x; i++) {
            if (hito[i] >= y) count++;

        }
        System.out.println(count);
    }
}

Measured memory_bytes: 48344
N = int(input())
X = list(map(int, input().split()))

C_1 = sum(X)
P_R = C_1 / N
P_int_min = int(P_R)
P_int_max = P_int_min + 1

zahyou = -1
if (P_R - P_int_min) <= (P_int_max - P_R):
# P_R が下側の整数に近い時　<=> 下側の整数との距離の方が小さい時
    zahyou = P_int_min
else:
    zahyou = P_int_max

ans = 0
for i in range(N):
    ans += (X[i] - zahyou)**2

print(ans)


Measured memory_bytes: 3064
#pragma region
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 1e9
using namespace std;
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}

typedef long long ll;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

#pragma endregion

int main() {
  string a = in<string>(), b = in<string>();
  int c = stoi(a + b);
  if ((int)sqrt(c) * (int)sqrt(c) == c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
let [| n; m; |] = stdin.ReadLine().Split() |> Array.map int
let xs = stdin.ReadLine().Split() |> Array.map int

match m - n <= 0 with
| true -> 0
| false ->
    xs |> Seq.sort |> Seq.pairwise |> Seq.map (fun (x,y) -> y - x) |> Seq.sort 
    |> Seq.take (m-n) |> Seq.sum
|> stdout.WriteLine

Measured memory_bytes: 26076
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*                                                    
      I ♥ CLARICE STARLING...                                                               
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
const ll INF = (ll)2e18 + 77;
void solve()
{
    char c;cin>>c;
    if(c>='a')cout<<"a\n";
    else cout<<"A\n";
}
int main()
{
   fastio
   //Test_cases
   solve();
  return 0;
}
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
// Syntax to create a min heap for priority queue priority_queue <int, vector<int>, greater<int>>; 
//for modinverse use modularexponention(x,M-2,M);
//for "each" subtraction from ans(ans-k) if(ans<0) do ans+=MOD,ans%=MOD
//vector<vector<int>>dp(201,vector<int>(n+1)); A way to initialize vector of vector
//If wrong on pretest 2 means logically wrong


/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


Measured memory_bytes: 3648
import math

def divisorGenerator(n):
    large_divisors = []
    for i in range(1, int(math.sqrt(n) + 1)):
        if n % i == 0:
            yield i
            if i*i != n:
                large_divisors.append(n / i)
    for divisor in reversed(large_divisors):
        yield divisor

n = int(input())
output = 0
for i in range(1, n + 1):
	if(i % 2 != 0):
		if(len(list(divisorGenerator(i))) == 8):
			output += 1
		
print(output)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
 
int main(void){
    int n;
    cin>>n;
    vector<int> c(n),s(n),f(n);
    rep(i,n-1){
        cin>>c[i]>>s[i]>>f[i];
    }
    rep(i,n){
        int t = 0;
        for(int j=i;j<n-1;j++){
            t=max(t,s[j]);
            if(t%f[j]==0){
                t += c[j];
            }else{
                t += f[j]-t%f[j] + c[j];
            }
        }
        cout<<t<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int n, i, j, k, h, w;
  int d[8][2] = {
    {-1, 1}, {0, 1}, {1, 1}, {1, 0},  {-1, 0}, {-1, -1}, {0, -1},  {1, -1}
  };
  scanf("%d%d", &h, &w);
  char s[h][w + 10];
  for(i = 0; i < h; ++i) scanf("%s", s[i]);
  for(i = 0; i < h; ++i) for(j = 0; j < w; ++j) if(s[i][j] != '#') {
    int tmp = 0;
    for(k = 0; k < 8; ++k) if(d[k][0] + i >= 0 && d[k][0] + i < h && d[k][1] + j >= 0 && d[k][1] + j < w && s[d[k][0] + i][d[k][1] + j] == '#') ++tmp;
    s[i][j] = tmp + '0';
  }
  for(i = 0; i < h; ++i) printf("%s\n", s[i]);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int , int>
#define fast ios_base::sync_with_stdio(0)
#define mx 100005
#define inf 1000000000000000008LL
ll arr[102], dp[102][mx], weight[102], value[102];
ll n;
ll fun(int pos, int rem)
{
    if(rem<=0) return 0;
    if(pos>n) return inf;
    ll& ret = dp[pos][rem];
    if(ret!=-1) return ret;
    ret = min(fun(pos+1, rem), weight[pos] + fun(pos+1, rem - value[pos]));
    return ret;
}
int main()
{
    ll cap;
    scanf("%lld%lld",&n, &cap);
    int sum = 0;
    for(int i=1; i<=n; i++){
        scanf("%lld%lld",&weight[i], &value[i]);
        sum+=value[i];
    }
    int lo = 0, hi = sum, mid,ans = 0;
    while(lo<=hi){
        mid = (lo+hi)/2;
        memset(dp, -1, sizeof dp);
        ll res = fun(1,mid);
        if(res<=cap){
            lo = mid+1;
            ans = max(ans, mid);
        }
        else hi = mid-1;
    }
    printf("%d\n",ans);

}


Measured memory_bytes: 80000
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#include <chrono>
#define LL long long
#define pb push_back
#define mp make_pair
#define INf 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define f first
#define S second
using namespace std;
typedef pair<int,int>pii;
using namespace std;
char a[4000010],b[4000010];
int n,m,l,f[4000010],g[4000010];
int main() {
	cin>>(a+1)>>(b+1);
	n=strlen(a+1);
	m=strlen(b+1);
	while(n<(m<<1)){
		for(int i=1;i<=n;i++)a[i+n]=a[i];
		n<<=1;
	}
	for(int i=1;i<=n;i++)a[i+n]=a[i];
	n<<=1;
	f[0]=-1;
	for(int i=1;i<=m;i++){
		int j=i-1;
		while(j&&b[f[j]+1]!=b[i])j=f[j];
		f[i]=f[j]+1;
	}
	int j=0,ans=0;
	for(int i=1;i<=n;i++){
		while(~j&&a[i]!=b[j+1])j=f[j];
		if(++j==m){
			g[i]=g[i-m]+1;
			ans=max(ans,g[i]);
			l=i;
		}
	}
	if(ans>=n/m-1) puts("-1");
	else cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 23040
#include<algorithm>
#include<string>
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
 
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

 
int main(){
    
    int n,m;
    cin >> n >> m;
    vector<int> c(m),p(m),y(m),s(n,0);
    vector<pair<int, llong>> pairs(m),paird(m);

    REP(i,m){
        cin >> p[i] >> y[i];
        pairs[i] = make_pair(y[i],p[i]);
        paird[i] = make_pair(y[i],i);
    }

    sort(pairs.begin(), pairs.end());
    sort(paird.begin(), paird.end());

    REP(i,m){
        s[pairs[i].second-1]++;
        c[paird[i].second] = s[pairs[i].second-1];
    }



    REP(i,m){
        printf("%06d%06d\n",p[i],c[i]);
    }

    return 0;
}

Measured memory_bytes: 6144
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
 
class Program
{
    static void Main()
    {
        long[] inputs = Console.ReadLine().Split(' ')
                                    .Select(val => long.Parse(val))
                                    .ToArray();
        Console.WriteLine(Func(inputs[1], inputs[2]) - Func(inputs[0] - 1, inputs[2]));
    }
    static long Func(long n, long x)
    {
        return n < 0 ? 0 : n / x + 1;
    }
}


Measured memory_bytes: 2776
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a1=0,a2=0,a3=0,a4=0,a5=0,a6=0,a7=0,a8=0,a9=0,n,i,m,min,max;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
            scanf("%d",&m);
            if(m<=399)
                a1=1;
            else if(m<=799)
                a2=1;
            else if(m<=1199)
                a3=1;
            else if(m<=1599)
                a4=1;
            else if(m<=1999)
                a5=1;
            else if(m<=2399)
                a6=1;
            else if(m<=2799)
                a7=1;
            else if(m<=3199)
                a8=1;
            else
                a9++;
    }
    min=a1+a2+a3+a4+a5+a6+a7+a8;
    if(min==0)
    {
            min=1;
            max=a9;
    }
    else
        max=min+a9;
    printf("%d %d\n",min,max);
}


Measured memory_bytes: 128
N = int(input())
D = {i: 0 for i in range(100)}
for i in range(1, N+1):
  if i % 10 != 0:
    s = str(i)
    D[int(s[0])*10+int(s[-1])] += 1
S = 0
for i in range(10):
  for j in range(10):
    S += D[i*10+j] * D[j*10+i]
print(S)

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

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<pair<int, int>> a;
    rep(i, N) {
        int s; cin >> s;
        a.push_back({s, -(i + 1)});
    }
    a.push_back({0, 0});
    sort(a.begin(), a.end(), greater<pair<int, int>>());
    /*
    rep(i, N) {
        cout << a[i].first << " " << -a[i].second << endl;
    }
    */
    int ans[100010] = {};
    pair<int, int> focus;
    rep(i, N) {
        if (i == 0 || a[i].first > focus.first || -a[i].second < -focus.second) 
            focus = a[i];
        //cout << a[i].first << " " << -a[i].second << " " << -focus.second << " " << i + 1 <<  endl;
        ans[-focus.second] += (a[i].first - a[i + 1].first) * (i + 1);
    }
    REP(i, 1, N) {
        cout << ans[i] << endl;
    }

    return 0;
}


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

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(vs) (ll)(vs.size())
#define rep(i,a,b) for (ll i=a;i<b;++i)
#define rep_(i,a,b) for (ll i=a;i>b;--i)
#define iter(i,c) for (auto i:c)
#define endl '\n'
const ll mod = 1e9 + 7;

const ll maxn = 2e6 + 5;

ll n, k;
ll a[maxn];

void solve() {
	cin>>n>>k;
	rep(i,0,n) cin>>a[i];
	rep(i, k, n) {
		if (a[i]>a[i-k]) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

void aux() {
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cout<<fixed<<setprecision(10);
	aux();
	ll _ = 1;
	// cin>>_;
	while(_--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 5204
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
const int N=1e6+5,MAX=3e7,MOD=1e9+7;
 
using namespace std;

int n;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
      scanf("%d",&n);
      std::vector<int> a(n);
      int ans = 0;
      for(int i=0,x;i<n;i++)scanf("%d",&x),ans=__gcd(x,ans);
      printf("%d\n",ans );
 }

Measured memory_bytes: 640
# -*- coding: utf-8 -*-
"""
Created on Wed May  2 21:28:06 2018
ALDS1_5a_r1  
@author: maezawa
"""
import itertools as itr

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

sum_array = []
for r in range(1,n+1):
    for comb in itr.combinations(a, r):
        sum_array.append(sum(comb))
sum_array.sort()

for i in m:
    left = 0
    right = len(sum_array)
    yesorno = 'no'
    while(left < right):
        #print(left, right)
        mid = (left+right)//2
        if sum_array[mid] == i:
            yesorno = 'yes'
            break
        elif sum_array[mid] > i:
            right = mid
        else:
            left = mid+1
            
    print(yesorno)



Measured memory_bytes: 47160
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
const long long MOD = 1000000007;

int N, K;
ll a[5001];
ll asum;
bool dp[5001];

bool isNoNeed(int x) {
    if (asum < K) {
        return true;
    }
    fill(dp, dp + K, false);
    dp[0] = true;
    if (K - a[x] <= 0) {
        return false;
    }
    for (int i = 0; i < N; i++) {
        if (i == x) continue;
        for (int j = K - 1; j >= a[i]; j--) {
            dp[j] = dp[j] || dp[j - a[i]];
            if (dp[j] && K - a[x] <= j) {
                return false;
            }
        }
    }
    return true;
}

int main() {
    cin >> N >> K;
    asum = 0;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        asum += a[i];
    }
    sort(a, a + N);

    //upper_bound [L, R) ans = L
    int L = -1;
    int R = N;
    while (R - L > 1) {
        int M = (L + R) / 2;
        if (isNoNeed(M)) {
            L = M;
        } else {
            R = M;
        }
    }

    cout << L + 1 << endl;

    return 0;
}

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

int main(){
	int n,x;	cin>>n>>x;
	int a[n],i;
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	i=0;
	while(i<n){
		if(x<a[i])	break;
		x-=a[i];	i++;
	}
	if(i==n){
		if(x==0)	cout<<n;
		else	cout<<n-1;
	}
	else	cout<<i;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vb = vector<bool>;
using vs = vector<string>;
using pint = pair<int, int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
    int n, m, x, y;
    cin >> n >> m >> x >> y;

    vi a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    
    if(x == y) {
        cout << "War" << endl;
        return 0;
    }

    bool nowar = false;
    for(int i = x+1; i <= y; i++) {
        bool find = true;
        rep(j, n) {
            if(a[j] >= i) find = false;
        }
        rep(j, m) {
            if(b[j] < i) find = false;
        }
        if(find) nowar = true;
    }

    cout << (nowar ? "No War" : "War") << endl;
    
    return 0;
}


Measured memory_bytes: 256
from collections import  deque

H, W = map(int, input().split())
s = [input() for _ in range(H)]

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

white = 0
dist = [[-1 for _ in range(W)] for _ in range(H)]

for h in range(H):
    for w in range(W):
        if s[h][w] == ".":
            white += 1

q = deque()
q.append([0, 0])
dist[0][0] = 0
while(q):
    a = q.popleft()
    for i in range(4):
        if a[0] + dx[i] < 0 or a[0] + dx[i] >= W or a[1] + dy[i] < 0 or a[1] + dy[i] >= H:
            continue
        if s[a[1] + dy[i]][a[0] + dx[i]] == "#":
            continue
        if dist[a[1] + dy[i]][a[0] + dx[i]] == -1:
            dist[a[1] + dy[i]][a[0] + dx[i]] = dist[a[1]][a[0]] + 1
            q.append([a[0] + dx[i], a[1] + dy[i]])

if dist[H - 1][W - 1] == -1:
    print(-1)
else:
    print(white - dist[H - 1][W - 1] - 1)

Measured memory_bytes: 3316
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const N = parseInt(args[0][0], 10)
	const H = args[1].map(arg => parseInt(arg, 10))
	let max = 0
	let cnt = 0
	
	for (let i = 0; i < N - 1; i++) {
		if (H[i] >= H[i + 1]) {
			cnt++
			max = Math.max(max, cnt)
		} else {
			cnt = 0
		}
	}

	console.log(max)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 17804
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    int ans = (A*3 + P)/2;
    cout << ans << endl;
}

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

int main(){
  str s; cin >> s;
  int ans=0;
  for(int i=0; i<s.length(); i++){
    if(s[i] == '+'){
      ans += 1;
    }else{
      ans -= 1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256