akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define int long long
#define INF 1000000000000000000
using namespace std;

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
template<typename T>
void debug(vector<vector<T>> m){ REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;} }



signed main(){

    int N; cin >> N;
    vec x(N); readv(x);
    int M, K; cin >> M >> K;
    vec a(M); readv(a);

    vec d(N - 1);
    REP(i, N - 1) d[i] = x[i + 1] - x[i];

    mat next(61, vec(N - 1));
    REP(i, N - 1) next[0][i] = i;
    REP(i, M) swap(next[0][a[i] - 2], next[0][a[i] - 1]);
    FOR(i, 1, 61) REP(j, N - 1) next[i][j] = next[i - 1][next[i - 1][j]];

    int A = x[0];
    cout << A << endl;
    REP(i, N - 1){
        int u = i;
        IREP(j, 61) if((K >> j) & 1) u = next[j][u];
        A += d[u];
        cout << A << endl;
    }

    return 0;
}


Measured memory_bytes: 51440
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int t[8]={0,1,2,3,4,5,6,7};

int main(){
    int n; cin>>n;
    vector<ip> p(n);
    rep(i,n)cin>>p[i].first>>p[i].second;

    long double ans = 0;
    do{
        rep(i,n-1){
            ans += sqrt(pow(p[t[i]].first - p[t[i+1]].first,2)+pow(p[t[i]].second - p[t[i+1]].second,2));
        }
    }while(next_permutation(t,t+n));
    
    ll divisor = 1; REP(i,n)divisor *= i;
    cout<<fixed<<setprecision(10)<<ans/divisor<<endl; return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define oo (long long)1e18
#define ll long long
#define setdp memset(dp,-1,sizeof(dp))
const ll mod = 1e9+7;
void _IOS(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);}
#define PI 3.14159265359
int sx,sy,tx,ty;
ll a[200003];
ll b[200003];
ll n,m;
bool vis[1009][1009];
struct threeElements{
int _1st,_2nd,_3rd;
};
vector<int> read(int n){vector<int>v(n+1);for(int i=0;i<n;i++) cin>>v[i]; return v;}
int main()
{
   // freopen ("jumping.in","r",stdin);
   _IOS();
    ll x,k,d;
    cin>>x>>k>>d;
    x=abs(x);
        ll q=ceil(1.0*x/d);
        q=min(q,k);
        ll ans1=x-(d*q);
        q=k-q;
        if(q&&q%2)
            ans1+=d;
        ans1=abs(ans1);
        q=floor(x/d);
        q=min(q,k);
        ll ans2=x-(d*q);
        q=k-q;
        if(q&&q%2)
            ans2+=d;
        ans2=abs(ans2);
        cout<<min(ans1,ans2);


}


Measured memory_bytes: 3776
import java.util.*;
public class Main {
    public static void main(String aegs[]) {
        Scanner s = new Scanner(System.in);
        for(int x = 1; x <= 10000; x++) {
            int a = s.nextInt();
            if (a == 0) {
                return ;
            }else {
                System.out.println("Case " + x + ": " + a);
            }
        }
    }
}


Measured memory_bytes: 45204
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <algorithm>
#include <cassert>
#include <string>
#include <climits>
#include <numeric>

#define all(x) begin(x),end(x)

using namespace std;
using ll = long long;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a >= b)
		swap(a, b);
	if (c >= a && b >= c)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void)
{
    string s;

    cin >> s;
    
    for (int i = 0;i < s.length(); i++)
    {
        if (((i+1) %2 == 1) && (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')){
        } else if (((i+1) %2 == 0) && (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')){
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 888
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class AStudyScheduling {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int h1, m1, h2, m2, k;
      cin >> h1 >> m1 >> h2 >> m2 >> k;
      int t = (h2-h1)*60 + (m2-m1);
      cout << t-k << endl;


    }
};

signed main() {
  AStudyScheduling solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 3656
/*input
0 3
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


ll power(ll a,ll m,ll mod){
    ll ans=1;
    while(m){
        if(m%2){
            ans*=a;
            ans%=(mod);
        }
        a=(a*a)%(mod);
        m>>=1;
    }
    return ans;
}


void init(ll* a,ll n,ll val){
    for(ll i=0;i<n;i++)
        a[i]=val;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    ll t=1,i,j;
    ll n,m;
    cin>>n>>m;
    cout<<(n)*(n-1)/2+(m)*(m-1)/2<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int K;
  cin >> K;
  int counte=0;
  int counto=0;
  for(int i=1; i<=K; i++){
    if(i%2 == 0){
      counte++;
    }else{
      counto++;
    }
  }
  cout << counte*counto << endl;
}

Measured memory_bytes: 256
def if_inside(boundary, pos, stretch, boundedside):
    if boundedside is "greater":
        return False if pos + stretch > boundary else True
    else:
        return False if pos - stretch < boundary else True


w,h,x,y,r = map(int,input().split())

leftin = if_inside(0, x, r, "lesser")
buttomin = if_inside(0, y, r, "lesser")
rightin = if_inside(w, x, r, "greater")
topin = if_inside(h, y, r, "greater")

print("Yes") if leftin and buttomin and rightin and topin else print("No")

Measured memory_bytes: 7748
num_str_list = list(input().split())
answer_list = []

for i in num_str_list:
    if i in "+-*":
        v1 = answer_list.pop()
        v2 = answer_list.pop()
        if i == "+":
            v3 = int(v2) + int(v1)
            answer_list.append(v3)
        if i == "-":
            v3 = int(v2) - int(v1)
            answer_list.append(v3)
        if i == "*":
            v3 = int(v2) * int(v1)
            answer_list.append(v3)
    else:
        answer_list.append(i)
        
print(answer_list[0])


Measured memory_bytes: 5600
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

int main() {
    int h, w, ch, cw, dh, dw;
    cin >> h >> w >> ch >> cw >> dh >> dw;
    ch--; cw--; dh--; dw--;
    vector<string> s(h);
    for (int i=0; i<h; i++) cin >> s[i];

    vector cnt(h, vector(w, INT_MAX));
    cnt[ch][cw] = 0;
    priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>, greater<tuple<int, int, int>>> que;
    que.emplace(0, ch, cw);

    vector vy = {-1, 1, 0, 0};
    vector vx = { 0, 0,-1, 1};
    while (!que.empty()) {
        auto [c, y, x] = que.top();
        que.pop();

        // if (y == dh && x == dw) break;
        
        for (int i=0; i<4; i++) {
            int yy = y + vy[i];
            int xx = x + vx[i];
            if (yy<0 || h<=yy || xx<0 || w<=xx) continue;
            if (s[yy][xx] == '#') continue;
            if (cnt[yy][xx] <= c) continue;

            cnt[yy][xx] = c;
            que.emplace(c, yy, xx);
        }

        for (int i=-2; i<=2; i++) {
            for (int j=-2; j<=2; j++) {
                if (abs(i)+abs(j) <= 1) continue;
                int yy = y + i;
                int xx = x + j;
                if (yy<0 || h<=yy || xx<0 || w<=xx) continue;
                if (s[yy][xx] == '#') continue;
                if (cnt[yy][xx] <= c+1) continue;

                cnt[yy][xx] = c+1;
                que.emplace(c+1, yy, xx);
            }
        }
    }

    if (cnt[dh][dw] == INT_MAX)
        cout << -1 << endl;
    else
        cout << cnt[dh][dw] << endl;
}


Measured memory_bytes: 8708
/* - - - - - - - - - - - - - - -
	User : 		VanishD
	problem :
	Points : 	
- - - - - - - - - - - - - - - */
# include <bits/stdc++.h>
# define 	ll 		long long
using namespace std;
const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
int read(){
	int tmp = 0, fh = 1; char ch = getchar();
	while (ch < '0' || ch > '9'){ if (ch == '-') fh = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9'){ tmp = tmp * 10 + ch - '0'; ch = getchar(); }
	return tmp * fh;
}
const int L = 2000, N = 2010, P = 998244353;
int power(int x, int y){
	int i = x; x = 1;
	while (y > 0){
		if (y % 2 == 1) x = 1ll * i * x % P;
		i = 1ll * i * i % P;
		y /= 2;
	}
	return x;
}
int c[N][N], p2[N], k, n, s[N][N], g[N][N], ans[N * 2];
int main(){
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	k = read(), n = read();
	c[0][0] = 1;
	for (int i = 1; i <= L; i++){
		c[i][0] = 1;
		for (int j = 1; j <= i; j++)
			c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % P;
	}
	g[0][0] = s[0][0] = 1;
	for (int i = 1; i <= L; i++) s[0][i] = 1;
	for (int i = 1; i <= L; i++){
		for (int j = 0; j <= L; j++)
			g[i][j] = s[i - 1][j];
		s[i][0] = g[i][0];
		for (int j = 1; j <= L; j++)
			s[i][j] = (s[i][j - 1] + g[i][j]) % P;
	}
	p2[0] = 1; for (int i = 1; i <= L; i++) p2[i] = p2[i - 1] * 2 % P;
	for (int i = 2; i <= k + 1; i++){
		if (i % 2 == 1){
			int cnt = i / 2;
			for (int j = 0; j <= cnt; j++){
				if (cnt - j > n) continue;
				int num = 1ll * c[cnt][j] * p2[cnt - j] % P, les = n - (cnt - j);
				ans[i] = (ans[i] + 1ll * num * g[k - cnt - j][les]) % P;
			}
		}
		else {
			int cnt = i / 2 - 1;
			int tmp = n;
			for (int j = 0; j <= cnt; j++){
				if (cnt - j > tmp) continue;
				int num = 1ll * c[cnt][j] * p2[cnt - j] % P, les = tmp - (cnt - j);
				ans[i] = (ans[i] + 1ll * num * g[k - cnt - j - 1][les]) % P;
			}
			tmp = n - 1;
			for (int j = 0; j <= cnt; j++){
				if (cnt - j > tmp) continue;
				int num = 1ll * c[cnt][j] * p2[cnt - j] % P, les = tmp - (cnt - j);
				ans[i] = (ans[i] + 1ll * num * g[k - cnt - j - 1][les]) % P;
			}
		}
		ans[2 * k - i + 2] = ans[i];
	}
	for (int i = 2; i <= 2 * k; i++)
		printf("%d\n", ans[i]);
	return 0;
}


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

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

    long long a, b;
    cin >> a >> b;
    long long tmp = a + b;
    tmp /= 2;
    if(abs(a - tmp) == abs(b - tmp)){
        cout << tmp << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#-swank
(unless (member :child-sbcl *features*)
  (quit
	:unix-status
	(process-exit-code
	  (run-program *runtime-pathname*
				   `("--control-stack-size" "128MB"
					 "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
					 "--eval" "(push :child-sbcl *features*)"
					 "--script" ,(namestring *load-pathname*))
				   :output t :error t :input t))))

(defun func (x)
  (when x
	(princ (car x))
	(when (and (cdr x) (cddr x))
	  (func (cddr x)))))

(func (concatenate 'list (read-line)))


Measured memory_bytes: 11188
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
 
int main(){
    int n;
    cin>>n;
    int r;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(&a[0],&a[n]);
    for(int i=0;i<n-1;i++){
        r=a[i+1]%a[i];
        while(r!=0){
            a[i+1]=a[i];
            a[i]=r;
            r=a[i+1]%a[i];
        }
        a[i+1]=a[i];
    }
    cout<<a[n-1]<<endl;
    return 0;
}

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

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

    int n;
    string s;
    cin >> n >> s;
    vector<vector<ll>> dp(n, vector<ll>(n, 1));
    vector<ll> sdp(n);
    iota(sdp.begin(), sdp.end(), 1);
    ll mod = 1e9 + 7;

    rep(i, 0, n - 1) {
        if (s[i] == '<') {
            rep(j, 0, n - i - 1) dp[i + 1][j] = sdp[j];
        } else {
            rep(j, 0, n - i - 1) dp[i + 1][j] =
                (sdp[n - i - 1] - sdp[j] + mod) % mod;
        }
        rep(j, 0, n - 1 - i) sdp[j] =
            (dp[i + 1][j] + (j ? sdp[j - 1] : 0)) % mod;
    }

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

    return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if((A + B) > (C + D))
    cout << "Left" << endl;
  else if((A + B) < (C + D))
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
}

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

long long N, M, K, x[1000010], p[1000010], a, last, ans[100010], P[100010];

int main(){
	scanf("%lld", &N);
	for(int i=1; i<=N; i++)	scanf("%lld", &x[i]);
	for(int i=N; i; i--)	x[i]-=x[i-1], p[i]=i;
	scanf("%lld%lld", &M, &K);
	for(int i=1; i<=M; i++){
		scanf("%lld", &a);
		swap(p[a], p[a+1]);
	};
	for(int i=1; i<=N; i++)	ans[i]=i, P[i]=p[i];
	while(K){
		if(K&1)	
			for(int i=1; i<=N; i++)
				ans[i]=p[ans[i]];
		for(int i=1; i<=N; i++)
			P[i]=p[P[i]];
		for(int i=1; i<=N; i++)
			p[i]=P[i]; 
		K>>=1; 
	}
	for(int i=1; i<=N; i++){
		last+=x[ans[i]];
		printf("%lld\n", last);
	}
	return 0;
}

Measured memory_bytes: 7424
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = scan.nextInt();
		for ( int i = 1; i <= n; i++ ) {
			int x = i;
			if (x % 3 == 0) {
				sb.append(" " + i);
			} else {
				do {
					if (x % 10 == 3) {
						sb.append(" " + i);
						break;
					}
					x = x / 10;
				} while (x != 0);
			}
		}
		System.out.println(sb);
	}
}

Measured memory_bytes: 28388
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-2;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int t[10] = { 0,2,5,5,4,5,6,3,7,6 };
bool used[10001];
string ans[10001];
int a[10];
string great(string x, string y) {
	if (x == "?")return y;
	else if (y == "?")return x;
	else if (x.length() > y.length())return x;
	else if (y.length() > x.length())return y;
	else if (x > y)return x;
	else return y;
}
string dfs(int id) {
	if (id < 0) {
		return "?";
	}
	else if (id == 0)return "";
	if (used[id])return ans[id];
	used[id] = true;
	string res = "?";
	rep(i, 10) {
		if (a[i] < 0)continue;
		string z = dfs(id - i);
		if (z == "?")continue;
		string u; u.push_back('0'+a[i]);
		u += z;
		res = great(res, u);
	}
	return ans[id]=res;
}
int main() {
	int n, m; cin >> n >> m;
	fill(a, a + 10, -1);
	rep(i, m) {
		int b; cin >> b;
		a[t[b]] = max(a[t[b]], b);
	}
	cout << dfs(n) << endl;
	//stop
	return 0;
}

Measured memory_bytes: 33408
from math import ceil
n=int(input())
""" flag=True
xceil=ceil(n/1.08)
xfloor=int(n/1.08)
for i in range(xfloor,xceil+1):
    if int(i*1.08)==n:
        print(i)
        flag=False
        break
if flag:
    print(":(") """

flag = True
for i in range(1,50001):
    if int(i*1.08)==n:
        print(i)
        flag=False
        break
if flag:
    print(":(")

Measured memory_bytes: 9100
#include<bits/stdc++.h>
#define ll long long
#define lld long long double
#define pb push_back
#define mp make_pair
#define M 1000000007
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	int n, m;
	cin >> n >> m;
	ll dp[n][m];
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < m; j++) {
			if (s[j] == '#') dp[i][j] = 0;
			else dp[i][j] = 1;
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (dp[i][j] == 0) continue;
			if (i - 1 >= 0 && j - 1 >= 0)
				dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % M;
			else if (i - 1 >= 0) {
				dp[i][j] = dp[i - 1][j];
			}
			else if (j - 1 >= 0)dp[i][j] = dp[i][j - 1];
			//else continue;
		}
	}
	// for (int i = 0; i < n; i++) {
	// 	for (int j = 0; j < m; j++) {
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << "\n";
	// }
	cout << dp[n - 1][m - 1];
	return 0;

}

Measured memory_bytes: 8064
N = int(input())
H = list(map(int, input().split()))
c_list = []
count = 0
bh = 0
for h in H:
  if h <= bh:
    count += 1
  else:
    c_list.append(count)
    count = 0
  bh = h
c_list.append(count)
  
c_list.sort()
print(c_list[-1])


Measured memory_bytes: 15020
#include<bits/stdc++.h>
using namespace std;
int n,k,h[100010];
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>h[i];
	int ans=0;
	for(int i=1;i<=n;i++)
		if(h[i]>=k)
			ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std;

const int N = 2e5 + 10;
int n, Q, val[N];
vector<int> nxt[N];

void dfs(int x, int fa) {
    val[x] += val[fa];
    for (int i = 0; i < nxt[x].size(); i++) {
        int y = nxt[x][i];
        if (y == fa) continue;
        dfs(y, x);
    }
}

int main() {
    cin >> n >> Q;
    rep(i, 1, n - 1) {
        int x, y; cin >> x >> y;
        nxt[x].push_back(y), nxt[y].push_back(x);
    }
    while (Q--) {
        int x, v; cin >> x >> v;
        val[x] += v;
    }
    dfs(1, 0);
    rep(i, 1, n) printf("%d ", val[i]); puts("");
    return 0;
}


Measured memory_bytes: 23424
def bs(L, left, right, bc):
    while left != right:
        mid = (left + right)//2
        if L[mid] > bc:
            right = mid
        else:
            left = mid+1
    if L[left] <= bc:
        return -1
    return left


def solve():
    N = int(input())
    L = list(map(int, input().split()))
    L.sort()
    # print(L)
    count = 0
    for i in range(1, N-1):
        for j in range(i + 1, N):
            left = 0
            right = i-1
            div = bs(L, left, right, L[j] - L[i])
            if (div != -1):
                count += i - div
                # print('counted')
                # print(i-div)

    print(count)


if __name__ == "__main__":
    solve()
    # L = [1, 2, 3, 4, 5, 6]
    # print(bs(L, 0, 3, 1))


Measured memory_bytes: 43996
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
 
template<class V> class MaxFlow_Ford {
public:
	struct edge { int to,reve;V cap;};
	static const int MV = 10000;
	vector<edge> E[MV];
	int vis[MV];
	void add_edge(int x,int y,V cap,bool undir=false) {
		E[x].push_back((edge){y,(int)E[y].size(),cap});
		E[y].push_back((edge){x,(int)E[x].size()-1,undir?cap:0});
	}
	V dfs(int from,int to,V cf) {
		V tf;
		if(from==to) return cf;
		vis[from]=1;
		FORR(e,E[from]) if(vis[e.to]==0 && e.cap>0 && (tf = dfs(e.to,to,min(cf,e.cap)))>0) {
			e.cap -= tf;
			E[e.to][e.reve].cap += tf;
			return tf;
		}
		return 0;
	}
	V maxflow(int from, int to) {
		V fl=0,tf;
		while(1) {
			ZERO(vis);
			if((tf = dfs(from,to,numeric_limits<V>::max()))==0) return fl;
			fl+=tf;
		}
	}
};
 
MaxFlow_Ford<ll> mf;
 
int N;
int A[101];
 
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	ll tot=0;
	for(i=1;i<=N;i++) {
		cin>>A[i];
		if(A[i]>=0) {
			tot+=A[i];
			mf.add_edge(0,i,A[i]);
			mf.add_edge(i,N+1,0);
		}
		else {
			mf.add_edge(0,i,0);
			mf.add_edge(i,N+1,-A[i]);
		}
		
		for(x=i*2;x<=N;x+=i) mf.add_edge(x,i,1LL<<40);
	}
	cout<<tot-mf.maxflow(0,N+1)<<endl;
}
 
 
int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}

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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 35;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

/*
int par[MAXN];
int find(int a) {
    return par[a] = par[a]==a ? a : find(par[a]);
}
bool same (int a, int b) {
    return find(a)==find(b);
}
void unite(int a, int b) {
    a = find(a), b = find(b);
    if (a == b) return;
    par[b] = a;
}*/

string s;
ll a[MAXN];
ll suf[MAXN];

int main ()
{
    FAST_IO;

    cin >> s;
    int n = s.size()+1;

    for(int i = n-2; i >= 0; i--) {
        if (s[i] == '<') suf[i] = 0;
        else suf[i] = suf[i+1] + 1;
    }

    FOR(i, 0, n-1) {
        if (i < n-1) a[i] = suf[i];

        if (i > 0 && s[i-1] == '<') a[i] = max(a[i], a[i-1]+1);
    }

    ll sum = 0;
    FOR(i, 0, n-1) sum += a[i];
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 8732
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mii map<int,int>
#define msi map<string,int>
#define mci map<char,int>
#define pb push_back
#define mp make_pair
#define M 1101
#define MOD 1000000007
#define fi first
#define se second
#define vi vector<int>
#define vl vector<ll>
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define repl(i,l,r) for(long long i=l;i<=r;++i)
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define ins insert
#define inf 10000000000000000ll
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define eps 1e-7
#define endl "\n"
/*ll gcd(ll a,ll b){if(a==0){return b;}return gcd(b%a,a);}
ll modexp(ll x,ll y,ll p)
{ll res=1;x%=p;while(y){if(y&1){res=(res*x)%p;}y=y>>1;x=(x*x)%p;}return res;}
int x[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int y[] = { -1, 0, 1, -1, 1, -1, 0, 1 }; */
const int maxn=2e5+10;
vector<int>g[maxn];
ll ans[maxn];
int n,q;
void dfs(int v,int p)
{
    for(auto to:g[v])
    {
        if(to==p){continue;}
        ans[to]+=ans[v];
        dfs(to,v);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>q;
    rep(i,1,n-1)
    {
        int a,b;cin>>a>>b;
        g[a].pb(b);
        g[b].pb(a);
    }
    rep(i,1,q)
    {
        int p,x;cin>>p>>x;
        ans[p]+=x;
    }
    dfs(1,1);
    rep(i,1,n)
    {
        cout<<ans[i]<<" ";
    }


    return 0;

    /*check for long long or int*/
}


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

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

    string T1 = S.substr(0, N / 2);
    string T2 = S.substr(N / 2);

    if (T1 == T2) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=500+19;

struct node{
	int x,i;
	bool operator < (const node &B) const {return x<B.x;}
} A[N];
int res[N*N],vis[N*N];
set<int> S;
int n,c;

int main(){
	n=IN();
	For(i,1,n+1){
		A[i]=(node){IN(),i};
		vis[A[i].x]=1;
	}
	sort(A+1,A+n+1);
	c=1;
	For(i,1,n+1){
		for (;c<A[i].x;c++)
			if (!vis[c]){
				S.insert(c);
			}
		For(j,1,A[i].i){
			if (S.empty()){
				puts("No");
				return 0;
			}
			res[*S.begin()]=A[i].i;
			S.erase(S.begin());
		}
		res[A[i].x]=A[i].i;
	}
	c=1;
	For(i,1,n+1)
		For(j,0,n-A[i].i){
			while (res[c]) c++;
			res[c]=A[i].i;
			if (c<A[i].x){
				puts("No");
				return 0;
			}
		}
	puts("Yes");
	For(i,1,n*n+1) printf("%d ",res[i]);
	puts("");
}

Measured memory_bytes: 12544
def is_include(mid, m, book):
    cnt = 1
    length = 0
    for sz in book:
        if sz > mid:
            return False
        if length + sz <= mid:
            length += sz
        else:
            cnt += 1
            length = sz
    return cnt <= m

while True:
    m, n = map(int, raw_input().split())
    if m == n == 0:
        break
    book = [input() for i in range(n)]
    l = 1
    r = 1500000
    ans = 10000000
    while l <= r:
        mid = (l + r) / 2
        if is_include(mid, m, book):
            r = mid - 1
            ans = min(ans, mid)
        else:
            l = mid + 1
    print ans

Measured memory_bytes: 4240
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return a % 1000000007;
}

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


int main(){
  ll n,m; cin >> n >> m;
  
  if(2*n >= m) cout << m/2 << endl;
  else cout << n + (m -2*n)/4 << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int sum(int *p,int n){
  int i;
  int ans=0;
  for(i=0;i<n;i++){
    if(p[i]>0){
      ans++;
    }
  }
  return ans;
}

int getsame(int n){
  int a[n];
  int i;
  int f=0;  

  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if((f==0)&&(a[i]>1)){
      f=1;
    }
  }
  return f*sum(a,n);
}

void doit(){
  int n;
  scanf("%d",&n);
  if(n!=0){
    int ans=getsame(n);
    if(ans==0){
      printf("NA\n");
    }
    else{
      printf("%d\n",ans+1);
    }
    doit();
  }
}

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

Measured memory_bytes: 648
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// -------------------- I/O -------------------- //
///////////////////////////////////////////////////
// https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords
template<typename T> void outputVec(const std::vector<T>& vec, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	for (auto it = vec.begin(); it != vec.end() - 1; ++it) { std::cout << *it << " "; }
	std::cout << *(vec.end() - 1) << "\n";
}
template<typename T> void outputVal(const T& res, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	std::cout << res << "\n";
}
template<typename T> T inputVal() { T a; std::cin >> a; return a; }
template<typename T> std::vector<T> inputVec(T N) {
	std::vector<T> vec(N);
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
	return vec;
}
template<typename T> void inputVec(std::vector<T>& vec) {
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
}

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
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; }

double dist(const int x1, const int y1, const int x2, const int y2) {
	const double sq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
	return sqrt(sq);
}

double factorial(const ll n) {
	ll ret = 1;
	for (ll i = 1; i <= n; ++i) {
		ret *= i;
	}
	return ret;
}

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////
void Main() {

	const int N = inputVal<int>();
	vector<pair<int, int> > pos(N);
	for (int i = 0; i < N; ++i) {
		pos[i].first = inputVal<int>();
		pos[i].second = inputVal<int>();
	}

	double total = 0;
	
	for (int i = 0; i < N-1; ++i) {
		for (int j = i + 1; j < N; ++j) {
			total += dist(pos[i].first, pos[i].second, pos[j].first, pos[j].second);
		}
	}


	const double dn = static_cast<double>(N);
	const double nbSpokes = (dn - 1.0) * dn / 2.0;
	const double ret = total * (dn - 1.0)/nbSpokes;

	outputVal(ret);

}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout << std::fixed << std::setprecision(15);
	Main();

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

struct UFT{    //O(loga(n))
    int n;
    vi d, r;
    UFT(int n) : n(n), d(n, -1), r(n, 0){};
    int root(int i){
        if(d[i] < 0) return i;
        return d[i] = root(d[i]);
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
    bool unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return false;

        if(r[x] < r[y]) swap(x, y);
        else if(r[x] == r[y]) r[x]++;
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    int size(int i){
        return -d[root(i)];
    }
};

int main(){
    int N, K, L;
    cin >> N >> K >> L;

    UFT uf1(N), uf2(N);
    
    rep(i, K) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        uf1.unite(a, b);
    }

    rep(i, L) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        uf2.unite(a, b);
    }

    map<pair<int, int>, int> mp;
    rep(i, N) mp[make_pair(uf1.root(i), uf2.root(i))]++;

    rep(i, N) {
        cout << mp[make_pair(uf1.root(i), uf2.root(i))];
        if(i != N-1) cout << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 15104
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FI first
#define SE second
#define endl "\n"
#define ciosup cin.tie(0);ios::sync_with_stdio(false);
#define eb emplace_back
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int cnte[100'000], cnto[100'000];

int main()
{
    ciosup;
    int n, k;
    string s;
    cin >> n >> k >> s;
    set<pair<pint, int>> dom;
    int f = s[0] - '0';
    pint s2[n];
    s2[0] = make_pair(0, f);
    int now,arind=0;
    FOR(i, 1, n)
    {
        now = s[i] - '0';
        if (f != now)
        {
            s2[++arind] = make_pair(i, now);
            f = now;
        }
    }
    int ans=0;
    REP(i, arind+1)
    {
        if (s2[i].SE == 0){
            if (i + 2*k <= arind)
            {
                ans = max(ans, s2[i + 2*k].FI - s2[i].FI);
            }else{
                ans = max(ans, n - s2[i].FI);
            }
        }
        else
        {
            if (i + 2*k + 1 <= arind)
            {
                ans = max(ans, s2[i + 2*k + 1].FI - s2[i].FI);
            }else{
                ans = max(ans, n - s2[i].FI);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1232
NT=[int(i) for i in input().split()]
ct=[[int(j) for j in input().split()] for i in range(NT[0])]

ans=0
for i in range(NT[0]):
	if ct[i][1]<=NT[1]:
		if ct[i][0]<ct[ans][0]:
			ans=i
if ct[ans][1]<=NT[1]:
	print(ct[ans][0])
else:
	print("TLE")

Measured memory_bytes: 3064
//Joy Shree Kriskna
    #include<bits/stdc++.h>
    #define fast  ios_base::sync_with_stdio(false);cin.tie(NULL)
    #define rep(i,n) for(i=0;i<n;i++)
    #define rep1(i,n) for(i=n-1;i>=0;i--)
    #define rep2(j,t) for(j=1;j<=t;j++)
    #define rep3(i,a,b) for(i=a;i<=b;i++)
    #define PI acos(-1)
    #define remove(s) s.erase(unique(s.begin(),s.end()),s.end());
    #define e return 0
    //#define lcm(a,b) ((a*b)/__gcd(a,b))
    #define endl "\n"
    #define al(v) v.begin(),v.end()
    #define ll long long
    using namespace std;
    int main()
      {
           fast;
           ll i,n,t=0,k,m=0,x=0,y,f=0;
           cin>>n>>k;
           int a[k+3];
           rep(i,k)
           {
               cin>>a[i];
               //if(!a[i])v.push_back(a[i]);
           }
          for(i=0;i<k-1;i++)
           {
            t+=abs(a[i]-a[i+1]);
           }
           x=n-a[k-1];
           x+=a[0];
           for(i=0;i<k-2;i++)
           {
               x+=abs(a[i]-a[i+1]);
           }
           rep(i,k-1)
           {
               if((a[i+1]-a[i])>m)
               {
                   m=a[i+1]-a[i];
                   y=i;
               }
           }
           for(i=0;i<y;i++)
           {
               f+=a[i+1]-a[i];
           }
           for(i=y+1;i<k-1;i++)
           {
             f+=a[i+1]-a[i];
           }
           f+=a[0];
           f+=n-a[k-1];
           cout<<min(min(t,x),f);
      }
//arupsaha52
//1704052_Arup


Measured memory_bytes: 1024
def solve(n, x):
    if x == 1:
        return int(n <= 0)
    elif 1 < x <= 1 + layer[n-1]:
        return solve(n-1, x-1)
    elif x == 2 + layer[n-1]:
        return patty[n-1] + 1
    elif 2 + layer[n-1] < x <= 2 + 2 * layer[n-1]:
        return solve(n-1, x-layer[n-1]-2) + patty[n-1] + 1
    else:
        return 2 * patty[n-1] + 1


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

layer, patty = [1], [1]
for _ in range(N):
    layer.append(layer[-1] * 2 + 3)
    patty.append(patty[-1] * 2 + 1)

print(solve(N, X))

Measured memory_bytes: 61980
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N, M;
	cin >> N >> M;
	vector< pair<int, int> > E(M);
	vector< vector< pair<int, int> > > G(N);
	for(int i = 0; i < M; i++) {
		cin >> E[i].ff >> E[i].ss;
		G[--E[i].ff].push_back({--E[i].ss, i});
		G[E[i].ss].push_back({E[i].ff, i});
	}
	vector< vector<int> > kill_time(N);
	vector<bool> ok(N, true);
	for(int i = 0; i < N; i++) {
		kill_time[i].resize(N, -1);
		kill_time[i][i] = M;
		vector<int> qu(M+1, -1);
		qu[M] = i;
		for(int j = M; j >= 0; j--) {
			int v = qu[j];
			if(v == -1) continue;
			ALL_THE(G[v], it) if(it->ss < j) {
				if(kill_time[i][it->ff] != -1) {
					ok[i] = false;
					break;
				}
				kill_time[i][it->ff] = it->ss;
				if(qu[it->ss] == -1) qu[it->ss] = it->ff;
				if(qu[it->ss] != it->ff) {
					ok[i] = false;
					break;
				}
			}
			if(!ok[i]) break;
		}
	}
	int ans = 0;
	for(int i = 0; i < N; i++) for(int j = 0; j < i; j++) {
		if(!ok[i] || !ok[j]) continue;
		bool is_ok = true;
		for(int k = 0; k < N; k++) if(kill_time[i][k] != kill_time[j][k])
			if(kill_time[i][k] != -1 && kill_time[j][k] != -1) is_ok = false;
		if(is_ok) ans++;
	}
	cout << ans << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 4368
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#define INF (2000000000)
using namespace std;

typedef vector<int> VI;
typedef vector<int>::iterator VII;
typedef vector<double> VD;
typedef vector<double>::iterator VDI;


int rank[3];
int array[10000];

int main()
{
	fill(rank, rank + 3, INF);
	
	int n;
	scanf("%d", &n);
	
	for (int i = 0; i < n; i++){
		scanf("%d", &array[i]);
	}
	sort(array, array + n);
	
	for (int i = 0; i < min(n, 4) - 1; i++){
		for (int j = i + 1; j < min(n, 4); j++){
			char a[32];
			sprintf(a, "%d%d", array[i], array[j]);
			int b;
			sscanf(a, "%d", &b);
			for (int k = 0; k < 3; k++){
				if (b < rank[k]){
					for (int l = 2; l > k; l--){
						rank[l] = rank[l - 1];
					}
					rank[k] = b;
					break;
				}
			}
			
			sprintf(a, "%d%d", array[j], array[i]);
			sscanf(a, "%d", &b);
			for (int k = 0; k < 3; k++){
				if (b < rank[k]){
					for (int l = 2; l > k; l--){
						rank[l] = rank[l - 1];
					}
					rank[k] = b;
					break;
				}
			}
		}
	}
	
	printf("%d\n", rank[2]);
	
	return 0;
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <map>
using namespace std;

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

int main() {
	int h, w;
	while(cin >> h >> w, h || w) {
		vector<string> in(h);
		rep(y,h) {
			cin >> in[y];
		}
		int dx[3] = {w-1, 0, 1};
		int dy[3] = {h-1, 0, 1};
		map<string, int> mp;
		rep(sy, h) {
			rep(sx, w) {
				rep(iy, 3) {
					rep(ix, 3) {
						if(ix==1 && iy==1) continue;
						int nx=sx, ny=sy;
						string str = "";
						do {
							str += in[ny][nx];
							nx = (nx + dx[ix]) % w;
							ny = (ny + dy[iy]) % h;
							mp[str]++;
						} while(nx!=sx || ny!=sy);
					}
				}
			}
		}
		int mx = 0;
		string res = "";
		for(map<string, int>::iterator it=mp.begin(); it!=mp.end(); it++) {
			if( it->second == 1 ) continue;
			if(res.length() < it->first.length() || (res.length()==it->first.length() && it->first < res)) {
				mx = it->second;
				res = it->first;
			}
		}
		if(res.length() < 2) {
			res = "0";
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 36032
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll =long long;
using P = pair<int,int>;

int main(){
    int n,m;
    cin >> n >> m;
    vector<char> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n){
        if(i==m-1){
            char A = a[i];
            if('A' <= A && A <= 'Z')
                cout << (char)(A+32);
            else
                cout << (char)(A-32);
        }else
            cout << a[i];
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int r, d, x;
  cin >> r >> d >> x;
  vector<int> vec(11);
  vec[0] = x;
  for (int i = 1; i < 11; i++) {
    vec[i] = r*vec[i-1] - d;
  }
  for (int i = 1; i < 11; i++) {
    cout << vec[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL maxn(2000005), mod(1e9 + 7);
LL Jc[maxn];
void calJc()    //求maxn以内的数的阶乘
{
    Jc[0] = Jc[1] = 1;
    for(LL i = 2; i < maxn - 5; i++)
        Jc[i] = Jc[i - 1] * i % mod;
}
/*
//拓展欧几里得算法求逆元
void exgcd(LL a, LL b, LL &x, LL &y)    //拓展欧几里得算法
{
    if(!b) x = 1, y = 0;
    else
    {
        exgcd(b, a % b, y, x);
        y -= x * (a / b);
    }
}
LL niYuan(LL a, LL b)   //求a对b取模的逆元
{
    LL x, y;
    exgcd(a, b, x, y);
    return (x + b) % b;
}
*/
//费马小定理求逆元
LL pow(LL a, LL n, LL p)    //快速幂 a^n % p
{
    LL ans = 1;
    while(n)
    {
        if(n & 1) ans = ans * a % p;
        a = a * a % p;
        n >>= 1;
    }
    return ans;
}
LL niYuan(LL a, LL b)   //费马小定理求逆元
{
    return pow(a, b - 2, b);
}
LL C(LL a, LL b)    //计算C(a, b)
{
    return Jc[a] * niYuan(Jc[b], mod) % mod
        * niYuan(Jc[a - b], mod) % mod;
}
int main()
{
	int x,y;
	calJc();
	int mod = 1000000007;
	cin >> x >> y;
	int n = max(x,y) - min(x,y);
	if((x + y) % 3 != 0 || max(x,y) > 2 * min(x,y)){
		cout << 0 << endl;
	}else{
		int hh = (x + y) / 3;
		int sb = (hh - n) / 2;
		int xx = sb;
		int yy = sb + n;
//		cout << xx << " " << yy << endl;
		long long ans = 1;
		cout << C(hh,sb)<< endl;
	}
	
	return 0;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
    string o, e;
    cin >> o >> e;
    int o_len = o.length();
    int e_len = e.length();
    char ans[o_len + e_len];
    int j = 0;
    REP(i, e_len) {
        ans[j++] = o[i];
        ans[j++] = e[i];
    }
    if(o_len != e_len) ans[j] = o[o.length() - 1];
    REP(i, o_len + e_len) {
        cout << ans[i];
    }
    cout << "\n";
}


Measured memory_bytes: 256
N=int(input())
F=[]
P=[]
for i in range(N):
    F.append(list(map(int,input().split())))
for i in range(N):
    P.append(list(map(int,input().split())))
inf=1<<60
ans=-inf
for t in range(1,2**10):
    a=0
    for i in range(N):
        c=0
        for j in range(10):
            if F[i][j]==1 and (t & (1<<j)) != 0:
                c+=1
        a+=P[i][c]
    ans=max(ans,a)
print(ans)


Measured memory_bytes: 42092
void main() {
	auto N = ri;
	auto W = readAs!(int[]);
	int tmp = int.max;
	foreach(i; 0..N) {
		int a = W[0..i].sum;
		int b = W[i..$].sum;
		tmp = min(tmp, abs(a - b));
	}
	tmp.writeln;
}

// =======================111=1===========

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.ascii : toLower;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}

T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <numeric>

using namespace std;

const uint64_t MOD = 1000000000 + 7;

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

	string s;
	cin >> s;

	int m = 1 << 30;
	vector<pair<int, int>> p;
	int e = 0, w = 0;
	for (int i = 0; i < n; i++)
	{
		if (s.substr(i, 1) == "W")
		{
			w++;
		}
		else
		{
			e++;
		}
		p.push_back(make_pair(e, w));
	}

	for (int i = 0; i < n; i++)
	{
		int j = n - i - 1;
		int x;
		if (i == 0)
		{
			if (s.substr(i, 1) == "W")
			{
				x = e;
			}
			else
			{
				x = max(0, e - 1);
			}
			
		}
		else if(i == n - 1)
		{
			if (s.substr(i, 1) == "W")
			{
				x = max(0, w - 1);
			}
			else
			{
				x = w;
			}
		}
		else
		{
			if (s.substr(i, 1) == "W")
			{
				x = p.at(i - 1).second + (e - p.at(i).first);
			}
			else
			{
				x = p.at(i).second + (e - p.at(i).first);
			}
		}
		m = min(m, x);
	}

	cout << m << endl;
}


Measured memory_bytes: 6904