akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define For1(i, n) for(int i = 1; i <= (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;
#include <set>

int main(void){
    Cin(int, n);
    Cins(int, n, a);
    Cins(int, n, b);

    ll lack = 0, ans = 0;
    multiset<int> s;
    For(i, n){
        if(a[i] < b[i]) lack += b[i]-a[i], ans ++;
        if(a[i] > b[i]) s.insert(a[i]-b[i]);
    }
    while(lack > 0){
        if(s.empty()){
            Cout(-1); return 0;
        }
        auto itr = s.end();
        lack -= *(--itr);
        s.erase(itr);
        ans ++;
    }
    Cout(ans);
}





Measured memory_bytes: 3584
inf = 10**10


def resolve():
    n, m, gas = map(int, input().split())

    costs = [[inf for i in range(n)] for i in range(n)]

    for i in range(len(costs)):
        costs[i][i] = 0
    for i in range(m):
        v1, v2, cost = map(int, input().split())
        costs[v1 - 1][v2 - 1] = cost
        costs[v2 - 1][v1 - 1] = cost

    for k in range(n):
        for i in range(n):
            for j in range(n):
                costs[i][j] = min(costs[i][j], costs[i][k]+costs[k][j])

    cost_with_gas = [[inf for i in range(n)] for i in range(n)]

    for i in range(len(cost_with_gas)):
        cost_with_gas[i][i] = 0
    for i in range(len(cost_with_gas)):
        for j in range(i+1, len(cost_with_gas)):
            if gas - costs[i][j] >= 0:
                cost_with_gas[i][j] = 1
                cost_with_gas[j][i] = 1

    for k in range(n):
        for i in range(n):
            for j in range(n):
                cost_with_gas[i][j] = min(cost_with_gas[i][j], cost_with_gas[i][k]+cost_with_gas[k][j])

    q = int(input())

    for i in range(q):
        from_city, destination = map(int, input().split())
        ans = cost_with_gas[from_city-1][destination-1] -1 if cost_with_gas[from_city-1][destination-1] != inf else -1
        print(ans)

resolve()

Measured memory_bytes: 60504
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int p;
    vector <int>a;
    cin>>p;
    while(p){
        p--;
        int n,i;
        cin>>n;
        if(n==0){
            cin>>i;
            a.push_back(i);
        }
        if(n==1){
            cin>>i;
            cout<<a[i]<<endl;
        }
        if(n==2){
            a.pop_back();
        }
    }
}


Measured memory_bytes: 3920
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};const sum=(arr)=>{return arr.reduce((a,b)=>a+b);};const isPrime=(n:number):boolean=>{if(n<2)return false;const suq=Math.sqrt(n);for(let i=2;i<=suq;i++){if(n%i==0){return false;}}return true;};
const main=()=>{
  let [n,m]=tnn(2),p=[],k=[],save=new Array(n+1),wa=0,ac=0
  save.fill(0)
  for(let i=0;i<m;i++){
    p.push(tn())
    k.push(ts())
  }
  for(let i=0;i<m;i++){
    if(save[p[i]]==-1)continue
    if(k[i]=='WA'){
      save[p[i]]++
    }
    else if(k[i]=='AC'){
      ac++
      wa+=save[p[i]]
      save[p[i]]=-1
    }
  }
  to(ac,wa)
}
main()


Measured memory_bytes: 34380
using System;

namespace ALDS1_1_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int element = int.Parse(Console.ReadLine());
            int[] input = new int[element];
            int count = 0;

            for (int i=0; i<element; i++)
            {
                input[i] = int.Parse(Console.ReadLine());
                bool check_flg = judge(input[i]);

                if (check_flg == false) count++;
            }

            Console.WriteLine(count);
        }

        static bool judge(int a)
        {
            int div;
            bool check = false;
            
            for (int i=2; i<=Math.Sqrt(a); i++)
            {
                div = a % i;

                if (div == 0)
                {
                    check = true;
                    break;
                }
            }

            return check;
        }
    }
}

Measured memory_bytes: 9076
#include "bits/stdc++.h"
using namespace std;
#define int int64_t
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define mod 1000*1000*1000+7
#define mem(dp,a) memset(dp,a,sizeof dp)
int br[1<<18][2];
int location(int e,int pos)
{
    int st=0;
    int en=e;
  //  int ans=0;
    while(st<=en)
    {
        int mid=(st+en)/2;
        if(br[mid][1]<pos)
        {
            st=mid+1;
        }
        else
        {
            en=mid-1;
        }
    }
    if(br[st][1]>=pos)
        st--;
    else
        st++;
    return st;
}
int32_t main()
{
    int n,d,a;cin>>n>>d>>a;
    vector<pair<int,int> > points;
    for(int i=0;i<n;i++)
    {
        int x,y;cin>>x>>y;
        points.pb(mp(x,y));
    }
    int ans=0;
    sort(points.begin(),points.end());
    double k=ceil((1.0000*points[0].s)/a);
    ans+=k;
    br[1][0]=k*a;
    br[1][1]=points[0].f;
    br[0][0]=0;
    br[0][1]=-1e15;
    for(int i=1;i<n;i++)
    {
        int im=br[i][0];
        br[i+1][1]=points[i].f;
        im-=br[location(i+1,points[i].f-2*d)][0];
        int req=points[i].s-im;
        int vs=max((int)ceil((1.000*req)/a),(int)0);
        ans+=vs;
        br[i+1][0]=br[i][0]+max(vs*a,(int)0);
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 8428
S_, T = readlines.map(&:strip)

sl, tl = S_.length, T.length
a = (sl - tl).downto(0).find{|i| T =~ /#{S_[i, tl].gsub('?', '[a-z]')}/}
puts a ? (s = S_; s[a, tl] = T; s.gsub('?', 'a')) : 'UNRESTORABLE'


Measured memory_bytes: 1788
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <iostream>
using namespace std;

int deg[100010];
vector<int> G[100010];
int ans[110][110], used[100010];
// set<int> adj[110];

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

int main() {
  int N; cin >> N;
  for(int i=0; i<2*N*N - 2*N; i++) {
    int a, b; cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
    deg[a]++; deg[b]++;

    if(a > b) swap(a, b);
    // adj[a].insert(b);
    // adj[b].insert(a);
  }

  
  for(int i=0; i<N*N; i++) {
    // search deg[i] == 2
    if(deg[i] == 2) {
      // start
      for(int r=0; r<N; r++) {
        for(int c=0; c<N; c++) {
          if(r == 0 and c == 0) {
            ans[r][c] = i;
            used[i] = true;
          }
          else {
            map<int, int> cnt;
            int neighbor = 0;
            for(int k=0; k<2; k++) {
              int x = r + dx[k], y = c + dy[k];
              if(x < 0 or y < 0 or x >= N or y >= N) continue;
              int id = ans[x][y];
              neighbor++;
              for(auto to : G[id]) {
                cnt[to]++;
              }
            }

            for(auto x : cnt) {
              if(x.second != neighbor) continue;
              int target = -1;
              if     (r == 0 and c == N-1) target = 2;
              else if(r == 0 and c == 0  ) target = 2;
              else if(r == N-1 and c == 0  ) target = 2;
              else if(r == N-1 and c == N-1) target = 2;
              else if(r == 0 or r == N-1) target = 3;
              else if(c == 0 or c == N-1) target = 3;
              else target = 4;

              // fprintf(stderr, "(x, y) = (%d, %d), target = %d, deg = %d\n", r, c, target, deg[x.first]);
              if(deg[x.first] != target) continue;
              if(used[x.first]) continue;
              ans[r][c] = x.first;
              used[x.first] = true;
              break;
            }
          }
        }
      }
      break;
    }
  }

  for(int i=0; i<N; i++) {
    for(int j=0; j<N; j++) {
      cout << ans[i][j] + 1 << " \n"[j+1==N];
    }
  }
  return 0;
}




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

// Top Down DP
int frog1TopDown(int cur, int heights[], int N, int dp[]) {
    // Base Case
    if(cur >= N) return 0;
    // Recursive Case
    if(dp[cur] != 0) return dp[cur];
    int op1 = abs(heights[cur] - heights[cur + 1]) + frog1TopDown(cur + 1, heights, N, dp);
    int op2 = abs(heights[cur] - heights[cur + 2]) + frog1TopDown(cur + 2, heights, N, dp);
    int ans = min(op1, op2);
    return (dp[cur] = ans);
}

// Bottom Up DP
int frog1BottomUp(int heights[], int N) {
    int dp[100005] = {0};
    dp[0] = 0; // Init Base Case
    for(int i = 1; i <= N; i++) {
        int opt1 = (abs(heights[i] - heights[i - 1]) + dp[i - 1]);
        int opt2 = (i == 1) ? INT_MAX : (abs(heights[i] - heights[i - 2]) + dp[i - 2]);
        dp[i] = min(opt1, opt2);
    }
    return dp[N];
}

int main() {
    int N;
    cin >> N;
    int heights[100005];
    for(int i = 0; i < N; i++) cin >> heights[i];
    // Top Down Approach
    // int dp[100005] = {0};
    // cout << frog1TopDown(0, heights, N - 1, dp) << endl;
    // Bottom Up Approach
    cout << frog1BottomUp(heights, N - 1) << endl;
    return 0;
}

Measured memory_bytes: 4364
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll fact[200003];
ll ifact[200003];
int main() {
  fact[0] = 1;
  ifact[0] = 1;
  for (int i = 1; i <= 200003; i++) {
    fact[i] = fact[i-1] * i;
    fact[i] %= Mod;
    ifact[i] = modinv(fact[i],Mod);
  }
  int N;
  cin >> N;
  ll x[N];
  for (int i = 0; i < N; i++) cin >> x[i];
  ll ans = 0;
  ll S[N];
  S[0] = 1;
  for (ll i = 0; i < N-1; i++) {
    ll res = S[i];
    ll d = x[i+1] - x[i];
    res *= fact[N-1];
    res %= Mod;
    res *= ifact[i+1];
    res %= Mod;
    res *= d;
    res %= Mod;
    ans += res;
    ans %= Mod;
    S[i+1] = S[i] * (i + 2LL);
    S[i+1] %= Mod;
    S[i+1] += fact[i+1];
    S[i+1] %= Mod;
  } 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8260
/*
    A - Christmas Eve Eve Eve
    https://atcoder.jp/contests/abc115/tasks/abc115_a
*/
#include <bits/stdc++.h>
using namespace std;

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

    string christmas = "Christmas";
    int d;
    cin >> d;
    for (int i = 0; i < 25 - d; i++) {
        christmas += " Eve";
    }
    cout << christmas << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var S = ReadText();
            var T = ReadText();
            var count = 0L;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] != T[i])
                {
                    count++;
                }
            }
            return count;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 27532
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, m, count=0;
	cin >> n >> m;
	while(n--)
	{
		double a, b;
		cin >> a >> b;
		double ans = sqrt((a*a)+(b*b));
		if(ans<=m)
			count++;
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3848
#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
#endif
//BEGIN CUT HERE
template<typename T>
struct SegmentTree{
  using P = pair<int, T>;
  int n;
  vector<P> v;
  vector< vector<T> > dat;
  SegmentTree(){};
  SegmentTree(int n,vector<P> v):v(v){init(n);build();};

  void init(int n_){
    n=1;
    while(n<n_) n<<=1;
    dat.assign(n<<1,vector<int>());
  }

  void build(){
    for(auto p:v)
      dat[p.first+n].emplace_back(p.second);

    for(int i=0;i<n;i++)
      sort(dat[i+n].begin(),dat[i+n].end());

    for(int i=n-1;i;i--){
      merge(dat[(i<<1)|0].begin(),dat[(i<<1)|0].end(),
            dat[(i<<1)|1].begin(),dat[(i<<1)|1].end(),
            back_inserter(dat[i]));
    }
  }

  // [a,b) * [c,d)
  inline int query(int a,int b,T c,T d){
    int res=0;
    auto calc=[a,b,c,d](vector<T> &x){
                auto latte=lower_bound(x.begin(),x.end(),d);
                auto malta=lower_bound(x.begin(),x.end(),c);
                return int(latte-malta);
              };
    for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
      if(l&1) res+=calc(dat[l++]);
      if(r&1) res+=calc(dat[--r]);
    }
    return res;
  }
};
//END CUT HERE
#ifndef call_from_test
signed ABC106_D(){
  int n,m,q;
  scanf("%d %d %d",&n,&m,&q);
  vector<int> x(m),y(m);
  for(int i=0;i<m;i++) scanf("%d %d",&x[i],&y[i]);

  using P = pair<int, int>;
  vector<P> vp;
  for(int i=0;i<m;i++) vp.emplace_back(x[i],y[i]);

  SegmentTree<int> seg(n+1,vp);

  for(int i=0;i<q;i++){
    int a,b;
    scanf("%d %d",&a,&b);
    printf("%d\n",seg.query(a,b+1,a,b+1));
  }
  return 0;
}

signed main(){
  ABC106_D();
  return 0;
}
#endif


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

using namespace std;

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

void solve() {
    int n;
    cin >> n;
    vector<ll> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i] += a[i - 1];
    }

    vector<vector<ll>> dp(n, vector<ll>(n, 1e18));
    for (int i = 0; i < n; i++) dp[i][i] = 0;

    for (int len = 1; len < n; len++) {
        for (int i = 0; i + len < n; i++) {
            int j = i + len;
            for (int k = i; k < j; k++) {
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k + 1][j]);
            }
            dp[i][j] += a[j + 1] - a[i];
        }
    }

    cout << dp[0][n - 1];
}

int main() {
    cout << fixed << setprecision(20);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main(){
  	long n,kabu = 0,money = 1000;
      
    cin >> n;
  	
  	vector<int>a(n),b(n-1);
  
  	for(int i = 0;i < n;i++){
      cin >> a.at(i);
     	if(i > 0)
          b.at(i - 1) = (a.at(i - 1) <= a.at(i)) ? 1 : 0;
    }
  	
  	for(int i = 0;i < n;i++){
      if(i < n-1){
        if(b.at(i) > 0 && a.at(i) <= money){
          kabu += money / a.at(i);
          money -= kabu * a.at(i); 
        }else if(b.at(i) == 0){
          money += kabu * a.at(i);
          kabu = 0;
        }
      }else{
        money += kabu * a.at(i);
        kabu = 0;
      }
    }
  
  	cout << money << endl;
  
}

Measured memory_bytes: 3588
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;
inline int toInt(string s){int v;istringstream i(s);i>>v;return v;}
template<class T> inline string toString(T x){ostringstream o;o<<x;return o.str();}
template<class T> void pv(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}
const int INF = 1000000000;
const double EPS = 1e-10;

string decode(string s, int alpha, int beta) {
	for(string::iterator it = s.begin(); it != s.end(); ++it) {
		if(isalpha(*it)) *it = (alpha * (*it - 'a') + beta) % 26 + 'a';
	}
	return s;
}

int main() {
	int N;
	cin >> N;
	cin.ignore();
	while(N--) {
		string line;
		getline(cin, line);
		string ans = "";
		for(int i = 0; i < 26; i++) {
			for(int j = 0; j < 26; j++) {
				string s = decode(line, i, j);
				if(s.find("that") != string::npos || s.find("this") != string::npos) {
					ans = s;
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<queue>

using namespace std;

int persimmon_cnt(vector< vector<int> > vv,int s, int t,int y,int x){
	int cnt = 0;
	for (int i = 0; i < t; i++){
		for (int j = 0; j < s; j++){
			if (vv[y+i][x+j] == 1){
				cnt++;
			}
		}
	}
	return cnt;
}
int search_max(vector< vector<int> > vv,int s, int t){
	int max = 0;
	for (int i = 0; i <= vv.size() - t ; i++){ 
		for (int j = 0; j <= vv.front().size() - s; j++){ 
			int persimmon = persimmon_cnt(vv,s,t,i,j);
			if (max < persimmon) max = persimmon;		
		}
	}
	return max;
}
void print(vector<vector<int> > vv){
	for (int i = 0; i < vv.size(); i++){
		for (int j = 0; j < vv.front().size(); j++){	
			cout << vv[i][j];
		}
	}
}
int main(){
	while(1){
		int n; cin >> n;
		if (n == 0) break;
		int w,h; cin >> w >> h;
		vector< vector<int> > field(h,vector<int>(w,0));
		for (int i = 0 ; i < n; i ++){	
			int x,y;
			cin >> x >> y;
			field[y-1][x-1] = 1;
		}
		int s,t; cin >> s >> t;
		cout << search_max(field,s,t) << endl;;
	}
return 0;
}

Measured memory_bytes: 3140
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
#include<iomanip>
#define mod 1000000007
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mad(a,b) a=(a+b)%mod
#define mul(a,b) a=a*b%mod

#define N 510

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a%c==0&&b%d==0){
	cout<<"No"<<endl;
    }
    else{
	cout<<"Yes"<<endl;
	ll t=(a/c)*(b/d)+10;
	ll p=t*(c*d-1)-1;
	if(t>1e9||p>1e9)cout<<1/0<<endl;
	for(int i=0;i<a;i++){
	    for(int j=0;j<b;j++){
		if(j)cout<<" ";
		if(i%c==0&&j%d==0)cout<<p;
		else cout<<-t;
	    }
	    cout<<endl;
	}
    }
}



Measured memory_bytes: 2048
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = scanner.nextInt();
        }
        Arrays.sort(s);
        int q = scanner.nextInt();
        int[] t = new int[n];
        for(int i = 0; i < q; i++){
            t[i] = scanner.nextInt();
        }

        int ans = 0;
        for(int i = 0; i < q; i++){
            int target = t[i];
            int head = 0;
            int tail = n-1;
            while(head <= tail){
                int middle = (head + tail)/2;
                //System.out.println(s[middle]);
                if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;}
                
            }
        }
        System.out.println(ans);
    }
}


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

#define int long long
const int MOD = 1e9+7;

int pow26(int n) {
  if ( n == 0 ) return 1;
  int ret = 1;
  for ( int i = 0; i < n; i++ ) {
    ret *= 26;
    ret %= MOD;
  }

  return ret;
}

signed main() {
  string Z, O;
  int N;
  cin >> Z >> O >> N;
  int MAX = 110000;
  int NOW = min(MAX, N);  
  string add = string(NOW, '?');  
  string S = add + Z + add + O;
  for ( int i = 0; i < (int)S.size(); i++ ) {
    if ( S[i] == '?' ) S[i] = S[(int)S.size()-i-1];    
  }

  int cnt = 0;  
  for ( int i = 0; i < (int)S.size()/2; i++ ) {
    if ( S[i] != S[(int)S.size()-i-1] ) {
      cout << 0 << endl;
      return 0;
    }
    if ( S[i] == '?' ) cnt++;
  }

  for ( int i = 0; i < NOW; i++ ) {
    if ( S[i] != S[NOW+(int)Z.size()+i] && (S[i] != '?' && S[NOW+(int)Z.size()+i] != '?')) {
      cout << 0 << endl;
      return 0;
    }
  }

  if ( cnt == 0 ) {
    cout << 1 << endl;
    return 0;
  }
  
  vector<int> ss;
  {
    int now = 0;
    for ( int i = 0; i < (int)S.size(); i++ ) {
      if ( S[i] == '?' ) now++;
      else if ( now ) {
	ss.emplace_back(now);
	now = 0;
      }
    }
    if ( now ) ss.emplace_back(now);
  }

  int ans = 1;
  
  // if ( ss.size() == 2 ) {
  int num = ss[0];
  if ( MAX < N ) num += N-MAX;  
  ans = pow26((num+1)/2);    
    /*} else {
    ans = pow26((ss[0]+1)/2)*pow26((ss[1]+1)/2);
    ans %= MOD;
    }*/

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



Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin >> a >> b;
  map<int,int> score;
  for(int i = 0;i<a;i++){
    int c,d;
    cin >> c >> d;
    score[c] = d;
  }
  int MIN = 10000;
  for (auto p : score) {
    auto key = p.first;
    auto value = p.second;
    if(value <= b && key < MIN){
      MIN = min(MIN,key);
    }
  }
  if(MIN == 10000)
     cout << "TLE" << endl;
  else{
    cout << MIN << endl;
  }
    
}

Measured memory_bytes: 764
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue> 
using namespace std;
#define INF 0x3f3f3f3f
char a[15],b[15],c[15];
int main()
{
	while(~scanf("%s%s%s",a,b,c))
	{
		int la=strlen(a);
		int lb=strlen(b);
		int lc=strlen(c);
		if(a[la-1]==b[0]&&b[lb-1]==c[0]) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>

typedef  long long ll;
#define mop 1000000007
#define mop2 998244353

using namespace std;

void print(vector <ll> v) {
	for (auto itr = v.begin(); itr != v.end(); itr++) {
		cout << *itr;
		if (itr + 1 != v.end()) {
			cout << " ";
		}
	}
	cout << endl;
}

ll bubbleSort(vector <ll> v) {
	ll ans = 0;
	ll n = v.size();
	bool flag = true;
	while (flag) {
		flag = false;
		ll i = 1;
		for (ll j = n - 1; j >= i; j--) {
			if (v[j] < v[j - 1]) {
				swap(v[j], v[j - 1]);
				ans++;
				flag = true;
			}
		}
		i++;
	}
	print(v);
	return ans;
}

int main() {
	ll n;
	cin >> n;
	vector <ll> v;
	v.resize(n);
	for (ll i = 0; i < n; i++) {
		ll tmp;
		cin >> tmp;
		v[i] = tmp;
	}
	
	cout << bubbleSort(v) << endl;
}


Measured memory_bytes: 3160
#include <iostream>

using namespace std; 
static const int MAX = 200000;

int main()
{
	int R[MAX], n;

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

	int maxv = -2000000000;
	int minv = R[0];

	for (int i = 1; i < n; i++)
	{
		maxv = (maxv > R[i] - minv) ? maxv : R[i] - minv;
		minv = (minv < R[i]) ? minv : R[i];
	}

	cout << maxv << endl; 

	return 0;
}


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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT_NUMBER(vector<ll> V)
{
    ll N = V.size();
    for(ll i=0;i<N;i++)
    {
        cout << V[i];
        if(i<N-1) cout << ' ';
    }
    cout << endl;
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

void Ans(ll A, ll V, ll B, ll W, ll T)
{
    if(abs(A-B)<=T*(V-W))
    {
        OUT0("YES");
    }
    else
    {
        OUT0("NO");
    }
}

int main()
{
    ll A,V,B,W,T;
    cin >> A >> V >> B >> W >> T;

    Ans(A,V,B,W,T);

    return 0;
}

Measured memory_bytes: 3680
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map> //要学会用map 
#include<queue>
#include<stack>
using namespace std;
/*如果a大于0且b大于0，但相加得到的却是小于等于0的说明是正溢出，这时肯定比c大（因为c肯定在long long的范围内）。
如果a小于0且b小于0，但相加得到的却是大于等于0的说明是负溢出，这是肯定比c小。*/
const int maxn = 10001;
int prime[maxn],pNum = 0;
bool p[maxn] = {0};
void Find_Prime()
{
	for(int i=2;i<maxn;i++)
	{
		if(p[i] ==false)
		{
			prime[pNum++]=i;
			for(int j=i+i;j<maxn;j+=i)
			{
				p[j] = true;
			}
		}
	}
}
int main(){
	int n;
	scanf("%d",&n);
	int count = 0;
	for(int i=0;i<n;i++)
	{
		int temp;
		scanf("%d",&temp);
		if(temp%4==0) count+=2;
		else if(temp%2==0) count+=1;
	}
	if(n%2==0)
	{
		if(count>=n) printf("Yes");
		else printf("No");
	}
	else
	{
		if(count>=n-1) printf("Yes");
		else printf("No");
	}
	return 0;	
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
    
   int a, b, c, count;
    
    count = 0;
    
    cin >> a >> b >> c;
    
    for(int x = a; x <= b; x++){
        if(c % x == 0){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}



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

vector<vector<char>> grid(55, vector<char>(55));
vector<vector<int>> dist(55, vector<int>(55, -1));
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(void) {
  int h, w;
  cin >> h >> w;
  int cnt = 0;
  rep (i, h) rep (j, w) {
    cin >> grid[i][j];
    if (grid[i][j] == '.') cnt++;
  }

  queue<pair<int, int>> Q;
  Q.push(make_pair(0, 0));

  dist[0][0] = 0;
  
  while (!Q.empty()) {
    pair<int, int> nowpos = Q.front(); Q.pop();
    int x = nowpos.first, y = nowpos.second;
    for (int i = 0; i < 4; i++) {
      int nx = x + dx[i], ny = y + dy[i];
      if (0 <= nx && nx < w && 0 <= ny && ny < h && grid[ny][nx] == '.' && dist[ny][nx] == -1) {
        dist[ny][nx] = dist[y][x] + 1;
        Q.push(make_pair(nx, ny));
      }
    }
  }
  
  cout << (dist[h - 1][w - 1] != -1 ? cnt - dist[h - 1][w - 1] - 1 : -1)<< endl;
  return 0;
}

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

using namespace std;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef pair<int, int> pii;

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
// dfsの場合はglobalにする必要があってめんどう？
// やってみようあとで
vector<vector<int>> to, cost;

void dfs(int p, vector<int> &ans) {
  rep(i, to[p].size()) {
    int v = to[p][i];
    int u = cost[p][i];
    if(ans[v] != -1) continue;
    else {
      ans[v] = (ans[p] + u) % 2;
      dfs(v, ans);
    }
  }
}

void solve() {
  int n;
  cin >> n;
  to.resize(n);
  cost.resize(n);
  rep(i,n-1) {
    int a, b, w;
    cin >> a >> b >> w;
    a--, b--;
    to[a].push_back(b);
    to[b].push_back(a);
    cost[a].push_back(w);
    cost[b].push_back(w);
  }
  vector<int> ans(n, -1);
  ans[0] = 0;
  dfs(0, ans);
  rep(i,n) cout << ans[i] << " ";
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 13312
# Initializing variables
people = int(input())
coordinates = list(map(int, input().split()))
max_ = max(coordinates)
min_ = min(coordinates)
ans = 0

# Calculating the minimum total of stamina
for i in range(min_, max_ + 1):
    currentMin = 0
    for j in range(people):
        currentMin += (coordinates[j] - i) ** 2
    if i == min_:
        ans = currentMin
    elif currentMin < ans:
        ans = currentMin
        
print(ans)

# Check out my Youtube channel! https://www.youtube.com/channel/UCMOKVyAbTZOpKikTrX5dy_A



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INF 1000000000000000000
#define MOD 1000000007
using Graph=vector<vector<int>>;

void dfs(Graph &G,int v,vector<int> &color,int c){
  color.at(v)=c;
  for(auto nv:G.at(v)){
    if(color.at(nv)==-1){
      dfs(G,nv,color,1-c);
    }
  }
}

int main(){
  int N;
  cin>>N;
  Graph G(N);
  for(int i=0;i<N-1;i++){
    int a,b;
    cin>>a>>b;
    a--;
    b--;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }

  vector<int> color(N,-1);
  dfs(G,0,color,0);

  int zero=0;
  int one=0;
  for(int i=0;i<N;i++){
    if(color.at(i)==0){
      zero++;
    }else{
      one++;
    }
  }

  int mod_one=1;
  int mod_two=2;
  int mod_zero=3;
  vector<int> p(N,-1);
  if(zero>N/3&&one>N/3){
    int i=0;
    while(mod_one<=N){
      while(color.at(i)==1){
        i++;
      }
      p.at(i)=mod_one;
      i++;
      mod_one+=3;
    }
    i=0;
    while(mod_two<=N){
      while(color.at(i)==0){
        i++;
      }
      p.at(i)=mod_two;
      i++;
      mod_two+=3;
    }
    i=0;
    while(mod_zero<=N){
      while(p.at(i)!=-1){
        i++;
      }
      p.at(i)=mod_zero;
      i++;
      mod_zero+=3;
    }
  }else if(zero<=N/3){
    int i=0;
    while(mod_one<=N){
      while(color.at(i)==0){
        i++;
      }
      p.at(i)=mod_one;
      i++;
      mod_one+=3;
    }
    while(mod_two<=N){
      while(color.at(i)==0){
        i++;
      }
      p.at(i)=mod_two;
      i++;
      mod_two+=3;
    }
    i=0;
    while(mod_zero<=N){
      while(p.at(i)!=-1){
        i++;
      }
      p.at(i)=mod_zero;
      i++;
      mod_zero+=3;
    }
  }else{
    int i=0;
    while(mod_one<=N){
      while(color.at(i)==1){
        i++;
      }
      p.at(i)=mod_one;
      i++;
      mod_one+=3;
    }
    while(mod_two<=N){
      while(color.at(i)==1){
        i++;
      }
      p.at(i)=mod_two;
      i++;
      mod_two+=3;
    }
    i=0;
    while(mod_zero<=N){
      while(p.at(i)!=-1){
        i++;
      }
      p.at(i)=mod_zero;
      i++;
      mod_zero+=3;
    }
  }

  for(int i=0;i<N;i++){
    cout<<p.at(i)<<" ";
  }
  cout<<endl;
}


Measured memory_bytes: 17920
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(a,b);
  FOR(i,a,b+1){
    string str = to_string(i);
    if(str[0] == str[4] && str[1] == str[3]) c++;
  }
  OUT(c);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a < b){
    printf("a < b\n");
  }else if(a > b){
    printf("a > b\n");
  }else if(a == b){
    printf("a == b\n");
  }
 return 0;
}

Measured memory_bytes: 580
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int kaisu = 0;
		for (; a <= b; a++) {
			if (c % a == 0)
				kaisu += 1;
		}
		System.out.println(kaisu);
		sc.close();
	}
}



Measured memory_bytes: 26304
#include <iostream>
using namespace std;
int main(){
  int n;
  while(cin >> n, n){
    string w[n];
    for(int i = 0; i < n; ++i){
      cin >> w[i];
    }
    int phrase[] = {5,7,5,7,7};
    bool f = false;
    for(int i = 0; i < n; ++i){
      if(f) break;
      int s = 0, t = 5;
      for(int j = i; j < n; ++j){
	t -= w[j].size();
	if(!t){
	  ++s;
	  if(s == 5){
	    cout << i+1 << endl;
	    f = true;
	    break;
	  }
	  t = phrase[s];
	}else if(t < 0) break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3144
n = gets.to_i

a = Array.new(n) do |i|
  s, point = gets.to_s.split
  e = s, point.to_i, i+1
end

a.sort_by{|_,point,_|-point}.sort_by{|s,_,_|s}.each{|_,_,i| puts i }


Measured memory_bytes: 1788
#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>;



const int MAX = 2001;
const int MOD = 1000000007;

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

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

// 二項係数計算
ll COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {

  int s;
  cin >> s;
  COMinit();

  ll ans = 0;
  int r0 = s%3;
  int n0 = s/3;
  for(int n=1; n<=n0; n++){
    int r = s - 3*n;
    ans += COM(r+n-1,r);
    ans %= MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3672
maxNum = int(input())
favNum = 1
max2 = 0

for i in range(1,maxNum+1):
    currNum = i
    j = 0
    while(1):
        if currNum % 2 == 1:
            break
        else:
            currNum = currNum/2
            j += 1
    if max2 < j:
        max2 = j 
        favNum = i

print(favNum)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;




int main(){

    int n;

    while(cin >> n){

        if(n == 0){
            return 0;
        }
        int ans = 0;

        for(int i = 5;i <=n;i *= 5){
            ans += n/i;
        }
        
        cout << ans << endl;
    }



    return 0;

}


Measured memory_bytes: 3064
s = list(input())
t = list(input())
s_to_t = {chr(c):set() for c in range(ord('a'),ord('z')+1)}
t_to_s = {chr(c):set() for c in range(ord('a'),ord('z')+1)}

for i in range(len(s)):
    s_to_t[s[i]].add(t[i])
    t_to_s[t[i]].add(s[i])

for c in range(ord('a'), ord('z')+1):
    if len(s_to_t[chr(c)]) > 1 or len(t_to_s[chr(c)]) > 1:
        print('No')
        exit()
print('Yes')

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

using namespace std;

typedef long long ll;

const ll M = 1e9 + 7;
const int N = 500;

ll dp[N][N];
ll m[N][N];

ll binpow(ll a, ll p) {
    ll s = 1;
    while (p) {
        if (p & 1) {
            s = s * a % M;
        }
        a = a * a % M;
        p >>= 1;
    }
    return s;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, c;
    cin >> n >> c;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= c; ++j) {
            ll t = 0;
            for (ll k = a[i]; k <= b[i]; ++k) {
                t = (t + binpow(k, j)) % M;
            }
            m[i][j] = t;
        }
    }
    for (int i = 0; i <= c; ++i) {
        dp[0][i] = m[0][i];
    }
    for (int i = 1; i < n; ++i) {
        for (int j = 0; j <= c; ++j) {
            for (int k = 0; k <= c - j; ++k) {
                dp[i][j + k] = (dp[i][j + k] + dp[i - 1][j] * m[i][k]) % M;
            }
        }
    }
    cout << dp[n - 1][c];
    return 0;
}

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


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順

signed main(){
  int x,a;
  cin >> x >> a;
  if(x < a) cout << 0 << endl;
  else cout << 10 << endl;
   return 0;
}


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

int main(void){
  while(true){
    int n;
    cin >> n;
    if(n == 0)
      break;

    vector<int> p(n);
    int nmax = -1, nmin = 1001;
    int imax, imin;
    for(int i=0; i<n; i++){
      cin >> p[i];
      if(p[i] > nmax){
	nmax = p[i];
	imax = i;
      }
      if(p[i] < nmin){
	nmin = p[i];
	imin = i;
      }
    }

    int ave = 0;
    for(int i=0; i<n; i++){
      if(i != imax && i != imin)
	ave += p[i];
    }
    ave /= n-2;

    cout << ave << endl;
  }
  
  return 0;
}

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

using namespace std;

int main()
{
    bool first = true;
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        int cnt[4];
        for (int i = 0; i < 4; i++) {
            cin >> cnt[i];
        }
        int yen[4] = {10, 50, 100, 500};
        int ans[4] = {0, 0, 0, 0};
        int maxi = numeric_limits<int>::min();
        for (int i = 0; i <= cnt[3]; i++) {
            for (int j = 0; j <= cnt[2]; j++) {
                for (int k = 0; k <= cnt[1]; k++) {
                    for (int l = 0; l <= cnt[0]; l++) {
                        int ret = (i * 500 + j * 100 + k * 50 + l * 10) - n;
                        if (ret < 0) {
                            continue;
                        }
                        int sum = 0;
                        for (int i = 3; i >= 0; i--) {
                            sum += ret / yen[i];
                            ret = ret % yen[i];
                        }
                        const int d = i + j + k + l - sum;
                        if (maxi < d) {
                            ans[3] = i;
                            ans[2] = j;
                            ans[1] = k;
                            ans[0] = l;
                            maxi = d;
                        }
                    }
                }
            }
        }
        if (not first) {
            cout << endl;
        } else {
            first = false;
        }
        for (int i = 0; i < 4; i++) {
            if (ans[i] > 0) {
                cout << yen[i] << " " << ans[i] << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 2940
h, w =map(int,input().split())
S=["."+input()+"." for i in range(h)]
S=["."*(w+2)]+S+["."*(w+2)]
r = 'Yes'
for i in range(h):
    for j in range(w):
        if S[i][j]=="#":
            if S[i-1][j]=="." and S[i+1][j]=="." and S[i][j-1]=="." and S[i][j+1]==".":
                r = 'No'
                break
print(r)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define X first
#define Y second
#define sz(v) (int)v.size()
using ord = tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update>;

void solve();

main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
#ifdef ONPC
	freopen("in.txt", "r", stdin);
#endif
	int t = 1;
	//cin >> t;
	while (t--) solve();
	return 0;
}



void solve() {
	ll n, a, b;
	cin >> n >> a >> b;
	if (a > b) swap(a, b);
	if (a % 2 == b % 2) {
		ll d = abs(a - b);
		cout << d / 2;
	} else {
		ll ans = numeric_limits<ll>::max();
		ll g2 = 0;
		ll aa = a, bb = b;
		g2 = min(n - a, n - b);
		bb += g2;
		aa += g2;
		++g2;
		++aa;
		g2 += (bb - aa) / 2;
		ans = min(ans, g2);
		g2 = a - 1;
		aa = a, bb = b;
		aa -= g2;
		bb -= g2;
		++g2;
		--bb;
		g2 += (bb - aa) / 2;
		ans = min(ans, g2);
		cout << ans;
	}
}

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

using namespace std;

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

template<typename T>
class BinaryIndexedTree2D {
    int H;
    int W;
    vector<vector<T> > data2d;
public:
    BinaryIndexedTree2D(int H, int W) : H(H), W(W) {
        data2d.resize(H + 1, vector<T>(W + 1, 0));
    }

    T sum(int h, int w) {
        T res = 0;
        for (int i = h; i > 0; i -= i & -i) {
            for (int j = w; j > 0; j -= j & -j) {
                res += data2d[i][j];
            }
        }
        return res;
    }

    /**
     * 左上の座標(h1, w1), 右下の座標(h2, w2) の累積和
     */
    T sum(int h1, int w1, int h2, int w2) {
        return sum(h2, w2) - sum(h1 - 1, w2) - sum(h2, w1 - 1) + sum(h1 - 1, w1 - 1);
    }

    void add(int h, int w, ll x) {
        for (int i = h; i <= H; i += i & -i) {
            for (int j = w; j <= W; j += j & -j) {
                data2d[i][j] += x;
            }
        }
    }
};

int main() {
    int H, W, T, Q;
    cin >> H >> W >> T >> Q;
    BinaryIndexedTree2D<ll> completed(H, W), notCompleted(H, W);
    queue<pair<ll, P> > queue;
    for (int q = 0; q < Q; ++q) {
        int t, c, h1, w1, h2, w2;
        cin >> t >> c >> h1 >> w1;
        while (!queue.empty()) {
            pair<ll, P> p = queue.front();
            if (p.first > t) break;
            queue.pop();
            int h = p.second.first;
            int w = p.second.second;
            completed.add(h, w, 1);
            notCompleted.add(h, w, -1);
        }

        if (c == 0) {
            notCompleted.add(h1, w1, 1);
            queue.push({t + T, {h1, w1}});
        } else if (c == 1) {
            if (completed.sum(h1, w1, h1, w1) == 1) {
                completed.add(h1, w1, -1);
            }
        } else {
            cin >> h2 >> w2;
            cout << completed.sum(h1, w1, h2, w2) << " " << notCompleted.sum(h1, w1, h2, w2) << '\n';
        }
    }
    return 0;
}



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

#define ll long long
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	long double r;
	cin >> r;
	r = 2 * (22.0/7.0) * r;

	cout << r << "\n";
}

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

    int n,h;
    cin>>h>>n;
    int arr[n];
    int count=0;
    for(int i=0;i<n;++i){
        cin>>arr[i];
        count+=arr[i];
    }   
    if(count>=h){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 640