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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
constexpr int DX[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int sgn(int x) { return (x > 0) - (x < 0); }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int ans[11000];
signed main() {
    cin >> N;
    reps(x, N) {
        if (x * x > N) { continue; }
        reps(y, N) {
            if (x * x + y * y + x * y > N) { continue; }
            reps(z, N) {
                int k = x * x + y * y + z * z + x * y + y * z + z * x;
                if (k > N) { continue; }
                ans[k]++;
            }
        }
    }
    reps(i, N) { cout << ans[i] << endl; }
}

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

using namespace std;

int main(){

    int n;
    vector<int> l(10,0); 

    cin >> n;

    for(int i = 0; i < n; i++)cin >> l[i];

    sort(l.begin(), l.end());reverse(l.begin(), l.end());

    int low = 0;

    for(int i = 1; i < n; i++)low += l[i];

    if(low > l[0])cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;

}

Measured memory_bytes: 256
import sys
from collections import deque
input = sys.stdin.readline

N = int(input().strip())
ans = deque([])
if N == 0:
  print(0)
  exit()
while N != 0:
    if N % -2 != 0:
        N -= 1
        ans.appendleft('1')
    else:
        ans.appendleft('0')
    N /= -2

print(''.join(ans))

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;

int main() {
	int N, H, W;
	int count = 0;
	vector<int> a, b;
	int temp1, temp2;

	cin >> N >> H >> W;

	for (int i = 1; i <= N; i++) {
		cin >> temp1 >> temp2;

		if ((temp1 >= H) && (temp2 >= W)) {
			count++;
		}
	}

	cout << count << endl;
}


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

using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    
    for (int i = 0; i < M; i++) {
        int k = i + 1;
        for (int j = 0; j < N-1; j++) {
            if (a[j] % k > a[j+1] % k) {
                swap(a[j], a[j+1]);
            }
        }
    }
    for (int i = 0; i < N; i++) {
        cout << a[i] << endl;
    }    
    return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
// #include <atcoder/all>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
// using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

// auto mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

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

  vc(mint) dp(n+1);
  dp[0] = 1;

  REPe(i, n) {
    REPo(j, i-3) {
      dp[i] += dp[j];
    }
  }

  cout << dp[n] << endl;

  return 0;
}

Measured memory_bytes: 3644
N = int(input())
a = list(map(int,input().split()))
dicta = {}
for i in a:
    if i not in dicta:
        dicta[i] = 1
    else:
        dicta[i] += 1
ans = 0
for k,v in dicta.items():
    if k > v:
        ans += v
    if k < v:
        ans += v-k
print(ans)

Measured memory_bytes: 17780
#include <iostream>
#include <algorithm>
#include <fstream>

using namespace std;

struct Card {
    char suit, value;
};

void print(struct Card A[], int num){
    for(int i=0; i<num; i++){
        if (i > 0) cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

//book?????´??????1???true???0???false????????????

bool isStable(struct Card C1[], struct Card C2[], int num){
    for(int i=0; i<num; i++){
        if (C1[i].suit != C2[i].suit) return false;
    }
    return true;
}

void printArray(int A[], int num){
    for(int j=0; j<num; j++){
        if (j > 0) printf(" ");
        printf("%d", A[j]);
    }
    printf("\n");
}

int bubbleSort(struct Card A[], int num){
    int sw = 0;
    for(int i=0; i<num-1; i++){
        for(int j=num-1; j>=i+1; j--){
            if (A[j-1].value > A[j].value){
                swap(A[j-1], A[j]);
                sw++;
            }
        }
    }
    return sw;
}

int SelectionSort(struct Card A[], int num){
    int sw = 0;
    int minj;

    for(int i=0; i<num; i++){
        minj = i;
        for(int j=i; j<num; j++){
            if(A[j].value < A[minj].value){
                minj = j;
            }
        }
        swap(A[i], A[minj]);
        sw++;
    }
    return sw;
}

int main(){

    Card C1[100], C2[100];
    int num;
    char ch;

    cin >> num;
    for(int i=0; i<num; i++){
        cin >> C1[i].suit >> C1[i].value;
    }

    for(int i=0; i<num; i++) C2[i] = C1[i];

    bubbleSort(C1, num);
    SelectionSort(C2, num);

    print(C1, num);

    cout << "Stable" << endl;

    print(C2, num);

    if (isStable(C1, C2, num)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }

    return 0;
}

Measured memory_bytes: 3108
#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 X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;

    vector<pair<ll, ll>> apple;
    ll tmp;
    rep(i, A) {
        cin >> tmp;
        apple.push_back(make_pair(tmp, 0));
    }
    rep(i, B) {
        cin >> tmp;
        apple.push_back(make_pair(tmp, 1));
    }
    rep(i, C) {
        cin >> tmp;
        apple.push_back(make_pair(tmp, 2));
    }

    sort(apple.begin(), apple.end(), greater<>());

    ll ans = 0;
    vector<int> MAX = {X, Y, 10000000};
    vector<int> cnt(3, 0);
    rep(i, A + B + C) {
        pair<ll, ll> p = apple[i];
        if (cnt[p.second] >= MAX[p.second]) continue;
        ++cnt[p.second];
        ans += p.first;

        if (cnt[0] + cnt[1] + cnt[2] == X + Y) break;
    }

    cout << ans << endl;
}

Measured memory_bytes: 11644
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

main :: IO ()
main = do
    n <- fst . fromJust . B.readInt <$> B.getLine
    as <- replicateM n $ do
        [l, r] <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine
        return $ r - l + 1
    print $ sum as


Measured memory_bytes: 1148
#include <iostream>

using namespace std;

int main(){
  int n,m,c,num=0;
  cin >> n >> m >> c;
  int b[m];
  for(int i=0;i<m;i++){
    cin >> b[i];
  }

  for(int i=0;i<n;i++){
    int ans =0;
    int a=0;
    for(int j=0;j<m;j++){
      cin >> a;
      ans += b[j]*a;
    }
    ans += c;
    if(ans > 0)num++;
  }
  
  cout << num << endl;
  return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

struct UnionFind {
    vector<int> parent;
    int size;
    UnionFind(int n) :parent(n, -1), size(n) {}
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x == y)return false;
        if (sizeOf(x) < sizeOf(y))swap(x, y);
        parent[x] += parent[y]; parent[y] = x; size--;
        return true;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int root(int x) { return parent[x] < 0 ? x : parent[x] = root(parent[x]); }
    int sizeOf(int x) { return -parent[root(x)]; }
};

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

    int2(n, m);
    UnionFind mm(n + n);
    rep(i, m) {
        int3(a, b, c);
        a--; b--;
        if (c % 2) {
            mm.unite(a, n+b);
            mm.unite(n+a, b);
        } else {
            mm.unite(a, b);
            mm.unite(n+a, n+b);
        }
    }

    set<int> shami;
    rep(i, n+n) {
        shami.insert(mm.root(i));
    }

    std::cout << shami.size()/2 << std::endl;


    return 0;
}


Measured memory_bytes: 11264
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> P;

const ll INF = 1e15;
const double eps = 1e-6;
const ll MOD = 1000000007;

vector<vector<vector<int>>> dp;


bool memo(int a, int b, int k) {
	if (k < 0)
		return false;
	if (dp[a][b][k] != -1)
		return dp[a][b][k];
	if (a == b)
		return dp[a][b][k] = true;
	if (b >= (a + 1) / 2)
		return dp[a][b][k] = false;
	if (k == 0)
		return dp[a][b][k] = false;
	bool ret = false;
	ret |= memo(a % k, b, k - 1);
	ret |= memo(a, b, k - 1);
	return dp[a][b][k] = ret;
}

int main() {
	dp = vector<vector<vector<int>>>(51, vector<vector<int>>(51, vector<int>(51, -1)));
	ll N;
	cin >> N;
	vector<ll> a(N);
	for (int i = 0;i < N;i++)
		cin >> a[i];
	vector<ll> b(N);
	for (int i = 0;i < N;i++)
		cin >> b[i];
	bool exist = true;
	for (int i = 0;i < N;i++) {
		if (b[i] >= (a[i] + 1) / 2 && a[i] != b[i])
			exist = false;
	}
	if (!exist) {
		cout << -1 << endl;
		return 0;
	}

	vector<ll> ans;
	ll answer = 0;
	vector<vector<int>> from(N, vector<int>(51, false));
	for (int i = 0;i < N;i++)
		from[i][a[i]] = true;
	for (ll check = 50;check >= 1;check--) {
		bool ok = true;
		for (int i = 0;i < N;i++) {
			bool nowok = false;
			for (int j = 0;j <= 50;j++)
				if (from[i][j])
					nowok |= memo(j, b[i], check - 1);
			ok &= nowok;
		}
		if (!ok) {
			ans.push_back(check);
			answer += 1LL << check;
			for (int i = 0;i < N;i++)
				for (int j = 50;j >= 0; j--)
					from[i][j % check] |= from[i][j];
		}
	}
	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 1528
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
const int c=1e6;
const ll mod=1e9+7;
bool p[1000];
void sieve(){
p[0]=p[1]=1;
for(int i=2;i<=100;i++){
    for(int j=i*i;j<=100;j+=i){
        p[j]=1;
    }
}
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m,ans;
    cin>>n>>m;
    ans=((((n-1)*(n))/2)+(((m-1)*(m))/2));
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
local function comp(a, b)
  return a < b
end

local function lower_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if not comp(ary[1], x) then return 1 end
  if comp(ary[num], x) then return num + 1 end
  local min, max = 1, num
  while 1 < max - min do
    local mid = (min + max) // 2
    if comp(ary[mid], x) then
      min = mid
    else
      max = mid
    end
  end
  return max
end


local n = io.read("*n", "*l")
local s = io.read()
local t = {}
for i = 1, 10 do
  t[i] = {}
end
for i = 1, n do
  local v = s:sub(i, i):byte() - 48
  if v == 0 then v = 10 end
  table.insert(t[v], i)
end
local ret = 0
for i = 1, 10 do
  local lb1 = lower_bound(t[i], 1)
  if lb1 <= #t[i] then
    local p1 = t[i][lb1]
    for j = 1, 10 do
      local lb2 = lower_bound(t[j], p1 + 1)
      if lb2 <= #t[j] then
        local p2 = t[j][lb2]
        for k = 1, 10 do
          local lb3 = lower_bound(t[k], p2 + 1)
          if lb3 <= #t[k] then
            ret = ret + 1
          end
        end
      end
    end
  end
end
print(ret)


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

long long n,a,b;

int main()
{
	cin>>n>>a>>b;
	if(a>b)
	{
		cout<<0<<endl;
		return 0;
	}
	if(n==1&&(a!=b))
	{
		cout<<0<<endl;
		return 0;
	}
	else
		cout<<b*(n-1)+a-a*(n-1)-b+1;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <cstring>
using namespace std;

int main() {
  int a,b,c,e,n;
  int x = 0;
  int d = 0;
  cin >> n >> a >> b;

  for(int i = 1;i <= n;i++){
    c = i;
    while (c != 0) {
      d += c % 10;
      c = c / 10;
    }
    if(a <= d && d <= b)
      x += i;
    d = 0;
  }
  cout << x <<'\n';
  return 0;
}

Measured memory_bytes: 256
/*Author SHUBH AGRAWAL  */

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
//a power n mod p

#define vl  vector<long long int >
#define vpl vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 

long long int modp(lld a,lld p,lld n)
{
    int d[100];
    int i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

long long int nCrModPFermat(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
    
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    lld fac[n+1]; 
    fac[0] = 1; 
    for (lld i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%p; 
  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}


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


lld l,r,mid,ans;
lld n,m,i,j,k;
lld x,w,y,z;

void solve()
{
    string s;
    cin>>s;
    x=y=0;
    for(i=0;i<3;i++)
    {
        if(s[i]=='A') x+=1;
        else y+=1;
    }
    if(x*y) cout<<"Yes";
    else cout<<"No";
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int j,n,maxv,minv;

  scanf("%d",&n);

  int R[n];

  for(j=0;j<n;j++){
    scanf("%d",&R[j]);
  }
  
  minv = R[0];
  maxv = R[1]-R[0];
  for(j=1;j<n;j++){
    if(maxv<R[j]-minv){
      maxv=R[j]-minv;
    }else{
      maxv=maxv;
    }
    if(minv>R[j]){
      minv=R[j];
    }else{
      minv=minv;
    }
  }
  printf("%d\n",maxv);
  return 0;
}



Measured memory_bytes: 2576
using System;
using System.Collections.Generic;
using System.Linq;

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            Array.Sort(abc);
            Console.WriteLine(abc[0]+abc[1]);
        }
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // long[] NK = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // long N = NK[0];
            // long K = NK[1];
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int x = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int N = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] s = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
        
        // //最小公倍数
        // static long Lcm(long a, long b)
        // {
        //     return a/Gcd(a,b)*b;
        // }

        // //最大公約数
        // static long Gcd(long m, long n)
        // {
        //     if(n==0)return m;
        //     return Gcd(n,m%n);
        // }
    }
}

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

int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  
  int x[n] = {0};
  int sum = 0;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == 'A' && s[i + 1] == 'C')
      sum++;
    x[i + 1] = sum;
  }
  
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    
    cout << (x[r - 1] - x[l - 1]) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1408
using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var N = int.Parse(inputs[0]);
        var K = int.Parse(inputs[1]);
        var ans = N - K + 1;
        Console.WriteLine(ans);
    }
}



Measured memory_bytes: 13140
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let xl = Array.init n @@ fun _ -> Scanf.sscanf (read_line ()) "%d %d" @@ fun x l -> (x - l, x + l - 1)

let ans = Array.make n 0

let rec loop e i =
  if i < 0 then true
  else if ans.(i) = 0 then loop e (i - 1)
  else snd xl.(i) < e

let () =
  Array.sort (fun (_, a) (_, b) -> a - b) xl;
  Array.iteri (fun i (l, r) -> ans.(i) <- if loop l (i - 1) then 1 else 0) xl;
  Printf.printf "%d\n" @@ Array.fold_left (+) 0 ans

Measured memory_bytes: 10088
import java.util.*;

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

    int n = sc.nextInt();
    long x = sc.nextInt();
    int d = 0;
    int ans = 1;

    for(int i = 0; i < n; i++){
      int l = sc.nextInt();
      if(d + l <= x){
        d += l;
        ans += 1;
      } else {
        break;
      }
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int k; vector<int> v; vector<string>x;
string in; int n;
void add(string s) {
	stack<int> t;
	string res;
	int csum = 0;
	rep(i, n) {
		if (s[i] == '[') {
			t.push(res.length());
		}
		else if (s[i] == ']') {
			int le = t.top(); t.pop();
			reverse(res.begin() + le, res.end());
		}
		else if (s[i] == '+') {
			csum++;
		}
		else if (s[i] == '-') {
			csum--;
		}
		else {
			int j = s[i] - 'A';
			j = ((j + csum) % 26 + 26) % 26;
			res.push_back('A' + j);
			csum = 0;
		}
	}
	x.push_back(res);
	return;
}
void trans(int i) {
	if (i == k) {
		add(in); return;
	}
	rep(j, 26) {
		in[v[i]] = 'A' + j;
		trans(i + 1);
	}
	return;
}
void solve() {
	n = in.length();
	k = 0; v.clear(); x.clear();
	rep(i, n) {
		if (in[i] == '?') {
			k++; v.push_back(i);
		}
	}
	trans(0);
	int len = x.size();
	string out = x[0];
	rep(j, len) {
		out = min(out, x[j]);
	}
	cout << out << endl;
}
int main(){
	while (cin >> in) {
		if (in == ".")break;
		solve();
	}
	return 0;
}


Measured memory_bytes: 6076
import java.util.*;
public class Main {

	public static int investigate(String goal, String old){
		for(int m = 0; m < old.length(); m++){//何文字目を探しているのか
			int cnt = 0;
			if(goal.charAt(0) == old.charAt(m)){//1文字目発見
				for(int k = 1; m + k < old.length(); k++){//どのくらいの間隔で検索するか
					int dis = m + k;
					for(int p = 1; p < goal.length() && dis < old.length(); p++){//作りたい文字の何文字目を探すか
						if(goal.charAt(p) == old.charAt(dis)){
							cnt++;
							dis += k;
							if(cnt == goal.length() - 1){
								return 1;
							}
						}
						else{
							cnt--;
							break;
						}
					}
					cnt = 0;
				}
			}
		}
		return 0;
	}
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		String goal = in.next();
		String [] old = new String[N];
		for(int i = 0; i < N; i++){
			old[i] = in.next();
		}
		int ans = 0;
		for(int i = 0; i < N; i++){//どの看板をみているか
			ans += investigate(goal, old[i]);
		}
		System.out.println(ans);
	}
}

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

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

int main() {
  ll n, m;
  cin >> n >> m;
  vector<ll> l(m), r(m);
  rep(i, m) cin >> l[i] >> r[i];
  ll ans = *min_element(r.begin(), r.end())-*max_element(l.begin(), l.end())+1;
  cout << max(ans, (ll)0) << endl;
  return 0;
}

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

#define SENTINEL 10000000000000

int count = 0;
void merge(long long int A[], int left, int mid, int right);
void mergeSort(long long int A[], int left, int right) {
	int i, mid;
	if (left + 1 < right) {
		mid = (left + right) / 2;
		mergeSort(A, left, mid);
		mergeSort(A, mid, right);
		merge(A, left, mid, right);
	}
}



void merge(long long int A[], int left, int mid, int right) {
	long long int n1, n2, i, j, k;
	long long int *L, *R;
	n1 = mid - left;
	n2 = right - mid;
	L = (long long int *)malloc(sizeof(long long int)*(n1 + 1));
	R = (long long int *)malloc(sizeof(long long int)*(n2 + 1));
	for (i = 0; i <= n1 - 1; i++) {
		L[i] = A[left + i];
	}
	for (j = 0; j <= n2 - 1; j++) {
		R[j] = A[mid + j];
	}
	L[n1] = SENTINEL;
	R[n2] = SENTINEL;
	i = 0;
	j = 0;
	for (k = left; k <= right - 1; k++) {
		if (L[i] <= R[j]) {
			A[k] = L[i];
			i++;
			count++;
		}
		else {
			A[k] = R[j];
			j++;
			count++;
		}
	}
	free(L);
	free(R);
}

long long int big(long long int a, long long int b) {
	if (a >= b) {
		return a;
	}
	else {
		return b;
	}
}
int main() {
	long long int n, m;
	long long int x[1005] = {}, y[1005] = {}, z[1005] = {}, num[1005] = {}, num2[10] = {};
	scanf("%lld%lld", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%lld%lld%lld", &x[i], &y[i], &z[i]);
		 num[i] = x[i] + y[i] + z[i]; 
		
	}
	mergeSort(num, 0, n);
	for (int i = 1; i <= m; i++) {
		num2[1] += num[n - i];
	}
	for (int i = 0; i < n; i++) {
		
		 num[i] = x[i] + y[i] - z[i]; 
		
	}
	mergeSort(num, 0, n);
	for (int i = 1; i <= m; i++) {
		num2[2] += num[n - i];
	}
	for (int i = 0; i < n; i++) {

		 num[i] = x[i] - y[i] - z[i]; 

	}
	mergeSort(num, 0, n);
	for (int i = 1; i <= m; i++) {
		num2[3] += num[n - i];
	}
	for (int i = 0; i < n; i++) {

		num[i] = -x[i] + y[i] - z[i]; 

	}
	mergeSort(num, 0, n);
	for (int i = 1; i <= m; i++) {
		num2[4] += num[n - i];
	}
	for (int i = 0; i < n; i++) {

		 num[i] = -x[i] - y[i] - z[i]; 

	}
	mergeSort(num, 0, n);
	for (int i = 1; i <= m; i++) {
		num2[5] += num[n - i];
	}
	for (int i = 0; i < n; i++) {

		num[i] = x[i] - y[i] + z[i]; 

	}
	mergeSort(num, 0, n);
	for (int i = 1; i <= m; i++) {
		num2[6] += num[n - i];
	}
	for (int i = 0; i < n; i++) {

		num[i] = -x[i] + y[i] + z[i]; 

	}
	mergeSort(num, 0, n);
	for (int i = 1; i <= m; i++) {
		num2[7] += num[n - i];
	}
	for (int i = 0; i < n; i++) {

		 num[i] = -x[i] - y[i] + z[i]; 

	}
	mergeSort(num, 0, n);
	for (int i = 1; i <= m; i++) {
		num2[0] += num[n - i];
	}
	printf("%lld", big(big(big(big(big(big(big(num2[0], num2[1]), num2[2]), num2[3]), num2[4]), num2[5]), num2[6]), num2[7]));
}


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

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        x += (d + a - 1) / a;
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
x,y = map(int,input().split())
p = []
ans = 0

for i in range(x):
    p.append(4)

for a in range(x):
    if sum(p)==y:
        ans = 1
        break
    else:
        p.remove(4)
        p.append(2)
if ans == 0:
    if sum(p)==y:
        ans = 1

if ans == 1:
    print('Yes')
else:
    if (y==2)&(x==1):
        print('Yes')
    if (y==4)&(x==1):
        print('Yes')
    else :
        print('No')


Measured memory_bytes: 9212
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
vector<pair<int, int> > e;
int n, a[100001] = {};
string s;

int main() {
  int cnt = 0, p;
  cin >> s;
  n = s.length();
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') {
      a[i + 1] = 1;
      cnt++;
    }
  }
  for (int i = 0; i < n / 2; i++) {
    if (s[i] != s[n - 2 - i]) {
      printf("-1\n");
      return 0;
    }
  }
  if (s[n - 1] == '1' || s[0] == '0') {
    printf("-1\n");
    return 0;
  }
  p = 1;
  for (int i = 1; i < n; i++) {
    if (s[i] == '1') {
      while (p < i + 1) {
        cout << i + 1 << " " << p << endl;
        p++;
      }
    }
  }
  cout << p << " " << n << endl;
}

Measured memory_bytes: 2048
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <map>
#include <ctime>
#include <cstdio>
#include <set>
using namespace std;

#define LL unsigned long long int
#define SZ 110

int g[SZ];

int mex(set<int> &grnd)
{
    int i=0;
    for(const int &x:grnd){
        if(x!=i)
            return i;
        i++;
    }
    return i;
}

int grundy(int n)
{
    if(g[n]!=-1) return g[n];
    if(n<2) return g[n]=0;

    set<int> grnd;

    for(int i=1; i<=n; i++)
        if(n%(n-i)==0)
            grnd.insert(grundy(n-i));

    return g[n]=mex(grnd);
}

int result(int n, int m)
{
    int jor=0;

    if(n&1) jor=grundy(m);

    return jor;
}

int towerBreakers(int n, int m)
{
    if(result(n, m)) return 1;
    return 2;
}

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

    cin >> h >> a;
    cout << fixed << setprecision(0) << ceil(h/(double)a) << endl;

    return 0;
}
/**
2
2 2
1 4

*/


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = B[:]
output = 0

for i in range(N):
    C[i],A[i] = max(C[i]-A[i],0),max(A[i]-C[i],0)
    C[i],A[i+1] = max(C[i]-A[i+1],0),max(A[i+1]-C[i],0)

for i in range(N):
    output += B[i]-C[i]

print(output)

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll N;
ll A[100010],B[100010];
vector<ll> g[100010];
vector<ll> ds[100010];
ll C[100010];

ll predfs(ll v,ll pre){
	ll sum=0;
	rep(i,g[v].size()){
		ll nv=g[v][i];
		if(nv==pre){
			ds[v].push_back(-1);
			continue;
		}
		ll t=predfs(nv,v);
		ds[v].push_back(t);
		sum+=t;
	}

	return (A[v]-B[v]+sum);
}

void dfs(ll v,ll pre,ll s){
	C[v]=s;
	rep(i,g[v].size()){
		if(g[v][i]==pre){
			continue;
		}
		dfs(g[v][i],v,s+ds[v][i]);
	}
}

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

  cin>>N;
  rep(i,N-1){
  	ll a,b;
  	cin>>a>>b;
  	a--;b--;
  	g[a].push_back(b);
  	g[b].push_back(a);
  }
  rep(i,N){
  	cin>>A[i];
  }
  rep(i,N)cin>>B[i];
  predfs(0,-1);
  dfs(0,-1,0);
  ll mn=0;
  rep(i,N){
  	minch(mn,C[i]);
  }
  ll res=0;
  rep(i,N){
  	res+=C[i]-mn;
  }
  cout<<res<<endl;

  return 0;
}



Measured memory_bytes: 25080
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define  show for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
#define ld long double
#define e endl
#define bc __builtin_popcount
#define MOD 1000000007
#define INT_SIZE 32
#define me(x) memset(x,0,sizeof(x))
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
    ll n,m;
    cin>>n>>m;
    ll ans=(n*(n-1))/2+(m*(m-1))/2;
    cout<<ans<<e;


}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	ll a, b, n;cin >> n >> a >> b;
	cout << min(a * n, b) << endl;

	return 0;
}


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 T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector< vector<Int> > G(n);
  for(Int i=0;i<m;i++){
    Int a,b;
    cin>>a>>b;
    a--;b--;
    G[a].emplace_back(b);
  }

  vector<Int> ans;
  for(Int s=0;s<n;s++){
    vector<Int> dp(n,-1),pr(n,-1);
    queue<Int> que;
    dp[s]=0;
    que.emplace(s);
    Int len=n+1,t=-1;
    while(!que.empty()){
      Int v=que.front();que.pop();
      for(Int u:G[v]){
        if(u==s&&len>dp[v]+1) len=dp[v],t=v;
        if(~dp[u]) continue;
        dp[u]=dp[v]+1;
        pr[u]=v;
        que.emplace(u);
      }
    }
    if(t<0) continue;

    if(ans.empty()||len<(Int)ans.size()){
      ans.clear();
      Int v=t;
      while(v!=s) ans.emplace_back(v),v=pr[v];
      ans.emplace_back(v);
    }
  }
  if(ans.empty()) drop(-1);
  cout<<ans.size()<<endl;
  for(Int v:ans) cout<<v+1<<endl;
  return 0;
}


Measured memory_bytes: 384
const main = input => {
    s = input[0];
    var ans = 0,i;
    for(i=0; i<s.length-1; i++) {
        if (s[i]==s[i+1]) ans++;
    }
    console.log(ans?'Bad':'Good');
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

Measured memory_bytes: 7372
disc_set = lambda index: ["#","."] if index % 2 == 0 else [".","#"]
while True:
    height, width = map(int, input().split())
    if height == 0 and width == 0:
        break
    
    for col in range(height):
        disc = disc_set(col)
        for row in range(width):
            index = row % 2
            print(disc[index], end="")
        print("")
    print("")


Measured memory_bytes: 7012
#include<iostream>
#include<math.h>
using namespace std;

int main(){
  long long input;
  cin >> input;
  long long c = 100;
  //cout << input<<endl;
  int counter = 0;
  while(c<input){
    counter++;
    c+= (long long)c*0.01;
    //if((counter%1000)==0) cout << "counter:" <<counter <<endl;
  }

 cout <<counter << endl;

}

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

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

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(int, N);
    CIN(int, L);

    int ans = L * N + N * (N + 1) / 2 - N;
    int l = L;
    int r = L + N -1;
    if ( l > 0 ) {
        ans -= l;
    } else if ( r < 0 ) {
        ans -= r;
    }
    
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> A;

int partition(int p,int r){
  int x=A[r];
  int i=p-1;
  for(int j=p;j<r;j++){
    if (A[j]<=x){
      i++;
      swap(A[i],A[j]);
    }
  }
  swap(A[i+1],A[r]);
  return i+1;
}

int main(){
  int n;
  cin>>n;
  A.resize(n);
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  int q=partition(0,n-1);
  for(int i=0;i<n;i++){
    if (i==q){
      cout<<"["<<A[i]<<"]";
    }else{
      cout<<A[i];
    }
    if (i!=n-1){
      cout<<" ";
    }
  }
cout<<endl;
  return 0;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
#define ll                 long long int
#define mod                9000000000000000000
#define pi                 3.14159265358979323846264338327950288419716939937510
#define setbit(x)          __builtin_popcountll(x)
#define db                 long double
#define pp(x)              pair<x,x>
#define ff                 first
#define ss                 second
#define FIO                ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc                 ll tc; cin>>tc; for(ll number = 1 ; number <= tc ; number ++ )
#define vv(x)              vector<x>
#define pb                 push_back
#define pob                pop_back
#define pf                 push_front
#define pof                pop_front
#define endl               "\n"
#define pq                 priority_queue
#define dbg(x)             { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)          { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define bp                 ll kkk; cin >>kkk;
#define dbgArr(a,n)        cout<<"Array "<<#a<<endl; for(ll i=0 ; i<n ; i++) cout<<a[i]<<" "; cout<<endl;
#define maxE(a,n)          *max_element(a,a+n);
#define minE(a,n)          *min_element(a,a+n);
#define forn(i,s,n)        for(ll i=s ; i<n ; i++)
#define fornr(i,e,s)       for(ll i=e-1 ; i>=s ; i--)
#define arr(a,n)           for(ll i=0;i<n;i++){ cin>>a[i]; }
#define arr1(a,n)          for(ll i=1;i<=n;i++){ cin>>a[i]; }
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define print cout<<"Case #"<<number<<": "
#define all(x) x.begin(), x.end()
ll power(ll x, ll b) {ll p = 1;while (b > 0) {if(b&1) {p = p * x; p %= mod;} b >>= 1; x *= x; x %= mod;} return p % mod;}
using namespace std;
# define INF 1e15
struct lex_compare {
    bool operator() (const pair<db,ll>  p1, const pair<db,ll> p2){
        return (p1.first ==  p2.first) ? p1.ss < p2.ss : p1.first > p2.first;
    }
};

int main(){
    FIO;
    ll n,k ; cin >> n >> k;
    ll arr[n];
    forn(i,0,n) cin >> arr[i];
    sort(arr,arr+n);
    ll ans = 0;
    forn(i,0,k) ans += arr[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int maxCake = N/4;
		int maxDounut = N/7;
		final int CACE_PRICE= 4;
		final int DOUNUT_PRICE= 7;


		boolean isOK = false;
		for (int i = 0; i <= maxCake ; i++) {
			for (int j = 0; j <= maxDounut ; j++) {
				if ((CACE_PRICE*i)+ (DOUNUT_PRICE*j) == N) {
					isOK = true;
					break;
				}
			}
		}
		if (isOK) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23764
# coding: utf-8
# Your code here!
import collections

n=int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)

# 出現回数最大となる文字列の出現回数
count_max = c.most_common()[0][1]

ans_list = []
values, counts = zip(*c.most_common())

for i, count in enumerate(counts):
    if(count == count_max):
        ans_list.append(values[i])
      
for ans in sorted(ans_list):
    print(ans)

Measured memory_bytes: 59504
def alf(a):
   A = "abcdefghijklmnopqrstuvwxyz"
   for l in range(26):
      if a == A[l]:
         return l
   return -1

def main():
   s = input()
   t = input()

   S = []
   for s in s:
      S.append([alf(s), s])
   T = []
   for t in t:
      T.append([alf(t), t])
   
   S.sort()
   T.sort()
   T = T[::-1]
   for i in range(len(S)):
      if i == len(T):
         return "No"
      elif S[i] < T[i]:
         return "Yes"
      elif S[i] > T[i]:
         return "No"
   if len(S)==len(T):
      return "No"
   else:
      return "Yes"

print(main())


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(int i=0;i<(int)N;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    IO;

    int N; cin >> N;
    vector<ll> A(N), B(N);
    rep(i, N) {
        cin >> A[i]; B[i] = A[i];
    }

    sort(A.begin(), A.end());
    int k = count(A.begin(), A.end(), A[N - 1]);

    if (k > 1) {
        rep(i, N) { cout << A[N - 1] << endl; }
    } else {
        rep(i, N) {
            if (B[i] == A[N - 1]) { cout << A[N - 2] << endl; }
            else { cout << A[N - 1] << endl; }
        }
    }


}

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

const ll INF = 1LL<<62;
ll dp[105][100001];

int main(){
	ll n , W;
	cin >> n >> W;

	vector<ll> v(n) , w(n);
	for(ll i = 0 ; i < n ; i++){
		cin >> w[i] >> v[i];
	}

	dp[0][0] = 0;
	dp[0][w[0]] = v[0];

	for(ll i = 1 ; i < n ; i++){
		dp[i][0] = 0;
		for(ll j = 1 ; j <= W ; j++){
			dp[i][j] = dp[i-1][j];
			if (j >= w[i]){
				dp[i][j] = max(dp[i][j] , dp[i-1][j-w[i]] + v[i]);
			}
		}
	}

	ll ans = -INF;
	for(ll j = 0 ; j <= W ; j++){
		ans = max(ans , dp[n-1][j]);
	}

	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 80884
a=int(input())
li={}
while(a):
    a=a-1
    b=input()
    if b in li:
        li[b]+=1
    else:
        li[b]=1
m = max(li.values())
l=[]
for t in li:
    if m==li[t]:
        l.append(t)
l=sorted(l)
for y in l:
    print(y)

Measured memory_bytes: 33112
N=int(input())
a=list(map(int,input().split()))
s=[0]
count=0
from operator import mul
from functools import reduce
from collections import Counter
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
for i in range(N):
    s.append(s[i]+a[i])
a=Counter(s)
b=a.most_common()
for i in range(len(b)):
    if b[i][1]!=1:
        count+=cmb(b[i][1],2)
print(count)

Measured memory_bytes: 41964
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
using namespace std;

typedef long long int lli;

int K;
string S;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> K >> S;
    if(S.size() > K){
        for(int j = 0; j < K; ++j)
            cout << S[j];
        cout << "...";
    }else
        cout << S;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int dist(vector<int> a, vector<int> b)
{
  int d = 0;
  rep(i, a.size())
  {
    d += (a[i] - b[i]) * (a[i] - b[i]);
  }

  return d;
}

bool square(int a)
{
  bool result = false;
  for (int i = 0; i * i <= a; i++)
  {
    if (i * i == a)
      result = true;
  }

  return result;
}

int main()
{
  int N, D;
  cin >> N >> D;

  vector<vector<int>> X(N);
  rep(i, N)
  {
    X[i].resize(D);
    rep(j, D)
    {
      cin >> X[i][j];
    }
  }

  int sum = 0;
  rep(i, N)
  {
    for (int j = i + 1; j < N; j++)
    {
      int dist_ = dist(X[i], X[j]);
      if (square(dist_))
        sum++;
    }
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pii pair<ll,ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<ll,ll>
#define mii map<pii,ll>
#define ms map<string,ll>
#define itr ::iterator
#define all(x) x.begin(),x.end()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fe(i,a,b) for(ll i=a;i<=b;i++)
#define fn(i,a,b) for(ll i=a;i>b;i--)
#define fm(it,m) for(it = m.begin();it != m.end();++it)
#define db(i) cout<<i<<"  "
#define M 1000000007

int main()
{ ll t=1;
  //cin>>t;
  while(t--)
  { ll h=0,a=0,k=0;
    cin>>h>>a;
    if(h%a==0)
        cout<<h/a;
    else cout<<(h/a)+1;

  }
return 0;
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int n; cin >> n;
    int h[n];
    rep(i,n) cin >> h[i];

    int dp[n];
    rep(i,n) dp[i] = INF;
    dp[0] = 0;
    for(int i=1; i<n; i++){
        if(i == 1) dp[i] = dp[i-1] + abs(h[i]-h[i-1]);
        else{
            dp[i] = min(dp[i], min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2])));
        }
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 4368