akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
	string c;
	cin>>c;
	if(c[0]=='a'&&c[1]=='b'&&c[2]=='c'){
		cout<<"Yes";
	}
	else if(c[0]=='a'&&c[2]=='b'&&c[1]=='c'){
		cout<<"Yes";
	}
	else if(c[1]=='a'&&c[2]=='b'&&c[0]=='c'){
		cout<<"Yes";
	}
	else if(c[1]=='a'&&c[0]=='b'&&c[2]=='c'){
		cout<<"Yes";
	}
	else if(c[2]=='a'&&c[0]=='b'&&c[1]=='c'){
		cout<<"Yes";
	}
	else if(c[2]=='a'&&c[1]=='b'&&c[0]=='c'){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
static inline void PUT(char c)
{
  static char buf[1<<15],*ptr=buf;
  if(ptr==buf+strlen(buf)||c==0){fwrite(buf,1,ptr-buf,stdout),ptr=buf;}*ptr++=c;
}
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline void OUT(int a)
{
  if(a<0)PUT('-'),a=-a;
  int d[40],i=0;do{d[i++]=a%10;}while(a/=10);
  while(i--){PUT(d[i]+48);}PUT('\n');
}
static inline int Min(int a,int b){return a<b?a:b;}
const int INF=0x3f3f3f3f;
int M,seg[800002],tag[800002];
static inline void upt(int x){seg[x]=Min(seg[x<<1],seg[x<<1|1]);}
static inline void nodeCover(int x,int l,int val){seg[x]=l-val;tag[x]=val;}
static inline void dnt(int x,int l,int r)
{
  if(tag[x])
  {
    int mid=(l+r)/2;
    nodeCover(x<<1,l,tag[x]);nodeCover(x<<1|1,mid+1,tag[x]);
    tag[x]=0;
  }
}
static inline void segCover(int u,int v,int t,int x=1,int l=1,int r=M)
{
  if(u<=l&&r<=v){nodeCover(x,l,t);return;}
  dnt(x,l,r);int mid=(l+r)/2;
  if(u<=mid){segCover(u,v,t,x<<1,l,mid);}
  if(v>mid){segCover(u,v,t,x<<1|1,mid+1,r);}
  upt(x);
}
static inline int segQuery(int p,int x=1,int l=1,int r=M)
{
  if(l==r){return p-seg[x];}dnt(x,l,r);int mid=(l+r)/2;
  return p<=mid?segQuery(p,x<<1,l,mid):segQuery(p,x<<1|1,mid+1,r);
}
int main()
{
  int N=IN()+1,count=0,cur=1,left,right;M=IN();
  while(N--)
  {
    left=IN(),right=IN();count++;
    if(cur>=left&&cur<=right)segCover(cur,right,-INF),cur=right+1;
    else if(cur<left)segCover(left,right,segQuery(left-1));
    if(cur>M){puts("");while(N--){puts("-1");}return 0;}
    OUT(seg[1]+count);if(N==1){return 0;}
  }
}

Measured memory_bytes: 5664
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll dp[3000][3000];
char ans[3000][3000];
pair<int, int> nxt[3000][3000];
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	string a, b;
	cin >> a >> b;
	int na = a.size();
	int nb = b.size();
	if (a[0] == b[0]) {
		dp[0][0] = 1;
		ans[0][0] = a[0];
	}
	else {
		dp[0][0] = 0;
		ans[0][0] = 0;
	}
	nxt[0][0] = { -1, -1};
	for (int j = 1; j < nb; j++) {
		if (a[0] == b[j]) {
			dp[0][j] = 1;
			ans[0][j] = a[0];
			nxt[0][j] = { -1, -1};
		}
		else {
			dp[0][j] = dp[0][j - 1];
			nxt[0][j] = {0, j - 1};
		}
	}
	for (int i = 1; i < na; i++) {
		if (a[i] == b[0]) {
			dp[i][0] = 1;
			ans[i][0] = b[0];
			nxt[i][0] = { -1, -1};
		}
		else {
			dp[i][0] = dp[i - 1][0];
			nxt[i][0] = { i - 1, 0};
		}
	}
	for (int i = 1; i < na; i++) {
		for (int j = 1; j < nb; j++) {
			if (a[i] == b[j]) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
				ans[i][j] = a[i];
				nxt[i][j] = {i - 1, j - 1};
			}
			else {
				if (dp[i - 1][j] > dp[i][j - 1]) {
					nxt[i][j] = {i - 1, j};
				}
				else {
					nxt[i][j] = {i, j - 1};
				}
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
	}
	int i = na - 1, jj = nb - 1, ilast, jlast;
	string res = "";
	while (i != -1) {
		if (ans[i][jj]) {
			res += ans[i][jj];
		}
		ilast = i, jlast = jj;
		i = nxt[ilast][jlast].first;
		jj = nxt[ilast][jlast].second;
	}
	reverse(res.begin(), res.end());
	cout << res;
	return 0;
}

Measured memory_bytes: 152996
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int N;
VI m_sum(111);
int con[111];
bool cut[111][111];

int main(void) {
    cin >> N;
    {
        int all_sum = N * (N + 1) / 2;
        REP(i, N) m_sum[i] = all_sum - (i + 1);
    }
    for(int i = -1; i < N; i++) {
        memset(cut, false, sizeof(cut));
        if (i > -1) {
            FOR(j, N - i, N) cut[j][N - 1] = cut[N - 1][j] = true;
            m_sum[N - 1] -= (i + 1);
            m_sum[i] -= N;
            cut[i][N - 1] = cut[N - 1][i] = true;
        }
        auto sum = m_sum;
        const int cur_sum = sum[N - 1];

        bool ok = true;
        RREP(j, N - 1) {

            while (sum[j] > cur_sum) {
                int mul;
                if (sum[j] - cur_sum < j + 1) {
                    mul = sum[j] - cur_sum;
                } else {
                    mul = j;
                }

                sum[j] -= mul;
                sum[mul - 1] -= j + 1;
                cut[j][mul - 1] = cut[mul - 1][j] = true;
            }

            if (sum[j] != cur_sum) {
                ok = false;
            }

        }
        if (ok) {
            VPII ans;
            REP(j, N) {
                FOR(k, j + 1, N) if (!cut[j][k]) {
                    ans.EB(j, k);
                }
            }
            cout << ans.size() << endl;
            FORE(e, ans) {
                cout << e.first + 1 << " " << e.second + 1 << endl;
            }
            return 0;
        }
    }
}


Measured memory_bytes: 384
def same_integers(A: int, B: int, C: int) -> int:
    A, B, C = sorted([A, B, C])
    count = (C-A)//2 + (C-B)//2
    A = A + 2 * ((C-A)//2)
    B = B + 2 * ((C-B)//2)

    A, B, C = sorted([A, B, C])
    # (A,B,C)は以下のいづれか
    # 1.(C, C, C)
    # 終了
    if A == C and B == C:
        return count
    # 2.(C-1, C, C)
    # A に 2 を足して、B, C に 1 を足す。
    if B == C:
        return count + 2
    # 3.(C-1,C-1,C)
    # A, B に 1 を足す。
    return count + 1


if __name__ == "__main__":
    A, B, C = map(int, input().split())
    ans = same_integers(A, B, C)
    print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll=long long int;
ll mod=998244353;
ll power(ll a,ll b)
{
    ll result=1;
    while(b>0)
    {
        if(b%2)
        result=(result*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return result;
}
int main()
{
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n+1);
    for(ll i=1;i<=n;i++)
    cin>>a[i];
    ll p=power(2,mod-2);
    vector<vector<ll> > dp(n+1,vector<ll> (k+3));
    dp[0][0]=power(2,n);
    // cout<<dp[0][0]<<endl;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=k;j++)
        {
            dp[i][j]=dp[i-1][j];
            if(j-a[i]>=0)
            {
                (dp[i][j]+=((dp[i-1][j-a[i]])*p)%mod)%=mod;
            }
            
        }
    }
    cout<<dp[n][k]<<endl;


    
}

Measured memory_bytes: 73684
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <cassert>
#ifdef DEBUG
#include "./Lib/debug.hpp"
#else
#define dump(...)
template<class T>inline auto d_val(T a, T b) { return a; }
#endif

/* (=＾o＾=) */
#define int ll

/* macro */
#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define REPI2(it,b,e) for(auto it = (b); it != (e); ++it)
#define REPI(it,c) REPI2(it, (c).begin(), (c).end())
#define RREPI(it,c) REPI2(it, (c).rbegin(), (c).rend())
#define REPI_ERACE2(it, b, e) for(auto it = (b); it != (e);)
#define REPI_ERACE(it, c) REPI_ERACE2(it, (c).begin(), (c).end())
#define ALL(x) (x).begin(),(x).end()
#define cauto const auto&
/* macro func */
#define SORT(x) do{sort(ALL(x));}while(false)
#define RSORT(x) do{sort((x).rbegin(),(x).rend());}while(false)
#define UNIQUE(v) do{v.erase( unique(v.begin(), v.end()), v.end() );}while(false)
#define MAX(x,y) do{x = std::max(x,y);}while(false)
#define MIN(x,y) do{x = std::min(x,y);}while(false)
#define BR do{cout<<"\n";}while(false)

/* type define */
using ll = long long;
using PAIR = std::pair<ll, ll>;
using VS = std::vector<std::string>;
using VL = std::vector<long long>;
using VVL = std::vector<VL>;
using VVVL = std::vector<VVL>;
using VD = std::vector<double>;
template<class T>
using V = std::vector<T>;

/* using std */
using std::cout;
constexpr char endl = '\n';
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::queue;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::unordered_multiset;
using std::multiset;
using std::bitset;
using std::priority_queue;

/* constant value */
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;

/* Initial processing  */
struct Preprocessing { Preprocessing() { std::cin.tie(0); std::ios::sync_with_stdio(0); }; }_Preprocessing;

/* Remove the source of the bug */
signed pow(signed, signed) { assert(false); return -1; }

/* define hash */
namespace std { template <>	class hash<std::pair<ll, ll>> { public:	size_t operator()(const std::pair<ll, ll>& x) const { return hash<ll>()(1000000000 * x.first + x.second); } }; }

/* input */
template<class T> std::istream& operator >> (std::istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }

//=============================================================================================

signed main() {
	string a, b;
	cin >> a >> b;
	ll cnt = 0;
	REP(i, a.size()) {
		cnt += a[i] == b[i];
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
import math
n = int(input())
s = [list(map(int, input().split())) for i in range(n)]

dist = 0
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        dist += math.sqrt((s[i][0]-s[j][0])**2 + (s[i][1]-s[j][1])**2)
ans = dist/n
print(ans)

Measured memory_bytes: 3064
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = 1;
        while(true){
            int x = sc.nextInt();
            
            if(x == 0){
                break;
            }
            
            System.out.println("Case " + n + ": " + x );
            n++;
        }
    }
}


Measured memory_bytes: 41576
/*      ░░█ ▄▀█ █   █▀ █░█ █▀█ █▀▀ █▀▀   █▀█ ▄▀█ █▀▄▀█
        █▄█ █▀█ █   ▄█ █▀█ █▀▄ ██▄ ██▄   █▀▄ █▀█ █░▀░█     */

// Author : Udit "luctivud" Gupta @ (https://www.linkedin.com/in/udit-gupta-1b7863135/)


#include <bits/stdc++.h>
#pragma GCC optimize "trapv"

using namespace std;

typedef long long int lld;
typedef unsigned long long int llu;


#define       TESTCASES()  cin >> (T3X0); T353 = T3X0; while(T3X0--)
#define       _input(V3C)  for(auto &V3C_I7 : (V3C)) cin >> (V3C_I7)
#define mems(A77AY, V4LU)  memset((A77AY), (V4LU), sizeof((A77AY)))
#define  CH3K(I7, E4, S7)  (((S7)<0) ? (I7)>(E4) : (I7)<(E4))
#define for4(I7,S4,E4,S7)  for(auto I7=(S4); CH3K(I7,E4,S7); (I7)+=(S7))




void solveEachTest(lld T35TC453N = 1) {

	string a, b; cin >> a >> b;
	lld n = (lld) a.length();
	lld m = (lld) b.length();
	puts((n == m and a == b) ? "EQUAL" : (n > m or n == m and a > b) ? "GREATER" : "LESS");
	return;
}


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

	lld T3X0 = 0, T353 = 1;

	// TESTCASES()
	solveEachTest(T353 - T3X0);
	return 0;
}
// Random Thought :  null

Measured memory_bytes: 3632
import string

S = list(input())
T = list(string.ascii_lowercase)
found = 0
for i in range(0, 26):
  for j in range(0, len(S)):
    if T[i] == S[j]:
      break
    if j == len(S)-1:
      print(T[i])
      found = 1
  if found == 1:
    break
  if i == 25:
    print('None')


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, n);
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  int ans = 0;
  int moved = 0;
  for (int i = 1; i < n; ++i) {
    if (h[i] <= h[i - 1]) {
      ++moved;
      ans = max(ans, moved);
    } else {
      moved = 0;
    }
  }
  out(ans);
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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);
    int N; cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    ll ans=INF;
    rep2(i,1,101){
        ll cnt=0;
        rep(j,N) cnt+=(i-A[j])*(i-A[j]);
        chmin(ans,cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long A = sc.nextLong();
    long B = sc.nextLong();
    Main abc122D = new Main();
    System.out.println(abc122D.solve(A, B));
  }

  public long solve(long A, long B){
    return f(A-1) ^ f(B);
  }

  private long f(long x) {
    if(x % 2 == 0){
      return x^(x/2%2);
    } else {
      return f(x+1) ^ (x+1);
    }
  }
}


Measured memory_bytes: 23892
// Born Sinner
// old but im not that old
// fuck all you hoes get a grip
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static int modPower(int x, int y, int mod){
        int res = 1;
        x %= mod;
        if(x==0) return 0;
        while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        }
        return res;
    }
    static class pair<T1, T2>{
        T1 first;
        T2 second;
        pair(T1 first, T2 second){
            this.first = first;
            this.second = second;
        }
    }
    
    public static void main (String[] args) throws java.lang.Exception
    {
        FastReader in = new FastReader();
        int t = 1;
        //t = in.nextInt();
        while(t-->0){
            int n = in.nextInt();
            long[] a = new long[n];
            for(int i = 0; i < n; i++) {
                a[i] = in.nextLong();
            }
            long[] suffix = new long[n+1];
            long mod = (long)(1E9 + 7);
            for(int i = n-1; i >= 0; i--) {
                suffix[i] = (suffix[i+1] + a[i]);
                suffix[i] %= mod;
            }

            long ans = 0;
            for(int i = 0; i < n-1; i++) {
                ans += ((a[i] * (suffix[i+1]))%mod);
            }
            System.out.println(ans%mod);
        }
    }
}


Measured memory_bytes: 55952
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n, a, b = MI()
    d = b - a
    ans = 0
    if d%2:
        temp = min(a-1, n-b)
        ans = (d-1)//2 + temp + 1
    else:
        ans = d//2
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9164
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;
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; }

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
typedef long double ldouble;

typedef vector<llong> vecllong;
typedef vector<vecllong> vvecllong;

const llong MOD = 1e9 + 7;
const llong INF = 1e17;

#define FOR(i, n) for (llong i = 0; i < n; i++)
#define FORS(i, a, b) for (llong i = a; i < b; i++)
#define FORR(i, n) for (llong i = n; i > 0; i++)

llong memo[3000][3000][2] = {0};  // memo[left][right][0:first/1:second] = sumX
bool confilm[3000][3000][2] = {false};

llong deq[3000] = {0};

llong search(llong left, llong right, bool isFirst) {
    if(left == right) {
        if(isFirst) return deq[left];
        else return 0;
    }

    int type = isFirst ? 0 : 1;
    if(confilm[left][right][type] > 0) {
        return memo[left][right][type];
    }

    confilm[left][right][type] = true;
    llong leftTake = search(left + 1, right, !isFirst) + (isFirst ? deq[left] : 0);
    llong rightTake = search(left, right - 1, !isFirst) + (isFirst ? deq[right] : 0);

    if(isFirst) {
        memo[left][right][type] = max(leftTake, rightTake);
        return memo[left][right][type];
    } else {
        memo[left][right][type] = min(leftTake, rightTake);
        return memo[left][right][type];
    }
};

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

    llong N;
    llong sum = 0;
    cin >> N;
    FOR(i, N) {
        cin >> deq[i];
        sum += deq[i];
    }

    llong ans = search(0, N - 1, true);

    cout << (ans - (sum - ans)) << endl;

    return 0;
}

Measured memory_bytes: 158208
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    l = list(map(int, input().split()))
    D = int(l[0])
    T = int(l[1])
    S = int(l[2])
    
    if D/S<= T:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 9164
n = int(input())
edge = [tuple(map(int, input().split())) for _ in range(n-1)]

connect = [set() for _ in range(n)]
for a, b in edge:
    connect[a-1].add(b-1)
    connect[b-1].add(a-1)

ans = {(-1, 0): -1}
que = {(-1, 0)}
while que:
    queque = set()
    for p, v in que:
        c = 1
        for w in connect[v]:
            if w != p:
                if c == ans[(p, v)]:
                    c += 1
                ans[(v, w)] = c
                queque.add((v, w))
                c += 1
    que = queque
pri = [0] * (n-1)
for i, (a, b) in enumerate(edge):
    a -= 1
    b -= 1
    if (a, b) in ans:
        pri[i] = ans[(a, b)]
    else:
        pri[i] = ans[(b, a)]
print(max(pri))
for x in pri:
    print(x)

Measured memory_bytes: 64216
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);
bool G[8][8] = {0};


int main(){
  int N;
  ll ans = 1;
  bool can = true;
  cin >> N;
  int C[N]= {0};
  rep(i, N){
    int a;
    cin >> a;
    C[a]++;
  }
  if(N%2){
    if(C[0] != 1)
      can = false;
    for(int i=1; i<=N/2; i++){
      if(C[2*i] != 2)
        can = false;
    }
  }
  if(!(N%2)){
    rep(i, (N-2)/2){
      if(C[2*i+1] != 2)
        can = false;
    }
  }
  if(!(can)) cout << 0 << endl;
  else {
    rep(i, N/2){
    ans *= (ll) 2;
    ans %= MOD;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
int N;
int f[305][305],imos[305][305];
int l[305],r[305];
int sum(int i,int j,int k)
{
	return imos[j][k]-imos[j][k-1]-imos[i-1][k]+imos[i-1][k-1];
}
int add(int i,int j,int k)
{
	if(i==j)return f[i][k];
	return f[i][k]+f[j][k];
}
int main()
{
	scanf("%d",&N);
	for(int i=1;i<=N;i++)
	{
		for(int j=1;j<=N;j++)
		{
			scanf("%d",&f[i][j]);
			imos[i][j]=f[i][j];
		}
	}
	for(int i=1;i<=N;i++)
	{
		for(int j=1;j<=N;j++)
		{
			imos[i][j+1]+=imos[i][j];
		}
	}
	for(int j=1;j<=N;j++)
	{
		for(int i=1;i<=N;i++)
		{
			imos[i+1][j]+=imos[i][j];
		}
	}
	int ans = -INF;
	for(int i=1;i<=N;i++)
	{
		for(int j=i;j<=N;j++)
		{
			l[1]=sum(i,j,1);
			for(int k=1;k<=N;k++)ans = max(ans,sum(i,j,k));
			for(int k=2;k<=N;k++)l[k] = max(l[k-1]+add(i,j,k),sum(i,j,k));
			r[N]=sum(i,j,N);
			for(int k=N-1;k>=1;k--)r[k] = max(r[k+1]+add(i,j,k),sum(i,j,k));
			for(int k=1;k<N;k++)ans = max(ans,l[k]+r[k+1]);
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1916
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int main(){
	ll X, Y;
	cin >> X >> Y;

	int ans = 0;
	while(X<=Y){
		ans++;
		X *= 2;
	}
	cout << ans <<endl;
	
    
  	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
using namespace std;
int main() {
	int n, a, ans = 1e9, yan = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		while (!(a % 2)) {
			yan++;
			a /= 2;
		}
		ans = min(ans, yan);
		yan = 0;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include "bits/stdc++.h"
using namespace std;

#ifdef LOCAL
#include "debug.h"
#define input \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#else
#define debug(...) 4
#define input 4
#endif

using ll = long long;
const int N = 2e6 + 5;
const int mod = 1e9 + 7;
int n, m, k;
long long dp[3005][3005][4];
vector<pair<int, long long>> v[3002];
long long solve(int i, int j, int picked) {
    if(i == n + 1) {
        return 0;
    }
    if(~dp[i][j][picked])
        return dp[i][j][picked];

    if(v[i].empty())
        solve(i + 1, j, 0);
    long long ans = 0;
    auto it = lower_bound(v[i].begin(), v[i].end(), make_pair(j, 0ll)) - v[i].begin();
    if(it != v[i].size()) {
        auto x = v[i][it];
        if(x.first >= j and picked < 3) {
            ans = max(ans, x.second + solve(i, x.first + 1, picked + 1));
            ans = max(ans, x.second + solve(i + 1, x.first, 0));
        }
        ans = max(ans, solve(i, x.first + 1, picked));
    }
    ans = max(ans, solve(i + 1, j, 0));
    return dp[i][j][picked] = ans;
}
int32_t main() {
    input;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m >> k;
    for(int i = 0; i < k; i++) {
        int x, y, price;
        cin >> x >> y >> price;
        v[x].push_back(make_pair(y, price));
    }
    for(int i = 0; i <= 3000; i++) {
        sort(v[i].begin(), v[i].end());
    }
    memset(dp, -1, sizeof dp);
    cout << solve(0, 0, 0);


}


Measured memory_bytes: 291500
#include<iostream>

using namespace std;

int sum(int n){
  return n*(n+1)/2;
}

int main(void){

  int n;
  while(cin >> n,n){
    int cnt = 0;

    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	if(sum(j)-sum(i)==n)cnt++;
      }
    }
    cout << cnt << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    string s;
    vi v(3);
    cin >> s;
    for (char c: s) ++v[c - 'a'];
    bool ok = true;
    forn(i, 3) forn(j, 3) ok &= abs(v[i] - v[j]) <= 1;
    cout << (ok ? "YES" : "NO") << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main (){
    int a,b,c,i,count=0;
    scanf("%d%d%d",&a,&b,&c);
    for (i = a; i <= b; i++){
        if (c%i == 0)  count++;
    }
    printf("%d\n",count);
    return 0;
}



Measured memory_bytes: 2760
n = int(raw_input())
W = map(int, raw_input().split())
s = min(W)
T = [0] * (max(W)+1)

def solve():
    ans = 0
    B = W[:]
    V = [False] * n

    B = sorted(B)
    for i in xrange(n):
        T[B[i]] = i
    for i in xrange(n):
        if V[i]:
            continue
        cur = i
        S = 0
        m = max(W)+1
        an = 0
        while True:
            V[cur] = True
            an += 1
            v = W[cur]
            m = min(m, v)
            S += v
            cur = T[v]
            if V[cur]: break
        ans += min(S + (an - 2) * m, m + S + (an + 1) * s)

    return ans

def main():
    ans = solve()
    print ans
    return 0

main()

Measured memory_bytes: 6496
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
	int n;
	cin >> n;
	cout << ((n % 2) ? (n * 2) : n) << '\n';
	return 0;
}


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

int main () {
  int N, K;
  cin >> N >> K;
  
  vector<int> S(N, 0);
  
  int d = 0, have = 0;
  for (int i = 0; i < K; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> have;
      S.at(have-1) = 1;
    }
  }
  
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == 0) {
      count++;
    }
  }
  
  cout << count;
}

Measured memory_bytes: 3600
#include<iostream>
#define ll long long
using namespace std;
int main()
{
  ll a,b,c,a1,b1,c1;
  int result=0;
  cin>>a>>b>>c;
  if(a%2!=0 || b%2!=0 || c%2!=0)
  {
    cout<<0;
  }
  else if(a==b && b==c)
  {
    cout<<-1;
  }
  else
  {
  	while(a%2==0 && b%2==0 && c%2==0)
  	{
      a1=a;
      b1=b;
      c1=c;
      a=b1/2+c1/2;
      b=a1/2+c1/2;
      c=a1/2+b1/2;
      result++;
    }
    cout<<result;
  }
  return 0;
}
    


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


using namespace std;


int main(){
    int b[2][3];
    for(int i = 0;i < 2;i++){
        for(int j = 0;j < 3;j++){
            cin >> b[i][j];
        }
    }

    if(b[0][0] == b[1][0]){
        int d1 = 100 * b[0][1] + b[0][2],d2 = 100 * b[1][1] + b[1][2];
        if(d1 == d2){
            cout << 0 << endl;
        }else{
            cout << 1 << endl;
        }
        return 0;
    }else if(b[0][0] > b[1][0]){
        for(int i = 0;i < 3;i++){
            swap(b[0][i],b[1][i]);
            /* 
            int tmp;
            tmp = b[0][i];
            b[0][i] = b[1][i];
            b[1][i] = tmp;
            */
        }
    }
    int ans = b[1][0] - b[0][0];
    int d1 = 100 * b[0][1] + b[0][2],d2 = 100 * b[1][1] + b[1][2];
    if(d2 - d1 > 0)ans++;
    cout << ans << endl;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int w,h;
    while (cin>>w>>h) {
        if (w==0&&h==0) {
            break;
        }
        std::vector<vector<int>> vec(h*2+1,vector<int>(w*2+1));
        for (int i=0;i<h*2+1;i++) {
            for (int j=0;j<w*2+1;j++) {
                vec[i][j]=0;
            }
        }
        for (int i=0;i<h*2+1;i++) {
            vec[i][0]=-1;
            vec[i][w*2]=-1;
        }
        for (int i=0;i<w*2+1;i++) {
            vec[0][i]=-1;
            vec[h*2][i]=-1;
        }
        int a;
        for (int i=0;i<2*h-1;i++) {
            if (i%2==0) {
                for (int j=0;j<w-1;j++) {
                    cin>>a;
                    if (a==1) {
                        vec[i+1][(j+1)*2]=-1;
                    }
                }
            } else {
                for (int j=0;j<w;j++) {
                    cin>>a;
                    if (a==1) {
                        vec[i+1][j*2+1]=-1;
                    }
                }
            }
        }
        /*
        for (int i=0;i<h*2+1;i++) {
            for (int j=0;j<w*2+1;j++) {
                cout<<vec[i][j]<<" ";
            }cout<<endl;
        }*/
        std::deque<pair<int,int>> deq;
        deq.emplace_back(make_pair(1,1));
        vec[1][1]=1;
        int flag=0;
        while (deq.size()!=0) {
            int x=deq.front().first;
            int y=deq.front().second;
            if (x==h*2-1&&y==w*2-1) {
                cout<<vec[x][y]<<endl;
                flag=1;
                break;
            } else if (x+2<h*2+1&&vec[x+1][y]==0&&vec[x+2][y]==0) {
                deq.emplace_back(make_pair(x+2,y));
                vec[x+2][y]=vec[x][y]+1;
            } else if (y+2<w*2+1&&vec[x][y+1]==0&&vec[x][y+2]==0) {
                deq.emplace_back(make_pair(x,y+2));
                vec[x][y+2]=vec[x][y]+1;
            } else if (x-2>0&&vec[x-1][y]==0&&vec[x-2][y]==0) {
                deq.emplace_back(make_pair(x-2,y));
                vec[x-2][y]=vec[x][y]+1;
            } else if (y-2>0&&vec[x][y-1]==0&&vec[x][y-2]==0) {
                deq.emplace_back(make_pair(x,y-2));
                vec[x][y-2]=vec[x][y]+1;
            } else {
                deq.pop_front();
            }
        }
        /*
        for (int i=0;i<h*2+1;i++) {
            for (int j=0;j<w*2+1;j++) {
                if (vec[i][j]!=0) {
                    cout<<vec[i][j]<<" ";
                } else {
                    cout<<" "<<vec[i][j]<<" ";
                }
            }cout<<endl;
        }*/
        if (flag==0) {
            cout<<0<<endl;
        }
    }
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
ll llmax = LLONG_MAX;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
vi d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}
void mysort(vs &a) {sort(a.begin(), a.end());}

int main() {
  string x;
  cin >> x;
  ll n = x.size(), cnt = 0, s = 0, t = 0;
  if (x[0] == 'S') s++;
  else t++;
  for (ll i = 1; i < n; i++) {
    if (t == 0 && x[i] == 'S') s++;
    else if (x[i] == 'S') {
      if (s == t) {
        s = 1;
        t = 0;
      }
      else if (s > t) {
        s -= t;
        s++;
        t = 0;
      }
      else {
        cnt += t - s;
        s = 1;
        t = 0;
      }
    }
    else if (s == 0 && x[i] == 'T') cnt++;
    else if (x[i] == 'T') t++;
    //cout << cnt << " " << s << " " << t << endl;
  }
  cnt += max(s - t, t - s);
  cout << cnt << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,m,now=0;
	string ic[257]={},out,log[2]={"Opened by ","Closed by "};
	for(cin>>n;n>0;n--)cin>>ic[n];
	for(cin>>m;m>0;m--){
		bool kawa=0;
		cin>>out;
		for(int j=1;j<255;j++)if(ic[j]==out)kawa=1;
		if(kawa)cout<<log[now]+out<<endl;
		else cout<<"Unknown "+out<<endl;
		now=(now+kawa)%2;
	}
}

Measured memory_bytes: 1224
#include<stdio.h>

int main(){
 int W,H,x,y,r;
 scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);

 if(x-r<0){
 printf("No\n");
}else if(y-r<0){
 printf("No\n");
 }else if(y+r>H){
 printf("No\n");
 }else if(x+r>W){
 printf("No\n");
 }else{
 printf("Yes\n");
}
return 0;
}




Measured memory_bytes: 2108
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

ll c[200000];
#define M 1000000007

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n = gi();
    for (int i = 0; i < n; i++)
        c[i] = gi();

    if (n == 1) {
        printf("%d\n", (int(c[0]) * 2)%M);
        return 0;
    }

    sort(c, c+n);

    ll t4 = 1;
    for (int i = 2; i < n; i++) {
        t4 *= 2;
        t4 %= M;
    }
    ll t2 = (t4*2)%M;
    ll t1 = (t2*2)%M;

    ll res = 0;
    for (int i = 0; i < n; i++) {
        res += (((t2 + t4*(n-1-i)) % M) * c[i]) % M;
        res %= M;
    }

    res *= t1;
    res %= M;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1792
import copy
def dfs(graph,s):
    S=[s]
    visited=[s]
    while len(S)>0:
        v=S.pop()

        for n in graph[v]:

            if n not in visited:
                S.append(n)
                visited.append(n)
    return len(visited)


if __name__ == '__main__':
    N,M=list(map(int,input().split()))
    graph={i+1:[] for i in range(N)}
    E=[]
    for i in range(M):
        a,b=list(map(int,input().split()))
        graph[a].append(b)
        graph[b].append(a)
        E.append((a,b))

    ans=0
    for e in E:
        a,b=e[0],e[1]
        copied=copy.deepcopy(graph)
        copied[a].remove(b)
        copied[b].remove(a)
        if dfs(copied,1)!=N:
            ans+=1
    print(ans)






Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <array>
#define llt long long int

using namespace std;
int main()
{
    int n;

    cin >> n;
    array<int, 250> a;

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

    int cnt = 0;

    while (true)
    {
        bool exist_odd = false;
        for (int i = 0; i < n; i++)
        {
            if (a[i] % 2 != 0)
                exist_odd = true;
        }

        if (exist_odd)
            break;

        for (int i = 0; i < n; i++)
        {
            a[i] /= 2;
        }
        cnt++;
    }

    cout << cnt << endl;
}


Measured memory_bytes: 888
class LazySegTree:
    inf = 2147483647
    INF = [-1,2147483647]
    def __init__(self,n_):
        self.n_ = n_
        self.n = 1
        while self.n < n_: self.n*=2
        self.st = [self.INF]*(2*self.n-1)
        self.lazy = [self.INF]*(2*self.n-1)

    def propagate(self,k):
        if self.lazy[k]==self.INF:return
        self.st[k] = self.lazy[k][1]
        if k<self.n_-1:
            self.lazy[k*2+1] = self.lazy[k]
            self.lazy[k*2+2] = self.lazy[k]
        self.lazy[k] = self.INF
    
    def update(self,a,b,k,x,l,r):
        #self.propagate(k)
        if r<=a or b<=l :return
        if a<=l and r<=b:
            self.st[k] = x
            self.lazy[k] = x
            return
        self.update(a,b,k*2+1,x,l,(l+r)//2)
        self.update(a,b,k*2+2,x,(l+r)//2,r)

    def Update(self,a,b,x):
        return self.update(a,b,0,x,0,self.n)

    def search(self,k,l,r):
        #self.propagate(k)
        k += self.n-1
        res = self.INF
        while 0<=k:
            res = max(res,self.lazy[k])
            k = (k-1)//2
        return res[1]

    def Search(self,k):
        return self.search(k,0,self.n)

def main():
    n,m = map(int,input().split())
    lst = LazySegTree(n)
    for i in range(m):
        q = list(map(int,input().split()))
        if q[0] == 0:
            lst.Update(q[1],q[2]+1,[i,q[3]])
        else        :print(lst.Search(q[1]))

if __name__ == '__main__':
    main()




Measured memory_bytes: 14348
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String n=sc.next();
    if (n.charAt(0)=='9'||n.charAt(1)=='9') {
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000 * 1000 * 1000 + 7;
const int MAXN = 3001;
int nb[MAXN][MAXN];
int32_t main()
{
	int N;
	cin >> N;
	string s;
	cin >> s;
	nb[0][0] = 1;
	for (int i = 0 ; i < N - 1 ; i++)
	{
		if (s[i] == '>')
		{
			int sommeActu = 0;
			for (int j = i ; j >= 0 ; j--)
			{
				sommeActu+=nb[i][j];
				sommeActu%=MOD;
				nb[i + 1][j] = sommeActu;
			}
		}
		else
		{
			int sommeActu = nb[i][0];
			for (int j = 1 ; j <= i + 1; j++)
			{
				nb[i + 1][j] = sommeActu;
				sommeActu += nb[i][j];
				sommeActu %= MOD;
			}
		}
	}
	int total = 0;
	for (int i = 0 ; i < N ; i++)
	{
		total = (total + nb[N - 1][i]) % MOD;
	}
	cout<<total<<endl;
}

Measured memory_bytes: 68992
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n; cin>>n;
    vector<int> p(n);
    rep(i,n) cin>>p[i];
    int ans=0;
    rep(i,n){
        while(p[i]%2==0){
            ans++;
            p[i]/=2;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
var lines = [];

var readline = require('readline')
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', (x) => {
    lines.push(x);
});

rl.on('close', () => {
    var N = Number(lines[0]);
    var ans = 0

    if (N % 2 === 0) { ans = N / 2 * N / 2; }
    else { ans = (N - 1) / 2 * ((N - 1) / 2 + 1); }
    
    console.log(ans);
});

Measured memory_bytes: 7500
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(__typeof((X).begin()) it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)(x).size())

using namespace std;

struct timer{
	time_t start;
	timer(){start=clock();}
	~timer(){cerr<<1.*(clock()-start)/CLOCKS_PER_SEC<<" secs"<<endl;}
};

typedef istringstream iss;
typedef long long ll;
typedef pair<int,int> pi;
typedef stringstream sst;
typedef vector<int> vi;

int N,y[500010],n[500010];
ll end[500010],nosave[500010],dep[500010],ans[500010];

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	cin>>N;
	rep(i,N-1)cin>>y[i]>>n[i],y[i]--,n[i]--;
	
	end[N-1]=1;
	for(int i=N-2;i>=0;i--){
		end[i] = end[y[i]] + end[n[i]];
	}
	
	nosave[N-1]=1;
	for(int i=N-2;i>=0;i--){
		nosave[i] = end[y[i]]+nosave[y[i]] + end[n[i]]+nosave[n[i]];
	}
	
	dep[0]=0;
	rep(i,N-1){
		dep[y[i]] = dep[n[i]] = dep[i]+1;
	}
	
	ans[N-1]=0;
	for(int i=N-2;i>=0;i--){
		ans[i] = min( 1+ans[y[i]] + dep[i] + 1+ans[n[i]], min(
			nosave[y[i]] + 1+ans[n[i]],
			nosave[n[i]] + 1+ans[y[i]]) );
	}
	cout<<ans[0]<<endl;
}

Measured memory_bytes: 20724
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define flash ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define pii pair<int,int>
#define ff first
#define ss second
#define mod 1000000007


int main() {
flash;

    int a; cin>>a;
    cin.ignore();
    string s; cin>>s;
    int n = s.length();
    
    for(int i=0;i<n;i++){
        
        s[i] += a;
        
        if(s[i]>'Z'){ s[i] -= 26; }
    }
    
    cout<<s;
    
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		/* if (N == 1 && M == 1) {
			System.out.println(0);
		} else if (N == 1) {
			System.out.println(M * (M - 1) / 2);
		} else if (M == 1) {
			System.out.println(N * (N - 1) / 2);
		} else {
			System.out.println(N * (N - 1) / 2 + M * (M - 1) / 2);
		}*/
		System.out.println(N * (N - 1) / 2 + M * (M - 1) / 2);
		scan.close();
	}
}


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

int main(){
  string s;
  cin>>s;
  string t="abc";
  sort(s.begin(),s.end());
  if(s==t){
    cout<<"Yes"<<endl;
  }else {
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
A = [list(input()) for _ in range(H)]
B = [[0 for w in range(W+2)] for h in range(H+2)]
for h in range(1,H+1):
    for w in range(1,W+1):
        if A[h-1][w-1] == '#':
            B[h][w] = -1
for h in range(1,H+1):
    for w in range(1,W+1):
        if A[h-1][w-1] != '#':
            if B[h-1][w] == -1 or B[h+1][w] == -1 or B[h][w-1] == -1 or B[h][w+1] == -1:
                B[h][w] = 1
            else:
                if B[h-1][w] == 0 and B[h+1][w] == 0 and B[h][w-1] == 0 and B[h][w+1] == 0:
                    pass
                else:
                    k = [B[h-1][w],B[h+1][w],B[h][w-1],B[h][w+1]]
                    k = [i for i in k if i > 0]
                    B[h][w] = min(k)+1
for w in reversed(range(1,W+1)):
    for h in reversed(range(1,H+1)):
        if A[h-1][w-1] != '#':
            if B[h-1][w] == -1 or B[h+1][w] == -1 or B[h][w-1] == -1 or B[h][w+1] == -1:
                B[h][w] = 1
            else:
                if B[h-1][w] == 0 and B[h+1][w] == 0 and B[h][w-1] == 0 and B[h][w+1] == 0:
                    pass
                else:
                    k = [B[h-1][w],B[h+1][w],B[h][w-1],B[h][w+1]]
                    k = [i for i in k if i > 0]
                    B[h][w] = min(k)+1

#print(B)
ans = 0
for h in range(1,H+1):
    for w in range(1,W+1):
        ans = max(ans,B[h][w])
print(ans)


Measured memory_bytes: 97500
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
   ll n,i,j,cc=0;
   cin>>n;
   ll ara[n];for(i=0;i<n;i++)cin>>ara[i];
   sort(ara,ara+n);
   cout<<ara[n/2]-ara[n/2-1]<<endl;
return 0;
}


Measured memory_bytes: 5760