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

int main() {
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;

	int base, extra;
	if (N <= K) {
		base = X * N;
		extra = 0;
	}
	else {
		base = X * K;
		extra = Y * (N - K);
	}

	cout << base + extra << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 2019;
ll mul(ll a, ll b){
    return ((a%mod) * (b%mod))%mod;
}
ll power(ll a, ll b){
    ll z = 1; ll x = a;
    while(b>0){
        if (b&1)z = mul(z, x);
        x = mul(x, x);
        b >>= 1;
    }
    return z;
}
int main()
{
    string s;
    cin>>s;
    int n = 2019;
    long long int a[n];
    memset(a, 0, sizeof(a));
    ll rem = 0;
    a[0] = 1;
    ll l = s.length();
    for (int i=l-1; i>=0; i--){
        rem = (rem + mul(ll((s[i]-'0')), power(10, l-i-1)))%mod;
        // cout<<"rem is "<<rem<<endl;
        a[rem]++;
    }
    long long int ans = 0;
    for (int i=0; i<n; i++)if (a[i]>1)ans += (a[i]*(a[i]-1))/2;
    cout<<ans<<endl;
}

Measured memory_bytes: 3748
#include "bits/stdc++.h"
using namespace std;

#define ll long long

int main() {
	ll x, k, d;
	cin >> x >> k >> d;
	ll i, j;
	ll buf1, buf2;
	ll ans;
	if (x > 0) {
		if (x / d > k) {
			ans = x - k * d;
		}
		else {
			buf1 = x % d;
			if ((k - x / d) % 2 == 0)ans = buf1;
			else ans = abs(buf1 - d);
		}
	}
	else if(x < 0){
		if (-x / d > k) {
			ans = -x - k * d;
		}
		else {
			buf1 = -x % d;
			if ((k + x / d) % 2 == 0)ans = buf1;
			else ans =-buf1 + d;
		}
	}
	else {
		if (k % 2 == 0)ans = 0;
		else ans = d;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
#include<math.h>
#define N 100005
#define K 200005
#define MOD 998244353
#define ll long long int
using namespace std;
 ll max(ll a,ll b)
 {
     if(a>=b)
     {
         return a;
     }
     else
     {
         return b;
     }
     
 }
int main() {
ll n,W;
cin>>n>>W;

vector<ll> dp(W+1,0);
for(ll i=0;i<n;i++)
{
    ll w,v;
    cin>>w>>v;
    for(ll j=W-w;j>=0;j--)
    {
        dp[j+w]=max(dp[j+w],dp[j]+v);
    }
}
cout<< dp[W]<<endl;
//ll ans=0;
/*for(ll i=0;i<=W;i++)
{
    ans=max(dp[i],ans);
}
//cout<<ans;*/
}

Measured memory_bytes: 1024
n, k = map(int, input().split())
s, p, r = map(int, input().split())
t = input()
pre = "0"
ans = 0

for i in range(k):
    for j in t[i::k]:
        if j != pre:
            if j == "s":
                ans += s
            elif j == "p":
                ans += p
            elif j == "r":
                ans += r
            pre = j
        else:
            pre = "0"
    pre = "0"
    
print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define reps(i,n) for (int i=1;i<=(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rreps(i,n) for (int i=(n);i>0;i--)
#define all(v) (v).begin(),(v).end()
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>
template<class T> inline bool chmin(T &a, T b) {if (a>b) {a = b; return 1;} return 0;};
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a = b; return 1;} return 0;};
typedef long long int ll;
const long long INF = 1LL << 60;

bool contain(string s){
  bool b3 = 0, b5 = 0, b7 = 0;
  for (int i=0;i<s.size();i++){
    if (s[i]=='3') b3 = true;
    if (s[i]=='5') b5 = true;
    if (s[i]=='7') b7 = true;
  }
  bool ans = (b3 && b5 && b7);
  return ans;
}

int main(){
  int N; cin >> N;
  queue<string> q;
  q.push(""s);
  int cnt = 0, cnt_MAX = 30000;
  vector<ll> vec;
  while (cnt<cnt_MAX){
    string s = q.front(); q.pop();
    if (contain(s)) {
      ll si = stoll(s);
      vec.push_back(si);
      cnt++;
    }
    q.push(s+"3");
    q.push(s+"5");
    q.push(s+"7");
  }
  int ans = lower_bound(vec.begin(),vec.end(),N) - vec.begin();
  if (vec[ans]==N) ans++;
  cout << ans << endl;



 

  // cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 5836
#include <stdio.h>

int main( void )
{
	int W,H,x,y,r;

	scanf( "%d %d %d %d %d", &W, &H, &x, &y, &r );

	if( x + r <= W && y + r <= H && x - r >= 0 && y - r >= 0 )
	{
		printf( "Yes\n" );
	}
	else
	{
		printf( "No\n" );
	}

	return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
int N;
vector<pair<int, int> > conn[101010];
int ans[101010];
void dfs(int a, int pa, int c)
{
	ans[a] = c;
	for(auto x: conn[a])
		if(x.first != pa)
			dfs(x.first, a, c^x.second);
}
int main()
{
	scanf("%d", &N);
	for(int i=0; i<N-1; ++i)
	{
		int u, v, w;
		scanf("%d%d%d", &u, &v, &w);
		conn[u].emplace_back(v, w%2);
		conn[v].emplace_back(u, w%2);
	}
	dfs(1, 0, 0);
	for(int i=1; i<=N; ++i)
		printf("%d\n", ans[i]);
}

Measured memory_bytes: 8448
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <limits>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, a, n) for (int i = a; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eps 1e-15

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef tuple<int, int, int> ti3;

int main()
{
    int a = 0;
    int b = 0;
    int c = 0;
    char str[3];
    scanf("%s", str);
    for (auto x : str) {
        if (x == 'a')
            a++;
        else if (x == 'b')
            b++;
        else if (x == 'c')
            c++;
    }
    if (a == 1 && b == 1 && c == 1) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
}


Measured memory_bytes: 256
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

int main() {
    int n;
    cin >> n;
    bool f[n][10];
    int  p[n][11];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 10; j++) {
            cin >> f[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= 10; j++) {
            cin >> p[i][j];
        }
    }

    int ret = -(1 << 30);
    for (int i = 1; i < (1 << 10); i++) {
        int sum = 0;
        for (int j = 0; j < n; j++) {
            int count = 0;
            for (int k = 0; k < 10; k++) {
                if (f[j][k] && (i & (1 << k))) {
                    count++;
                }
            }
            sum += p[j][count];
        }
        ret = max(ret, sum);
    }
    cout << ret << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
struct
{
    int Top=0;
    int s[20000];
    bool Empty()
    {
        return Top==0;
    }
    void push(int x)
    {
        s[++Top]=x;
    }
    void pop()
    {
        Top--;
    }
    int top()
    {
        return s[Top];
    }
}S;
const int N=100;
const int bai=0;
const int hui=1;
const int hei=2;
int n,tu[N][N];
int fx[N],js[N],sum,nt[N],jilu[N];
int next(int u)
{
    for (int v=nt[u];v<n;v++)
    {
        nt[u]=v+1;
        if(tu[u][v]) return v;
    }
    return -1;
}
void DFS_visit(int r)
{

    S.push(r);
    jilu[r]=hui;
    fx[r]=++sum;
    while(!S.Empty())
    {
        int u=S.top();
        int v=next(u);
        if(v!=-1)
        {
            if(jilu[v]==bai)
            {
                jilu[v]=hui;
                fx[v]=++sum;
                S.push(v);
            }
        }
        else
        {
            S.pop();
            jilu[u]=hei;
            js[u]=++sum;    
        }
    }
}
void DFS()
{
    sum=0;
    for (int u=0;u<n;u++)
    {
        if(jilu[u]==bai)
            DFS_visit(u);
    }
    for (int i=0;i<n;i++)
    {
        printf("%d %d %d\n",i+1,fx[i],js[i]);
    }
}
int main()
{
    int u,k,v;
    scanf("%d",&n);
    for (int i=0;i<n;i++)
    {
        scanf("%d%d",&u,&k);
        u--;
        for(int j=0;j<k;j++)
        {
            scanf("%d",&v);
            v--;
            tu[u][v]=1;
        }
    }
    DFS();
    return 0;
}

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

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

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

#define si(a)           scanf("%d",&a)
#define sii(a,b)        scanf("%d %d",&a,&b)
#define siii(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define sl(a)           scanf("%lld",&a)
#define sll(a,b)        scanf("%lld %lld",&a,&b)
#define slll(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)

#define un(x)           x.erase(unique(all(x)), x.end())
#define xx              first
#define yy              second
#define pb              push_back
#define mp              make_pair
#define all(v)          v.begin(),v.end()
#define D(x)            cerr << #x " = " << x << '\n'
#define DBG             cerr << "Hi!" << '\n'

#define CLR(a)          memset(a,0,sizeof(a))
#define SET(a)          memset(a,-1,sizeof(a))

#define PI              acos(-1.0)

inline int setBit(int n,int pos) { return n = n | (1 << pos); }
inline int resetBit(int n,int pos) { return n = n & ~(1 << pos); }
inline bool checkBit(int n,int pos) { return (bool)(n & (1 << pos)); }
//inline int countBit(ll n) { return __builtin_popcountll(n); }


//int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
//int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; //Four & Eight Direction

/******************************************************************************************/

//const int MAX = 200010;
//const int INF = 0x3f3f3f3f;
//const double inf = 1.0/0.0;
const int MOD = 1000000007;

int ara[105];
int dp[105][100005];
int cum[100005];

int getcum(int i,int j) {
    if(i<0) i=0;
    if(i==0) return cum[j];
    else return (cum[j]-cum[i-1] + MOD) % MOD;
}

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

    int n,k;
    sii(n,k);
    for(int i=1;i<=n;i++) si(ara[i]);
    dp[0][0] = cum[0] = 1;
    for(int j=1;j<=k;j++) cum[j] += cum[j-1];
    for(int i=1;i<=n;i++) {
        dp[i][0] = 1;
        for(int j=1;j<=k;j++) {
            dp[i][j] = getcum(j-ara[i],j);
        }
        cum[0] = 1;
        for(int j=1;j<=k;j++) {
            cum[j] = (cum[j-1] + dp[i][j]) % MOD;
        }
    }
    cout << dp[n][k] << endl;
    return 0;
}


Measured memory_bytes: 40832
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const int maxn = 1e6 + 7;
const LL INF = 1e12;
const LL mod = 1e9 + 7;

int main() {
    char ch;
    scanf("%c",&ch);
    printf("%c",ch+1);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
   int i;
   int data[5];
 

       scanf("%d %d %d %d %d",&data[0],&data[1],&data[2],&data[3],&data[4]);

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

   return 0;  
}


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

using namespace std;

int n, k, a[100], sum[100];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen(".inp", "r", stdin);
    cin >> n >> k;
    for(int i=1 ; i<=n ; ++i) {
            cin >> a[i];
            sum[i]=sum[i-1]+a[i];
    }
    set <int > S;
    long long ans=0;
    for(int lef=0; lef<min(n, k+1) ; ++lef) {
        if(lef>0) S.insert(a[lef]);
        set <int > S2;
        S2=S;
        for(int rig=0 ; rig<=min(n-lef, k-lef) ; ++rig) {
            if(rig>0) S2.insert(a[n-rig+1]);
            long long res=sum[lef]+sum[n]-sum[n-rig];
            int cnt=0;
            for(auto val:S2) {
                if(cnt+lef+rig==k||val>0) break;
                ++cnt; res-=val;
            }
            ans=max(ans, res);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))

Ans = 0
for x in range(N):
    ans = 0
    for i in range(N):
        if i <= x:
            ans += A1[i]
        if i >= x:
            ans += A2[i]
    Ans = max(Ans,ans)

print(Ans)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

ll h[303];
ll dp[303][303];
const ll INF = 1e17;

int main() {
  int n,k;
  cin >> n >> k;
  for(int i = 1; i <= n; i++) cin >> h[i];

  for(int i = 0; i <= n; i++) {
    for(int j = 0; j <= n; j++) {
      dp[i][j] = INF;
    }
  }
  
  dp[0][0] = 0;

  for(int i = 1; i <= n; i++) {
    for(int j = 1; j <= n; j++) {
      ll tmp = INF;
      for(int k = 0; k < j; k++) {
	tmp = min(tmp,dp[i-1][k] + max(0ll,h[j] - h[k]));
      }
      dp[i][j] = tmp;
    }
  }
  

  /*  for(int i = 0; i <= n; i++) {
    for(int j = 0; j <= n; j++) {
      cout << "dp["<<i<<"]["<<j<<"] = "<<dp[i][j] << endl;
    }
    }*/

  ll ans = INF;
  for(int i = 0; i <= n; i++) {
    ans = min(ans,dp[n-k][i]);
  }
  cout << ans << endl;
}
  
      
      


Measured memory_bytes: 1024
#!/usr/bin/env python
import sys

if __name__ == '__main__':
    nums = input().split()
    a = nums[0]
    b = nums[1]
    c = nums[2]

    a = nums[1]
    b = nums[0]

    a = nums[2]
    c = nums[1]
    print(int(a),int(b),int(c))
    sys.exit()

Measured memory_bytes: 3064
N = int(input())
S = list(map(int, input().split()))
b = [0 for i in range(N)]
if N % 2 == 0:
  for i in range(N):
    if i % 2 == 0:
      b[(N + i) // 2] = S[i]
    else:
      b[(N - i) // 2] = S[i]
else:
  b[N // 2] = S[0]
  for i in range(1, N):
    if i % 2 == 1:
      b[(N + i) // 2] = S[i]
    else:
      b[(N - i) // 2] = S[i]
for i in range(N - 1):
  print(b[i], end = ' ')
print(b[N - 1])


Measured memory_bytes: 26180
using System;

class Program
{
	static void Main(string[] args)
	{
		// 整数の入力
		string[] input = Console.ReadLine().Split(' ');
		int a = int.Parse(input[0]);
		int b = int.Parse(input[1]);
		// スペース区切りの整数の入力

		// 文字列の入力
		//出力
		if (a==b)
		{
			Console.WriteLine("Yes");
		}
		else
		{
			Console.WriteLine("No");
		}
	}
}


Measured memory_bytes: 11092
x, y = [int(x) for x in input().split()]

list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]
list3 = [2]

if x in list1:
	if y in list1:
		print("Yes")
	else:
		print("No")
elif x in list2:
	if y in list2:
		print("Yes")
	else:
		print("No")
else:
	if y in list3:
		print("Yes")
	else:
		print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

double f(ll n){
	double res;
	int sum=0;
	ll nn=n;
	while(nn){
		sum+=nn%10;nn/=10;
	}
	return res=(double)(n/(double)sum);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll k,n=0,diff=1;
	cin>>k;
	rep(i,k){
		ll a,b;
		a=n+diff;b=n+diff*10;
		bool fl=f(a)<=f(b);
		if(fl)n=a;
		else{
			n=b;
			diff*=10;
		}
		cout<<n<<endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

int main(){
    int n; cin >> n;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    int a=0,b=0,ab=0;
    rep(i,n){
        if(s[i][s[i].length()-1] == 'A' && s[i][0] =='B') ab++;
        else if(s[i][0] =='B') b++;
        else if(s[i][s[i].length()-1] == 'A') a++;
    }
    int c=0;
    rep(i,n){
        rep(j,s[i].length()-1) if(s[i][j]=='A' && s[i][j+1]=='B') c++;
    }
    int pl = (ab > 0 ? ab-1 : 0);
    if(ab > 0 && a > 0){pl++; a--;}
    if(ab > 0 && b > 0){pl++; b--;}
    pl += min(a,b);
    //cout << b << endl;
    cout << c + pl << endl;
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;

int main(void){
    int n;cin>>n;
    int tmp=0,res=0;
    rep(i,n){
        int a;cin>>a;a--;
        if(a==tmp)tmp++;
        else res++;
    }
    if(tmp==0)cout<<-1<<endl;
    else cout<<res<<endl;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

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

    int count = 0;
    while (a[0] % 2 == 0 && a[0] > 0) {
            count++;
            a[0] /= 2;
        }
    
    for (i = 1; i < n; i++) {
        int tmp = 0;
        while (a[i] % 2 == 0 && a[i] > 0) {
            tmp++;
            a[i] /= 2;
        }
        count = min(count, tmp);
        
    }
    cout << count << endl;
    return 0;
}

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

int findSumOfDigits(int n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int total = 0;
	for (int i = 1; i <= N; ++i) {
		int sum = findSumOfDigits(i);
		if (sum >= A && sum <= B) {
			total += i;
		}
	}
	cout << total << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			char pre = ' ';
			int count = 0;
			for (char c : s) {
				if (c != pre) {
					count++;
					pre = c;
				}
			}
			System.out.println(count - 1);
		}
	}
}


Measured memory_bytes: 39124
// 

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for (int i=(a);i>(b);i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define caset int ___T; cin >> ___T; while(___T--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define get1(a) ll int a; cin>>a;
#define get2(a,b) ll int a,b; cin>>a>>b;
#define get3(a,b,c) ll int a,b,c; cin>>a>>b>>c;
#define gets(s) string s; cin >> s;

#define fast_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"

int main() {
	fast_IO;

	int h, w, k;
	cin >> h >> w >> k;

	vector < vector <char> > v (h, vector <char> (w));
	REP(i, h) REP(j, w) cin >> v[i][j];

	auto cpy = v;

	int cnt = 0;
	for (int i = 0; i < pow(2, h); ++i) {
		for (int j = 0; j < pow(2, w); ++j) {
			cpy = v;
			for (int row = 0; row < h; ++row) {
				if ((1<<row)&i) {
					cpy[row] = vector <char> (w, 'r');
				}
			}

			for (int col = 0; col < w; ++col) {
				if ((1<<col)&j) {
					REP(row, h) cpy[row][col] = 'r';
				}
			}

			int black = 0;
			REP(r, h) REP(c, w) {
				if (cpy[r][c] == '#') black++;
			}

			if(black == k) cnt++;
		}
	}

	cout << cnt << endl;

	cout << flush;
}


Measured memory_bytes: 4096
#include <cstdio>
#include <iostream>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

typedef long long ll;
int main(void) {
  ll n, p;
  cin >> n >> p;
  ll res = 1;
  for(int i = 2; i <= 1000000; ++i) {
    int ct = 0;
    while(p % i == 0) {
      p /= i;
      ++ct;
    }
    REP(j, ct / n) {
      res *= i;
    }
  }
  if(p > 1 && n == 1) {
    res *= p;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())

S = [i for i in range(1, 14)]
H = [i for i in range(1, 14)]
C = [i for i in range(1, 14)]
D = [i for i in range(1, 14)]

for i in range(n) :
    m, r = map(str, input().split())
    
    if m == "S" :
        S.remove(int(r))
    elif m == "H" :
        H.remove(int(r))
    elif m == "C" :
        C.remove(int(r))
    else :
        D.remove(int(r))
        
if len(S) > 0 :
    for i in range(len(S)) :
        print("S", S[i])
if len(H) > 0 :
    for i in range(len(H)) :
        print("H", H[i])
if len(C) > 0 :
    for i in range(len(C)) :
        print("C", C[i])
if len(D) > 0 :
    for i in range(len(D)) :
        print("D", D[i])



Measured memory_bytes: 5624
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

//ll ncr(ll n,ll r){ll ans=1;r=min(r,n-r);for (int i=1;i<=r;i++){ans*=(n-r+i);ans/=i;}return ans;}

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI=3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

#define fi first
#define se second

ll n;
vector< pair<ll,ll> >points;

long double fac[10];

long double dist(pair<ll,ll>&a,pair<ll,ll>&b)
{
    long double delX=abs(a.fi-b.fi);
    long double delY=abs(a.se-b.se);
    return sqrt(delX*delX+delY*delY);
}

ll visited[10];

long double big=0;
long double ans=0;
void f(ll c,ll i)
{
    if(c==(n-1))
    {
        ans+=(big/fac[n]);
        return; 
    }
    else
    {
        for(ll j=0;j<n;j++)
        {
            if(!visited[j])
            {
                visited[j]=1;
                long double fre=dist(points[j],points[i]);
                big+=fre;
                f(c+1,j);
                big-=fre;
                visited[j]=0;
            }
        }
    }
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;
	fac[0]=1;
	for(ll i=1;i<=9;i++)
	    fac[i]=fac[i-1]*i;
	for(ll u=0;u<n;u++)
	{
	    ll x,y;
	    cin>>x>>y;
	    points.eb(x,y);
	}
    for(ll i=0;i<n;i++)
    {
        big=0;
        visited[i]=1;
        f(0,i);
        visited[i]=0;
    }
    cout<<fixed<<setprecision(10);
    cout<<ans;
    return 0;
}


//252908XL

Measured memory_bytes: 256
using System;

namespace ConsoleApp1
{

    class Program
    {
        public static int H = 0;
        static void Main()
        {
            int[] A = new int[2000000];
            while (true)
            {
                string[] command = Console.ReadLine().Split(' ');
                if (command[0].Equals("insert"))
                {
                    int i = H;
                    A[H++] = int.Parse(command[1]);
                    while (i >= 0 && A[(i - 1) / 2] < A[i]) {
                        int temp = A[i];
                        A[i] = A[(i - 1) / 2];
                        A[(i - 1) / 2] = temp;
                        i = (i - 1) / 2;
                    }
                }
                else if (command[0].Equals("extract"))
                {
                    Console.WriteLine(A[0]);
                    A[0] = A[--H];
                    Maxheapfy(A, 0);
                }
                else break;
            }
        }
        private static void Maxheapfy(int[] A, int i)
        {
            int largest = i;
            int l = (i + 1) * 2 - 1;
            int r = (i + 1) * 2;
            if (l < H && A[l] > A[i])
                largest = l;
            if (r < H && A[r] > A[largest])
                largest = r;

            if (largest != i)
            {
                int temp = A[i];
                A[i] = A[largest];
                A[largest] = temp;
                Maxheapfy(A, largest);
            }
        }
        private static void buildMaxHeap(int[] A)
        {
            for (int i = H / 2; i >= 0; i--)
            {
                Maxheapfy(A, i);
            }
        }
    }
}




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

int main(){
    int N;
    cin >> N;
    ll A[N];
    rep(i, N) cin>>A[i];
    ll NUM=1000000007;

    ll sum_A[N];
    rep(i, N){
        int k=N-i-1;
        if(k==N-1) sum_A[k]=A[k]%NUM;
        else sum_A[k]=(sum_A[k+1]+A[k])%NUM;
    }

    ll ans=0;
    for(int i=0; i<N-1; i++){
        ans+=(A[i]*sum_A[i+1])%NUM;
    }

    cout<<ans%NUM<<endl;
    return 0;
}

Measured memory_bytes: 6692
def main():
    import sys
    input = sys.stdin.readline
    n = int(input())
    a = list(map(int, input().split()))
    a.reverse()
    mod = 7 + 10**9
    leng = len(format(max(a), 'b'))
    bit_acc = [0 for i in range(leng)]
    for i in range(n):
        # 先頭から二進数を0埋めした
        bit_data = format(a[i], 'b').zfill(leng)
        for j in range(leng):
            if bit_data[j] == '1':
                bit_acc[j] += 1
    p = [pow(2, (leng - j - 1), mod) for j in range(leng)]
    ans = 0
    for i in range(n):
        bit_data = format(a[i], 'b').zfill(leng)
        for j in range(leng):
            if bit_data[j] == '1':
                ans += (n - bit_acc[j]) * p[j]
            else:
                ans += bit_acc[j] * p[j]
            ans %= mod
    print((ans * 500000004) % mod)


if __name__ == "__main__":
    main()


Measured memory_bytes: 123084
def calc_replace_n(str, start) :
    n = 0
    for i in range(len(str)) :
        if i%2==0 :
            if str[i] == start :
                n = n+1
        else :
            if str[i] != start :
                n = n+1
    return n

s = input()

replace_n_zero = calc_replace_n(s,"0")
replace_n_one = calc_replace_n(s,"1")

out = replace_n_zero if replace_n_zero < replace_n_one else replace_n_one
print(out)

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

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

using namespace std;

typedef long long int ll;

const ll INF=(ll)1e18;

ll dp[100005][13];

int main(){
  string s;
  cin >> s;

  REP(i,100005)REP(j,13)dp[i][j]=0;

  dp[0][0] = 1;

  int l = 1;
  REP(i,s.size()){
    char c = s[s.size()-i-1];

    if(c=='?'){
      REP(k,10){
        int m = k * l % 13;
        REP(j,13){
          int mm = (j + m) % 13;
          dp[i+1][mm] += dp[i][j];
          dp[i+1][mm] %= MOD;
        }
      }

    }else{
      int m = (c - '0') * l % 13;
      REP(j,13){
        int mm = (j + m) % 13;
        dp[i+1][mm] += dp[i][j];
        dp[i+1][mm] %= MOD;
      }
    }


    l = l * 10 % 13;
  }
  
  printf("%lld\n", dp[s.size()][5]);
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define N 1000000007
typedef long long ll;
#define all(v) (v).begin(),(v).end()
#define sz(x) int(x.size())
int main(){
	int n;
	cin>>n;
	vector<int> dn(n);
	int sum=0;
	rep(i,n){
		cin>>dn.at(i);
		sum+=dn.at(i);
	}
	ll ans=0;
	rep(i,n){
		ans+=dn.at(i)*(sum-dn.at(i));
	}
	ans/=2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
st = 0
nd = 0
rd = 0
for i in p:
    if i <= a:
        st += 1
    elif i >= b + 1:
        rd += 1
    else:
        nd += 1
print(min([st, nd, rd]))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define lb long double 
using namespace std;
struct Po{lb x,y;}p1,p2,q1,q2,an;
int t;
void get(Po &x){scanf("%Lf %Lf",&x.x,&x.y);}
Po operator +(Po x,Po y){return (Po){x.x+y.x,x.y+y.y};}
Po operator -(Po x,Po y){return (Po){x.x-y.x,x.y-y.y};}
Po operator *(Po x,lb y){return (Po){x.x*y,x.y*y};}
lb operator *(Po x,Po y){return x.x*y.y-x.y*y.x;}
int main(){
	scanf("%d",&t);
	while (t--){
		get(p1);get(p2);get(q1);get(q2);
		lb x=(q2-p1)*(p2-p1),y=(p2-p1)*(q1-p1);
		lb z=y/(x+y);
		an=q1+(q2-q1)*z;
		printf("%.10Lf %.10Lf\n",an.x,an.y);
	}
	return 0;
}


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

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

using namespace std;

int main(){
  int x=0,y=0;
  string s;cin>>s;
  map<char, int> d;
  rep(i, s.size()) d[s[i]]=1;
  if( ((d['W'] || d['E']) && d['W']^d['E']) || ((d['N'] || d['S']) && d['N']^d['S']) ) cout<<"No";
  else cout<<"Yes";

  return 0;
}

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

int main() {
  long long a;
  string b;
  cin >> a >> b;
  long long b100 = (b[0] - '0') * 100 + ((b[2] - '0') * 10) + (b[3] - '0');
  long long v;
  v = a * b100 / 100;
  cout << a * b100 / 100 << endl;
}


Measured memory_bytes: 3604
/*
ID: varunra2
LANG: C++
TASK: b
*/

#include<bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#include "lib/debug.h"
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define debug_arr(...) \
  cerr << "[" << #__VA_ARGS__ << "]:", debug_arr(__VA_ARGS__)
#pragma GCC diagnostic ignored "-Wsign-compare"
//#pragma GCC diagnostic ignored "-Wunused-parameter"
//#pragma GCC diagnostic ignored "-Wunused-variable"
#else
#define debug(...) 42
#endif

#define EPS 1e-9
#define IN(A, B, C) assert(B <= A && A <= C)
#define INF (int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))
#define MOD 1000000007
#define MP make_pair
#define PB push_back
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define x first
#define y second

const double PI = acos(-1.0);
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef map<int, int> MPII;
typedef multiset<int> MSETI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef vector<string> VS;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
typedef vector<int> vi;
#pragma GCC diagnostic ignored "-Wsign-compare"
// util functions


int main() {
#ifndef ONLINE_JUDGE
  freopen("b.in", "r", stdin);
  freopen("b.out", "w", stdout);
#endif
  cin.sync_with_stdio(0); cin.tie(0);

  int sum = 0;

  string s;
  cin >> s;
  int n = (int)s.size();

  for(int i = 0; i < n; i++) {
    int cur = s[i] - '0';
    sum += cur;
  }

  cout << (sum%9 ? "No" : "Yes") << endl;

  return 0;
}


Measured memory_bytes: 3752
#include <stdio.h>
void judge(int x, int y, int z)
{
	int f = 0;
	if(x * x == y * y + z * z){
		f = 1;
	}else if(y * y == z * z + x * x){
		f = 1;
	}else if(z * z == x * x + y * y){
		f = 1;
	}
	printf( (f == 1) ? ("YES\n") : ("NO\n") );
	return;
}
int main(void)
{
	int n,a,b,c;
	
	scanf("%d", &n);
	while(n--){
		scanf("%d%d%d", &a, &b, &c);
		judge(a,b,c);
	}
	return 0;
}

Measured memory_bytes: 580
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vi = vector<int>;
using vs = vector<string>;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repp(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define repd(i, n) for(ll i = n - 1; i >= 0; i--)
#define all(x) x.begin(), x.end()

ll k, l, m, n;
const ll M = 1e9 + 7;



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

	ll a, b, c, d;
	cin >> a >> b >> c >> d;

	if(max(a * c, b * d) >= 0) return cout << max(a * c, b * d) << endl, 0;

	if(max(a * c, b * d) >= 0) return cout << max(a * c, b * d) << endl, 0;

	if((a <= 0 && 0 <= b) || (c <= 0 && 0 <= d)) return cout << 0 << endl, 0;

	cout << max(b * c, a * d) << endl;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;


int main() {
    int n, m; cin >> n >> m;
    vector<int> x(n); rep(i, n) cin >> x[i];
    sort(x.begin(), x.end());
    vector<vector<int>> y(m);
    rep(i, n) {
        y[x[i] % m].push_back(x[i]);
    }
    vector<int> cnt(m);
    rep(i, n-1) {
        if (x[i+1] == x[i]) {
            cnt[x[i]%m]++;
            i++;
        }
    }
    int ans = 0;
    rep(i, m) {
        int p1 = i;
        int p2 = (m - i) % m;
        if (p2 < p1) continue;
        if (p2 == p1) {
            ans += y[p1].size() / 2;
            continue;
        }
        int n1 = y[p1].size();
        int n2 = y[p2].size();
        if (n1 < n2) {
            swap(p1, p2);
            swap(n1, n2);
        }

        if (2 * cnt[p1] >= n1 - n2) {
            ans += (n1 + n2) / 2;
        } else {
            ans += cnt[p1] + n2;
        }
    }

    cout << ans << endl;

    return 0;
}


    


Measured memory_bytes: 6528
#include <stdio.h>
void solve(void)
{
	unsigned long long a, b, x, p, q;
	scanf("%llu %llu %llu", &a, &b, &x);
	if(sizeof(long)!=8){
		printf("0\n");
	}else{
		printf("%llu\n", (b+x)/x - (a+x-1)/x);
	}
}
int main(int argc, char **argv)
{
	solve();
	return 0;
}


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

unsigned long long a, b, c;

int main() {
  cin >> a >> b >> c;
  unsigned long long A = a * a + b * b + c * c + 2 * a * b - 2 * b * c - 2 * a * c, B = 4 * a * b;
  puts((A > B && c > a + b) ? "Yes" : "No");
}


Measured memory_bytes: 256
n, q = map(int, input().split())
s = list(str(input()))
ac = [0]*100000
cnt = 0
for i in range(n-1) :
  if(s[i] + s[i+1] == "AC") : cnt += 1
  ac[i+1] = cnt
for i in range(q) :
  lr = list(map(int, input().split()))
  print(ac[lr[1]-1] - ac[lr[0]-1])

Measured memory_bytes: 8480
#include<bits/stdc++.h>
using namespace std;
const int N=100;
int arrp[N];
int arrq[N];
int arr[N];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>arrp[i];
    for(int i=1;i<=n;i++) cin>>arrq[i];
    for(int i=1;i<=n;i++) arr[i]=i;
    int a=-1,b=-1,s=1;
    while(1){
        int i;
        for(i=1;i<=n;i++){
            if(arr[i]!=arrp[i]) break;
        }
        if(i>=n) {
            a=s;
        }
        int j;
        for(j=1;j<=n;j++){
            if(arr[j]!=arrq[j]) break;
        }
        if(j==n+1) {
            b=s;
        }
        next_permutation(arr+1,arr+n+1);
        s++;
        if(a!=-1&&b!=-1) break;
    }
    cout<<abs(a-b)<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int m = 10;
        int d = 0;
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
            int q = a[i] % 10;
            if (q != 0 && q < m) {
                m = q;
                d = i;
            }
        }
        int sum = 0;
        for (int i = 0; i < a.length; i++) {
            if (i == d) {
                continue;
            }
            if (a[i] % 10 != 0) {
                sum += ((a[i] / 10) + 1) * 10;
            } else {
                sum += a[i];
            }
        }
        sum += a[d];
        System.out.println(sum);
        sc.close();
    }
}

Measured memory_bytes: 21844
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    a, b, c = gets.chomp.split

    if a[-1] == b[0] && b[-1] == c[0]
      puts "YES"
    else
      puts "NO"
    end

  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 4092
#include <bits/stdc++.h>
using namespace std;
string chuyen(int a){
    stringstream ss;
    ss<<a;
    string s=ss.str();
    return s;
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b,x=0,y=0;
    string s1,s2;
    cin>>a>>b;
    for (int i=1;i<=b;i++) x=x*10+a;
    for (int i=1;i<=a;i++) y=y*10+b;
    s1=chuyen(x);
    s2=chuyen(y);
    if (s1>s2) s1=s2;
    cout<<s1;
    return 0;
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

template <class T>
T gcd(T a,T b) {
	if (b == 0) return a;
	else return gcd(b, a % b);
}

ll n;
string s1,s2;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n>>s1>>s2;
    ll ans;
    bool flag=false;
    if(s1[0]==s2[0]){
      ans=3;
    }else{
      ans=6;
      flag=true;
    }
    FOR(i,1,n){
      //cout<<i<<' '<<ans<<'\n';
      if(flag){
        i++;
        flag=false;
      }
      if(s1[i]==s2[i]){
        if(s1[i-1]==s2[i-1]){
          ans*=2;
          ans%=mod;
        }
      }else{
        i++;
        if(s1[i-2]==s2[i-2]){
          ans*=2;
          ans%=mod;
        }else{
          ans*=3;
          ans%=mod;
        }
      }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
using namespace std;

int N, W, H, X, Y, K;
int vx[100010], vy[100010];

int main(void) {
  cin >> N >> W >> H;
  REP(i, 0, 100010) vx[i] = vy[i] = 0;
  REP(i, 0, N) {
    cin >> X >> Y >> K;
    vx[max(X - K, 0)]++;
    vx[min(X + K, W)]--;
    vy[max(Y - K, 0)]++;
    vy[min(Y + K, H)]--;
  }
  REP(i, 0, W) vx[i + 1] += vx[i];
  REP(i, 0, H) vy[i + 1] += vy[i];

  int mx = *min_element(vx, vx + W);
  int my = *min_element(vy, vy + H);

  cout << (mx > 0 || my > 0 ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 3868
# -*- coding: utf-8 -*-
# input
n, y = map(int, input().split())

for i in range(n, -1, -1):
    for j in range(0, n + 1 - i):
        if y == 10000 * i + 5000 * j + 1000 * (n - i - j):
            print(i, j, n - i - j)
            exit()
        elif y < 10000 * i + 5000 * j + 1000 * (n - i - j):
            break

print('-1', '-1', '-1')


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 X;
	cin >> X;
	int64 res = X/500*1000 + (X%500)/5*5;
	cout << res << endl;
}


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

int main(){

	int N;
  	cin >> N;
	int S,m;
  	string M,I,ist,sst;
  
  	int min = 9999999999999999;
  	for(int i = 1; i< N ;i++){
    	
		m = N - i;
      	S = 0;
      	I = std::to_string(i);
      	M = std::to_string(m);
      	
      	for(int j = 0; j < I.size(); j++){
        	ist = I[j];
        	S=S+std::stoi(ist);
        
        }
      
        for(int j = 0; j < M.size(); j++){
        	sst = M[j];
        	S=S+std::stoi(sst);
        
        }
    
      
      	if(min >= S) min = S;
      
      
    }

  	cout << min <<endl;


}

Measured memory_bytes: 256
O = input()
E = input()
s = ""
if len(O)>len(E):
  for i in range(len(E)):
    s = s + O[i] + E[i]
  print(s + O[len(O)-1])
else:
  for i in range(len(E)):
    s = s + O[i] + E[i]
  print(s)

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

int main(){
    int d,g;
    cin>>d>>g;
    int p[10],c[10];
    for(int i=0;i<d;i++)cin>>p[i]>>c[i];
    int ans=10000;
    for(int bit=0;bit<(1<<d);bit++){
        int t=0,s=0;
        for(int i=0;i<d;i++){
            if(bit&(1<<i)){
                t+=p[i];
                s+=(i+1)*100*p[i]+c[i];
            }
        }
        if(s>=g){
            ans=min(ans,t);
            continue;
        }
        for(int j=d-1;j>=0;j--){
            if(!(bit&(1<<j))){
                int lim=p[j];
                while(s<g&&lim){
                    s+=(j+1)*100;
                    t++;
                    lim--;
                }
            }
        }
        if(s<g)continue;
        ans=min(ans,t);
    }
    cout<<ans<<endl;
}


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

int main()
{
	long int w, h, x, y;
	int m;
	scanf("%ld %ld %ld %ld", &w, &h, &x, &y);
	
	if(x+x==w && y+y==h){ m=1; }
	else { m=0; }
	
	printf("%lf %d", ((double)w*(double)h)/2, m);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
vector<int> input(int N) {
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  return vec;
}

int main() {
  int n,sumb=0,sumc=0,ans=0;
  cin >> n;
  vector<int> a=input(n);
  vector<int> b=input(n);
  vector<int> c=input(n);
  
  rep(i,n-1){
    if(a[i+1]-a[i]==1){
      sumc += c[a[i]-1];
    }
  }
  ans += sumc;
  
  rep(i,n){
    sumb += b[i];
  }
  ans += sumb;
  
  cout << ans << endl;
}


Measured memory_bytes: 256
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


n = int(input())
cnt = 0
lis = list(set(prime_factorize(n)))
for i in range(len(lis)):
    for j in range(1, 10**9):
        if n % lis[i]**j == 0:
            n /= lis[i]**j
            cnt+=1
        else:
            break
print(cnt)


Measured memory_bytes: 9200
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,m,i;
    map<string,int> f1,f2;
    string s;
    cin>>n;
    for (i=0;i<n;i++)
    {
        cin>>s;
        f1[s]++;
    }
    cin>>m;
    for (i=0;i<m;i++)
    {
        cin>>s;
        f2[s]++;
    }
    int ans=0;
    for (auto e: f1)
        ans=max(ans,e.ss-f2[e.ff]);
    cout<<ans<<endl;
}


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

const int MOD = (int)1e9+7;

int main(){
	int N;
	cin >> N;
	vector<int> B(N-1);
	for(int i=0;i<N-1;i++)	cin >> B.at(i);

	int ans=B.at(0);
	for(int i=0;i<N-2;i++){
		ans+=min(B.at(i),B.at(i+1));
	}
	ans+=B.at(N-2);
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
bool isprime[(int)1e6], isvisit[(int)1e6];
bool func(int x)
{
	if(isvisit[x])
	{
		return isprime[x];
	}
	isvisit[x] = true;
	for(int i = 2; i < sqrt(x); ++i)
	{
		if(x % i == 0)
		{
			return false;
		}
	}
	return isprime[x] = true;
}
signed main()
{
	int x;
	scanf("%d", &x);
	for(; ; ++x)
	{
		if(func(x))
		{
			printf("%d\n", x);
			break;
		}
	}
}

Measured memory_bytes: 256
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

#include <bits/stdc++.h>
 
using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair

typedef long long ll;
typedef long double ld;

void solve(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = k; i < n; i++){
        if(a[i] > a[i - k]){
            cout << "Yes\n";
        }
        else{
            cout << "No\n";
        }
    }
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3968
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <queue>
#include <iomanip>
#include <algorithm>
using namespace std;

typedef long long ll;

const int Maxn = 100005;

int n;
int A[Maxn], B[Maxn], C[Maxn];
ll dpA[Maxn], dpB[Maxn];
ll res;

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &A[i]);
	for (int i = 1; i <= n; i++)
		scanf("%d", &B[i]);
	for (int i = 1; i <= n; i++)
		scanf("%d", &C[i]);
	sort(A, A + n + 1); sort(B, B + n + 1); sort(C, C + n + 1);
	for (int i = 1; i <= n; i++)
		dpA[i] = i;
	for (int i = 1; i <= n; i++) {
		int ind = lower_bound(A, A + n + 1, B[i]) - A - 1;
		dpB[i] = dpB[i - 1] + dpA[ind];
	}
	for (int i = 1; i <= n; i++) {
		int ind = lower_bound(B, B + n + 1, C[i]) - B - 1;
		res += dpB[ind];
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3072
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		
		if(a - b >= 2)
			System.out.println(a + a - 1);
		else if(b - a >= 2)
			System.out.println(b + b - 1);
		else
			System.out.println(a + b);
	}
}


Measured memory_bytes: 22228
S = input()
if S[0] != 'A':
  print('WA')
else:
  cnt = 0
  validate = True
  for i in range(2, len(S)-1):
    if S[i].islower():
      continue
    elif S[i] == 'C':
      cnt += 1
    else:
      validate = False
      break
  if cnt == 1 and validate and S[-1].islower() and S[1].islower() and S[1] != 'C':
    print('AC')
  else:
    print('WA')
  


Measured memory_bytes: 3060