akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
const long long MOD = 1000000007;
vector <pair <long long, int> > edges[100000];
pair<long long, long long> d[100000][2];
void dijikstra_cost(int S, int N, int ind){
    for(int i = 0; i < N; i++){
      d[i][ind] = make_pair(LLONG_MAX, 0);
    }

    priority_queue < pair <long long, int> , vector <pair <long long, int> >, greater<pair <long long, int > > > pq;
    d[S][ind] = make_pair(0, 1);
    pq.push(make_pair(0, S));
    while(!pq.empty()){
        auto cur = pq.top();
        auto cur_cost = cur.first;
        auto cur_node = cur.second;
        pq.pop();
        if(d[cur_node][ind].first < cur_cost){
            continue;
        }

        for(int i = 0; i < edges[cur_node].size(); i++){
          auto next = edges[cur_node][i];
          auto next_node = next.second;
          auto cost = next.first;
          long long next_d = d[cur_node][ind].first + cost;
          if(d[next_node][ind].first >= next_d){
            if(d[next_node][ind].first > next_d){
              d[next_node][ind] = make_pair(next_d, d[cur_node][ind].second);
              pq.push(make_pair(next_d, next_node));
            } else {
              d[next_node][ind].second = (d[next_node][ind].second + d[cur_node][ind].second) % MOD;
            }
          }
        }
      }
}


int main(){
  int N;
  int M;
  cin >> N >> M;
  int S;
  int T;
  cin >> S >> T;
  S --;
  T --;
  for(int i = 0; i < M; i++){
    int U;
    int V;
    long long D;
    cin >> U >> V >> D;
    edges[U - 1].push_back(make_pair(D, V - 1));
    edges[V - 1].push_back(make_pair(D, U - 1));
  }
  
  dijikstra_cost(S, N, 0);
  dijikstra_cost(T, N, 1);

  long long coll_num = 0;
  long long ST_dst = d[T][0].first;
  for(int i = 0; i < N; i++){
    if(d[i][0].first + d[i][1].first == ST_dst){
      if(d[i][0].first == d[i][1].first){
        long long tmp = (((d[i][0].second * d[i][0].second) % MOD) * ((d[i][1].second * d[i][1].second) % MOD)) % MOD;
        coll_num = (coll_num + tmp) % MOD;
      }
      for(int j = 0; j < edges[i].size(); j++){
        int adj = edges[i][j].second;
        long long adj_cost = edges[i][j].first;
        if(d[i][0].first + adj_cost + d[adj][1].first == ST_dst){
          if(d[adj][0].first > d[adj][1].first && d[i][1].first > d[i][0].first){
            long long tmp = (((d[i][0].second * d[i][0].second) % MOD) * ((d[adj][1].second * d[adj][1].second) % MOD)) % MOD;
            coll_num = (coll_num + tmp) % MOD;
          }
        }
      }
    }
  }

  long long all_num = (d[T][0].second * d[S][1].second) % MOD;
  cout << (all_num - coll_num + MOD) % MOD << endl;
  return 0;
}


Measured memory_bytes: 21632
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 10000000000000000
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

struct edge { int to, cap, rev; };

vector<edge> g[210];
bool used[210];

void add_edge(int from, int to, int cap) {
	g[from].push_back(edge{ to,cap,(int)g[to].size() });
	g[to].push_back(edge{ from,0,(int)g[from].size() - 1 });
}

int dfs(int v, int t, int f) {
	if (v == t)return f;
	used[v] = true;
	for (int i = 0; i < (int)g[v].size(); i++) {
		edge &e = g[v][i];
		if (!used[e.to] && e.cap > 0) {
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t) {
	int flow = 0;
	while (1) {
		memset(used, 0, sizeof(used));
		int f = dfs(s, t, INF);
		if (f == 0)return flow;
		flow += f;
	}
}

int h, w;
string s[110];
int a, b, c, d;

signed main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		cin >> s[i];
		for (int j = 0; j < w; j++) {
			if (s[i][j] == 'S') {
				add_edge(h + w, i, INF);
				add_edge(h + w, h + j, INF);
				a = i;
				b = j;
			}
			if (s[i][j] == 'T') {
				add_edge(i, h + w + 1, INF);
				add_edge(h + j, h + w + 1, INF);
				c = i;
				d = j;
			}
			if (s[i][j] == 'o') {
				add_edge(i, h + j, 1);
				add_edge(h + j, i, 1);
			}
		}
	}
	if (a == c || b == d)cout << -1 << endl;
	else cout << max_flow(h + w, h + w + 1) << endl;
}

Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



// 2*2の正方形のうち黒の個数と白の個数がどちらも偶数のものは全部黒にできる
// どちらも奇数のものはできない(白黒反転は可)
// そういう正方形を内側に含まないような最大の長方形を求める

int h, w, ng[2020][2020], x[2020], res;
string s[2020];

signed main() {
	cin >> h >> w;
	res = max(h,w);
	rep(i,h) cin >> s[i];
	rep(i,h) {
		rep(j,w-1) {
			if (i && !(s[i-1][j]^s[i-1][j+1]^s[i][j]^s[i][j+1])) x[j]++;
			else x[j] = 1;
		}
		stack<int> s;
		rep(r,w) {
			while (!s.empty() && x[s.top()]>=x[r]) {
				int t = s.top(); s.pop();
				int l = (s.empty() ? -1 : s.top());
				chmax(res, x[t]*(r-l));
			}
			s.push(r);
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 4480
cards_list = [input() for _ in range(3)]
def battle(cards_list):
  dict = {"a": 0, "b": 1, "c": 2}
  current = "a"

  while True:
    index = dict[current] #0
    current = cards_list[index][0] #b
    if len(cards_list[index]) > 1:
      cards_list[index] = cards_list[index][1:]
    else:
      cards_list[index] = []
    
    index = dict[current]
    if len(cards_list[index]) == 0:
      return current.upper()
    


print(battle(cards_list))

Measured memory_bytes: 3064
using System;
using System.Linq;
class Program
{
    static void Main()
    {
        char[] input = Array.ConvertAll(Console.ReadLine().Split(),char.Parse);
        //int input=int.Parse(Console.ReadLine());
        //string a = Console.ReadLine();
        string ans;
        if (input[0]<input[1])
        {
            ans = "<";
        }
        else if (input[1]<input[0])
        {
            ans = ">";
        }
        else
        {
            ans = "=";
        }
        Console.WriteLine(ans);
        Console.ReadLine();
    }
}


Measured memory_bytes: 11092
// At Corder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <algorithm>
#include <iostream>
using namespace std;
#include <vector>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using p = pair<int, int>;//<key,value>
#include <math.h>
int main()
{
int n,k;
cin>>n>>k;
vector<int>data(n,0);
for (int i = 0;  i < k; ++ i) {
	int d;
	cin>>d;
	for (int  j= 0; j < d; ++j) {
		int a;
		cin>>a;
		data.at(a-1)++;
	}
}
int ans=0;
rep(i,n)
if(data.at(i)==0)
	ans++;
cout<<ans<<endl;
	return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント:
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 3628
import java.util.*;

public class Main {
  public static class Pair {
    int a, b;

    public Pair(int a, int b) {
      this.a = a;
      this.b = b;
    }
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    long K = Long.parseLong(sc.next());
    Pair[] p = new Pair[N];
    for (int i = 0; i < N; i++) {
      int a = Integer.parseInt(sc.next());
      int b = Integer.parseInt(sc.next());
      p[i] = new Pair(a, b);
    }
    Arrays.sort(p, (x, y) -> x.a - y.a);
    long length = 0L;
    for (int i = 0; i < N; i++) {
      length += p[i].b;
      if (K <= length) {
        System.out.println(p[i].a);
        return;
      }
    }
  }
}


Measured memory_bytes: 64108
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(i,m,n) for (int i=m;i<n;i++)
#define FOR(i,m,n,a) for(int i=m;i<n;i+=a)
const ll MOD=1e9+7;

int main(){
  int N,M;
  cin >> N >> M;
  vvl a=vvl(N,vl(N,0));
  vvl b=vvl(M,vl(M,0));

  char c;
  REP(i,0,N){
    REP(j,0,N){
      cin >> c;
      a[i][j]=((c=='#')?0:1);
    }
  }
  REP(i,0,M){
    REP(j,0,M){
      cin >> c;
      b[i][j]=((c=='#')?0:1);
    }
  }

  bool flag;
  REP(i,0,N-M+1){
    REP(j,0,N-M+1){
      flag=true;
      REP(k,0,M){
        REP(l,0,M){
          if(a[i+k][j+l]!=b[k][l]){
            flag=false;
          }
        }
      }
      if(flag){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
  return 0;
}


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



int main(){
    int N, D; 
    double calc;
    int icalc;
    int flag=0;
    //入力
    cin >> N >> D;
    int X[N][D];
    for(int i=0; i<N; i++){
        for(int j=0; j<D; j++){
            cin >> X[i][j];
        }
    }

    for(int j=0; j<N; j++){
        for(int i=0; i<j; i++, calc=0){
            for(int k=0; k<D; k++){
                calc += ( X[j][k] - X[i][k] ) * ( X[j][k] - X[i][k] );
            }
            calc = sqrt(calc);
            icalc = calc;
            if(calc ==  icalc){
                flag++;
            } 
        }
    }

    cout << flag << endl;
    
    

    
    return 0;
}

Measured memory_bytes: 256
s = str(input())
t = ''
for i in range(len(s)):
    t += s[-i-1]
flag = False

if s==t:
    s1 = s[:len(s)//2]
    if len(s)%2==0:
        s2 = s[len(s)//2:]
    elif len(s)%2!=0:
        s2 = s[len(s)//2+1:]
    t1 = ''
    t2 = ''

    for i in range(len(s1)):
        t1 += s1[-1-i]
        t2 += s2[-1-i]

    if s1==t1:
        if s2==t2:
            flag = True

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())
#define mp make_pair
#define pb push_back
#define forn(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

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




void solve() {
    int n;
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    sort(all(s));
    s.resize(unique(all(s)) - s.begin());
    cout << sz(s) << "\n";
}



int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    while (cin.peek() != EOF) {
        solve();
        cout << endl << endl;
        string s;
        do getline(cin, s);
        while (!cin.eof() && !s.empty());
        while (isspace(cin.peek())) cin.get();
    }
#else
    solve();
#endif
    return 0;
}


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

using namespace std;

typedef long long LL;
const int MOD=1e9+7;
const int MAXN=128;
struct Mat{
	LL m[MAXN][MAXN];
}e,a;
LL n,k;

Mat mul(Mat x,Mat y){
	Mat tmp;
	memset(tmp.m,0,sizeof(tmp.m));
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=n;k++){
				tmp.m[i][j]+=x.m[i][k]*y.m[k][j]%MOD;
				tmp.m[i][j]%=MOD;
			}
		}
	}
	return tmp;
}

Mat pow(){
	for(int i=1;i<=n;i++) e.m[i][i]=1;
	Mat ans=e;
	while(k){
		if(k&1) ans=mul(ans,a);
		a=mul(a,a);
		k>>=1;
	}
	return ans;
}

int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cin>>a.m[i][j];
		}
	}
	Mat ans=pow();
	LL tot=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			tot+=ans.m[i][j];
			tot%=MOD;
		}
	}
	cout<<tot<<endl; 
	return 0;
}


Measured memory_bytes: 1280
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i, n) for(ll i = 0; i < (n); i++)
int main() {
  ll H,W,dx[4]={-1,1,0,0},dy[4]={0,0,-1,1};
  cin>>H>>W;
  /**/
  vector<string> vv(H);
  rep(i,H) cin>>vv[i];
  vector<string> v(H+2);
  rep(i,W+2) v[0].push_back('#');
  rep(i,H){
    v[i+1].push_back('#');
    rep(j,W) v[i+1].push_back(vv[i][j]);
    v[i+1].push_back('#');
  }
  rep(i,W+2) v[H+1].push_back('#');
  
  /**/
  H+=2;
  W+=2;
  
  vector<vector<ll>> w(H,vector<ll>(W,-1));
  ll ans=0;
  rep(sx,W){
    rep(sy,H){
      rep(gx,W){
        rep(gy,H){
          if(v[gy][gx]=='#' || v[sy][sx]=='#') continue;
          if(gy==sy && gx==sx) continue;
          rep(i,H){
            rep(j,W){
              if(v[i][j]=='#') w[i][j]=-2;
              else if(v[i][j]=='.') w[i][j]=-1;
            }
          }
         
          queue<pair<ll,ll>> que;
          que.push(pair<ll,ll>(sy,sx));
          while(!que.empty()){
            auto c=que.front();
            que.pop();
            rep(i,4){
              ll ny=c.first+dy[i];
              ll nx=c.second+dx[i];
              if(w[ny][nx]==-2 || nx<0 || ny<0 || nx>=W || ny>=H) continue;
              if(w[ny][nx]==-1){
                w[ny][nx]=w[c.first][c.second]+1;
                que.push(pair<ll,ll>(ny,nx));
              }
            }
          }
          ans=max(w[gy][gx]+1,ans);
        }
      }
    }
  }
  cout<<ans<<endl;
}




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

#define SIZE_OF_ARRAY(array) sizeof(array)/sizeof(array[0])
typedef long long ll;

int main() {
    string S,T,U;
    int A,B;
    cin >> S >> T >> A >> B >> U;
    if(S==U){
        A--;
    } else if(T==U){
        B--;
    }
    cout << A << " " << B << endl;
}


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

/* 
 * So basically you want to find the fastest way to perform the operations 
 * Before reading this solution 
 * You should understand how deque works (Google it :D)
 * If you understand how a deque works you should understand this solution 
 * So first thing you should notice is that we don't really need to reverse the whole string 
 * All we need to know is where the front is currently and where the back is currently 
 * So in my code I have a variable swapped 
 * If swapped is true you know that the end has become the front and the front has become the end 
 * So if swapped is true and you get an end operation then it should go to the front and vice-versa 
 * And if swapped isn't true then you should perform the operations as usual 
 * You can look at the code to understand it better 
 * Solution runs in O(Q log n) time
 * Hope this helps!
 */

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  deque<char> deck;
  for (const char& ch : s) 
    deck.push_back(ch);
  int ops;
  cin >> ops;
  bool swapped = false;
  while (ops--) {
    int op;
    cin >> op;
    if (op == 1) swapped = !swapped; // this is just a fancy way of changing the value of swapped (true -> false) and (false -> true)
    else {
      int f;
      char ch;
      cin >> f >> ch;
      if (f == 1) {
        if (swapped)
          deck.push_back(ch); // if swapped this should now go to the back instead of the front 
        else
          deck.push_front(ch); // if not swapped this should go to the front as usual
      } else {
        if (swapped)
          deck.push_front(ch); // if swapped this should now go to the front instead of the back
        else 
          deck.push_back(ch); // if not swapped this should go to the back as usual 
      }
    }
  }
  if (swapped)  // if swapped you need to print the result in reverse
    reverse(deck.begin(), deck.end());
  for (char& ch : deck)
    cout << ch;
  cout << '\n';
  return 0;
}

Measured memory_bytes: 4028
#include<bits/stdc++.h>
using namespace std;
long long lmax,lmin,rmax,rmin,lx,lm,rx,rm,lx1,lm1,rx1,rm1,ans1,ans2,sum,n,a[200003],b[200003],hhh[200003],ran,aaa=1e18;
int main()
{
	srand(time(0));
	cin>>n;
	for(long long i=1; i<=n; i++)
		cin>>a[i]>>b[i];
	for(int k=1; k<=30; k++)
	{
		memset(hhh,0,sizeof(hhh));
		ran=rand()%n+1,sum=0,hhh[ran]=1,lmax=a[ran],lmin=a[ran],rmax=b[ran],rmin=b[ran];
		for(long long i=1; i<=n*10; i++)
		{
			ran=rand()%n+1;
			if(hhh[ran]==0)
			{
				hhh[ran]=1,lx=lmax,lm=lmin,rx=rmax,rm=rmin,lx=max(lx,a[ran]),lm=min(lm,a[ran]),rx=max(rx,b[ran]),rm=min(rm,b[ran]),ans1=(lx-lm)*(rx-rm),lx1=lmax,lm1=lmin,rx1=rmax,rm1=rmin,lx1=max(lx1,b[ran]),lm1=min(lm1,b[ran]),rx1=max(rx1,a[ran]),rm1=min(rm1,a[ran]),ans2=(lx1-lm1)*(rx1-rm1);
				if(ans1<=ans2)
					lmax=lx,lmin=lm,rmax=rx,rmin=rm,sum=ans1;
				else
					lmax=lx1,lmin=lm1,rmax=rx1,rmin=rm1,sum=ans2;
			}
		}
		for(long long i=1; i<=n; i++)
		{
			if(hhh[i]==0)
			{
				lx=lmax,lm=lmin,rx=rmax,rm=rmin,lx=max(lx,a[i]),lm=min(lm,a[i]),rx=max(rx,b[i]),rm=min(rm,b[i]),ans1=(lx-lm)*(rx-rm),lx1=lmax,lm1=lmin,rx1=rmax,rm1=rmin,lx1=max(lx1,b[i]),lm1=min(lm1,b[i]),rx1=max(rx1,a[i]),rm1=min(rm1,a[i]),ans2=(lx1-lm1)*(rx1-rm1);
				if(ans1<=ans2)
					lmax=lx,lmin=lm,rmax=rx,rmin=rm,sum=ans1;
				else
					lmax=lx1,lmin=lm1,rmax=rx1,rmin=rm1,sum=ans2;
			}
		}
		aaa=min(aaa,sum);
	}
	cout<<aaa;
	return 0;
}

Measured memory_bytes: 4992
#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 whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(whole(a));
    cout << a[n-1] << endl;
    int ans = a[0];
    rep(i, n-1) {
        if (abs(a[i]-a[n-1]/2)+abs(a[i]-a[n-1]/2-1)<abs(ans-a[n-1]/2)+abs(ans-a[n-1]/2-1)) ans = a[i];
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
import java.util.Arrays;
import java.util.List;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //数字が最大か最小か
        while(true) {
            double x;
            try {
                x = sc.nextDouble();
            }catch(Exception e) {
                break;
            }
            if(x <= 48.0) {
                System.out.println("light fly");
            }else if(x <= 51.0) {
                System.out.println("fly");
            }else if(x <= 54.0) {
                System.out.println("bantam");
            }else if(x <= 57.0) {
                System.out.println("feather");
            }else if(x <= 60.0) {
                System.out.println("light");
            }else if(x <= 64.0) {
                System.out.println("light welter");
            }else if(x <= 69.0) {
                System.out.println("welter");
            }else if(x <= 75.0) {
                System.out.println("light middle");
            }else if(x <= 81.0) {
                System.out.println("middle");
            }else if(x <= 91.0) {
                System.out.println("light heavy");
            }else if(x > 91.0) {
                System.out.println("heavy");
            }
        }
    }
}



Measured memory_bytes: 27900
using System;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
        string[] reader = ReadLine().Split(' ');
        int ktn = int.Parse(reader[0]);
        int hp = int.Parse(reader[1]);
        int[] kiri = new int[ktn];
        int[] nage = new int[ktn];
        for(int i=0;i<ktn;i++){
            string[] readdam = ReadLine().Split(' ');
            kiri[i] = int.Parse(readdam[0]);
            nage[i] = int.Parse(readdam[1]);
        }
        Array.Sort(kiri);
        Array.Sort(nage);
        Array.Reverse(kiri);
        Array.Reverse(nage);
        int count = 0;
        for(int i=0;i<ktn;i++){
            if(nage[i] < kiri[0]){
                break;
            }
            hp-=nage[i];
            count++;
            if(hp <= 0){
                break;
            }
        }
        if(hp > 0){
            count += hp/kiri[0];
            if(hp% kiri[0] > 0){
                count++;
            }
        }
        WriteLine(count);
    }
}


Measured memory_bytes: 15820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }






int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;cin >> n;
	if(n % 2 == 1) cout << 0 << endl;
	else{
		ll ans = 0;
		ll k = 5;
		while(n >= k){
			ans += n / k / 2;
			k *= 5;
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	for {
		c -= b
		if c <= 0 {
			fmt.Println("Yes")
			return
		}

		a -= d
		if a <= 0 {
			fmt.Println("No")
			return
		}
	}
}


Measured memory_bytes: 1756
import logging
import numpy as np


logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

Mod = 10 ** 9 + 7

def main():
    N = int(input())
    arr_1 = np.array(list(map(int, input().split())))
    logging.info("Hello!")

    ans = 0

    for i in range(64):
        num_of_1 = np.count_nonzero(arr_1 & 1)
        ans += (2 ** i) * (num_of_1 * (N - num_of_1))
        arr_1 >>= 1
        
    print(ans % Mod)
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 48816
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

using namespace std;

int main(void) {
  int r;
  cin >> r;
  puts(r < 1200 ? "ABC" : r < 2800 ? "ARC" : "AGC");
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<numeric>
#include<stdio.h>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;

#define INF 999999999
#define MOD 1000000007

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

/*const int M = 10000;

class Matrix{
	public:
	int n;//行
	int m;//列
	vector<int> data;
	Matrix(int a, int b, const vector<int> &v){
		n = a;
		m = b;
		data.resize(n*m);
		for(int i = 0; i < n*m; i++){
			data[i] = v[i];
		}
	}

	int show(){
		cout << this->n << "x" << this->m << "Matrix\n"; 
		for(int i = 0; i < this->n; i++){
			for(int j = 0; j < this->m; j++){
				cout << data[i * this->m + j];
				if(j == this->m-1) cout << "\n";
				else cout << " ";
			}
		}
		return 0;
	}
	Matrix operator * (Matrix obj){
		vector<int> rt;
		int a=0;
		for(int i = 0; i < this->n; i++){
			for(int j = 0; j < obj.m; j++){

				for(int k = 0; k < this->m; k++){
					//a += this->data[i * this->m + k] * obj.data[k * obj.m + j];
					a = (a%M + ((this->data[i * this->m + k]%M)*(obj.data[k * obj.m + j]%M))%M)%M;
				}
				rt.push_back(a);
				a = 0;

			}
		}
		Matrix RT(this->n, obj.m, rt);
		return RT;
	}

	Matrix expt(long long int p){
		if(p == 0){
			vector<int> v{1, 0, 0, 1};
			Matrix RT(2, 2, v);
			return RT;
		}else if(p == 1) return *this;
		else if(p%2 == 1){
			Matrix T = this->expt(p-1);
			return *this * T;
		}else{
			Matrix T = this->expt(p/2);
			return T*T;
		}
	}
};*/

class UF{
	vector<int> oya;

	public:
	UF(int s){
		oya.resize(s);
		for(int i = 0; i < s; i++) oya[i] = i;
	}

	int root(int x){
		vector<int> path;
		while(oya[x] != x){
			path.push_back(x);
			x = oya[x];
		}
		for(int i = 0; i < path.size(); i++){
			oya[ path[i] ] = x;
		}
		return x;
	}

	void unite(int x, int y){
		//x <= s, y <= s が保証されているものとする
		int ox = root(x), oy = root(y);
		oya[oy] = ox;
	}

	bool same(int x, int y){
		int ox = root(x), oy = root(y);
		return (ox == oy);
	}
};

int n, vsum=0;

struct path{
	int value;
	int start;
	int end;
};

vector<path> ps;

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

	cin >> n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			int a;
			cin >> a;
			if(a >= 0 && i < j){
				path p;
				p.value = a;
				p.start = i;
				p.end = j;
				ps.push_back(p);
			}
		}
	}

	UF uf(n);
	sort(ps.begin(), ps.end(), [](path a, path b){return (a.value < b.value);});
	
	for(auto itr = ps.begin(); itr != ps.end(); itr++){
		if(!uf.same(itr->start, itr->end)){
			uf.unite(itr->start, itr->end);
			vsum+=itr->value;
		}
		dbug(vsum)dbug(itr->value)dbug(itr->start)dbug(itr->end)dbugln;
	}

	cout << vsum << "\n";


	return 0;
}



Measured memory_bytes: 3312
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int N; cin>>N;
    vector<double> coins(N, 0.0);
    for(int i = 0; i < N; i++) cin>>coins[i];
    vector<vector<double> > dp(N+1, vector<double>(N+1, 0));
    dp[0][0] = 1;
    for(int j = 0; j <= N; j++){
	for(int i = 1; i <= N; i++){
	    if(j==0){
		dp[i][j] = dp[i-1][j] * (1-coins[i-1]);
		continue;
	    }
	    dp[i][j] = dp[i-1][j-1] * coins[i-1] + dp[i-1][j] * (1-coins[i-1]);
	}
    }
    double tot = 0;
    for(int i = 0; i <= N; i++){
	if(i > N/2){
	    tot += dp[N][i];
	}
    }
    printf("%.12f", tot);
}


Measured memory_bytes: 70656
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>

using namespace std;
int n;
long long t,you;
int main()
{
	scanf("%d",&n);
	t=n*800;
	you=(n/15)*200;
	cout<<t-you<<endl;
return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math


def solve(N: int):
    x = 1
    for i in range(1, math.ceil(math.sqrt(N))+1):
        m = N // i
        d = N % i
        if d == 0:
            x = max(1, i)
    print(x+N//x-2)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    
    /////////////////////
    // Write code below /
    /////////////////////
    int A, B, T;
    cin >> A >> B >> T;
    
    cout << int((T + 0.5) / A) * B << endl;
    
    return 0;
}


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

namespace AtCoderMake.ABC169
{
    class ABC169C
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split();
            long a = long.Parse(ab[0]) / 100;
            int ad = (int)(long.Parse(ab[0])%100);
            int b = (int)(int.Parse(ab[1].Split('.')[0]+ ab[1].Split('.')[1]));
            int abmin = ad * b / 100;
            Console.WriteLine(a*b+abmin);
        }
        
    }
}


Measured memory_bytes: 27528
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PGC
{
	class Program
	{
		static void Main(string[] args)
		{
			var X = int.Parse(Console.ReadLine());
			var val = X;
			var isFound = false;
			while (!isFound)
			{
				isFound = true;
				for (var i = 2; i < Math.Sqrt(val); i++)
				{
					if (val % i == 0)
					{
						isFound = false;
						break;
					}
				}
				val++;
			}
			val--;
			System.Console.WriteLine(val);
		}
	}
}


Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int condition = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        int N[];
        int tmp=0;
        N =new int[condition];
        for(int j=0;condition>j;j++){
            N[j]=j+1;
        }
        for(int i=0;condition>i;i++){
            if(A<=N[i]%10+N[i]%100/10+N[i]%1000/100+N[i]%10000/1000+N[i]/10000&&
                    N[i]%10+N[i]%100/10+N[i]%1000/100+N[i]%10000/1000+N[i]/10000<=B){
                tmp+=N[i];
            }
        }
        System.out.println(tmp);
    }
}

Measured memory_bytes: 20948
#include<iostream>
using namespace std;
static const int nmax = 100000;

struct P
{
	char name[100];
	int time;
}p[nmax], Q[1000000];

int head, tail;

void enqueue(P x)
{
	Q[tail] = x;
	tail = tail + 1;
}

P dequeue()
{
	P x = Q[head];
	head = head + 1;
	return x;
}

int min(int a, int b)
{
	return a < b ? a : b;
}

int main()
{
	head = tail = 0;

	int n, q, c, dispose;
	dispose = 0;
	P u;

	cin >> n >> q;

	for (int i = 0; i < n; i++)
	{
		cin >> p[i].name >> p[i].time;
		enqueue(p[i]);
	}

	while (head != tail)
	{
		u = dequeue();
		c = min(u.time, q);
		u.time -= c;
		dispose += c;
		if (u.time > 0)
			enqueue(u);
		else
			cout << u.name << " " << dispose << endl;
	}

	return 0;
}


Measured memory_bytes: 27300
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

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

ll lcm(ll a,ll b){
    ll g =gcd(a,b);
    return a/g*b;
}

int main(){
    string s;
    cin>>s;
    rep(i,4){
        if(s[i]==s[i+1]){
            cout<<"Bad"<<endl;
            return 0;
        }
    }
    cout<<"Good"<<endl;
    return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    num = input()
    num_list = [int(i) for i in str(num)]

    A = num_list[0]
    B = num_list[1]
    C = num_list[2]
    D = num_list[3]

    if A + B + C + D == 7:
        print("{0}+{1}+{2}+{3}=7".format(A, B, C, D))
    elif A + B + C - D == 7:
        print("{0}+{1}+{2}-{3}=7".format(A, B, C, D))
    elif A + B - C + D == 7:
        print("{0}+{1}-{2}+{3}=7".format(A, B, C, D))
    elif A + B - C - D == 7:
        print("{0}+{1}-{2}-{3}=7".format(A, B, C, D))
    elif A - B + C + D == 7:
        print("{0}-{1}+{2}+{3}=7".format(A, B, C, D))
    elif A - B + C - D == 7:
        print("{0}-{1}+{2}-{3}=7".format(A, B, C, D))
    elif A - B - C + D == 7:
        print("{0}-{1}-{2}+{3}=7".format(A, B, C, D))
    elif A - B - C - D == 7:
        print("{0}-{1}-{2}-{3}=7".format(A, B, C, D))


Measured memory_bytes: 3064
// Confessions of a Dangerous Mind

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 2e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 2e3 + 5;
const int logN = 22, BL = 400;
const double EPS = 3e-16;

/*
	Keep moving forward. Take the Leap of Faith
*/

vector<long long> g[N];

int main(){
//  freopen(".in", "r", stdin);
//  freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
	
    long long n, m; cin >> n >> m;
    
    vector<long long> h(n);
    for(long long i = 0; i < n; i++){
    	cin >> h[i];
    }
    
    for(long long i = 0; i < m; i++){
    	long long x, y; cin >> x >> y;
    	x--, y--;
    	g[x].push_back(y);
    	g[y].push_back(x);
    }
    
    long long ans = 0;
   	for(long long i = 0; i < n; i++){
   		long long cnt = 0; 
   		for(auto to : g[i]){
   			cnt += (h[i] > h[to]);
   		}
   		if(cnt == g[i].size()) ans++;
   	}
   	
   	cout << ans;
    
    return 0;
}

Measured memory_bytes: 12156
#include<bits/stdc++.h>
using namespace std;
const int N=11;
int n;
char c[N];
long long sum,ans;

void dfs(int k,long long now)
{
	if(k > n)
	{
		sum += now;
		ans += sum;
		sum -= now;
		return;
	}
if(k != 1)
		dfs(k + 1, now * 10 + c[k] - '0');
	sum += now;
	dfs(k+1, c[k]-'0');
	sum -= now;
}
int main()
{
	cin >> c + 1;
	n = strlen(c+1);
	dfs(1,0);
	cout << ans;
}

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

#define dbg(x) cerr << #x"=" << x << endl;
typedef long long LL;

const LL MOD = 1e9+7;
const int MAX_N = 1e5+100;
char s[MAX_N];
int N;
int cnt[30];

int main(){
	//freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    cin >> s;
    memset(cnt, 0, sizeof cnt);
    for(int i = 0; i < N; ++i){
        cnt[s[i]-'a']++;
    }
    LL ans = 1;
    for(int i = 0; i < 26; ++i){
        ans = (ans * (cnt[i]+1)) % MOD;
    }
    cout << (ans - 1) % MOD << endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

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

    string S;
    cin >> S;
    int check = 0;

    if (S.length() % 2 != 0)
    {
        cout << "No" << endl;
        check = 1;
    }
    

    if (check == 0)
    {
        for (int i = 0; i < N/2; i++)
        {
            if (S.at(i) != S.at(i+N/2))
            {
                cout << "No" << endl;
                check = 1;
                break;
            }
        }
    }

    if (check == 0)
    {
        cout << "Yes" << endl;
    }
    
    
}


Measured memory_bytes: 256
import scala.io.StdIn._
object Main extends App {

  val Array(n, a, b) = readLine.trim.split(' ').map(_.toInt)
  val count = Array.tabulate(1 << n){_.countBit}

  val nums = Array.tabulate(n + 1){_ ⇒ Nil: List[Int]}
  for (i ← 0 until 1 << n if i != a && i != b){
    nums(count(i)) ::= i
  }
  if (a.countBit % 2 == b.countBit % 2) {
    println("NO")
  }else {
    println("YES")
    println(make(n, a, b).mkString(" "))
  }

  def make(n: Int, a: Int, b: Int): List[Int] = {
    if (n == 1) List(a, b)
    else {
      val first = firstDiff(a, b)
      val remA = a.removeBit(first)
      val remB = b.removeBit(first)
      val aBit = a.positionBit(first)
      val bBit = b.positionBit(first)
      if (remA == remB) {
        val diff = remA ^ 1
        val l = make(n - 1, remA, diff)
        l.map(_.insertBit(first, aBit)) ++ l.reverse.map(_.insertBit(first, bBit))
      } else {
        val l = make(n - 1, remA, remA ^ 1)
        val r = make(n - 1, remA ^ 1, remB)
        l.map(_.insertBit(first, aBit)) ++ r.map(_.insertBit(first, bBit))
      }
    }
  }
  def firstDiff(a: Int, b: Int): Int = {
    if (a % 2 != b % 2) 0
    else firstDiff(a / 2, b / 2) + 1
  }
  implicit class WrappedInt(val value: Int) extends AnyVal {
    def countBit: Int = count(value)
    def insertBit(position: Int, bit: Int): Int = (((value >> position << 1) + bit) << position) + (value % (1 << position))
    def positionBit(position: Int): Int = (value >> position) % 2
    def removeBit(position: Int): Int = ((value >> (position + 1)) << position) + (value % (1 << position))
    private [this] def count(value: Int): Int = if (value == 0) 0 else value % 2 + count(value / 2)
  }
}

Measured memory_bytes: 80312
/* it was worth becoming a chemist */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int uni;
typedef unsigned long long unll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef pair<int, long long> pil;
typedef vector<int> vi;
typedef vector<long long> vll;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define NAME "puts"
#define F first
#define S second

const ll INF = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const db EPS = (db) 1e-9;
const db pi = acos(-1.0);
const int MAXN = 1e5 + 5;

int n, p, a[MAXN];
ll dp[MAXN][3];

int main() {	
    
	cin >> n >> p;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		dp[i][1] = dp[i - 1][1];
		dp[i][0] = dp[i - 1][0];
		if (a[i] & 1) {
			dp[i][1] += dp[i - 1][0];
			dp[i][0] += dp[i - 1][1];
		}
		else {
			dp[i][1] += dp[i - 1][1];
			dp[i][0] += dp[i - 1][0];
		}
	}
	
	cout << dp[n][p];
	return 0;
}


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

#define endl             '\n' 
#define pii              pair <int,int>
#define pll              pair <long long,long long>
#define sc               scanf
#define pf               printf
#define Pi               2*acos(0.0)
#define ms(a,b)          memset(a, b, sizeof(a))
#define pb(a)            push_back(a)
#define MP               make_pair
#define db               double
#define ll               long long
#define EPS              1E-5
#define ff               first
#define ss               second
#define sqr(x)           (x)*(x)
#define D(x)             cout<<#x " = "<<(x)<<endl
#define VI               vector <int>
#define DBG              pf("Hi\n")
#define MOD              1000000007
#define CIN              ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define SZ(a)            (int)a.size()
#define loop(i,n)        for(int i=0;i<n;i++)
#define loop1(i,n)       for(int i=1;i<=n;i++)
#define REP(i,a,b)       for(int i=a;i<b;i++)
#define TEST_CASE(t)     for(int z=1;z<=t;z++)
#define all(a)           a.begin(),a.end()
#define intlim           2147483648
#define infinity         (1<<28)
#define ull              unsigned long long
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))
 
using namespace std;
 
 
const int fx[]= {+1,-1,+0,+0};
const int fy[]= {+0,+0,+1,-1};
// const int N = 1e5 + 5;
#define piii pair<int, pair<int,int> >

const int N = 2e5 + 5;
int arr[N],frec[N],vis[N];
int main(){
  CIN;
  int n,m;
  while(cin >> n >> m)
  {
    int i,s=0;
    REP(i,0,m) cin >> arr[i],s += arr[i];
    cout << ((s>=n)?"Yes":"No") << endl;

  }
}

Measured memory_bytes: 640
(defun digit-length (k &optional (c 0))
  (if (zerop k)
      c
      (digit-length (floor k 10) (1+ c))))


(defun int->list (n &optional lst)
  (if (zerop n)
      lst
      (int->list (floor n 10) (cons (mod n 10) lst))))

(defun judge (l)
  (some #'(lambda (x) (/= x 9)) (rest l)))

(defun solve (n)
  (let* ((lst (int->list n))
         (first-digit (first lst)))
      (when (judge lst)
        (decf first-digit))
    (+ first-digit (* (1- (length lst)) 9))))

(defun main ()
  (let ((n (read)))
    (princ (solve n))
    (fresh-line)))

(main)


Measured memory_bytes: 24276
using System;

namespace Code001
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = int.Parse(Console.ReadLine());

            var cnt = new int[4];

            for (int i = 0; i < x; i++)
            {
                var y = Console.ReadLine();
                switch (y)
                {
                    case "AC":
                        cnt[0]++;
                        break;
                    case "WA":
                        cnt[1]++;
                        break;
                    case "TLE":
                        cnt[2]++;
                        break;
                    case "RE":
                        cnt[3]++;
                        break;
                }
            }

            Console.WriteLine($"AC x {cnt[0]}");
            Console.WriteLine($"WA x {cnt[1]}");
            Console.WriteLine($"TLE x {cnt[2]}");
            Console.WriteLine($"RE x {cnt[3]}");
        }
    }
}


Measured memory_bytes: 30644
#include<cstdio>
#include<cstring>
#include<algorithm>
typedef long long LL;
using namespace std;
#define max_n 100005

int a[max_n];

int main()
{
	int n,k=1,ans,i;
	bool flag,res=false;
	scanf("%d",&n);
	scanf("%d",&a[0]);
	if(n==1)
	{
		printf("1\n");
		return 0;
	}
	ans=a[0];
	for(i=1;i<n;i++)
	{
		scanf("%d",&a[i]);
//		for(;i<n;i++)
//		{
//			scanf("%d",&a[i]);
//			
//		}
		if(!res)
		{
			if(a[i]>ans)
			{
				flag=true;
				res=true;
				ans=a[i];
			}
			else if(a[i]<ans)
			{
				flag=false;
				res=true;
				ans=a[i];
			}
		}
		else
		{
			if(flag)
			{
				if(a[i]>=ans)
					ans=a[i];
				else
				{
					k++;
					ans=a[i];
					res=false;
				}
			}
			else
			{
				if(a[i]<=ans)
					ans=a[i];
				else
				{
					k++;
					ans=a[i];
					res=false;
				}
			}
		}
	}
	printf("%d\n",k);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <iostream>
#include <climits>
#include <algorithm>
typedef long long int ll;
using namespace std;
#define INF 1LL << 60;
#include <string>
#include <typeinfo>
#include <bitset>

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  
  int S;
  S = (A*B)/2;
  
  cout << S << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
using static CS_Contest.Utils;

namespace CS_Contest {
	using Li = List<int>;
	using LLi = List<List<int>>;
    class Program {
        static void Main(string[] args) {
			new Calc().Solve();
			return;
        }

		private class Calc {
			public void Solve() {
				string s = ReadLine();
				(s[0] + (s.Length - 2).ToString() + s.Last()).WL();
				return;
			}
		}
    }

	
	
    public static class Utils {
        public static void WL(this object obj) => WriteLine(obj);
        public static void WL(this string obj) => WriteLine(obj);
        public static void WL<T>(this IEnumerable<T> list) => list.ToList().ForEach(x => x.WL());
		public static int ReadInt() => int.Parse(ReadLine());
		public static List<int> ReadInt(char s) => ReadLine().Split(s).Select(int.Parse).ToList();
		public static long ReadLong() => long.Parse(ReadLine());
		public static List<long> ReadLong(char s) => ReadLine().Split(s).Select(long.Parse).ToList();
		public static void REP(int n,Action<int> act) {
			for (int i = 0; i < n; i++) {
				act(i);
			}
		}
    }
}


Measured memory_bytes: 11220
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  string S;
  cin >> S;
  regex re{"^(?:dream(?:er)?|erase(?:r)?)+$"};
  cout << (regex_match(S, re) ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 23652
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top,s[1000];

void push(int x){
	++top;
	s[top]=x;
}

int pop(){
	top--;
	return s[top+1];
}

int main(void){
	
	int a,b;
	top=0;
	char s[100];
	
	while(scanf("%s",s)!=EOF){
		if(s[0]=='+'){
			a=pop();
			b=pop();
			push(a+b);
		}else if(s[0]=='-'){
			b=pop();
			a=pop();
			push(a-b);
		}else if(s[0]=='*'){
			a=pop();
			b=pop();
			push(a*b);
		}else{
			push(atoi(s));
		}
	}
	
	printf("%d\n",pop());
	
	return 0;
}


Measured memory_bytes: 2092
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 100005;
using namespace std;

int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  ll  n,ans = 0;
  cin >> n;
  vector<ll>v(n),m;
  for (int i = 0; i < n; ++i)
  {
    cin >> v[i];
  }
  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j < n; ++j)
    {
      if(i != j)
      {
        ll a = v[i]*v[j];
        m.pb(a);
      }
    }
  }
  for (int i = 0; i < m.size(); ++i)
  {
    ans += m[i];
  }
  cout << ans/2;
  return 0;
}

Measured memory_bytes: 256