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

#define INF (2e9)
#define FOR(i, a, b) for (ll (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using namespace std;

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

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

using ll = long long;
using ld = long double;

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<ll>;
using vvi = vc<vi>;

template<class T>
using va = valarray<T>;
using vad = va<ld>;
using vai = va<ll>;

using pii = pair<ll, ll>;

vi Read(ll n) {
    auto      v = vi(n);
    for (auto i = std::size_t(0); i < n; ++i) {
        cin >> v[i];
    }
    return v;
}

template<class T>
void DumpRow(const T& A) {
    for (const auto& value : A)
        cout << value << "\n";
}

template<class T>
void DumpColumn(const T& A) {
    auto isFirst = true;
    for (const auto& value : A) {
        if (isFirst) {
            cout << value;
            isFirst = false;
        } else {
            cout << " " << value;
        }

    }
    cout << endl;
}

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

    ll n;
    cin >> n;
    const auto a = Read(n);

    ll q;
    cin >> q;
    const auto k = Read(q);

    REP(i, q) {
        const auto p = equal_range(ALL(a), k[i]);
        cout << p.first - a.begin() << " " << p.second - a.begin() << endl;
    }
    return 0;
}



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

int main(){
    int a,b,g=1,ans=0;
    cin>>a>>b;

    while(1){
        if(g>=b)break;

        g=g+a-1;
        ans++;
    }

    cout<<ans<<endl;

    return 0;
    
}

Measured memory_bytes: 384
N,M = map(int, input().split())
A = set([int(input()) for i in range(M)])

dp = [0]*(N+1)
dp[0] = 1

for next in range(1,N+1):
    if next in A:
        dp[next] = 0
    else:
        dp[next] = (dp[next-1] + dp[next-2])%1000000007

print(dp[N])


Measured memory_bytes: 13192
#include <stdio.h>
int main(int argc, char const *argv[]){
	int a,b,k,i;
	scanf("%d%d%d",&a,&b,&k);
	for(i=0;i<k;i++){
		if(a+i>b)
			break;
		printf("%d\n",a+i);
	}
	if(a+i>b-k)a=a+i;
	else a=b-k+1;
	for(i=a;i<=b;i++){
		printf("%d\n",i);
	}
	return 0;
}

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

int main(){
    while(1){
        int h, w;
        cin >> h >> w;
        if(h==0 && w==0) break;
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
#define mem(x,y) memset(x,y,sizeof(x))  
#define lli long long int
#define ll long long 
#define ld long double
#define pb push_back
#define mp make_pair
#define F first
#define S second 
#define LB lower_bound
#define UB upper_bound
#define BS binary_search
#define pii pair<lli,lli>
const long long int mod=1000000007;
//const long long int mod=998244353;
const long double PI=3.141592653589793;
const long long int inf=1e18;
const long long int inf2=LLONG_MAX;
#define setBitCount(x) __builtin_popcountll(x)
#define all(a) (a).begin(), (a).end()
#define all_r(a) (a).rbegin(), (a).rend()
lli gcd(lli a,lli b)
{
    if(b==0)
    return a;
    else
    return gcd(b,a%b);
}
// calculating (x^y)%p
lli power(lli x,lli y,lli p)
{
    lli res = 1;      
    x = x % p;  
    while (y > 0)
    {
        if (y & 1) //y is odd  
        res = (res*x) % p;
        y = y>>1; 
        x = ( (x%p)*(x%p) )% p;  
    }
    return res%p;
}
// calculating modular inverse using fermat little theorem
lli modInverse(lli n,lli p) 
{
    return power(n, p-2, p)%p;
}

// policy based data structures !!
#define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
// s.order_of_key (k) : Number of items strictly smaller than k
// *(s.find_by_order(k)) : K-th element in a set (counting from zero)
lli dp[3005][3005];
lli a[3005];
lli fun(lli i,lli j)
{
   if(i==j)
   return a[i];
   
   if(j-i==1)
   return max(a[i],a[j]);
   
   if(dp[i][j]!=-1)
   return dp[i][j];
   
   lli ans1=a[i]+min(fun(i+2,j),fun(i+1,j-1));
   lli ans2=a[j]+min(fun(i,j-2),fun(i+1,j-1));
   lli ans=max(ans1,ans2);
   
   dp[i][j]=ans;
   return ans;
}
void solve()
{
   lli n;
   cin>>n;
   
   lli sum=0;
   for(lli i=1;i<=n;i++)
   {
      cin>>a[i];
      sum+=a[i];
   }
   for(lli i=1;i<3005;i++)
   for(lli j=1;j<3005;j++)
   dp[i][j]=-1;
   
   lli ans=fun(1LL,n);
   cout<<ans-(sum-ans);
}
int main()
{
   
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    lli T;
    //cin>>T;
    T=1;
    while(T--)
    {
        solve();
    }




    return 0;
}

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

int N, M;

int main(void){
    // Here your code !
    scanf("%d %d", &N, &M);
    int p = pow(2, M);
    printf("%d\n", (1900 * M + 100 * (N - M)) * p);

    return 0;
}

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

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 1; i < s.size()-1; i++){
        ans++;
    }
    if(ans/10 > 0)
        cout << s[0] << char(ans/10+'0') << char(ans%10+'0') << s[s.size()-1] << endl;
    else
        cout << s[0] << char(ans+'0') << s[s.size()-1] <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> pll;

const int MAXN = 100000 + 10;
const LL MINLL = 0x8000000000000000;
pll nums[MAXN];
LL dp1[MAXN];
LL dp2[MAXN];

bool cmp(pll const & a, pll const & b) {
    return (a.first-a.second) < (b.first-b.second);
}

LL get(int i, bool first) {
    if (first) {
        return nums[i].first;
    }
    else {
        return nums[i].second;
    }
}

LL my_max(LL a, LL b) {
    return a > b ? a : b;
}

void solve(LL dp[], int init, int end, int k, bool first) {
    int delta = 1;
    if (init > end) delta = -1;
    multiset<LL> s;
    LL vals = 0;
    int i = init;
    for (int j = 0; j < k; i += delta, j++) {
        s.insert(get(i,first));
        vals += get(i,first);
    }
    dp[i-delta] = vals;
    while (i != end) {
        LL tmp = get(i, first);
        if (tmp > *s.begin()) {
            vals = vals - *s.begin() + tmp;
            s.erase(s.begin());
            s.insert(tmp);
        }
        dp[i] = vals;
        i += delta;
    }
}

int main() {
//    freopen("test.txt", "r", stdin);
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    int n = x + y + z;
    LL g, s, b, bias = 0;
    for (int i = 0; i < n; i++) {
        scanf("%lld%lld%lld", &g, &s, &b);
        bias += b;
        nums[i] = {g-b, s-b};
    }
    sort(nums, nums+n, cmp);
    solve(dp1, 0, y+z, y, false);
    solve(dp2, n-1, y-1, x, true);
    LL ret = MINLL;
    for (int i = y-1; i < y+z; i++) {
        ret = my_max(ret, dp1[i] + dp2[i+1]);
    }
    cout << ret+bias << endl;


}

Measured memory_bytes: 6272
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;

int main(){
	cin>>n;
	int m=inf,M=-1;
	for(int i=0;i<n;i++){
		int t;
		cin>>t;
		m=min(m,t);
		M=max(M,t);
	}
	cout<<M-m<<endl;
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
  int paSize = printArray.size();
  for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
  if (between != '\n') {cerr << endl;}
}

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

int Len[55], Pat[55];

int rec(int level, int layer) {
  if (level == 0) {
    return 1;
  }

  if (layer <= 1) { // 1
    return 0;
  } else if (layer <= Len[level-1] + 1) { // 2
    return rec(level-1, layer-1);
  } else if (layer <= Len[level-1] + 2) { // 3
    return Pat[level-1] + 1;
  } else if (layer <= 2*Len[level-1] + 2) { // 4
    return Pat[level-1] + 1 + rec(level-1, layer - Len[level-1] - 2);
  } else { // 5
    return  2*Pat[level-1] + 1;
  }
}

signed main() {
  int N, X;
  cin >> N >> X;

  Len[0] = Pat[0] = 1;
  for (int i = 1; i <= N; i++) {
    Len[i] = Len[i-1] * 2 + 3;
    Pat[i] = Pat[i-1] * 2 + 1;
  }

  cout << rec(N, X) << endl;

  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python

def main():
    n = int(input())
    a_lst = list(map(int, input().split()))

    s = a_lst[0]
    for a in a_lst[1:]:
        s = s ^ a

    ret = []
    for a in a_lst:
        ret.append(s ^ a)

    print(' '.join(map(str, ret)))

if __name__ == '__main__':
    main()


Measured memory_bytes: 41816
import java.util.Scanner;

public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int[] counts = new int[128];
while (sc.hasNext()){
String str = sc.nextLine().toLowerCase();
for(int i=0;i<str.length();i++){
counts[str.charAt(i)]++;
}
}
for(char ch = 'a';ch<='z';ch++){
System.out.println(ch + " : " + counts[ch]);
}
}
}


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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fill(a,v) memset(a,v,sizeof(a))
#define d1(a) cout << a << "\n"
#define d2(a,b) cout << a << " " << b << "\n"
#define d3(a,b,c) cout << a << " " << b << " " << c << "\n"
#define d4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << "\n"
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

int32_t main(){
	fast;
	int n,m;
	cin >> n >> m;
	int a[n];
	int sum = 0;
	f(i,0,n) cin >> a[i] , sum += a[i];
	int cnt = 0;
	f(i,0,n) if(a[i]*4*m>= sum)   cnt++;
	cout << (cnt >= m ? "Yes" : "No");
}


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

int main() {
  long int N;
  cin>>N;
	vector<long int>vec(N);
  for(int i=1;i<=N;i++){
 long int y;
    if(N%i==0){y=N/i;}
    else{y=N/i;}
    
  	vec.at(i-1)=y*(y+1)*i/2;
  }
  long int M=0;
  for(int k=0;k<N;k++){M+=vec.at(k);}
  cout<< M<<endl;
}



Measured memory_bytes: 81332
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,m;
  cin>>n>>m;
  int a[m];
  rep(i,m){
    cin>>a[i];
    n-=a[i];
    if(n<0){cout<<-1<<endl;return 0;}
  }
  cout<<n<<endl;
  

  return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
//const ll mod = 1000000007LL;
const ll mod = 998244353LL;

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


ll a[333], dp[333][MAX / 2];



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



  cin >> n;
  ll sum = 0;
  rep(i, n) {
    cin >> a[i];
    sum += a[i];
  }
  ans = 1;
  rep(i, n) (ans *= 3) %= mod;
  dp[0][0] = 1;
  rep(i, n) {
    rep(j, MAX / 2) dp[i + 1][j] = (dp[i][j] * 2) % mod;
    rep(j, MAX / 2) {
      if (j + a[i] >= MAX / 2) break;
      (dp[i + 1][j + a[i]] += dp[i][j]) %= mod;
    }
  }
  rep(i, MAX / 2) (dp[n][i] *= 3) %= mod;
  FOR(i, (sum + 1) / 2, MAX / 2) (ans += mod - dp[n][i]) %= mod;

  if (sum % 2 == 0) {
    rep(i, n + 1) rep(j, MAX / 2) dp[i][j] = 0;
    dp[0][0] = 1;
    rep(i, n) {
      rep(j, MAX / 2) dp[i + 1][j] = dp[i][j] % mod;
      rep(j, MAX / 2) {
        if (j + a[i] >= MAX / 2) break;
        (dp[i + 1][j + a[i]] += dp[i][j]) %= mod;
      }
    }
    (ans += (dp[n][sum / 2] * 3) % mod) %= mod;
  }

  cout << ans << endl;



  return 0;
}

Measured memory_bytes: 262400
#include <vector>
#include <iostream>
#include <algorithm>
#include <random>
#include <climits>
#include <cmath>
#include <queue>
#include <utility>
using namespace std;

#define MAX_V 10*10
#define INF INT_MAX/4
#define EMPTY -1

typedef pair<int, int> P;

struct edge {int to, cap, cost, rev;};
vector<edge> G[MAX_V];

struct node {int dist, prevV, prevE;};
vector<node> V;

int min_cost(int ind_startNode, int ind_endNode){
    //普通のダイクストラ法
    
    //ノード初期化。未到達の区別のため距離を無限で初期化さえすれば良い
    for(int i=0; i<V.size(); i++){
        V[i].dist = INF;
        V[i].prevV = EMPTY;
        V[i].prevE = EMPTY;
    }
    
    priority_queue<P, vector<P>, greater<P> > que;
    
    V[ind_startNode].dist = 0;
    que.push(P(0, ind_startNode));
    
    while(!que.empty()){
        //一番sからの距離の短いノードを取り出す
        P p = que.top(); que.pop();
        int ind_v = p.second;
        //queに追加された後に、distがより小さく更新されていたら、無視する
        if(V[ind_v].dist < p.first) continue;
        for(int ind_e = 0; ind_e < G[ind_v].size(); ind_e++){
            edge &e = G[ind_v][ind_e];
            bool isMinUpdatable = V[e.to].dist > V[ind_v].dist + e.cost;
            if(isMinUpdatable){
                V[e.to].dist = V[ind_v].dist + e.cost;
                V[e.to].prevV = ind_v;
                V[e.to].prevE = ind_e;
                que.push(P(V[e.to].dist, e.to));
            }
        }
    }
    
    //目的ノードまでの距離がINFなら到達できなかったということ
    if(V[ind_endNode].dist == INF){
        return -1;
    }
    
    return V[ind_endNode].dist;
}

void add_edge(int from, int to, int cap, int cost){
    int ind_rev_f = G[to].size();
    int ind_rev_b = G[from].size();
    
    G[from].push_back((edge){to, cap, cost, ind_rev_f});
    //G[to].push_back((edge){from, 0, -1*cost, ind_rev_b});
}

#define MAX_HW 200

int H, W;
int c[10][10];
int A[MAX_HW][MAX_HW];

void input(){
    cin >> H >> W;
    
    for(int i=0; i<10; i++){
        for(int k=0; k<10; k++){
            cin >> c[i][k];
            //隣接リストに変換
            add_edge(i, k, 0, c[i][k]);
        }
    }
    
    for(int i=0; i<H; i++){
        for(int k=0; k<W; k++){
            cin >> A[i][k];
        }
    }
}

int main(){
    input();
    int min_cost_to_1[10];
    //ノードは0~9までしかないので数は10固定
    V.resize(10);
    
    for(int i=0; i<10; i++){
        min_cost_to_1[i] = min_cost(i, 1);
    }
        
    int sum_cost = 0;
    for(int i=0; i<H; i++){
        for(int k=0; k<W; k++){
            //1か-1でない数字のときは、1への最小変換コストを積算
            if(A[i][k] != 1 && A[i][k] != -1){
                sum_cost += min_cost_to_1[A[i][k]];
            }
        }
    }
    
    printf("%d\n", sum_cost);
    
    return 0;
}



Measured memory_bytes: 384
def fibonacci(n):
    if n<0:
        return 0
    else:
        a=1
        b=1
        if n==0:
            return a
        elif n==1:
            return b
        else:
            i=n-2
            while i>=0:
                x=a
                a=b
                b=x+b
                i=i-1
            return b

N,M=map(int,input().split())
a=[]
for _ in range(0,M):
    a.append(int(input()))
a.append(N+1)
m=1
for i in range(0,M+1):
    if i==0:
        m=fibonacci(a[i]-1)
    else:
        m=m*fibonacci(a[i]-a[i-1]-2)

print(m%(10**9+7))

Measured memory_bytes: 7088
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif

//改造
typedef long long int ll;
using namespace std;

//ここから編集する

bool enough(ll t, int h[], int n, int a, int b) {
    ll ch[100005];
    for (int i = 0; i < n; i++) {
        ch[i] = h[i];
    }

    ll cnt = 0;
    ll dmg = b * t;
    ll dif = a - b;
    for (int i = 0; i < n; i++) {
//        ch[i] -= b * t;
//        if(ceil((double)ch[i] / (a - b)) > 0) cnt += ceil((double)ch[i] / (a - b)) ;
//        if(ch[i]> 0) cnt += (ch[i] + (a-b) - 1)/(a-b) ;
        if(h[i] <= dmg) continue;
        cnt += (h[i] - dmg + dif - 1)/dif;

    }

    return cnt <= t;

}

int main() {
    int n, a, b;
    int h[100005];

    cin >> n >> a >> b;
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }

//        if (enough(i, h, n, a, b)) {
//            cout << i << endl;
//            break;
//        }
    //にぶんたんさく！
    ll left = 0;
//    ll right = (ll) 1E10; //これだと正解した
    ll right = (ll) 1e10; //これだと何故か不正解
//    ll right = 10;

    while(right - left > 1){
        ll mid = (left + right) / 2;
//        if(mid == left) break;
        if(enough(mid,h,n,a,b)){
            right = mid;
        }else{
            left = mid;
        }
    }
    cout << right << endl;
}
/*
2 10 4
21
20
 */


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

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    cout << (100 * n + 1800 * m) * (1 << m) << endl;
}

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

int main()
{
	int a, b;
	cin >> a >> b;
	if (a <= 0 && b >= 0)
	{
		cout << "Zero" << endl;
		return 0;
	}
	if (a > 0)
	{
		cout << "Positive" << endl;
		return 0;
	}
	cout << ((b - a) % 2 ? "Positive" : "Negative") << endl;
}


Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int N=105;
int n,a[N],b[N];
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=2;i<=n;i++)
		a[i]+=a[i-1];
	for (int i=n-1;i>=1;i--)
		b[i]+=b[i+1];
	int ans=0;
	for (int i=1;i<=n;i++)
		ans=max(ans,a[i]+b[i]);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>//
#include <vector>//
#include <map>
#include <cstdlib>
#include <numeric>
#include <algorithm>//ソート等に使用
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <thread>///////////////////
#include <queue>//幅優先等のキュー
#include <stack>
#include <bitset>

#define rep(i,m,n) for(int i=(m);i<(n);i++)
#define mer(i,m,n) for(int i=(m);i>(n);--i)

#define MOD 1000000007
//#define MOD 998244353
#define MAX 

using namespace std;

using ll = long long int;
using ld = long double;
using std::swap;

vector<int> v;
vector<int> w;
vector<long long int> vll;
vector<long long int> wll;
//vector<vector<int>> vec(50, vector<int>(4, 0));
vector<vector<int>> vv;
vector<vector<int>> ww;
//vector<char> vc;
vector<string> vs;



int main() {
	string S,T;
	cin >> S >> T;
	int ans = 0;
	rep(i, 0, S.length()) {
		if (S.substr(i, 1) != T.substr(i, 1))++ans;
	}
	cout << ans << '\n';
	return 0;
}

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

int main(){
  ll n,x=0;
  cin >> n;
  vector<ll> a(n),b(n),c(n),d(n-1);
  for(ll i=0;i<n;i++){
    cin >> a.at(i);
    x += a.at(i);
  }
  
  b.at(0) = 0;
  c.at(0) = x;
  for(ll i=1;i<n;i++){
    b.at(i) = a.at(i-1) + b.at(i-1);
    c.at(i) = x - b.at(i);
  }
  for(ll i=0;i<n-1;i++){
    d.at(i) = max(b.at(i+1) -c.at(i+1),c.at(i+1) -b.at(i+1));
  }
  sort(d.begin(),d.end());
  cout << d.at(0) << endl;
  
  return 0;
}

Measured memory_bytes: 6528
using System;
using System.Linq;
using System.Text;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Convert.ToInt32 (Console.ReadLine ());
            int[] Ai = Array.ConvertAll<string, int> (Console.ReadLine ().Split (), int.Parse);
            int[] answer = new int[N + 1];
            for (var i = 0; i < Ai.Length; i++) {
                answer[Ai[i]]++;
            }
            StringBuilder builder = new StringBuilder (answer.Length);
            for (var i = 1; i < answer.Length; i++) {
                builder.Append (answer[i].ToString() + "\n");
            }
            Console.Write (builder.ToString ());
        }
    }
}


Measured memory_bytes: 51668
#include <bits/stdc++.h>
using namespace std;
 
int main(){

    int N, X, T;
    cin >> N >> X >> T;

    for(int i=1; i<=1000; i++){
        if(N <= i*X){
            cout << i*T << endl;
            break;
        }
    }

    return 0;

}

Measured memory_bytes: 3596
import math
A, B, H, M = map(float,input().split())
rad2 = 360 * (H + M/60) / 12
rad1 = 360 * M / 60
if rad2 > rad1:
    rad = rad2 - rad1


else:
    rad = rad1 - rad2
if rad > 180:
    rad = 360 - rad
len = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(math.radians(rad)))
print(len)

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


typedef long long ll;

int main()
{
    ll x;
    cin>>x;
    x-=1;
    ll ans=0;
    ans+=(x/11)*2;
    x=x%11;

    if(x>5)ans+=2;
    else if(0<x<=5)ans+=1;
    cout<<ans;


}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      int n = sc.nextInt();
      int d = sc.nextInt();
      int target =0;

      if(n<d){
        System.out.println(1);
        System.exit(0);
      }

      for (int i = 1;i<=n ;i++ ) {
        if(i-d==1){
          target = i+d;
        }
      }
      if(n%target!=0){
        System.out.println(n/target+1);
      }else{
        System.out.println(n/target);
      }

  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,t;
  cin >> a >> b >> t;
  int time = 0;
  int sum = 0;
  while(time < t + 0.5) {
    time += a;
    sum += b;
  }
  cout << b * (t / a) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)
typedef pair<int, int> Pi;
#define fi first
#define se second

const int LLINF = 1LL << 60;

signed main()
{
  int N;
  Pi A[100005];
  int out[100005] = {0};

  cin >> N;
  A[N].fi = 0, A[N].se = -1;
  Rep(i, N) {
    cin >> A[i].fi; A[i].se = i;
  }

  sort(A, A + N + 1, greater< Pi >());

  int minv = LLINF;
  int i = 0;
  while(i < N) {
    int save = A[i].fi;
    while(save == A[i].fi && i < N) i++;
    minv = min(A[i - 1].se, minv);
    //cout << i << " " << minv << " " << A[i - 1].fi << endl;
    out[minv] += i * (A[i - 1].fi - A[i].fi);
  }

  Rep(i, N) {
    cout << out[i] << endl;
  }

  return 0;
}

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

using namespace std;
using ll  = long long;
using ii  = pair < int , int >;
using i3  = pair < int , ii >;
using vi  = vector < int >;
using vii = vector < ii >;
using vi3 = vector < i3 >;

const int N = 2e5 + 5;
const ll INF = 1e12;
const double eps = 1e-9 , PI = acos(-1);

int n , m;
int a[N] , b[N];;

void solve(){
    scanf("%d" , &n);
    for(int i = 1 ; i <= n ; i ++){
        scanf("%d" , &a[i]);
        b[i] = a[i];
    }

    sort(b + 1 , b + 1 + n , [&](int a , int b){return a > b;});

    if(n == 1){
        printf("0\n");
        return;
    }

    for(int i = 1 ; i <= n ; i ++){
        if(a[i] == b[1]){
            printf("%d\n" , b[2]);
        }
        else printf("%d\n" , b[1]);
    }
}

main(){
    int t = 1;
    //scanf("%d" , &t);

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

    return 0;
}



Measured memory_bytes: 3200
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
int N, M, X;
int A[102];

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

  cin >> N >> M >>X;
  rep(i, M) cin >> A[i];

  int left_cnt = 0;
  for (int i=0; i<X; i++){
    rep (j, M){
      if (A[j] == i) left_cnt++;
    }
  }
  int right_cnt = 0;
  for (int i=X; i<N; i++){
    rep (j, M){
      if (A[j] == i) right_cnt++;
    }
  }

  cout << min(left_cnt, right_cnt) << endl;
  return 0;
}

Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;

int main(){
  int n,m;
  cin>>n>>m;
  int ans=0;
  int a[40][40];
  int k[40];
  for(int i=0;i<n;i++){
    cin>>k[i];
    for(int j=0;j<k[i];j++)cin>>a[i][j];
  }
  vector<int>cnt(m);
  for(int i=0;i<n;i++){
    for(int j=0;j<k[i];j++){
      cnt[a[i][j]-1]++;
    }
  }
  for(int i=0;i<m;i++){
    if(cnt[i]==n)ans++;
  }
  cout<<ans<<endl;
}
      
    
  
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint         = long long;
constexpr lint inf = 1LL << 60;
constexpr lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int ret = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] % 2 == 1 && i % 2 == 0)
            ret++;
    }
    cout << ret << "\n";
    return 0;
}

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

int n;
map<string,int>  M;
map<string,vector<int> >T;

int dp[111][111],nex[111];


signed main(){

  memset(nex,-1,sizeof(nex));
  r(i,111)r(j,111)dp[i][j]=1e8;
  
  cin>>n;
  r(i,n){
    string s;
    cin>>s;
    if(s!="goto"){
      s=s.substr(0,s.size()-1);
      if(T.count(s)){
	r(j,T[s].size())
	  nex[ T[s][j] ] = i;
      }
      M[s]=i;
    }
    else{
      string t;
      cin>>t;
      t=t.substr(0,t.size()-1);
      if(M.count(t))nex[ i ] = M[t];
      else T[t].push_back(i);
    }
  }

  r(i,n){
    if(nex[i]==-1)dp[i][i+1]=0;
    else{
      dp[i][nex[i]] = 0;
      if(i+1!=nex[i]){
	dp[i][i+1] = 1;
      }
    }
  }

  r(k,n+1)r(i,n+1)r(j,n+1) dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);

  cout<<dp[0][n]<<endl;
}



Measured memory_bytes: 3288
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;
const long long INF = 1LL << 60;
ll mod = 1e9 + 7;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (c - (a - b) >= 0)
        cout << c - (a - b) << endl;
    else
    {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=998244353;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
struct triplet{int a,b,c;};
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,k;
    set<int>st;
    vector<triplet>ans;
    cin>>n>>k;
    if(2*k-1>n){
        puts("-1");
        return 0;
    }
    for(int i=k+2*n;i<k+3*n;i++)st.insert(i);
    int a=n,b=k+2*n-1,c=a+b;
    ans.pb({a,b,c});
    while(a>k){
        a--,b--;
        c=*st.lower_bound(a+b);
        ans.pb({a,b,c});
        st.erase(c);
    }
    a=k+n-1;
    b--;
    while(a>n){
        c=*st.lower_bound(a+b);
        ans.pb({a,b,c});
        st.erase(c);
        a--,b--;
    }
    for(triplet t:ans)cout<<t.a<<" "<<t.b<<" "<<t.c<<endl;
    return 0;
}

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

using namespace std;
//const int OO = 0x3f3f3f3f;
const long long OO = (long long) 1e18+7;
//const unsigned long long UOO = (long long) 10e18+7;
#define lp(i,a,n) for(long long i = a ; i < n ; ++i)
#define lpr(i,a,n) for(long long i = a ; i >= n ; --i)
#define rep(i,vec) for(ll i = 0 ; i < vec.size() ; ++i)
#define reprv(i,vec) for(ll i = vec.size()-1; i >=0 ; --i)
#define eps (1e-5)
#define pb(i) push_back(i)
#define EPS 1e-9
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define debug(x) cout<<(#x)<<": \""<<x<<"\""<<endl
#define debugVec(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl

typedef vector<int> vi ;
typedef   long long ll;
typedef   unsigned long long ull;
typedef vector<ll> vll ;
typedef pair<int,int> pii ;
typedef vector< pair<int,int> >  vpii;
typedef vector<pair<long long,long long>> vpll;
typedef vector<vector<int> > vvi ;
typedef complex<double> point;
typedef pair<ll,ll> pll;

using namespace std;
ll  inv(ll a, ll b) {return 1 < a ? b - inv(b % a, a) * b / a : 1;}
ll  Pow(ll  B,ll  P){ll  R=1; while(P>0)  {if(P&1) R=(R*B);P/=2;B=(B*B);}return R;} //compute b^p
ll  GCD(ll  a,ll  b){ while(b){b ^= a ^=b ^= a %=b;}  return a;}
ll  LCM(ll  a,ll  b) { return (a / GCD(a,b)*b); }
ll  BigMod(ll  B,ll  P,ll  M){ ll  R=1; while(P>0)  {if(P&1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return (ll )R;} //compute b^p%m
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//int i=uniform_int_distribution<int>(1,n)(rng);


int n1,n2;
string s1 ,s2;

int mem[3005][3005];

int dp(int pos1, int pos2 ){
    if(pos1==n1||pos2==n2) return 0;
    if(mem[pos1][pos2]!=-1) return mem[pos1][pos2];
    int a = 0,b = 0,c = 0;
    a = dp(pos1+1,pos2);
    b = dp(pos1,pos2+1);
    if(s1[pos1]==s2[pos2]) c = dp(pos1+1,pos2+1) + 1;
    return mem[pos1][pos2] = max(max(a,b),c);
}

void dp1(int pos1, int pos2){
    if(pos1==n1||pos2==n2) return;
    int a = 0,b = 0,c = 0;
    a = dp(pos1+1,pos2);
    b = dp(pos1,pos2+1);
    if(s1[pos1]==s2[pos2]) c = dp(pos1+1,pos2+1) + 1;
    if(mem[pos1][pos2]==a) dp1(pos1+1,pos2);
    else if(mem[pos1][pos2]==b)dp1(pos1,pos2+1);
    else{
        cout << s1[pos1];
        dp1(pos1+1,pos2+1);
    }
}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
//    cout.tie(0);
//#ifndef ONLINE_JUDGE
//   freopen( "output.txt" , "w" , stdout ) ;
//   freopen( "input.txt" , "r" , stdin ) ;
//#endif


    cin >> s1 >> s2;
    n1 = s1.size();
    n2 = s2.size();
    memset(mem,-1,sizeof mem);
    int ans = dp(0,0);
    dp1(0,0);
    return 0;
}


Measured memory_bytes: 39392
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <numeric>
#include <string>
#include <cmath>

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


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

	if (400 <= x and x <= 599) cout << 8;
	if (600 <= x and x <= 799) cout << 7;
	if (800 <= x and x <= 999) cout << 6;
	if (1000 <= x and x <= 1199) cout << 5;
	if (1200 <= x and x <= 1399) cout << 4;
	if (1400 <= x and x <= 1599) cout << 3;
	if (1600 <= x and x <= 1799) cout << 2;
	if (1800 <= x and x <= 1999) cout << 1;

	return 0;


}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,m;
  cin >> n >> m;
  vector<P> v[n];
  rep(i,m) {
    ll x,y,z;
    cin >> x >> y >> z;
    x--,y--;
    v[x].pb(P(y,z));
    v[y].pb(P(x,-z));
  }
  ll d[n];
  fill(d,d+n,MAXL);
  priority_queue<P,vector<P>,greater<P> > que;
  rep(i,n) {
    if(d[i]==MAXL) {
      que.push(P(0,i));
      d[i]=0;
      int t=0;
      while(!que.empty()) {
        P p=que.top();que.pop();
        ll x=p.S,c1=p.F;
        if(d[x]<c1) continue;
        rep(i,v[x].size()) {
          ll y=v[x][i].F,c2=v[x][i].S;
          if(d[y]==MAXL||d[y]==c1+c2) {
            if(d[y]==MAXL) que.push(P(c1+c2,y));
            d[y]=c1+c2;
          } else {
            pr("No");
            return;
          }
        }
      }
    }
  }
  pr("Yes");
}

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

Measured memory_bytes: 15856
#include <iostream>

using namespace std;

int f(int v, int per) {
	return v * (100+per) / 100;
}
int main() {
	int x, y, s;
	while ( cin >> x >> y >> s, x || y || s ) {
		int ans = 0;
		for (int i = 1; i <= s-1; ++i) {
			for (int j = 1; j <= s-1; ++j) {
				if ( f(i, x) + f(j, x) == s ) {
					ans = max(ans, f(i, y) + f(j, y));
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <ctype.h>


int main(){
   int count[26]={0};
   char ch;
   int i, num;


   while(scanf("%c", &ch)!=EOF){
       if(islower(ch)){
           num=ch-'a';
       }else if(isupper(ch)){
           num=ch-'A';
       }else{
           continue;
       }
       count[num]++;
   }
   for(i=0;i<26;i++){
       printf("%c : %d\n", 'a'+i, count[i]);
   }


   return 0;
}


Measured memory_bytes: 2128
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int main(void){
    ll n, p, q; cin >> n >> p >> q;
    vll C(n); for(auto & e : C) cin >> e;

    ll offset = 0;
    rep(i, n) C[i] += p * i, offset += p * i;
    sort(_all(C), greater<ll>());

    vll sum(n + 1);
    rep(i, n) sum[i + 1] = sum[i] + C[i];

    ll res = -inf;
    rep(i, n + 1){
        ll hnum = n - i;
        ll cur = sum[i] + p * (hnum * (hnum - 1) + q * hnum) - offset;
        chmax(res, cur);
    }

    cout << res << endl;

    return 0;
}

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

int main() {
	char words[27];
	cin >> words;
	for (int i = 0; i < strlen(words); i++)
	{
		for (int j = 0; j < strlen(words); j++)
		{
			if (words[i] == words[j] && i != j)
			{
				cout << "no" << endl;
				return 0;
			}
		}
	}
	cout << "yes" << endl;
	return 0;

}


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


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N; cin >> N;
	rep(i, 110) {
		rep(j, 110) {
			if (i == 0 && j == 0) continue;
			if (i * 4 + j * 7 == N) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
def dp(step, money)
  (0..step).each do |yukichi|
    (0..step - yukichi).each do |higuchi|
      # (0..step - yukichi).each do |hideyo| next unless (yukichi + higuchi + hideyo) == step
      hideyo = step - yukichi - higuchi
      return [yukichi, higuchi, hideyo] if
        yukichi * 10 + higuchi * 5 + hideyo * 1 == money
      # end
    end
  end
  return [-1, -1, -1]
end

n, y = gets.split
res = dp(n.to_i, y.to_i / 1000)
puts res.join(" ")


Measured memory_bytes: 3836
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int T = scanner.nextInt();
			if (T == 0) {
				break;
			}
			int P = scanner.nextInt();
			int R = scanner.nextInt();

			Team[] teams = new Team[T];
			for (int i = 0; i < teams.length; i++) {
				teams[i] = new Team(i);
			}

			int[][] wrong = new int[T][P];
			for (int i = 0; i < R; i++) {
				int tID = scanner.nextInt();
				int pID = scanner.nextInt();
				int time = scanner.nextInt();
				String message = scanner.next();
				if (message.equals("WRONG")) {
					wrong[tID - 1][pID - 1]++;
				} else {
					teams[tID - 1].correct++;
					teams[tID - 1].penalty += time + wrong[tID - 1][pID - 1]
							* 1200;
				}
			}
			Arrays.sort(teams);
			for (int i = 0; i < teams.length; i++) {
				System.out.println((teams[i].tID + 1) + " " + teams[i].correct
						+ " " + teams[i].penalty);
			}

		}

	}

	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while (c != '-' && (c < '0' || c > '9'))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			while (c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return -1;
	}

}

class Team implements Comparable<Team> {
	int tID, correct = 0, penalty = 0;

	Team(int id) {
		this.tID = id;
	}

	@Override
	public int compareTo(Team arg0) {
		if (arg0.correct == this.correct) {
			if (arg0.penalty == this.penalty) {
				return this.tID - arg0.tID;
			}
			return this.penalty - arg0.penalty;
		}
		return arg0.correct - this.correct;
	}
}

Measured memory_bytes: 62036
import sys

input = sys.stdin.readline

N, M = map(int, input().split())

if M == 0:
    ans = 0
    if N == 2:
        ans = 10
    if N == 3:
        ans = 100
    print(ans)
    exit()

sc = []
dic = dict()
out = ""
for _ in range(M):
    sc.append(list(map(int, input().split())))

sc.sort(key=lambda x:x[0])

if sc[-1][0] > N:
    print(-1)
    exit()

for i in range(M):
    if sc[i][0] not in dic.keys():
        dic[sc[i][0]] = sc[i][1]
    elif dic[sc[i][0]] != sc[i][1]:
        print(-1)
        exit()

if N > 1 and sc[0][0] == 1 and sc[0][1] == 0:
    print(-1)
    exit()

ans = ['a'] * N

for i in range(M):
    ans[sc[i][0]-1] = sc[i][1] 

if ans[0] == 'a':
    ans[0] = 1
for i in range(len(ans)):
    if ans[i] == 'a':
        ans[i] = 0
    out += str(ans[i])

print(int(out))

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

typedef long long ll;
const int INF = 1 << 30;

string s;

int main(){
    cin >> s;

    int res = INF;
    for (int i = 0; i < s.size()-2; i++){
        string a = s.substr(i, 3);
        res = min(res, abs(stoi(a)- 753));
    }

    cout << res << endl;
}

Measured memory_bytes: 256
x1,y1,x2,y2 = map(int, input().split())
x3 = x2-(y2-y1)
y3 = y2+(x2-x1)
x4 = x1-(y2-y1)
y4 = y1+(x2-x1)
print(x3,y3,x4,y4)

Measured memory_bytes: 9008
#include <iostream>
using namespace std;
typedef long long ll;

ll x[51];
ll memo[51][2501][51];

ll dfs(int n, int y, int i){
    if(n == 0){
        if(y == 0 && i == 0){
            return 1;
        }
        return 0;
    }
    if(y < 0 || i < 0){
        return 0;
    }
    if(memo[n][y][i] != -1){
        return memo[n][y][i];
    }
    return memo[n][y][i] = dfs(n - 1, y - x[n - 1], i - 1) + dfs(n - 1, y, i);
}

int main()
{
    ll n, a;
    cin >> n >> a;
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n * 50; j++){
            for(int k = 0; k <= n; k++){
                memo[i][j][k] = -1;
            }
        }
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ans += dfs(n, a * i, i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 51072
import bisect
N, M, K = map(int, input().split())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
sAs = [0]
s = 0
for A in As:
  s += A
  sAs.append(s)
sBs = [0]
s = 0
for B in Bs:
  s += B
  sBs.append(s)
rs = []
for n in range(0, N+1):
  kA = sAs[n]
  if kA > K:
    continue
  kB = K-kA
  m = bisect.bisect(sBs, kB)-1
  #print(n, kA, m, kB)
  r = n+m
  rs.append(r)
r = max(rs)
print(r)



Measured memory_bytes: 48696