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

using namespace std;

#define sz(x) ((int) ((x).size()))
typedef long long ll;
typedef long double ld;

int n, l, a[200000];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cin >> n >> l;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  int ind = -1;
  for (int i = 0; i < n - 1; i++)
    if (a[i] + a[i + 1] >= l)
      ind = i;
  if (ind == -1)
    cout << "Impossible\n";
  else {
    cout << "Possible\n";
    for (int i = 0; i < ind; i++)
      cout << i + 1 << "\n";
    for (int i = n - 2; i >= ind; i--)
      cout << i + 1 << "\n";
  }
}


Measured memory_bytes: 1280
# ALDS1_1_B: Greatest Common Divisor
import sys
x, y = map(int, sys.stdin.readline().strip().split())


def gcd(x, y):
    if x <= y:  # x のほうが
        x, y = y, x

    r = -1
    while r != 0:
        r = x % y
        x = y
        y = r
    return x


print(gcd(x, y))



Measured memory_bytes: 5604
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

const int MAXN = 100100;
const int MOD7 = 1000000007ll;
const int MOD9 = 1000000009ll;
const int INF = 2000000000;
const double ESP = 1e-9;
const double PI = 3.14159265358979;
const int dir_4r[] = { -1, 1, 0, 0 };
const int dir_4c[] = { 0, 0, -1, 1 };
const int dir_8r[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
const int dir_8c[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

int cnt[MAXN];

int main()
{
	int n, ans, val;
	scanf("%d", &n);
	memset(cnt, 0, sizeof(cnt));
	for (int i = 0; i < n; ++i)
	{
		scanf("%d", &val);
		cnt[val]++;
		cnt[val + 1]++;
		cnt[val + 2]++;
		ans = max(ans, cnt[val]);
		ans = max(ans, cnt[val + 1]);
		ans = max(ans, cnt[val + 2]);
	}
	printf("%d\n", ans);

	//system("pause");
	return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;


int main()
{
   int S,left,right;
   //bool test1=false,test2=false;
   cin>>S;
    right=S%10+((S/10)%10)*10;
    int aux=(S/10)/10;
    left=(aux/10)*10+aux%10;
  //  cout<<"left="<<left<<" right="<<right<<endl;
    if ((left>0)&&(right>0)&&(right<=12)&&(left<=12))
        cout<<"AMBIGUOUS"<<endl;
    else if ((left>=0)&&(right>0)&&(right<=12))
        cout<<"YYMM"<<endl;
    else if ((left>0)&&(right>=0)&&(left<=12))
        cout<<"MMYY"<<endl;
    else cout<<"NA"<<endl;
        return 0;
}

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

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

    string s, t;
    cin >> s >> t;

    const int ssz = s.size();
    const int tsz = t.size();

    int ans = INT_MAX;

    for (int i = 0; i + tsz - 1 < ssz; ++i) {
        int candidate = 0;

        for (int j = 0; j < tsz; ++j) {
            if (s[i + j] != t[j]) {
                ++candidate;
            }
        }

        ans = min(ans, candidate);
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <algorithm>
#include <memory.h>
#include <queue>
using namespace std;

int a[100001],k;
vector<int> v[100001];
int dist[100001],cnt;

int sparse[100001][17];

bool check[100001];

void dfs(int now,int len)
{
	if(check[now]) return;
	check[now]=true;
	dist[now]=len;
	for(auto dest:v[now])
		dfs(dest,len+1);
}

bool visited[100001];
void make_visit(int now)
{
	if(visited[now]) return;
	visited[now]=true;
	for(auto dest:v[now])
		make_visit(dest);
}

priority_queue<pair<int,int>> pq;

int main()
{
	int n;
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(i!=1) v[a[i]].push_back(i);
	}
    if(a[1]!=1) a[1]=1, cnt++;

    for(int i=1;i<=n;i++)
		sparse[i][0]=a[i];
	for(int i=1;i<=16;i++)
		for(int j=1;j<=n;j++)
			sparse[j][i]=sparse[sparse[j][i-1]][i-1];

	dfs(1,0);
	for(int i=1;i<=n;i++)
		if(dist[i]>k)
			pq.push(make_pair(dist[i],i));
	while(!pq.empty())
	{
		int now=pq.top().second;
		pq.pop();
		if(visited[now]) continue;

		int need=k-1;
		for(int i=16;i>=0;i--)
			if(need&(1<<i)) now=sparse[now][i];
		make_visit(now);
		cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 17528
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;

#define INF 1000000

int main() {
  int index_A, index_Z;
  string s;
  cin >> s;

  for(int i=0; i<=(int)(s.size())-1; ++i) {
    if(s[i]=='A') {
      index_A = i;
      break;
    }
  }
  for(int i=(int)(s.size())-1; i>=0; --i) {
    if(s[i]=='Z') {
      index_Z = i;
      break;
    }
  }

  cout << index_Z-index_A+1 << endl;

  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#define MAX 100000
#define SENTINEL 2000000000
 
struct Card {
  char suit;
  int value;
};
 
struct Card L[MAX/2+2], R[MAX/2+2];
 
void merge(struct Card A[], int n, int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for(int i=0;i<n1;i++) L[i] = A[left + i];
  for(int i=0;i<n2;i++) R[i] = A[mid  + i];
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for(k=left; k<right; k++) {
    if(L[i].value <= R[j].value) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}
 
void mergeSort(struct Card A[], int n, int left, int right) {
  if(left+1 < right) {
    int mid = (left+right) / 2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid, right);
    merge(A,n,left,mid,right);
  }
}
 
int partition(struct Card A[], int n, int p, int r) {
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j].value <= x.value) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}
 
void quickSort(struct Card A[], int n, int p, int r) {
  int q;
  if(p<r) {
    q = partition(A,n,p,r);
    quickSort(A,n,p,q-1);
    quickSort(A,n,q+1,r);
  }
}
 
int main() {
  int n, i, v;
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;
 
  scanf("%d", &n);
 
  for(i=0;i<n;i++) {
    scanf("%s %d",S,&v);
    A[i].suit =  B[i].suit  = S[0];
    A[i].value = B[i].value = v;
  }
 
  mergeSort(A,n,0,n);
  quickSort(B,n,0,n-1);
 
  for(i=0;i<n;i++) {
    // マージソートとクイックソートの結果を比べる
    if(A[i].suit != B[i].suit) stable = 0;
  }
 
  if(stable==1) printf("Stable\n");
  else printf("Not stable\n");
  for(i=0;i<n;i++) {
    printf("%c %d\n",B[i].suit,B[i].value);
  }
 
  return 0;
}


Measured memory_bytes: 4196
#include <stdio.h>

int main(void){
    int i, j, n, r[200000], max, rmin;

    scanf("%d", &n);
    for (i = 0; i < n; i++) scanf("%d", &r[i]);

    max = r[1] - r[0];
    rmin = r[0];

    for (i = 1; i < n; i++)
    {
        if (max < r[i] - rmin) max = r[i] - rmin;
        if (rmin > r[i]) rmin = r[i];
    }

    printf("%d\n", max);
    return 0;
}


Measured memory_bytes: 2632
n,q = map(int, input().split())
s = input()
cum_list = [0]*(n+1)
a_flag = 0

for idx,i in enumerate(s,1):
    cum_list[idx] = cum_list[idx-1]
    if a_flag == 1 and i =='C':
        cum_list[idx] +=1
    if i == 'A':
        a_flag = 1
    else:
        a_flag = 0

for i in range(q):
    l, r = map(int, input().split())
    print(cum_list[r]-cum_list[l])

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

typedef long long ll;
typedef double d;

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (abs(a*b)/gcd(a,b))
#define sqr(a) (a*a)

#define tt int t; cin>>t; while(t--)
#define lo(i, a, b) for(int i=a; i<=b; i++)
#define rlo(i, a) for(int i=a; i>0; i--)
#define be(a) a.begin(),a.end()
#define sz(x) x.size();
#define nl cout<<"\n";
#define sp cout<<" ";
#define Y cout<<"YES"<<endl;
#define N cout<<"NO"<<endl;
#define nlng long long n; cin>>n;
#define nint int n; cin>>n;
#define br break;
#define cn continue;
#define vec vector < int >
#define vecll vector < long long >
#define op() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

int main()
{
    op();
   string u;
   double s=0.0,x;int n;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
       cin>>x>>u;
      
       if(u=="BTC")
       {
           x=x*380000.0;

       }
       s=s+x;
   }
 std::cout<<setprecision(8)<<fixed<<s<<endl;
    return 0;
}




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


int main(){
    int n;
    cin >> n ;
    vector<ll> cum(n+1,0);
    for(int i = 1;i<=n;i++){
        int a;cin >> a;
        cum[i] = cum[i-1] + a;
    }

    map<ll,int> mp;
    
    rep(i,n+1){
        mp[cum[i]] += 1;
    }

    ll cnt = 0;

    for(auto p:mp){
        cnt += ll(p.second)*ll(p.second-1)/2;
    }
    cout << cnt << endl;
 }

Measured memory_bytes: 17196
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;



signed main(){
	string s;
	cin >> s;
	auto f = [&](string s){
		REP(i,s.size())if(s[i] != s[s.size() - i - 1])return false;
		return true;
	};
	int flg = f(s);
	if(!f(s.substr(0,s.size() / 2)))flg = 0;
	if(!f(s.substr((s.size() + 1) / 2,s.size() / 2)))flg = 0;
	if(flg)out("Yes");
	else out("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
using ld = long double;
#define vpl vector<pair<long long,long long>>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
long long MOD = 1000000007;
const long double pi = 3.1415926535897932;
#define pb push_back
#define mp make_pair
#define mt make_tuple
using Grid = vector<vector<char>>;
#define vc vector<char>
//(mod m)でのaの逆元を計算する
//a/b(mod m)=a(mod m)*modinv(b,m)
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (ll i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (ll i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//UF
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
//切り上げの割り算は(a + b - 1) / bでできる

//ここから
int main(){
    ll N,K;
    cin>>N>>K;
    map<char,ll> m;
    rep(i,K){
        char x;
        cin>>x;
        m[x]++;
    }
    rep2(i,N,1000000){
        string S=to_string(i);
        ll X=S.size();
        rep(j,X){
            char c=S[j];
            if(m[c]==1)break;
            if(j==X-1){
                cout<<i<<endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optmize("03")
#define boost ios::sync_with_stdio(); cin.tie(); cout.tie();
using namespace std;
#define st first
#define nd second
typedef long long ll;
typedef pair <int, int> pii;
const int INF = 1e9 + 10;
const ll LLINF = 1e18 + 10;
void solve()
{
    int n;
    cin >> n;
    if(n >=30){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}
int main()
{
    boost
    //int t; cin >> t; while(t--)
    solve();
}

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

int R;
//halo
int main () {
    cin>>R;
    if(R<1200)
        cout<<"ABC"<<endl;
    else{
        if(R<2800)
            cout<<"ARC"<<endl;
        else
            cout<<"AGC"<<endl;
    }
}

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 0
#  define DBG(fmt, ...) printf(fmt, __VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

#define MOD 1000000007
#define INF 1000000000
#define MAX_K 100010

ll K;
ll A[MAX_K];

int main()
{
    cin >> K;
    REP(i, K) { cin >> A[i]; }

    ll min_a = A[K-1];
    ll max_a = min_a + A[K-1] - 1;
    for(int i = K-1; i > 0; --i) {
        DBG("A[%d]:%lld\n", i, A[i]);
        if(A[i-1] < min_a) {
            if(min_a % A[i-1] != 0) { min_a = (min_a / A[i-1] + 1) * A[i-1]; }
        } else {
            min_a = A[i-1];
        }
        max_a = max(max_a, min_a + A[i-1] - 1);
        DBG("  min_a:%lld max_a:%lld\n", min_a, max_a);
    }
    // min_a がうまくいくか確認
    ll tmp = min_a;
    REP(i, K) {
        tmp /= A[i];
        tmp *= A[i];
    }
    if(tmp != 2) {
        printf("-1\n");
        return 0;
    }
    // max_a を二分探索で求めてみる
    ll ub = min_a * 2 + 100;
    ll lb = min_a - 1;
    ll cur = (ub - lb) / 2 + lb;
    max_a = min_a;
    while(cur != lb && cur != lb) {
        // 確認
        ll tmp = cur;
        REP(i, K) { tmp /= A[i]; tmp *= A[i]; }
        if(tmp != 2) { ub = cur; }
        else {
            max_a = max(max_a, cur);
            lb = cur;
        }
        cur = (ub - lb) / 2 + lb;
    }

    printf("%lld %lld\n", min_a, max_a);
    return 0;
}


Measured memory_bytes: 1024
N = int(input())
R = list(map(int,input().split()))
a = [0]*8
b = 0
for i in range(N):
    if R[i] < 400:
        a[0] += 1
    elif R[i] < 800:
        a[1] += 1
    elif R[i] < 1200:
        a[2] += 1
    elif R[i] < 1600:
        a[3] += 1
    elif R[i] < 2000:
        a[4] += 1
    elif R[i] < 2400:
        a[5] += 1
    elif R[i] < 2800:
        a[6] += 1
    elif R[i] < 3200:
        a[7] += 1
    else:
        b += 1
ans = 0
for i in range(8):
    if a[i] != 0:
        ans += 1
ans2 =str(ans+b)
if ans == 0:
    ans = 1
ans1 = str(ans)
print(ans1+" "+ans2)

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

using namespace std;


int main() {
    int k, t;
    cin >> k >> t;
    vector<int> a(t);
    for(int i = 0; i < t; i++) {
        cin >> a[i];
    }
    int m = *max_element(a.begin(), a.end());
    cout << max(0, m - 1 - (k - m)) << "\n";
    return 0;
}

Measured memory_bytes: 3576
#include<stdio.h>

int main (){

  int a,b,c;

  scanf("%d %d %d",&a,&b,&c);

  int i;
  int n=0;
  for(i=a;i<=b;i++){
    if(c%i==0){

      n=n+1;
}
    else {}
  }
  printf("%d\n",n);
  return 0;
}

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

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

int main() {
  ll n, k, ans = 0;
  cin >> n >> k;
  vector<ll> a(n), ar;
  unordered_set<ll> st;
  rep(i, n) cin >> a[i], a[i]--;

  ll now = 0;
  while (st.count(now) == 0) {
    st.insert(now);
    ar.push_back(now);
    now = a[now];
  }

  int s = find(ar.begin(), ar.end(), now) - ar.begin();
  int r = (int)ar.size() - s;

  if (k < s)
    cout << ar[k] + 1 << endl;
  else
    cout << ar[s + (k - s) % r] + 1 << endl;
  return 0;
}


Measured memory_bytes: 14268
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)

x,y=map(int,input().split())

for i in range(x+1):
    for j in range(x+1):
        if i*2+j*4==y and i+j==x:
            print("Yes")
            exit()
print("No")

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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

constexpr int N_MAX = 1001;
constexpr ll INF = 1000000000000000000;

int n, m;
vector<tuple<int, int, ll> > g;
vector<tuple<ll, int> > v;
int main(void)
{
	cin >> n >> m;
	rep(i, n + 1) {
		v.push_back(make_tuple(INF, -1));
	}
	v[1] = make_tuple(0, -1);
	rep(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		g.push_back(make_tuple(a, b, (ll)-c));
	}
	rep(i, n - 1) {
		rep(j, m) {
			int s = get<0>(g[j]), t = get<1>(g[j]);
			ll w = get<2>(g[j]);
			if(get<0>(v[t]) > get<0>(v[s]) + w) {
				v[t] = make_tuple(get<0>(v[s]) + w, s);
			}
		}
	}
	int now = n;
	while(true) {
		int prev = get<1>(v[now]);
		if(prev == -1) {
			break;
		}
		ll w;
		rep(j, m) {
			if(get<0>(g[j]) == prev && get<1>(g[j]) == now) {
				w = get<2>(g[j]);
			}
		}
		if(get<0>(v[now]) > get<0>(v[prev]) + w) {
			cout << "inf" << endl;
			return 0;
		}
		now = prev;
	}
	cout << -get<0>(v[n]) << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
long long int gcd(long long int a , long long int b)
{
    if(b==0)
    {

        return a;
    }
    return gcd(b,a%b);


}



int main()
{
string a;
string b;
int f=0;
cin>>a>>b;
if(a.size()>=b.size())
{

    f=1;
}
for(int i=0;i<a.size();i++)
{

    if(a[i]!=b[i])
    {

        f=1;
        break;
    }
}

if(f==1)
{

    cout<<"No\n";
}
else{
    cout<<"Yes\n";
}




return 0;

}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <stack>
#include <map>
#include <sstream>

using namespace std;

typedef pair<int, int> R;

int max_rectangular (vector <int> height )
{
	int size = height.size();

	stack<R> S;
	int pos = 0;
	int res = 0;

	for (int i = 0; i < size; ++i){

		R rect;

		rect.first = height[i];
		rect.second = i;

		if (S.empty() ){
			S.push (rect );
			continue;
		}else if ((S.top()).first < height[i] ){
			S.push (rect );
			continue;
		}else if ((S.top()).first == height[i] ){
			continue;
		} // end if

		while (!S.empty() && (S.top()).first >= height[i] ){
			R r = S.top(); S.pop();				
			int area = r.first*(i - r.second );
			res = max (res, area );
			pos = r.second;
		} // end while
		rect.second = pos;
		S.push (rect );

	} // end for

	while (!S.empty() ){
		R r = S.top(); S.pop();				
		int area = r.first*(size - r.second );
		res = max (res, area );
	} // end while

	return res;
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.rs", "r", stdin );
	string str = "";
	int h, w;

	while (getline (cin, str ) ){
		stringstream ssn(str);
		ssn >> h >> w;

		if (h == 0 && w == 0 ){
			break;
		} // end if
		
		vector <vector <char> > grid (h, vector <char>(w, ' ' ) );

		int i,j;
		for (i = 0; i < h; ++i){
			getline (cin, str );
			for (j = 0; j < w; ++j){
				grid[i][j] = str[j];
			} // end for
		} // end for

		vector <vector <int> > t (h, vector <int> (w, 0 ) );

		for (j = 0; j < w; ++j){
			if (grid[0][j] == '.'){
				t[0][j] = 1;
			} // end if
		} // end for
		
		for (i = 1; i < h; ++i){
			for (j = 0; j < w; ++j){
				if (grid[i][j] == '.'){
					t[i][j] += t[i-1][j] + 1;
				} // end if
			} // end for
		} // end for

		int res = 0;
		for (i = 0; i < h; ++i){
			int area = max_rectangular (t[i] );
			res = max (res, area );
		} // end for
		cout << res << endl;	

	} // end loop

		
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include<string.h>
#include <stack>
#define ll long long
using namespace std;
int a[100010];
int gcd(int a, int b) {
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
int main() {
	int n;
	int mn = 0x5f5f5f5f;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", a + i);
	sort(a, a + n);
	int t = a[0];
	for (int i = 1; i < n; i++) {
		if (mn == 1)
			break;
		if (a[i] % t == 0)
			mn = min(mn, t);
		else {
			t = gcd(a[i], t);
			mn = min(mn, t);
		}
	}
	printf("%d\n", mn);
}

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

using namespace std;

int main(int argc, char **argv)
{
    vector<int> v(3);

    cin >> v.at(0) >> v.at(1) >> v.at(2);

    sort(v.begin(), v.end());

    cout << v.at(0) << " " << v.at(1) << " " << v.at(2) << endl;

}


Measured memory_bytes: 3152
#include <stdio.h>
    int main(void){
    int n,x,a,b,c,i;
    while(1){
        scanf("%d %d",&n,&x);
        i=0;
        if(n==0 && x==0) break;
        for(a=1;a<=n;a++){
            for(b=a+1;b<=n;b++){
                for(c=b+1;c<=n;c++){
                    if((a+b+c)==x) i++;
                    
                }
            }
        }
    printf("%d\n",i);    
    }  
    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<min(a,b)+min(c,d)<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
         
typedef long long ll;
using namespace std;
        
#define F first
#define S second
#define sqr(x) x*x
#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define repit(i, n) for(auto it = n.begin(); it != n.end(); ++it)
       
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);}
          

int main(){ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    vector <int> v;
    for(int i = 0; i < n; ++i){
        int x;
        cin >> x;
        v.pb(x);
    }
    sort(all(v));
    cout << v[n - 1] - v[0];
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin >> n >> k;
    int arr[n+1];
    int dp[n+1];

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

    dp[1] = 0;

    for (int i=2 ; i<=n ; i++){
        int min = INT_MAX;
        for (int j=1 ; j<=k && i-j >= 1 ; j++){
            if (min > dp[i-j] + abs(arr[i]-arr[i-j])){
                min = dp[i-j] + abs(arr[i]-arr[i-j]);
            }
        }
        dp[i] = min;
    }

    cout << dp[n] << "\n";
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

double dp[3000][3000];

void Main() {
    int N;
    cin >> N;
    vector<double> P(N);
    rep(i, N) cin >> P[i];

    dp[0][0] = 1;
    rep(i, N) {
        double p = P[i];
        rrep(j, N - 1, 0) {
            dp[i + 1][j + 1] = dp[i][j] * p + dp[i][j + 1] * (1 - p);
            dp[i + 1][j] = dp[i][j] * (1 - p);
        }
    }
    double ans = 0;
    rep(i, N + 1) {
        if (i > N - i) {
            ans += dp[N][i];
        }
    }
    cout << ans << '\n';
}

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


Measured memory_bytes: 70528
#include <stdio.h>
int main(int argc, char const *argv[]) {
    int H,N;
    int A[100000];
    int sum=0;
    scanf("%d %d\n",&H,&N );
    for (int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }
    for (int i = 0; i < N; i++) {
        sum = sum + A[i];
    }
    //printf("%d %d\n",H,sum );
    if (sum>=H) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 512
import math

n = int(input())
a = []
min_a = 10**15
for i in range(5):
    a.append(int(input()))
    if a[-1] < min_a:
        min_a = a[-1]

if min_a >= n:
    print(5)
else:
    print(math.ceil(n/min_a)+4)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <iterator>
#pragma warning(disable:4996)

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);

    vector<string> x;
    long found=0;
    long i,j,k;
    for(i=0; i<n; i++) {
        char str[1024]={0};
        scanf("%s", str);
        x.push_back(string(str));
    }
    sort(x.begin(), x.end());

    ll cc[5]={0};
    for(i=0; i<(long)x.size(); i++) {
        if(x[i][0]=='M') cc[0]++; 
        if(x[i][0]=='A') cc[1]++;
        if(x[i][0]=='R') cc[2]++;
        if(x[i][0]=='C') cc[3]++;
        if(x[i][0]=='H') cc[4]++;
    }
    
    ll ans= 0;
    for(i=0; i<5; i++) {
        for(j=i+1; j<5; j++) {
            for(k=j+1; k<5; k++) {
                ans+=cc[i]*cc[j]*cc[k];
            }
        }
    }

    printf("%lld\n", ans);
    

    return 0;
}


Measured memory_bytes: 5748
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)

/*(c)
int main()
{
    int N;
    int c = 0;
    int min;
    cin >> N;
    vector<int> P(N + 1);
    for (int i = 1; i <= N; i++)
        cin >> P[i];
    //bool flg = false;
    min = P[1];
    for (int i = 1; i <= N; i++)
    {
        if (P[i] <= min)
        {
            min = P[i];
            c++;
        }
    }
    cout << c << endl;
}
*/
//(b)
int main()
{
    int a, b;
    cin >> a >> b;
    int A = 0, B = 0;
    string a2, b2;
    for (int i = 0; i < b; i++)
    {
        A += a * pow(10, i);
        //cout << A << endl;
    }
    for (int i = 0; i < a; i++)
    {
        B += b * pow(10, i);
    }
    a2 = to_string(A);
    b2 = to_string(B);
    if (a2 < b2)
        cout << a2 << endl;
    if (b2 <= a2)
        cout << b2 << endl;
}

Measured memory_bytes: 256
import sys
import math
import numpy as np

stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
h = na()
bar = h[0]
s = h[0]
for hi in h[1:]:
    s += max(hi - bar, 0)
    bar = hi
print(s)


Measured memory_bytes: 12504
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String s = scan.next();
        String t = scan.next();
        StringBuilder ans = new StringBuilder();
        for(int i = 0; i < n; i++) {
        	ans.append(s.substring(i, i + 1));
        	ans.append(t.substring(i, i + 1));
        }

        System.out.println(ans.toString());
    }
}

Measured memory_bytes: 21844
n, k =  [ int(v) for v in input().split() ] 
node_list = [] 
x_list = []
y_list = []

for i in range(n):
    x, y = [ int(v) for v in input().split() ]
    node_list.append((x,y))
    x_list.append(x)
    y_list.append(y)
x_list.sort()
y_list.sort()


x_list = [ (x_list[i],x_list[j]) for i in range(n-k+1) for j in range(i+k-1,n) ]
y_list = [ (y_list[i],y_list[j]) for i in range(n-k+1) for j in range(i+k-1,n) ]

def check(in_x,in_y):
    xl, xr, yu, yd = in_x[0], in_x[1], in_y[0], in_y[1]
    ok = 0
    for i in node_list:
        if xl <= i[0] <= xr and yu <= i[1] <= yd:
            ok += 1

    if ok >= k:
        return (xr-xl) * (yd-yu)
    else:
        return 10**19

ans = 10**19
for i in x_list:
    for j in y_list:
        ans = min(ans, check(i,j))
print(ans)


Measured memory_bytes: 46044
using System;

namespace ABC141_B
{
    class Program
    {
        static void Main(string[] args) {
            string s = Console.ReadLine();

            string ans = "Yes";

            for(int i = 0; i < s.Length; i++) {
                if(i % 2 == 0) {
                    if(s.Substring(i, 1) == "L") {
                        ans = "No";
                        break;
                    }
                } else {
                    if (s.Substring(i, 1) == "R") {
                        ans = "No";
                        break;
                    }
                }
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
//
// Created by Hideaki Imamura on 2019-07-17.
//

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

int main() {
    int N, K, a, i;
    cin >> N >> K;
    for(int j = 0; j < N; ++j) {
        cin >> a;
        if (a == 1) {
            i = j;
        }
    }

    int tmp = i % (K-1) + (N-i-1) % (K-1);
    cout << i / (K-1) + (N-i-1) / (K-1) + tmp / (K-1) + (tmp % (K-1) > 0) << endl;

    return 0;
}

Measured memory_bytes: 256
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

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

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

// vars
int n, y;

void input(){
    cin >> n >> y;
    return;
}

void solve(){
    int a = -1;
    int b = -1;
    int c = -1;
    for (int i=0; i<=n; ++i){
        for (int j=0; j<=n; ++j){
            int k = n - i - j;
            if(k < 0 || i + j + k != n){
                continue;
            }
            int sum = 10000 * i + 5000 * j + 1000 * k;
            if(sum == y){
                a = i;
                b = j;
                c = k;
                break;
            }
        }
    }
    printf("%d %d %d\n", a, b, c);
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

n, m = map(int, input().split()) 

d = defaultdict(int)
ans = 0
pena = 0

for _ in range(m):
    p, s = input().split()
    if s == "AC":
        if d[p] == -1:
            continue
        else:
            ans += 1
            pena += d[p]
            d[p] = -1
    else:
        if d[p] == -1:
            continue
        else:
            d[p] += 1

print(ans, pena)

Measured memory_bytes: 17500
package main

import (
	"fmt"
	"sort"
)

func main() {
	var x, y, z, k int
	fmt.Scan(&x, &y, &z, &k)
	ar := make([]int, x)
	br := make([]int, y)
	cr := make([]int, z)
	for i := range ar {
		fmt.Scan(&ar[i])
	}
	for i := range br {
		fmt.Scan(&br[i])
	}
	for i := range cr {
		fmt.Scan(&cr[i])
	}
	dr := make([]int, 0, x*y)
	for _, a := range ar {
		for _, b := range br {
			dr = append(dr, a+b)
		}
	}
	sort.Ints(dr)
	er := make([]int, 0, k)
	for i := len(dr) - 1; i >= 0; i-- {
		er = append(er, dr[i])
		if len(er) == k {
			break
		}
	}
	fr := make([]int, 0, len(er)*z)
	for _, e := range er {
		for _, c := range cr {
			fr = append(fr, e+c)
		}
	}
	sort.Ints(fr)
	for i := 0; i < k; i++ {
		fmt.Println(fr[len(fr)-1-i])
	}
}


Measured memory_bytes: 33024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,v,b,w,t;
	cin>>a>>v>>b>>w>>t;
	if(abs(a-b)<=abs(v*t)-abs(w*t))cout<<"YES";
	else cout<<"NO";
	return 0;
}

Measured memory_bytes: 3572
n, m = map(lambda x: int(x), input().split())
drinks = []
for _ in range(n):
    a, b = map(lambda x: int(x), input().split())
    drinks.append((a, b))
    
sorted_drinks = sorted(drinks, key=lambda x: x[0])

num_drinks = 0
sum_prices = 0
for price, num in sorted_drinks:
    num_drinks += num
    sum_prices += num * price
    if num_drinks > m:
        sum_prices -= (num_drinks - m) * price
        break
    elif num_drinks == m:
        break

print(sum_prices)

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

int main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    cout<<ceil((n-1)/((k-1)*1.0));
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N, A, B, C;
    cin >> N >> A >> B >> C;
    vc<char> ans;
    vc<string> S(N);
    rep(i, N) cin >> S[i];
    rep(i,N){
        if(S[i]=="AB"){
            if(A==0 and B==0){
                cout << "No" << endl;
                return 0;
            }
            if(A>B){
                ans.eb('B');
                A--, B++;
            }
            else if(A==B){
                if(i+1<N and S[i+1]=="BC")
                    ans.eb('B'), A--, B++;
                else
                    ans.eb('A'), A++, B--;
            }
            else{
                ans.eb('A');
                A++, B--;
            }
        }
        else if(S[i]=="AC"){
            if(A==0 and C==0){
                cout << "No" << endl;
                return 0;
            }
            if(A>C){
                ans.eb('C');
                A--, C++;
            }
            else if(A==C){
                if(i+1<N and S[i+1]=="BC")
                    ans.eb('C'), A--, C++;
                else
                    ans.eb('A'), A++, C--;
            }
            else{
                ans.eb('A');
                A++, C--;
            }
        }
        else{
            if(B==0 and C==0){
                cout << "No" << endl;
                return 0;
            }
            if(B>C){
                ans.eb('C');
                B--, C++;
            }
            else if(B==C){
                if(i+1<N and S[i+1]=="AC")
                    ans.eb('C'), B--, C++;
                else
                    ans.eb('B'), B++, C--;
            }
            else{
                ans.eb('B');
                B++, C--;
            }
        }
    }

    cout << "Yes" << '\n';
    rep(i, N) cout << ans[i] << '\n';
}

Measured memory_bytes: 6632
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ll_s long
#define mod 1000000007
#define forn(i,start,lim) for(ll i=start;i<lim;i++)
#define forn_d(i,start,lim) for(ll i=start;i>=lim;i--)
#define f first
#define s second
#define pb push_back
#define pf push_front
#define mp make_pair
#define debug1(a) cout<<a<<endl
#define debug2(a,b) cout<<a<<" "<<b<<endl
#define debug3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define debug4(a) cout<<"chu "<<a<<endl
#define sz(a) (ll)(a.size())
#define endl "\n"

ll dp[3005][3005],sum[3005][3005];

ll add(ll a, ll b)
{
	ll res = a + b;
	if(res >= mod)
		return res - mod;
	return res;
}

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  ll n;
  string s;
  cin>>n;
  cin.ignore();
  cin>>s;
  dp[1][1]=1;sum[1][1]=1;

  for(ll len=2;len<=n;len++){
    char sign=s[len-2];
    if(sign=='<'){
      for(ll j=1;j<=len;j++){
        dp[len][j]=add(dp[len][j],sum[len-1][j-1]);
        sum[len][j]=add(sum[len][j-1],dp[len][j]);
      }
    }else{
      for(ll j=1;j<=len;j++){
        dp[len][j]=add(dp[len][j],(sum[len-1][len-1]-sum[len-1][j-1]+mod)%mod);
        sum[len][j]=add(sum[len][j-1],dp[len][j]);
      }
    }
  }
  ll ans=0;
  for(ll j=1;j<=n;j++){
    ans=add(ans,dp[n][j]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 139648
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
#define ll long long
using namespace std;
int main(){
    int a;
    int b;
    cin>>a>>b;
    int ans=0;
    int x=1;
    while(x<b){
        x+=a-1;
        ans++;
    }
cout<<ans;
return 0;
}

Measured memory_bytes: 3160
N = int(input())
A = list(map(int, input().split()))

B = []
for i in A:
    if i%2==0:
        B.append(i)

C = len(B)
s = 0
for i in B:
    if i%3==0 or i%5==0:
        s += 1

if C==s:
    print("APPROVED")
else:
    print("DENIED")


Measured memory_bytes: 3060
# encoding: UTF-8
x = Array.new
2.times do
  x += gets.chomp.split
end
big_h, big_w, h, w = x[0].to_i, x[1].to_i, x[2].to_i, x[3].to_i
puts "#{ (big_h - h) * (big_w - w)}"

Measured memory_bytes: 1788
#include<iostream>
using namespace std;
int main(){
    long H ,A ,B,n;
    n = 0;
    cin >> H >> A >> B;
    //cout << "runnning" <<endl;
    for(int i = A;i <= B; i++){
        if(H % i == 0){
            n++;
            //cout << i << " ";
            if (H / i <= B && H / i != i && H / i >= A ){
                n++;
                B = H / i - 1;
                //cout << H / i <<" ";
            }
            
        }
    }
    //cout<<endl;
    cout << n <<endl;
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    
    int V[N];
    for (int i = 0; i < N; i++) {
        cin >> V[i];
    }
    
    int C[N];
    for (int i = 0; i < N; i++) {
        cin >> C[i];    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if(V[i] > C[i]){
            ans += V[i] - C[i];
        }
    }
    
    cout << ans << endl;

}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        int n = Integer.parseInt(input[0]);
        long c = Long.parseLong(input[1]);
        long forwardMax[] = new long[n+1];
        long backwardMax[] = new long[n+1];

        long positions[] = new long[n+1];
        long values[] = new long[n+1];

        positions[0] = 0;
        values[0] = 0;
        for(int i = 1; i <= n; i++){
            input = br.readLine().split(" ");
            positions[i] = Long.parseLong(input[0]);
            values[i] = Long.parseLong(input[1]);
        }

        long max = 0;
        long sum = 0;
        for(int i = 0; i <= n; i++){
            sum += values[i];
            max = Math.max(max, sum - positions[i]);
            forwardMax[i] = max;
        }

        max = 0;
        sum = 0;
        for(int i = n; i >= 0; i--){
            sum += values[i];
            max = Math.max(max, sum - (c - positions[i]) );
            backwardMax[i] = max;
        }

        long res = 0;

        for(int i = 0; i <= n; i++){
            // forward OA + OA + OB
            res = Math.max(res, forwardMax[i]);
            if(i != n)
                res = Math.max(res, forwardMax[i] - (positions[i]) + backwardMax[i+1]);
            
            // backward OA + OB + OB        
            res = Math.max(res , backwardMax[i]);
            if(i != 0) 
                res = Math.max(res , backwardMax[i] - (c - positions[i]) + forwardMax[i-1]);
        }

        System.out.println(res);
    }
}

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

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

vector<int> prime;

void enum_prime() {
  vector<bool> is_prime((int)1e6+1, true);
  for (int i = 2; i <= 1e6+1; ++i) {
    if (is_prime[i] == false) continue;
    prime.push_back(i);
    for (int j = 2*i; j <= 1e6+1; j += i) is_prime[j] = false;
  }
  return;
}

int main() {
  ll a, b;
  cin >> a >> b;
  ll g = gcd(a, b);
  enum_prime();
  int ans = 1;
  for (int i = 0; i < prime.size(); ++i) {
    if (g % prime[i] == 0) ++ans;
    while (g % prime[i] == 0) g /= prime[i];
  }
  if (g > 1) ++ans;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4032
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

int main()
{
    ll n=in();
    string s;cin>>s;
    cout<<(s.substr(0,n/2)==s.substr(n/2)?"Yes":"No")<<endl;
}


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

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

typedef long long ll;
const int MOD = 1000000007;
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

const int N = 105;
int d[N][N];

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	const int INF = INT_MAX >> 1;
	int n, m; cin >> n >> m;
	vector<int> a(m), b(m), c(m);
	REPU(i, 0, n) {
		REPU(j, 0, n) {
			d[i][j] = d[j][i] = INF;
		}
		d[i][i] = 0;
	}
	REPU(i, 0, m) {
		cin >> a[i] >> b[i] >> c[i];
		--a[i], --b[i];
		d[a[i]][b[i]] = d[b[i]][a[i]] = c[i];
	}
	REPU(k, 0, n) REPU(i, 0, n) REPU(j, 0, n) {
		amin(d[i][j], d[i][k] + d[k][j]);
	}
	int ans = 0;
	REPU(i, 0, m) {
		if (d[a[i]][b[i]] < c[i]) ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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() {
    int n;
    cin >> n;
    if(n < 600)cout << 8 << "\n";
    else if(n < 800)cout << 7 << "\n";
    else if(n < 1000)cout << 6 << endl;
    else if(n < 1200)cout << 5 << endl;
    else if(n < 1400)cout << 4 << endl;
    else if(n < 1600)cout << 3 << endl;
    else if(n < 1800)cout << 2 << endl;
    else if(n < 2000)cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 3632
a, b = map(int, input().split())


def prime_decomposition(n):
    i = 2
    table = [1, ]
    while i * i <= n:
      while n % i == 0:
        n /= i
        table.append(i)
      i += 1
    if n > 1:
      table.append(n)
    return set(table)


aa = prime_decomposition(a)
bb = prime_decomposition(b)

print(len(aa & bb))

Measured memory_bytes: 3064